text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: jameslarrue/enzo-e path: /tools/colormap_gen.py #!/usr/bin/python ''' Program to generate a Cello-compatible colormap. Can use either space-delimited RGB values (such as the ones generated here: http://jdherman.github.io/colormap) or can use matplotlib's built-in colormaps (see here: ...
code_fim
hard
{ "lang": "python", "repo": "jameslarrue/enzo-e", "path": "/tools/colormap_gen.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> f.write(firstline + '\n') f.write('\n' + "colormap = [" + '\n') for l in range(length-1): f.write(spaces + " ") f.write(str(reds[l]) + ", " + str(greens[l]) + \ ", " + str(blues[l]) + ',\n') f.write(spaces + " ") f.write(str(reds[length-1]) + ", " + ...
code_fim
hard
{ "lang": "python", "repo": "jameslarrue/enzo-e", "path": "/tools/colormap_gen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for x in range(256): # max colors expected r.append(cmap(x)[0]) g.append(cmap(x)[1]) b.append(cmap(x)[2]) num_lines = x if(cmap(x) == cmap(x+1)): break return r, g, b, num_lines def write_to_file(outfile, reds, greens, blues, length): ...
code_fim
hard
{ "lang": "python", "repo": "jameslarrue/enzo-e", "path": "/tools/colormap_gen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhilin007/LightEnhancement path: /net/deprecated/models/SepConv_cudnn.py import torch,torch.nn as nn,time from torchstat import stat def conv(feats,groups,kernel_size=3): return nn.Conv2d(in_channels=feats,out_channels=feats,kernel_size=kernel_size, stride=1,padding=kernel_size//2,groups=gro...
code_fim
hard
{ "lang": "python", "repo": "zhilin007/LightEnhancement", "path": "/net/deprecated/models/SepConv_cudnn.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stat(stanet,(16,256,256)) params: 9,280 (x5.4) memory: 16.00MB Flops: 608.17MFlops (x5.4) ''' #same with paper #208s x=torch.ones([1,16,256,256]).to('cuda:1') sepnet=sepnet.to('cuda:1') sep_time=time.time() for i in range(steps): print(f'\r sepnet {i}/{steps}',end='',flush=True) with torch....
code_fim
hard
{ "lang": "python", "repo": "zhilin007/LightEnhancement", "path": "/net/deprecated/models/SepConv_cudnn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rint "Hay", count, "líneas subject en", filename except: print "No se pudo abrir el fichero:", filename<|fim_prefix|># repo: riodementa/Python_Michigan-University path: /7_3.py # Exercise 7.3 (Easter Egg) filename = raw_input("Introduzca el nombre del fichero: [o pulsa INTRO] ") count = 0 try: ...
code_fim
medium
{ "lang": "python", "repo": "riodementa/Python_Michigan-University", "path": "/7_3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: riodementa/Python_Michigan-University path: /7_3.py # Exercise 7.3 (Easter Egg) filename = raw_input("Introduzca el nombre del fichero: [o pulsa INTRO] ") count = 0 try: if filename== "na na boo boo": print "NA NA BOO BOO PARA TI - ¡Te he pillado<|fim_suffix|>rint "Hay", count, ...
code_fim
medium
{ "lang": "python", "repo": "riodementa/Python_Michigan-University", "path": "/7_3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: if not os.path.exists(f'data/prices/{ticker}.csv'): prices = web.get_data_yahoo(ticker, start_date, end_date) prices.to_csv(f'data/prices/{ticker}.csv') else: prices = pd.read_csv(f'data/prices/{ticker}.csv', index_col=0) prices.inde...
code_fim
medium
{ "lang": "python", "repo": "lkqllx/Lim", "path": "/Project_1-Inclusion/backtest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lkqllx/Lim path: /Project_1-Inclusion/backtest.py import pandas as pd import pandas_datareader as web import numpy as np import datetime as dt import math import multiprocessing as mp import itertools import os def run(zipped): """Function to be run in parallel""" annc_date_str, (buy_ad...
code_fim
medium
{ "lang": "python", "repo": "lkqllx/Lim", "path": "/Project_1-Inclusion/backtest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def multi_proc(target_dates, buy_period, sell_period): pool = mp.Pool(mp.cpu_count()) profits = pool.map(run, zip(target_dates, itertools.product(buy_period, sell_period))) output = pd.DataFrame(profits, columns=['Buy Advance', 'Sell Delay', 'Ave Profit', 'AVE Profit Minus Benchmark']) out...
code_fim
hard
{ "lang": "python", "repo": "lkqllx/Lim", "path": "/Project_1-Inclusion/backtest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dybowskii/wizualizacja_danych path: /6_4.py import numpy as np def potega(a,b): <|fim_suffix|>x=int(input("jaka liczbe chcesz potegowac: ")) y=int(input("ile razy chcesz ja potegowac: ")) potega(x,y)<|fim_middle|> print("\n", np.logspace(1, b, num=b, base = a, dtype=int))
code_fim
medium
{ "lang": "python", "repo": "Dybowskii/wizualizacja_danych", "path": "/6_4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x=int(input("jaka liczbe chcesz potegowac: ")) y=int(input("ile razy chcesz ja potegowac: ")) potega(x,y)<|fim_prefix|># repo: Dybowskii/wizualizacja_danych path: /6_4.py import numpy as np def potega(a,b): <|fim_middle|> print("\n", np.logspace(1, b, num=b, base = a, dtype=int))
code_fim
medium
{ "lang": "python", "repo": "Dybowskii/wizualizacja_danych", "path": "/6_4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> or a>b) print (a==b and b==a) print (a==b or b==a)<|fim_prefix|># repo: umarahsan786/3 path: /06_comparsionoperator.py a = 34 b = 86 print (a<b) print (a!=b) print (a!=b)<|fim_middle|> print (a>b and a>b) print (a<b and a<b) print (a!=b) print (b!=a) print (a==b) print (b==a) print (a<b
code_fim
medium
{ "lang": "python", "repo": "umarahsan786/3", "path": "/06_comparsionoperator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: umarahsan786/3 path: /06_comparsionoperator.py a = 34 b = 86 print (a<b) print (a!=b) print (a!=b) print (a>b and a>b) print (a<b and a<b) print (a!=b<|fim_suffix|> or a>b) print (a==b and b==a) print (a==b or b==a)<|fim_middle|>) print (b!=a) print (a==b) print (b==a) print (a<b
code_fim
easy
{ "lang": "python", "repo": "umarahsan786/3", "path": "/06_comparsionoperator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SmokyTail/OldProjects path: /Other labs/ОП/Lab03/Lab03.3.py monty_python = "Monty Python" print(monty_python[1:5]) <|fim_suffix|>print(len(python)) phrase = """ It is a really long string triple-quoted strings are used to define multi-line strings """ l = len(phrase) / 2 first = phrase[:int(l)]...
code_fim
hard
{ "lang": "python", "repo": "SmokyTail/OldProjects", "path": "/Other labs/ОП/Lab03/Lab03.3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(len(python)) phrase = """ It is a really long string triple-quoted strings are used to define multi-line strings """ l = len(phrase) / 2 first = phrase[:int(l)] print(str(first))<|fim_prefix|># repo: SmokyTail/OldProjects path: /Other labs/ОП/Lab03/Lab03.3.py monty_python = "Monty Python" print(mo...
code_fim
medium
{ "lang": "python", "repo": "SmokyTail/OldProjects", "path": "/Other labs/ОП/Lab03/Lab03.3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MatthewWolff/DESMAN path: /scripts/write_strain_fasta.py #!/usr/bin/env python3 import sys from Bio import SeqIO from argparse import ArgumentParser def extract_strain_seqs(etaS_file, seq_index): strainseqs = [] with open(etaS_file, 'r') as fh: for i, line in enumerate(fh): ...
code_fim
hard
{ "lang": "python", "repo": "MatthewWolff/DESMAN", "path": "/scripts/write_strain_fasta.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> seq_index = SeqIO.index(args.fasta, 'fasta') tau_star_file = args.tau_star_file etaS_file = args.etaS_file outbase = args.outbase strainseqs = extract_strain_seqs(etaS_file, seq_index) # Update strains strainseqs = update_strain_seqs(tau_star_file, strainseqs) # Write strai...
code_fim
hard
{ "lang": "python", "repo": "MatthewWolff/DESMAN", "path": "/scripts/write_strain_fasta.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': parser = ArgumentParser() parser.add_argument("fasta", type=str, help="Gene nucleotide fasta file") parser.add_argument("tau_star_file", type=str, help="Prediction for strain haplotypes ('_tau_star.csv' output from Gen...
code_fim
hard
{ "lang": "python", "repo": "MatthewWolff/DESMAN", "path": "/scripts/write_strain_fasta.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: evgen-ryzhkov/computer_vision path: /face_recognition_game_of_thrones/scripts/dataset.py import http.client, urllib.parse, json import config.main as config import requests import time import os import shutil class Dataset: def __init__(self): # todo - replace the key into independ...
code_fim
hard
{ "lang": "python", "repo": "evgen-ryzhkov/computer_vision", "path": "/face_recognition_game_of_thrones/scripts/dataset.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _get_json(self, search_term): headers = {"Ocp-Apim-Subscription-Key": self.subscription_key} offset = 0 n_grab_images = 0 value_results = [] while n_grab_images < self.images_amount_for_class: params = {"q": search_term, "imageType": "photo", "o...
code_fim
hard
{ "lang": "python", "repo": "evgen-ryzhkov/computer_vision", "path": "/face_recognition_game_of_thrones/scripts/dataset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def save(request) : return HttpResponseRedirect(reverse('board:getList')) def delete(request, board_id) : board = Board.objects.get(id = board_id) # try : board.delete() # except : return HttpResponseRedirect(reverse('board:getList'))<|fim_prefix|># repo: Nexters/Dog58Server path: /Dog58/board/vi...
code_fim
medium
{ "lang": "python", "repo": "Nexters/Dog58Server", "path": "/Dog58/board/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nexters/Dog58Server path: /Dog58/board/views.py # -*- coding: utf-8 -*- from django.shortcuts import render, render_to_response from django.http import HttpResponse from django.http import HttpResponseRedirect from board.models import Board from board.forms import BoardAdminForm from django.templ...
code_fim
hard
{ "lang": "python", "repo": "Nexters/Dog58Server", "path": "/Dog58/board/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> boardList = Board.objects.all() context = {"boardList" : boardList} return render(request, "board/list.html", context) def get(request, board_id) : board = Board.objects.get(id = board_id) context = {"content" : board} return render(request, "board/content.html", context) def write(request): form...
code_fim
medium
{ "lang": "python", "repo": "Nexters/Dog58Server", "path": "/Dog58/board/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def shfl_up_sync(mask, var, delta, width=32): return call_cuda('__shfl_up_sync', [mask, var, delta, width]) def shfl_down_sync(mask, var, delta, width=32): return call_cuda('__shfl_down_sync', [mask, var, delta, width]) def shfl_xor_sync(mask, var, lane_mask, width=32): return call_cuda('_...
code_fim
hard
{ "lang": "python", "repo": "yaoyaoding/hidet-artifacts", "path": "/python/hidet/ir/primitives/cuda/funcs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def shfl_up_sync(mask, var, delta, width=32): return call_cuda('__shfl_up_sync', [mask, var, delta, width]) def shfl_down_sync(mask, var, delta, width=32): return call_cuda('__shfl_down_sync', [mask, var, delta, width]) def shfl_xor_sync(mask, var, lane_mask, width=32): return call_cuda('...
code_fim
hard
{ "lang": "python", "repo": "yaoyaoding/hidet-artifacts", "path": "/python/hidet/ir/primitives/cuda/funcs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Organizer) admin.site.register(Teachers) admin.site.register(Groups) admin.site.register(Students) admin.site.register(Subjects) admin.site.register(Lessons) admin.site.register(Reviews) admin.site.register(Answers) admin.site.register(Сriterions) admin.site.register(СriterionAnswers) ...
code_fim
easy
{ "lang": "python", "repo": "VicClone/reviews-for-teachers", "path": "/reviews/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: VicClone/reviews-for-teachers path: /reviews/admin.py from django.contrib import admin from .models import * <|fim_suffix|>admin.site.register(Organizer) admin.site.register(Teachers) admin.site.register(Groups) admin.site.register(Students) admin.site.register(Subjects) admin.site.register(Less...
code_fim
easy
{ "lang": "python", "repo": "VicClone/reviews-for-teachers", "path": "/reviews/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># for every dictionary on a list for dict_student in list_dict_students: if dict_student["middle"] != None: # student doesn't have a middle name registered on the database print(dict_student["first"] + " " + dict_student["middle"] + " " + dict_student["last"] + ", born " + str(d...
code_fim
hard
{ "lang": "python", "repo": "marianamourao-37/Harvard-CS50-Projects", "path": "/pset7/houses/roster.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: marianamourao-37/Harvard-CS50-Projects path: /pset7/houses/roster.py # import libraries: from sys import argv, exit import cs50 # check incorrect usage if len(argv) != 2: print("Usage: python roster.py house_name") exit(1) <|fim_suffix|># for every dictionary on a list for dict_student ...
code_fim
hard
{ "lang": "python", "repo": "marianamourao-37/Harvard-CS50-Projects", "path": "/pset7/houses/roster.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># opens database for interative manipulation within python db = cs50.SQL("sqlite:///students.db") # performs a query list_dict_students = db.execute("SELECT first, middle, last, birth FROM students WHERE house = ? ORDER BY last, first", house_name) # for every dictionary on a list for dict_student in li...
code_fim
medium
{ "lang": "python", "repo": "marianamourao-37/Harvard-CS50-Projects", "path": "/pset7/houses/roster.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if tmp_sum == target: res.append(tmp_list) return if tmp_sum > target or i == len(candidates): return for j in range(i, len(candidates)): if j > i and candidates[j] == candidates[j - 1]: ...
code_fim
hard
{ "lang": "python", "repo": "junyinglucn/leetcode", "path": "/medium/40. Combination Sum II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junyinglucn/leetcode path: /medium/40. Combination Sum II.py class Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: <|fim_suffix|> if tmp_sum == target: res.append(tmp_list) return if tmp_sum > t...
code_fim
hard
{ "lang": "python", "repo": "junyinglucn/leetcode", "path": "/medium/40. Combination Sum II.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def dfs(i, tmp_sum, tmp_list): if tmp_sum == target: res.append(tmp_list) return if tmp_sum > target or i == len(candidates): return for j in range(i, len(candidates)): if j > i and candidates[j] ==...
code_fim
hard
{ "lang": "python", "repo": "junyinglucn/leetcode", "path": "/medium/40. Combination Sum II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return sys.stdin.readline()[:-1] def readnlines(n): l = [] for i in range(n): l.append(readline()) for curcase in range(1, int(readline())+1): (n, k) = readline().split() power = 2**int(n) if (int(k) + 1) % power == 0: print "Case #%d: ON" % (curcase) else: ...
code_fim
medium
{ "lang": "python", "repo": "Kawser-nerd/CLCDSA", "path": "/Source Codes/CodeJamData/10/01/4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def readnlines(n): l = [] for i in range(n): l.append(readline()) for curcase in range(1, int(readline())+1): (n, k) = readline().split() power = 2**int(n) if (int(k) + 1) % power == 0: print "Case #%d: ON" % (curcase) else: print "Case #%d: OFF" % (curcase...
code_fim
medium
{ "lang": "python", "repo": "Kawser-nerd/CLCDSA", "path": "/Source Codes/CodeJamData/10/01/4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kawser-nerd/CLCDSA path: /Source Codes/CodeJamData/10/01/4.py #!/usr/bin/env python # -*- coding: utf-8 -*- # (c) DDPAlphaTiger1 2009 # Will be under GPL after the end of GCJ # Under no-use-by-anyone-else-than-me license until then :D # ***** ***** # Thanks for reading my weird code ! # ***** **...
code_fim
medium
{ "lang": "python", "repo": "Kawser-nerd/CLCDSA", "path": "/Source Codes/CodeJamData/10/01/4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>n=%s --train_color=%s --test_color=%s --data=%s'%(folder,node_dim,sampling, train_graph, test_graph, train_min_n, train_max_n, test_min_n, test_max_n, train_color, test_color, data_name)) file_id +=1 print("%d data files are successfully generated." %file_id)<|fim_prefix|># repo: anhnt2407/nn-extrapol...
code_fim
hard
{ "lang": "python", "repo": "anhnt2407/nn-extrapolate", "path": "/graph_algorithms/sample_scripts/sample_maxdeg_uniform.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: anhnt2407/nn-extrapolate path: /graph_algorithms/sample_scripts/sample_maxdeg_uniform.py import os folder = 'data' node_dim = 3 sampling = 'uniform' train_graphs = ['path', 'cycle', 'ladder', '4regular', 'complete', 'tree', 'expander', 'general'] test_graph = 'general' train_min_n = 20 train_ma...
code_fim
hard
{ "lang": "python", "repo": "anhnt2407/nn-extrapolate", "path": "/graph_algorithms/sample_scripts/sample_maxdeg_uniform.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: turtlegraphics/advent-of-code-2018 path: /day25/solve.py import sys if len(sys.argv) > 1: filename = sys.argv[1] data = open(filename).readlines() points = [tuple([int(x) for x in l.strip().split(',')]) for l in data] <|fim_suffix|> (x1,y1,z1,w1) = p1 (x2,y2,z2,w2) = p2 return ab...
code_fim
medium
{ "lang": "python", "repo": "turtlegraphics/advent-of-code-2018", "path": "/day25/solve.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>constellations = [] for p in points: belongs = [] for c in constellations: if inconst(p,c): belongs.append(c) if len(belongs) == 0: constellations.append([p]) elif len(belongs) == 1: belongs[0].append(p) else: # belongs to more than one ...
code_fim
hard
{ "lang": "python", "repo": "turtlegraphics/advent-of-code-2018", "path": "/day25/solve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShaneZTH/adidas-account-gen path: /test.py import json class tester(): def __init__(self): """ Deals with user entered emails """ with open('info.json') as file: self.info = json.load(file) file.close() self.count = 0 <|fim_suffix|> print(self.in...
code_fim
easy
{ "lang": "python", "repo": "ShaneZTH/adidas-account-gen", "path": "/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': test = tester() test.run()<|fim_prefix|># repo: ShaneZTH/adidas-account-gen path: /test.py import json class tester(): def __init__(self): <|fim_middle|> """ Deals with user entered emails """ with open('info.json') as file: self.info = json.l...
code_fim
hard
{ "lang": "python", "repo": "ShaneZTH/adidas-account-gen", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return next_write_use["waiting_write"] def declare_last_write_use(instruction): next_write_use["last_instruction_to_write"] = instruction next_write_use["waiting_write"] = True def concede_right_to_use(instruction): if next_write_use["last_...
code_fim
hard
{ "lang": "python", "repo": "marcelocra/ita-mips-simulator", "path": "/src/register.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcelocra/ita-mips-simulator path: /src/register.py class Register(): def __init__(self): value = {1: 0} next_write_use = {"last_instruction_to_write": None, "waiting_write": False} <|fim_suffix|> def declare_last_write_use(instruction): ...
code_fim
hard
{ "lang": "python", "repo": "marcelocra/ita-mips-simulator", "path": "/src/register.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if next_write_use["last_instruction_to_write"] == instruction: next_write_use["waiting_write"] = False self.write = write self.get_value = use self.is_waiting_for_use = is_waiting_for_use self.declare_last_write_use = declare_last_write_use ...
code_fim
hard
{ "lang": "python", "repo": "marcelocra/ita-mips-simulator", "path": "/src/register.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xinsec/python-framework path: /djangoapp/djangoapp/tasks/tasks.py # -*- coding: UTF-8 -*- """ celery启动时会自动扫描tasks.py 这个文件, 使用时需要导入子模块 """ from celery import platforms <|fim_suffix|># 开启超级管理员使用模式 platforms.C_FORCE_ROOT = True<|fim_middle|># 导入任务子模块 from .task_a import * from .task_b import *
code_fim
easy
{ "lang": "python", "repo": "xinsec/python-framework", "path": "/djangoapp/djangoapp/tasks/tasks.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 开启超级管理员使用模式 platforms.C_FORCE_ROOT = True<|fim_prefix|># repo: xinsec/python-framework path: /djangoapp/djangoapp/tasks/tasks.py # -*- coding: UTF-8 -*- """ celery启动时会自动扫描tasks.py 这个文件, 使用时需要导入子模块 """ <|fim_middle|>from celery import platforms # 导入任务子模块 from .task_a import * from .task_b import *
code_fim
medium
{ "lang": "python", "repo": "xinsec/python-framework", "path": "/djangoapp/djangoapp/tasks/tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: o2edu/MathsExams path: /maths/questions/tests/test_sketch_misc.py from maths.questions import sketch_misc, relationships from maths.latex.questions import QuestionTree from .question_tester import question_tester import pytest <|fim_suffix|> question = relationships.parse_structure(sketch_mi...
code_fim
easy
{ "lang": "python", "repo": "o2edu/MathsExams", "path": "/maths/questions/tests/test_sketch_misc.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> question = relationships.parse_structure(sketch_misc) question_tester(question)<|fim_prefix|># repo: o2edu/MathsExams path: /maths/questions/tests/test_sketch_misc.py from maths.questions import sketch_misc, relationships from maths.latex.questions import QuestionTree from .question_tester import...
code_fim
easy
{ "lang": "python", "repo": "o2edu/MathsExams", "path": "/maths/questions/tests/test_sketch_misc.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert len(unpaired_msa[0].splitlines()) == lines assert paired_msa is None assert query_seqs_unique == [Q60262] assert query_seqs_cardinality == [1] assert caplog.messages == []<|fim_prefix|># repo: sokrypton/ColabFold path: /tests/test_msa.py from unittest import mo...
code_fim
hard
{ "lang": "python", "repo": "sokrypton/ColabFold", "path": "/tests/test_msa.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sokrypton/ColabFold path: /tests/test_msa.py from unittest import mock from colabfold.batch import get_msa_and_templates from tests.mock import MMseqs2Mock def test_get_msa_and_templates(pytestconfig, caplog, tmp_path): Q60262 = "MEIIALLIEEGIIIIKDKKVAERFLKDLESSQGMDWKEIRERAERAKKQLEEGIEWAKKT...
code_fim
hard
{ "lang": "python", "repo": "sokrypton/ColabFold", "path": "/tests/test_msa.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_fields_names(self): # make a list of fields. return [field.verbose_name for field in Run._meta.fields] def get_fields(self): # make a list of fields/values. return [(field.verbose_name, field.value_to_string(self)) for field in Run._meta.fields] def ge...
code_fim
hard
{ "lang": "python", "repo": "smheidrich/RFWeb", "path": "/rfweb/rfwebapp/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Run(models.Model, object): id = models.AutoField(primary_key=True) task = models.ForeignKey(Task) start = models.DateTimeField(auto_now_add=False, auto_now=False) finish = models.DateTimeField(auto_now_add=False, auto_now=False, null=True) hwaddr = models.BigIntegerField(null=Tru...
code_fim
hard
{ "lang": "python", "repo": "smheidrich/RFWeb", "path": "/rfweb/rfwebapp/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: smheidrich/RFWeb path: /rfweb/rfwebapp/models.py from django.db import models from rfweb.settings import RESULTS_URL, RESULTS_PATH import os LOG_TYPE = ( (0, 'Start suite'), (1, 'Start test'), (2, 'Start keyword'), (3, 'End suite'), (4, 'End test'), (5, 'End keyword'), ...
code_fim
hard
{ "lang": "python", "repo": "smheidrich/RFWeb", "path": "/rfweb/rfwebapp/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(len(vectors)): for j in range(len(vectors)): # consine distance dist = (vectors[i]*vectors[j]).sum().item() print(images[i], images[j], dist) print('-------------')<|fim_prefix|># repo: chunhuizhang/bilibili_vlogs path: /cv/image_similarity/cnn/feature_simil...
code_fim
hard
{ "lang": "python", "repo": "chunhuizhang/bilibili_vlogs", "path": "/cv/image_similarity/cnn/feature_similarity.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chunhuizhang/bilibili_vlogs path: /cv/image_similarity/cnn/feature_similarity.py import random import torch from cv.image_similarity.cnn.build_models import IR_50, IR_101, IR_152 import torchvision import os from PIL import Image to_torch_tensor = torchvision.transforms.Compose([torchvision.tra...
code_fim
medium
{ "lang": "python", "repo": "chunhuizhang/bilibili_vlogs", "path": "/cv/image_similarity/cnn/feature_similarity.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># The model is trained for 25 epochs with batch_size of 15 model.fit(x_train,y_train,batch_size=15,epochs=25) # Evaluating model for test dataset pred_nn=model.evaluate(x_test,y_test) predic = model.predict(x_test) y_test = pd.DataFrame(y_test) res_NN = confusion_matrix(y_test,predic.round()) # confusi...
code_fim
medium
{ "lang": "python", "repo": "AbhishekBasu-14/Breast_Cancer_Detection", "path": "/CNN/NN_model_training.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># spliting the dataset into training and testing datasets x_train,x_test,y_train,y_test = train_test_split(X,Y,test_size=0.3,random_state=0) # Feature Scaling sc = StandardScaler() x_train = sc.fit_transform(x_train) x_test = sc.transform(x_test) # Creating a model with 5 layers # Activation function sig...
code_fim
hard
{ "lang": "python", "repo": "AbhishekBasu-14/Breast_Cancer_Detection", "path": "/CNN/NN_model_training.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AbhishekBasu-14/Breast_Cancer_Detection path: /CNN/NN_model_training.py # -*- coding: utf-8 -*- import numpy as np import pandas as pd import keras from keras.models import Sequential from keras.layers import Dense,Dropout import tensorflow as tf import matplotlib.pyplot as plt import seaborn as...
code_fim
hard
{ "lang": "python", "repo": "AbhishekBasu-14/Breast_Cancer_Detection", "path": "/CNN/NN_model_training.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 输入用户名 driver.find_element_by_name('username').clear() driver.find_element_by_name('username').send_keys(username) # 输入密码 driver.find_element_by_name('password').clear() driver.find_element_by_name('password').send_keys(password) # 点击登录 driv...
code_fim
medium
{ "lang": "python", "repo": "zhangsong1417/xx", "path": "/Python_script/51zxw/Test_Module/LoginClass_para.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhangsong1417/xx path: /Python_script/51zxw/Test_Module/LoginClass_para.py from selenium import webdriver from time import sleep class Login(): def user_login(self, driver, username, password): <|fim_suffix|> driver.find_element_by_link_text('退出').click() sleep(5) # 退...
code_fim
hard
{ "lang": "python", "repo": "zhangsong1417/xx", "path": "/Python_script/51zxw/Test_Module/LoginClass_para.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: samul3096/vehicleDetectCountTrafficControl- path: /ardu_tk.py import serial import po2 ard_srl=serial.Serial('com6',9600) print ard_srl.readline() print ("Enter 1 to ON and 0 to OFF") while 1: in_data=raw_input() print "you entered", in_data <|fim_suffix|> if (in_data == '0'): ...
code_fim
medium
{ "lang": "python", "repo": "samul3096/vehicleDetectCountTrafficControl-", "path": "/ardu_tk.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (in_data == '0'): ard_srl.write('0') print ("LED OFF")<|fim_prefix|># repo: samul3096/vehicleDetectCountTrafficControl- path: /ardu_tk.py import serial import po2 ard_srl=serial.Serial('com6',9600) print ard_srl.readline() print ("Enter 1 to ON and 0 to OFF") <|fim_middle|>while 1...
code_fim
medium
{ "lang": "python", "repo": "samul3096/vehicleDetectCountTrafficControl-", "path": "/ardu_tk.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kimmc6008/DP path: /DP__prime/DayPlanner/urls.py from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), path('new_search', views.new_search, name='new_search'), path('list_delete', views.deleteMarkEight, name='delete_list'), path('list...
code_fim
medium
{ "lang": "python", "repo": "kimmc6008/DP", "path": "/DP__prime/DayPlanner/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>teMarkEight, name='create_list'), path('list_update', views.updateMarkEight, name='update_list'), path('register', views.registerPage, name='register'), path('login', views.loginPage, name='login'), path('logout', views.logoutUser, name='logout'), ]<|fim_prefix|># repo: kimmc6008/DP path:...
code_fim
medium
{ "lang": "python", "repo": "kimmc6008/DP", "path": "/DP__prime/DayPlanner/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.sampling_offsets.bias.data = grid_init.view(-1) constant_init(self.attention_weights, val=0., bias=0.) xavier_init(self.value_proj, distribution='uniform', bias=0.) xavier_init(self.output_proj, distribution='uniform', bias=0.) self._is_init = True d...
code_fim
hard
{ "lang": "python", "repo": "OpenDriveLab/UniAD", "path": "/projects/mmdet3d_plugin/uniad/modules/spatial_cross_attention.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if value is None: value = query if identity is None: identity = query if query_pos is not None: query = query + query_pos if not self.batch_first: # change to (bs, num_query ,embed_dims) query = query.per...
code_fim
hard
{ "lang": "python", "repo": "OpenDriveLab/UniAD", "path": "/projects/mmdet3d_plugin/uniad/modules/spatial_cross_attention.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenDriveLab/UniAD path: /projects/mmdet3d_plugin/uniad/modules/spatial_cross_attention.py r import force_fp32, auto_fp16 from mmcv.runner.base_module import BaseModule, ModuleList, Sequential from mmcv.utils import ext_loader from .multi_scale_deformable_attn_function import MultiScaleDef...
code_fim
hard
{ "lang": "python", "repo": "OpenDriveLab/UniAD", "path": "/projects/mmdet3d_plugin/uniad/modules/spatial_cross_attention.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def main(_): c_time = time.strftime('%Y%m%d_%H%M', time.localtime()) args = parse_arg() update_config(args, c_time) # logging the configurations for display logging.info(cfg) if args.test: pdb.set_trace() data_dir = cfg.DATA_DIR set_names = cfg.set_names ...
code_fim
hard
{ "lang": "python", "repo": "tomarraj008/AQUAA", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomarraj008/AQUAA path: /train.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import pdb, pprint, argparse, json import warnings import tensorflow as tf from os.path import join as pjoin import numpy as np from utils.read_...
code_fim
hard
{ "lang": "python", "repo": "tomarraj008/AQUAA", "path": "/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ''' Create a vocab dictionary for mapping words to embeddings ''' # vocab_path = 'amazon/vocab.dat' if tf.gfile.Exists(vocab_path): rev_vocab = [] with tf.gfile.GFile(vocab_path, "rb") as f: rev_vocab.extend(f.readlines()) rev_vocab = [line.strip...
code_fim
hard
{ "lang": "python", "repo": "tomarraj008/AQUAA", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chocolate1337/python_base path: /lesson_006/02_snowfall_module.py # -*- coding: utf-8 -*- import simple_draw as sd from snowfall import create_snowflake, draw_snowflake, move_snowflake, number_low_snowflake, delete_snowflake <|fim_suffix|>n = 10 create_snowflake(n) while True: sd.start_drawi...
code_fim
hard
{ "lang": "python", "repo": "chocolate1337/python_base", "path": "/lesson_006/02_snowfall_module.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>n = 10 create_snowflake(n) while True: sd.start_drawing() draw_snowflake(sd.background_color) move_snowflake() draw_snowflake(sd.COLOR_WHITE) sd.finish_drawing() fallen = number_low_snowflake() if fallen: delete_snowflake(fallen) fallen.clear() sd.sleep(0.01...
code_fim
hard
{ "lang": "python", "repo": "chocolate1337/python_base", "path": "/lesson_006/02_snowfall_module.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PeterGrainfield/AltCoder path: /py/arc118_a.py t, N = map(int, input().split()) cnt = 0 s<|fim_suffix|> == 0: print(s * (100 + t) // 100 - 1) else: print((s+1) * (100 + t) // 100 - 1)<|fim_middle|>, sp = divmod(100*N, t) # print(s, sp) if sp
code_fim
easy
{ "lang": "python", "repo": "PeterGrainfield/AltCoder", "path": "/py/arc118_a.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> == 0: print(s * (100 + t) // 100 - 1) else: print((s+1) * (100 + t) // 100 - 1)<|fim_prefix|># repo: PeterGrainfield/AltCoder path: /py/arc118_a.py t, N = map(int, input().split()) cnt = 0 s<|fim_middle|>, sp = divmod(100*N, t) # print(s, sp) if sp
code_fim
easy
{ "lang": "python", "repo": "PeterGrainfield/AltCoder", "path": "/py/arc118_a.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Thymolzzw/demo_django2 path: /demo_django/wiki/wiki.py from lxml import etree import urllib.request import urllib.parse def query(content): # 请求地址 url = 'https://en.wikipedia.org/wiki/' + urllib.parse.quote(content) # print("url", url) # 请求头部 headers = { 'User-Age...
code_fim
hard
{ "lang": "python", "repo": "Thymolzzw/demo_django2", "path": "/demo_django/wiki/wiki.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # print("ouput", obj_list) # # 在所有的子节点对象中获取有用的 <p> 节点对象 # for i in range(0,len(obj_list)): # if 'p' == obj_list[i].tag: # start = i # break # print("开始:", i) # for i in range(start,len(obj_list)): # if 'p' != obj_list[i].tag: # end =...
code_fim
hard
{ "lang": "python", "repo": "Thymolzzw/demo_django2", "path": "/demo_django/wiki/wiki.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.delay = 0 #Grabs host and port on handshake def grab_host(self, packet): self.host = packet.data['host'] self.port = packet.data['port']<|fim_prefix|># repo: micropsi-industries/spock path: /plugins/ReConnect.py """ Hilariously out of date, I'll update this when it's not 3:30 in the morning...
code_fim
hard
{ "lang": "python", "repo": "micropsi-industries/spock", "path": "/plugins/ReConnect.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: micropsi-industries/spock path: /plugins/ReConnect.py """ Hilariously out of date, I'll update this when it's not 3:30 in the morning In the meantime, go look at plugins in spock.net.plugins for more up-to-date plugin examples """ from spock.mcp.mcpacket import Packet from spock.net.cflags impor...
code_fim
medium
{ "lang": "python", "repo": "micropsi-industries/spock", "path": "/plugins/ReConnect.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Rebind the workflow instance bound to the given 'old' record IDs to the given 'new' IDs. (``old_new_ids`` is a list of pairs ``(old, new)``. """ from odoo.addons.vneuron_workflow_odoo import workflow ...
code_fim
hard
{ "lang": "python", "repo": "hassanfadl/addons-2", "path": "/vneuron_workflow_odoo/base_model_extend.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hassanfadl/addons-2 path: /vneuron_workflow_odoo/base_model_extend.py from odoo import api, fields, models, _ import logging from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) _schema = logging.getLogger(__name__ + '.schema') _unlink = logging.getLogger(__name__ + '...
code_fim
hard
{ "lang": "python", "repo": "hassanfadl/addons-2", "path": "/vneuron_workflow_odoo/base_model_extend.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Salvatore-Rendo/caesar-cipher path: /caesar-cli.py # The Encryption Function def cipher_encrypt(plaintext, key): encrypted_text = "" for char in plaintext: if char.isupper(): #check if it's an uppercase character char_index = ord(char) - ord('A') # shi...
code_fim
hard
{ "lang": "python", "repo": "Salvatore-Rendo/caesar-cipher", "path": "/caesar-cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #retrivering command number = input ( "Enter 1 or 2 : ") #Encryption if number == "1": correct_number= True correct_input = False while correct_input == False: plaintext = input("ENCRYPTION:\nEnter the plaintext that you want to Encrypt: ") ...
code_fim
hard
{ "lang": "python", "repo": "Salvatore-Rendo/caesar-cipher", "path": "/caesar-cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> decrypted_text += c_og elif char.isdigit(): # if it's a number,shift its actual value c_og = (int(char) - key) % 10 decrypted_text += str(c_og) else: # if its neither alphabetical nor a number, just leave it like that ...
code_fim
hard
{ "lang": "python", "repo": "Salvatore-Rendo/caesar-cipher", "path": "/caesar-cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fabricourt/Web-Theme-Editor-Clone-Wix.com- path: /restaurant/migrations/0003_auto_20190506_0035.py # Generated by Django 2.2.1 on 2019-05-05 19:05 <|fim_suffix|> dependencies = [ ('restaurant', '0002_restdb_brandimg'), ] operations = [ migrations.AlterField( ...
code_fim
medium
{ "lang": "python", "repo": "Fabricourt/Web-Theme-Editor-Clone-Wix.com-", "path": "/restaurant/migrations/0003_auto_20190506_0035.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='restdb', name='brandimg', field=models.ImageField(blank=True, default='/static/restaurant/img/logo.png', null=True, upload_to='images/'), ), ]<|fim_prefix|># repo: Fabricourt/Web-Theme-Editor-Clon...
code_fim
medium
{ "lang": "python", "repo": "Fabricourt/Web-Theme-Editor-Clone-Wix.com-", "path": "/restaurant/migrations/0003_auto_20190506_0035.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('restaurant', '0002_restdb_brandimg'), ] operations = [ migrations.AlterField( model_name='restdb', name='brandimg', field=models.ImageField(blank=True, default='/static/restaurant/img/logo.png', null=True, upload_to='imag...
code_fim
easy
{ "lang": "python", "repo": "Fabricourt/Web-Theme-Editor-Clone-Wix.com-", "path": "/restaurant/migrations/0003_auto_20190506_0035.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Checks to see if the input filenames exist as objects in S3 Returns: (list) Filtered list containing string paths of filenames that exist as objects in S3 Or False if no files found """ objects = s3.list_objects(Bucket=BUCKET, Prefix=TRAIN_SET_PATH) if objec...
code_fim
hard
{ "lang": "python", "repo": "jolin1337/Text2Abstract", "path": "/serverless-sagemaker-orchestration/lambda_functions/check_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jolin1337/Text2Abstract path: /serverless-sagemaker-orchestration/lambda_functions/check_data.py import datetime import boto3 import json import os # Prefix to give to training jobs, models, and endpoint configs, and endpoint name MODEL_PREFIX = os.environ['MODEL_PREFIX'] # Name of bucket cont...
code_fim
hard
{ "lang": "python", "repo": "jolin1337/Text2Abstract", "path": "/serverless-sagemaker-orchestration/lambda_functions/check_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Upsample and incorporating residuals for residual_layer in reversed(residual_layers): target_shape = [residual_layer.shape[1], residual_layer.shape[2]] upsampled = tf.image.resize_nearest_neighbor(images=last_layer, size=target_shape) last_layer = residual_layer + upsampl...
code_fim
hard
{ "lang": "python", "repo": "viayeqian/FaceReconstruction", "path": "/hourglass2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: viayeqian/FaceReconstruction path: /hourglass2.py import tensorflow as tf ''' Residual Block from figure 3 https://arxiv.org/pdf/1603.06937.pdf ''' def res_block(x,channels=256,kernel_size=3, activation=tf.nn.leaky_relu): result = tf.layers.conv2d(inputs=x, filters=channels/2, kernel_size=[1...
code_fim
hard
{ "lang": "python", "repo": "viayeqian/FaceReconstruction", "path": "/hourglass2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>cnt = [0]*4 sol=0 for i in range(1, N): for j in range(1, N): cnt[0] = check(0, 0, i, j) # 1사분면 cnt[1] = check(0, j, i, N) # 2사분면 cnt[2] = check(i, 0, N, j) # 3분면 cnt[3] =check(i, j, N, N) #4분면 if cnt[0]==cnt[1] and cnt[1]==cnt[2] and cnt[2]==cnt[3] : ...
code_fim
medium
{ "lang": "python", "repo": "seunghoon2334/TIL", "path": "/algorithm/codexpert/과수원.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: seunghoon2334/TIL path: /algorithm/codexpert/과수원.py import sys sys.stdin = open("in.txt") def check(si, sj, ei, ej): cnt=0 for i in range(si, ei): for j in range(sj, ej): cnt+=arr[i][j] return cnt <|fim_suffix|>cnt = [0]*4 sol=0 for i in range(1, N): for j in ...
code_fim
medium
{ "lang": "python", "repo": "seunghoon2334/TIL", "path": "/algorithm/codexpert/과수원.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.size == 0: # if list is empty self.head = self.tail = new_node # make new_node both head and tail else: self.tail.next = new_node # place new_node after tail new_node.prev = self.tail # place current tail before new_node self.tai...
code_fim
hard
{ "lang": "python", "repo": "chazkiker2/Data-Structures", "path": "/doubly_linked_list/den_doubly_linked_list_02.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chazkiker2/Data-Structures path: /doubly_linked_list/den_doubly_linked_list_02.py class ListNode: """ Each ListNode holds a reference to its previous node as well as its next node in the List. That two-directional reference is what allows for our DoublyLinkedList to be doubly-...
code_fim
hard
{ "lang": "python", "repo": "chazkiker2/Data-Structures", "path": "/doubly_linked_list/den_doubly_linked_list_02.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def add_to_tail(self, value): """ Wraps the given value in a ListNode and inserts it as the new tail of the list. Don't forget to handle the old tail node's next pointer accordingly. """ new_node = ListNode(value) if self.size == 0: # if list ...
code_fim
hard
{ "lang": "python", "repo": "chazkiker2/Data-Structures", "path": "/doubly_linked_list/den_doubly_linked_list_02.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Return a dmd root organizer such as "Systems". The acquisition path will be cleaned so that it points directly to the root. >>> dmd.Devices.Server.getDmdRoot("Systems") <System at /zport/dmd/Systems> """ dmd = self.getDmd() return dmd._...
code_fim
hard
{ "lang": "python", "repo": "zenoss/zenoss-prodbin", "path": "/Products/ZenModel/ZenModelBase.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zenoss/zenoss-prodbin path: /Products/ZenModel/ZenModelBase.py createHierarchyObj, getHierarchyObj from Products.ZenUtils.Utils import getObjByPath, unpublished from Products.ZenUtils.csrf import get_csrf_token from Products.ZenUtils.Utils import prepId as globalPrepId, isXmlRpc from Products.Ze...
code_fim
hard
{ "lang": "python", "repo": "zenoss/zenoss-prodbin", "path": "/Products/ZenModel/ZenModelBase.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zenoss/zenoss-prodbin path: /Products/ZenModel/ZenModelBase.py of tuples to create a bread crumbs @rtype: list >>> dmd.Devices.Server.breadCrumbs() [('/zport/dmd/Devices', 'Devices'), ('/zport/dmd/Devices/Server', 'Server')] """ links = [] ...
code_fim
hard
{ "lang": "python", "repo": "zenoss/zenoss-prodbin", "path": "/Products/ZenModel/ZenModelBase.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }