text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: pulumi/pulumi path: /tests/integration/construct_component/python/component.py # Copyright 2016-2020, Pulumi Corporation. All rights reserved. from typing import Any, Optional import pulumi <|fim_suffix|> def __init__(self, name: str, echo: pulumi.Input[Any], opts: Optional[pulumi.Resource...
code_fim
medium
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/tests/integration/construct_component/python/component.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>om . import data_converters from . import metrics<|fim_prefix|># repo: SteamPeKa/krippendorffs_alpha path: /src/krippendorffs_alpha/__init__.py # coding=utf-8 # Creation date: 19 окт. 2020 # C<|fim_middle|>reation time: 10:22 # Creator: SteamPeKa from . import _bootstrap from . import _calculation fr
code_fim
medium
{ "lang": "python", "repo": "SteamPeKa/krippendorffs_alpha", "path": "/src/krippendorffs_alpha/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SteamPeKa/krippendorffs_alpha path: /src/krippendorffs_alpha/__init__.py # coding=utf-8 # Creation date: 19 окт. 2020 # Creation time: 10:22 # Creator: SteamPeKa from .<|fim_suffix|>om . import data_converters from . import metrics<|fim_middle|> import _bootstrap from . import _calculation fr
code_fim
easy
{ "lang": "python", "repo": "SteamPeKa/krippendorffs_alpha", "path": "/src/krippendorffs_alpha/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :return: Dictionary with build information """ manager_bl = self.safe_buildinfo("/api/buildinfo") gateway_bl = self.safe_buildinfo("/gateway/buildinfo") monitoring_bl = self.safe_buildinfo("/monitoring/buildinfo") rootcause_bl = self.safe_buildinfo("/rootcau...
code_fim
hard
{ "lang": "python", "repo": "Hydrospheredata/hydro-serving-sdk", "path": "/hydrosdk/cluster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hydrospheredata/hydro-serving-sdk path: /hydrosdk/cluster.py import json from typing import Dict from typing import Optional from urllib import parse import grpc import requests from hydrosdk.utils import grpc_server_on, handle_request_error from hydrosdk.exceptions import BadResponseException ...
code_fim
hard
{ "lang": "python", "repo": "Hydrospheredata/hydro-serving-sdk", "path": "/hydrosdk/cluster.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: add better url validation (but not python validators lib!) parse.urlsplit(http_address) # check if address is ok self.http_address = http_address self.channel = None if grpc_address: parse.urlsplit(grpc_address) self.grpc_address = ...
code_fim
hard
{ "lang": "python", "repo": "Hydrospheredata/hydro-serving-sdk", "path": "/hydrosdk/cluster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># CALCULS som = 0 i = 1 while i < nombre: som += i i+=1 # AFFICHAGES print("\n===============================>RESULTAT :<===============================\n") # CASING if choice == 1: print("\n\t\tLA SOMME DES CHIFFRES DE 1 à {0} DONNE {1}: \n".format(nombre, som)) os.system("pause") else:...
code_fim
hard
{ "lang": "python", "repo": "orbitturner/TDPythonP3Simplon", "path": "/TD1/exercice15.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: orbitturner/TDPythonP3Simplon path: /TD1/exercice15.py #coding: utf-8 ''' ENONCE 15 : Ecrire un algorithme qui demande un nombre de départ, et qui calcule la somme des entiers jusqu'à ce nombre. Par exemple si l'on tape 4, l’algorithme doit calculer : 1 + 2 + 3+ 4 = 10 Réécrire l'algorithme qui ...
code_fim
hard
{ "lang": "python", "repo": "orbitturner/TDPythonP3Simplon", "path": "/TD1/exercice15.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> cse8 = result.cse8 cse8_room = '' if(cse8 != '0'): cse8_room = Batch.objects.get(course_code=cse8).room temp.append(cse8_room) ece1 = result.ece1 ece1_room = '' if(ece1 != '0'): ece1_room = Batch.objects.get(course_code=ece1...
code_fim
hard
{ "lang": "python", "repo": "yash-khandelwal/TimeTable-Generator", "path": "/accounts/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yash-khandelwal/TimeTable-Generator path: /accounts/views.py 3 = '0' if('IT3' in keys): it3 = json.loads(data_js['IT3'])[i] it4 = '0' if('IT4' in keys): it4 = json.loads(data_js['IT4'])[i] it5 ...
code_fim
hard
{ "lang": "python", "repo": "yash-khandelwal/TimeTable-Generator", "path": "/accounts/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cse1 = result.cse1 cse1_room = '' if(cse1 != '0'): cse1_room = Batch.objects.get(course_code=cse1).room temp.append(cse1_room) cse2 = result.cse2 cse2_room = '' if(cse2 != '0'): cse2_room = Batch.objects.get(course_code=cse2)...
code_fim
hard
{ "lang": "python", "repo": "yash-khandelwal/TimeTable-Generator", "path": "/accounts/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjboyd02/seash path: /tests/ut_seash_help.py """ Executes a few help commands and make sures seash prints out the correct output. Make sure to update the txt file of the expected output if help's contents have modified """ import seash import sys <|fim_suffix|>test_results = open("test_results....
code_fim
hard
{ "lang": "python", "repo": "bjboyd02/seash", "path": "/tests/ut_seash_help.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(len(original)): if not original[i] == actual[i]: print "Line " + str(i) + " of test results are not consistent with expected results: help_test_results.txt" test_results.close() wanted_results.close()<|fim_prefix|># repo: bjboyd02/seash path: /tests/ut_seash_help.py """ Executes a f...
code_fim
hard
{ "lang": "python", "repo": "bjboyd02/seash", "path": "/tests/ut_seash_help.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saswatpp/cupy path: /tests/cupyx_tests/distributed_tests/comm_runner.py import sys import time import cupy from cupy import cuda from cupy.cuda import nccl from cupy import testing from cupyx.distributed import init_process_group from cupyx.distributed._nccl_comm import NCCLBackend from cupyx.d...
code_fim
hard
{ "lang": "python", "repo": "saswatpp/cupy", "path": "/tests/cupyx_tests/distributed_tests/comm_runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if dtype in 'hH': return # nccl does not support int16 def run_gather(rank, n_workers, root, dtype): dev = cuda.Device(rank) dev.use() comm = NCCLBackend(n_workers, rank) in_array = (rank + 1) * cupy.arange(10, dtype='f') out_array = cupy.zeros((n_...
code_fim
hard
{ "lang": "python", "repo": "saswatpp/cupy", "path": "/tests/cupyx_tests/distributed_tests/comm_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dev = cuda.Device(rank) dev.use() comm = NCCLBackend(n_workers, rank) in_array = cupy.arange( n_workers * 10, dtype='f').reshape(n_workers, 10) out_array = cupy.zeros((n_workers, 10), dtype='f') comm.all_to_all(in_array, out_array) expect...
code_fim
hard
{ "lang": "python", "repo": "saswatpp/cupy", "path": "/tests/cupyx_tests/distributed_tests/comm_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = request.get_data() try: datalist = json.loads(data) except: raise Exception("Invalid Data. Are you sure it's JSON encoded?") with open('housebuying1.csv', 'w') as f: for d in datalist: f.write("%s\r\n"%d) f.close() return 'OK'<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "UMWRG/interview", "path": "/interview.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UMWRG/interview path: /interview.py from flask import Flask, render_template, request import json app = Flask(__name__) @app.route('/') def index(): data = None with open('housebuying.csv', 'r') as f: data = f.readlines() <|fim_suffix|> try: datalist = json.loads(data...
code_fim
hard
{ "lang": "python", "repo": "UMWRG/interview", "path": "/interview.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not actualSegments: continue pid = actualSegments[0] for seg in actualSegments: if seg == 'imaging/UploadCSVToOmero.py': psPid = pid break if psPid: break if not psPid: print(' -- Upload pro...
code_fim
hard
{ "lang": "python", "repo": "mpi2/impc-etl", "path": "/imaging/CheckUploadProcessStatus.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpi2/impc-etl path: /imaging/CheckUploadProcessStatus.py import os def main(): psOutput = os.popen('ps x | grep imaging').read() lines = psOutput.split('\n') psPid = None for line in lines: line = line.strip() if not line: continue <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "mpi2/impc-etl", "path": "/imaging/CheckUploadProcessStatus.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not psPid: print(' -- Upload process is no longer running!') else: print(' -- Upload process is still running. PID: ' + str(psPid)) if __name__ == "__main__": main()<|fim_prefix|># repo: mpi2/impc-etl path: /imaging/CheckUploadProcessStatus.py import os def main(): ...
code_fim
hard
{ "lang": "python", "repo": "mpi2/impc-etl", "path": "/imaging/CheckUploadProcessStatus.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: drcdev-gh/cybld path: /cybld/cybld_command_handler.py #!/usr/bin/python # -------------------------------------------------------------------------- # # MIT License # # -------------------------------------------------------------------------- import atexit import logging import os import pty i...
code_fim
hard
{ "lang": "python", "repo": "drcdev-gh/cybld", "path": "/cybld/cybld_command_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # This prevents LF from being converted to CRLF attr = termios.tcgetattr(slave) attr[1] = attr[1] & ~termios.ONLCR termios.tcsetattr(slave, termios.TCSADRAIN, attr) proc = subprocess.Popen(cmd, shell=True, stdout=slave, stderr=slave, close_fds=F...
code_fim
hard
{ "lang": "python", "repo": "drcdev-gh/cybld", "path": "/cybld/cybld_command_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FANzhaoxin666/CloserLook3D path: /tensorflow/function/evaluate_partnet.py """ Evaluating script for part segmentation with PartNet dataset """ import os import sys import time import pprint import psutil import argparse import numpy as np import tensorflow as tf from sklearn.neighbors import KDTr...
code_fim
hard
{ "lang": "python", "repo": "FANzhaoxin666/CloserLook3D", "path": "/tensorflow/function/evaluate_partnet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def val_vote_one_epoch(sess, ops, dataset, epoch, split, num_votes=10): """ One epoch voting validating """ is_training = False original_labels, original_points, \ projection_inds, average_predictions = prepare_testing_structure(dataset, split) feed_dict = {ops['is_training_...
code_fim
hard
{ "lang": "python", "repo": "FANzhaoxin666/CloserLook3D", "path": "/tensorflow/function/evaluate_partnet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ One epoch validating """ is_training = False sess.run(ops[f'{split}_init_op']) feed_dict = {ops['is_training_pl']: is_training} preds = [] targets = [] objects = [] obj_inds = [] idx = 0 while True: try: tower_logits_all_shapes, to...
code_fim
hard
{ "lang": "python", "repo": "FANzhaoxin666/CloserLook3D", "path": "/tensorflow/function/evaluate_partnet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: giuseppebonaccorso/Machine-Learning-Algorithms-Second-Edition path: /Chapter08/decision_tree_regression.py from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.tree import DecisionTreeRegressor, export_graphviz from sklearn.mo...
code_fim
hard
{ "lang": "python", "repo": "giuseppebonaccorso/Machine-Learning-Algorithms-Second-Edition", "path": "/Chapter08/decision_tree_regression.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': # Load the dataset df = pd.read_excel(file_path, header=0) X = df.iloc[:, 0:8].values Y = df.iloc[:, 8].values # Print the statistic summary print(df.describe()) # Print the CV scores print(cross_val_score(DecisionTreeRegressor(criterion='mse',...
code_fim
hard
{ "lang": "python", "repo": "giuseppebonaccorso/Machine-Learning-Algorithms-Second-Edition", "path": "/Chapter08/decision_tree_regression.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestSequence(TestCase): def test_dummy(self): model = build_transformer_xl( units=4, embed_dim=4, hidden_dim=4, num_token=3, num_block=3, num_head=2, batch_size=3, memory_len=20, ...
code_fim
hard
{ "lang": "python", "repo": "CyberZHG/keras-transformer-xl", "path": "/tests/test_sequence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_dummy(self): model = build_transformer_xl( units=4, embed_dim=4, hidden_dim=4, num_token=3, num_block=3, num_head=2, batch_size=3, memory_len=20, target_len=10, ) ...
code_fim
hard
{ "lang": "python", "repo": "CyberZHG/keras-transformer-xl", "path": "/tests/test_sequence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CyberZHG/keras-transformer-xl path: /tests/test_sequence.py from unittest import TestCase import numpy as np from tensorflow import keras from keras_transformer_xl import MemorySequence, build_transformer_xl class DummySequence(object): def __init__(self): pass def __len__(s...
code_fim
hard
{ "lang": "python", "repo": "CyberZHG/keras-transformer-xl", "path": "/tests/test_sequence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: webstorage119/face_detection_and_recognition_yolov5 path: /split_oridataset.py from copy import deepcopy import shutil import cv2 import tqdm def read_file(txt_path): with open(txt_path, 'r', encoding='utf-8') as f: full_data = f.read().splitlines() # print(data[0:128]) img_i...
code_fim
hard
{ "lang": "python", "repo": "webstorage119/face_detection_and_recognition_yolov5", "path": "/split_oridataset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 复制图片文件 shutil.copyfile(ori_file_path, dst_file_path) # 生成labels文件并写入 lines = [] label = 0 img = cv2.imread(ori_file_path) if not img.data: print('xxxxxxxxxx', ori_file_path) continue height = img.shape[0] wi...
code_fim
hard
{ "lang": "python", "repo": "webstorage119/face_detection_and_recognition_yolov5", "path": "/split_oridataset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ONSdigital/address-index-developers path: /src/aims_dev_ui/config/dev.py """Development configuration""" <|fim_suffix|>API_URL = os.getenv('API_URL') or 'http://localhost:9000' SWAGGER_URL = os.getenv('SWAGGER_URL') SWAGGER_PATH = os.getenv('SWAGGER_PATH') if not (SWAGGER_URL or SWAGGER_PATH): ...
code_fim
easy
{ "lang": "python", "repo": "ONSdigital/address-index-developers", "path": "/src/aims_dev_ui/config/dev.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>API_URL = os.getenv('API_URL') or 'http://localhost:9000' SWAGGER_URL = os.getenv('SWAGGER_URL') SWAGGER_PATH = os.getenv('SWAGGER_PATH') if not (SWAGGER_URL or SWAGGER_PATH): SWAGGER_URL = API_URL + '/openapi/swagger.json'<|fim_prefix|># repo: ONSdigital/address-index-developers path: /src/aims_dev_u...
code_fim
easy
{ "lang": "python", "repo": "ONSdigital/address-index-developers", "path": "/src/aims_dev_ui/config/dev.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>history = ( "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=9000460", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=9587339", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=9807578", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=9618688", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=9460725",...
code_fim
hard
{ "lang": "python", "repo": "nishuer/mp-spider", "path": "/app/source/kuaibao_source.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nishuer/mp-spider path: /app/source/kuaibao_source.py food = ( "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5792078", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5777522", "https://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5332821", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=6529876...
code_fim
hard
{ "lang": "python", "repo": "nishuer/mp-spider", "path": "/app/source/kuaibao_source.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>joke = ( "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5228481", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5049022", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5255176", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5055370", "http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5051854", ...
code_fim
hard
{ "lang": "python", "repo": "nishuer/mp-spider", "path": "/app/source/kuaibao_source.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pccoeacm/all-calc path: /functions/quadratic-solver.py import cmath def calc(should_print=False): print(""" Name: Quadratic Solver Operation : Solves a quadratic equation of format ax^2 + bx + c =0 Inputs : a->int/float , b->int/float , c->int/float Outputs: x1,x2 ->complex...
code_fim
medium
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/quadratic-solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sol1 = (-b - cmath.sqrt(d)) / (2 * a) sol2 = (-b + cmath.sqrt(d)) / (2 * a) result = {} result['inputs'] = [a, b, c] result['outputs'] = [sol1, sol2] if should_print: print('The solution are {0} and {1}'.format(sol1, sol2)) else: return result<|fim_prefix|># r...
code_fim
medium
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/quadratic-solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d = (b**2) - (4 * a * c) sol1 = (-b - cmath.sqrt(d)) / (2 * a) sol2 = (-b + cmath.sqrt(d)) / (2 * a) result = {} result['inputs'] = [a, b, c] result['outputs'] = [sol1, sol2] if should_print: print('The solution are {0} and {1}'.format(sol1, sol2)) else: ...
code_fim
medium
{ "lang": "python", "repo": "pccoeacm/all-calc", "path": "/functions/quadratic-solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jack23912/FBG-interfero-controller-software path: /gui/controlView.py from PyQt5.QtWidgets import QWidget from PyQt5.QtCore import pyqtSlot from PyQt5.Qt import QIntValidator, QDoubleValidator from pyqtgraph import PlotItem from tool.MTD415Controller import MTDController import os from pyqtgraph ...
code_fim
hard
{ "lang": "python", "repo": "jack23912/FBG-interfero-controller-software", "path": "/gui/controlView.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setup_buttons(self): # self.le_P.setValidator(QDoubleValidator()) # self.le_D.setValidator(QDoubleValidator()) # self.le_I.setValidator(QDoubleValidator()) self.le_min.setValidator(QDoubleValidator()) self.le_max.setValidator(QDoubleValidator()) sel...
code_fim
hard
{ "lang": "python", "repo": "jack23912/FBG-interfero-controller-software", "path": "/gui/controlView.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: j-alex-hanson/rethinking-race-face-datasets path: /data/BalancedfaceSingle.py import cv2 import numpy as np import os from PIL import Image import random from torch.utils import data from torchvision import transforms as T class BalancedfaceSingle(data.Dataset): def __init__(self, root, ra...
code_fim
hard
{ "lang": "python", "repo": "j-alex-hanson/rethinking-race-face-datasets", "path": "/data/BalancedfaceSingle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getitem__(self, index): img_path = self.img_paths[index] label = self.labels[index] data = Image.open(img_path) data = data.convert('RGB') if self.noise_mixing and random.random() < self.noise: img = np.array(data) faces = self.fa...
code_fim
hard
{ "lang": "python", "repo": "j-alex-hanson/rethinking-race-face-datasets", "path": "/data/BalancedfaceSingle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ayoubhamaoui/SortAlgorithms-Python path: /MergeSort.py def Merge(A,p,q,r): n1=q-p+1 n2=r-q L=[] R=[] for i in range(n1): L.append(A[p+i-1]) for j in range(n2): R.append(A[q+j]) i=j=0 L.append(float( "inf" )) R.append(float("inf")) print("L=",L) print("R=",R) for k in...
code_fim
medium
{ "lang": "python", "repo": "ayoubhamaoui/SortAlgorithms-Python", "path": "/MergeSort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if(p<r): q=(p+r)/2 MergeSort(A,p,q) MergeSort(A,q+1,r) Merge(A,p,q,r)<|fim_prefix|># repo: ayoubhamaoui/SortAlgorithms-Python path: /MergeSort.py def Merge(A,p,q,r): n1=q-p+1 n2=r-q L=[] R=[] for i in range(n1): L.ap...
code_fim
medium
{ "lang": "python", "repo": "ayoubhamaoui/SortAlgorithms-Python", "path": "/MergeSort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zorro30/django-acs path: /acsadmin/urls.py from django.urls import path import acsadmin.views app_name = 'acsadmin' urlpatterns = [ path('http/requests/', acsadmin.views.AcsHttpRequestList.as_view(), name='acs_http_request_list'), path('http/requests/<int:pk>/', acsadmin.views.AcsHttpR...
code_fim
hard
{ "lang": "python", "repo": "Zorro30/django-acs", "path": "/acsadmin/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> path('jobqueue/', acsadmin.views.AcsQueueJobList.as_view(), name='acs_queue_job_list'), path('jobqueue/hideautomatic/', acsadmin.views.AcsQueueJobList.as_view(), name='acs_queue_job_list_hideautomatic', kwargs={'hideautomatic': True}), path('jobqueue/<int:pk>/', acsadmin.views.AcsQueueJobDetai...
code_fim
hard
{ "lang": "python", "repo": "Zorro30/django-acs", "path": "/acsadmin/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rabad/mysolr path: /mysolr/compat.py # -*- coding: utf-8 -*- """ mysolr.compat ~~~~~~~~~~~~~~ Resolve compatibility between python 2.X and 3.X """ import sys if sys.version_info >= (3, ): from urllib.parse import urljoin elif sys.version_info >= (2, ): from urlparse import...
code_fim
medium
{ "lang": "python", "repo": "rabad/mysolr", "path": "/mysolr/compat.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|>def get_wt(): if sys.version_info[0] == 3 and sys.version_info[1] == 2: return 'json' else: return 'python' def parse_response(content): if sys.version_info[0] == 3 and sys.version_info[1] == 2: import json return json.loads(content.decode('utf-8')) else: ...
code_fim
hard
{ "lang": "python", "repo": "rabad/mysolr", "path": "/mysolr/compat.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: boro-alpha/nf_common path: /nf_common_source/code/services/user_interaction_service/two_folder_selecters/select_two_folders_frames.py import tkinter from nf_common_source.code.services.user_interaction_service.common_knowledge.window_return_types import \ WindowReturnTypes from nf_common_sou...
code_fim
hard
{ "lang": "python", "repo": "boro-alpha/nf_common", "path": "/nf_common_source/code/services/user_interaction_service/two_folder_selecters/select_two_folders_frames.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tkinter.mainloop() def __create_window( self): window = \ tkinter.Tk() window.title( self.title) return \ window def __create_first_selection_frame( self, parent): self.select_folder...
code_fim
hard
{ "lang": "python", "repo": "boro-alpha/nf_common", "path": "/nf_common_source/code/services/user_interaction_service/two_folder_selecters/select_two_folders_frames.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self): window = \ tkinter.Tk() window.title( self.title) return \ window def __create_first_selection_frame( self, parent): self.select_folder_frame = \ SelectFolderFrames( ...
code_fim
hard
{ "lang": "python", "repo": "boro-alpha/nf_common", "path": "/nf_common_source/code/services/user_interaction_service/two_folder_selecters/select_two_folders_frames.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IBPA/OCB path: /TranscriptomicPipelines/microarray/m_module_template.py class MicroarrayModule: def __init__(self, owner): self.owner = owner def get_parameter_set(self): <|fim_suffix|> def get_m_query_id(self): return self.owner.get_m_query_id() d...
code_fim
medium
{ "lang": "python", "repo": "IBPA/OCB", "path": "/TranscriptomicPipelines/microarray/m_module_template.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def set_t_metadata(self,metadata): return self.owner.set_t_metadata(metadata) def get_t_gene_annotation(self): return self.owner.get_t_gene_annotation()<|fim_prefix|># repo: IBPA/OCB path: /TranscriptomicPipelines/microarray/m_module_template.py class MicroarrayModule: ...
code_fim
medium
{ "lang": "python", "repo": "IBPA/OCB", "path": "/TranscriptomicPipelines/microarray/m_module_template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.owner.set_t_metadata(metadata) def get_t_gene_annotation(self): return self.owner.get_t_gene_annotation()<|fim_prefix|># repo: IBPA/OCB path: /TranscriptomicPipelines/microarray/m_module_template.py class MicroarrayModule: def __init__(self, owner): se...
code_fim
medium
{ "lang": "python", "repo": "IBPA/OCB", "path": "/TranscriptomicPipelines/microarray/m_module_template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Get the status of a node at a given time """ try: if self.inf_time[node] > time: return 0 elif self.rec_time[node] > time: return 1 else: return 2 except IndexError: ...
code_fim
hard
{ "lang": "python", "repo": "amimul/friendship_paradox", "path": "/lab2/notebooks/epidemics_helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _process_child_infection(self, node, recovery_time, child, time): """Deal with neighbors infections""" infection_time = time + self._edge_delay[(node, child)] if infection_time <= self.max_time: if infection_time < recovery_time: if self.inf_time...
code_fim
hard
{ "lang": "python", "repo": "amimul/friendship_paradox", "path": "/lab2/notebooks/epidemics_helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amimul/friendship_paradox path: /lab2/notebooks/epidemics_helper.py """ epidemic_helper.py: Helper module to simulate continuous-time stochastic SIR epidemics. Copyright © 2017 — LCA 4 """ import time import bisect import numpy as np import networkx as nx from numpy import random as rd class ...
code_fim
hard
{ "lang": "python", "repo": "amimul/friendship_paradox", "path": "/lab2/notebooks/epidemics_helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>lb = tk.Label(text="MS ゴシック, サイズ20, 太字でない, 斜体, 河川なし, 取消線あり", font=("MS ゴシック", 20, "normal", "italic", "normal","overstrike")) lb.pack() root.mainloop()<|fim_prefix|># repo: visalpop/tkinter_sample path: /tk10.py # -*- coding: utf-8 -*- # tk10.pyw import tkinter as tk <|fim_middle|>root = tk.Tk() root.ti...
code_fim
easy
{ "lang": "python", "repo": "visalpop/tkinter_sample", "path": "/tk10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: visalpop/tkinter_sample path: /tk10.py # -*- coding: utf-8 -*- # tk10.pyw import tkinter as tk <|fim_suffix|>lb = tk.Label(text="MS ゴシック, サイズ20, 太字でない, 斜体, 河川なし, 取消線あり", font=("MS ゴシック", 20, "normal", "italic", "normal","overstrike")) lb.pack() root.mainloop()<|fim_middle|>root = tk.Tk() root.ti...
code_fim
easy
{ "lang": "python", "repo": "visalpop/tkinter_sample", "path": "/tk10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_substrate.py #calss header class _SUBSTRATE(): def __init__(self,): self.name = "SUBSTRATE" self.definitions = [u'a substance or surface that an organism grows and lives on and is supported by', u'a substance that an enzyme (= chemical made by...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_substrate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a = oda(5, zones, 'impedance', to=False, agg_func='mean') assert (a['counter'].values == np.ones(5)).all()<|fim_prefix|># repo: AZMAG/smartpy_core path: /smartpy_core/tests/test_od_access.py import numpy as np import pandas as pd import pytest from ..od_access import * @pytest.fixture() def zo...
code_fim
medium
{ "lang": "python", "repo": "AZMAG/smartpy_core", "path": "/smartpy_core/tests/test_od_access.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture() def oda(zones): od = pd.merge( zones, zones, on='counter', suffixes=['_from', '_to'] ) od.drop('counter', axis=1, inplace=True) od['impedance'] = 10 od.loc[od['zone_from'] == od['zone_to'], 'impedance'] = 1 od.loc[od['zone_from'] ...
code_fim
medium
{ "lang": "python", "repo": "AZMAG/smartpy_core", "path": "/smartpy_core/tests/test_od_access.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AZMAG/smartpy_core path: /smartpy_core/tests/test_od_access.py import numpy as np import pandas as pd import pytest from ..od_access import * @pytest.fixture() def zones(): z = pd.Series(np.arange(5)).to_frame('zone') z['counter'] = 1 return z <|fim_suffix|> return OdAccess(od...
code_fim
hard
{ "lang": "python", "repo": "AZMAG/smartpy_core", "path": "/smartpy_core/tests/test_od_access.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results[:, 1:3] /= wing.force_coef(1.225, 1) results[:, -1] /= wing.moment_coef(1.225, 1) with self.subTest('lift'): cl_polar = np.interp(results[:, 0], self.polar_data[:, 0], self.polar_data[:, 1]) np.testing.assert_array_almost_equal(cl_polar, results[:, ...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/tests/uvlm/static/polars/test_polars.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ImperialCollegeLondon/sharpy path: /tests/uvlm/static/polars/test_polars.py import unittest import tests.uvlm.static.polars.generate_wing as gw import os import glob import configobj import numpy as np from sharpy.aero.utils.utils import local_stability_axes import sharpy.utils.algebra as algebr...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/tests/uvlm/static/polars/test_polars.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # rotate the freestream dir_urel = algebra.rotation3d_y(alpha).T.dot(dir_urel) # Test free stream rotation lab = ['x', 'z'] with self.subTest(msg='Freestream test'): assert dir_urel[2] == np.sin(alpha), 'z component of freestream not properly rotated' ...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/tests/uvlm/static/polars/test_polars.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ASFHyP3/hyp3-event-monitoring path: /database/setup.py from setuptools import find_packages, setup <|fim_suffix|> python_requires='~=3.8', packages=find_packages(), )<|fim_middle|>setup( name='database', license='BSD', include_package_data=True,
code_fim
medium
{ "lang": "python", "repo": "ASFHyP3/hyp3-event-monitoring", "path": "/database/setup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> packages=find_packages(), )<|fim_prefix|># repo: ASFHyP3/hyp3-event-monitoring path: /database/setup.py from setuptools import find_packages, setup setup( name='database', license='BSD', include_package_data=True, <|fim_middle|> python_requires='~=3.8',
code_fim
easy
{ "lang": "python", "repo": "ASFHyP3/hyp3-event-monitoring", "path": "/database/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> license='BSD', include_package_data=True, python_requires='~=3.8', packages=find_packages(), )<|fim_prefix|># repo: ASFHyP3/hyp3-event-monitoring path: /database/setup.py from setuptools import find_packages, setup <|fim_middle|>setup( name='database',
code_fim
easy
{ "lang": "python", "repo": "ASFHyP3/hyp3-event-monitoring", "path": "/database/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: grantdfoster/api-template path: /app/api/security.py from functools import wraps from flask_restful import abort from flask import request <|fim_suffix|> auth_header = request.headers.get('Authorization') if not auth_header: abort(403, message="Please provide an 'Authorization' he...
code_fim
medium
{ "lang": "python", "repo": "grantdfoster/api-template", "path": "/app/api/security.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def require_auth(func): """ Secure method decorator """ @wraps(func) def wrapper(*args, **kwargs): auth_header = process_header() return func(*args, **kwargs) return wrapper<|fim_prefix|># repo: grantdfoster/api-template path: /app/api/security.py from functools import wra...
code_fim
hard
{ "lang": "python", "repo": "grantdfoster/api-template", "path": "/app/api/security.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> auth_header = process_header() return func(*args, **kwargs) return wrapper<|fim_prefix|># repo: grantdfoster/api-template path: /app/api/security.py from functools import wraps from flask_restful import abort from flask import request def process_header(): auth_header = request....
code_fim
medium
{ "lang": "python", "repo": "grantdfoster/api-template", "path": "/app/api/security.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rartino/ENVISIoN path: /demo/bandstructure.py import sys, os, inspect import os, sys, inspect, inviwopy path_to_current_folder = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.append(path_to_current_folder + "/../") import envisionpy import envisionpy.hdf5parse...
code_fim
hard
{ "lang": "python", "repo": "rartino/ENVISIoN", "path": "/demo/bandstructure.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Clear any old network inviwopy.app.network.clear() # Initialize inviwo network visManager = VisualisationManager(HDF5_FILE, inviwopy.app) visManager.start("band") # visManager.main_visualisation.hide(False, True)<|fim_prefix|># repo: rartino/ENVISIoN path: /demo/bandstructure.py import sys, os, inspec...
code_fim
medium
{ "lang": "python", "repo": "rartino/ENVISIoN", "path": "/demo/bandstructure.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.stage = stage self.mobile = mobile self.currentPage = None self.userName = None self.userPassword = None self.userEmail = None self.driver = driver self.logged_account = None def create_page_object(self, page_object): return...
code_fim
medium
{ "lang": "python", "repo": "GinoGalotti/python-selenium-utils", "path": "/SeleniumPythonFramework/src/main/Utils/world_context.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GinoGalotti/python-selenium-utils path: /SeleniumPythonFramework/src/main/Utils/world_context.py __author__ = 'Gino' class WorldContext(object): # WIP. Needed? Useful? Can we think about useful data? def __init__(self, driver, stage, mobile=False): <|fim_suffix|> def create_page_obj...
code_fim
hard
{ "lang": "python", "repo": "GinoGalotti/python-selenium-utils", "path": "/SeleniumPythonFramework/src/main/Utils/world_context.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def tearDownClass(inst): ''' Method that finishes the test case. ''' inst.oHelper.TearDown() if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: totvs/tir-script-samples path: /Protheus_WebApp/Modules/SIGAEST/MATC300TESTCASE.py from ti...
code_fim
hard
{ "lang": "python", "repo": "totvs/tir-script-samples", "path": "/Protheus_WebApp/Modules/SIGAEST/MATC300TESTCASE.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_MATC300_001(self): #Contempla os CT001 e CT002 #MATC300 - CT001: Amarração de Produto - TIR #MATC300 - CT002: Estoque Negativo - TIR self.oHelper.SetValue("MV_PAR01", "Mar") self.oHelper.SetValue("MV_PAR02","2018") self.oHelper.SetBut...
code_fim
hard
{ "lang": "python", "repo": "totvs/tir-script-samples", "path": "/Protheus_WebApp/Modules/SIGAEST/MATC300TESTCASE.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: totvs/tir-script-samples path: /Protheus_WebApp/Modules/SIGAEST/MATC300TESTCASE.py from tir import Webapp import unittest import time #//------------------------------------------------------------------- #/*/{Protheus.doc} MATC300 - DIAGNOSTICO BLOCO K # #@author ADRIANO VIEIRA #@since 16/09/2...
code_fim
medium
{ "lang": "python", "repo": "totvs/tir-script-samples", "path": "/Protheus_WebApp/Modules/SIGAEST/MATC300TESTCASE.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zed-b/advent-of-code path: /2020/src/day10.py import sys def solve1(nums): diff = dict({1:0,2:0,3:0}) for i in range(1, len(nums)): diff[nums[i]-nums[i-1]] += 1 return diff[1] * diff[3] <|fim_suffix|>if __name__ == "__main__": nums = [int(l.rstrip()) for l in sys.stdin] ...
code_fim
hard
{ "lang": "python", "repo": "zed-b/advent-of-code", "path": "/2020/src/day10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": nums = [int(l.rstrip()) for l in sys.stdin] nums.append(max(nums)+3) nums.append(0) nums.sort() print(solve1(nums)) print(solve2(nums))<|fim_prefix|># repo: zed-b/advent-of-code path: /2020/src/day10.py import sys def solve1(nums): diff = dict({1:0,...
code_fim
hard
{ "lang": "python", "repo": "zed-b/advent-of-code", "path": "/2020/src/day10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmbasnett/fake-bpy-module path: /modules/2.78/bpy/types/UserPreferencesView.py class UserPreferencesView: manipulator_handle_size = None manipulator_hotspot = None manipulator_size = None mini_axis_brightness = None mini_axis_size = None object_origin_size = None open_...
code_fim
hard
{ "lang": "python", "repo": "cmbasnett/fake-bpy-module", "path": "/modules/2.78/bpy/types/UserPreferencesView.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cene = None use_mouse_depth_cursor = None use_mouse_depth_navigate = None use_mouse_over_open = None use_quit_dialog = None use_rotate_around_active = None use_zoom_to_mouse = None view2d_grid_spacing_min = None view_frame_keyframes = None view_frame_seconds = None ...
code_fim
hard
{ "lang": "python", "repo": "cmbasnett/fake-bpy-module", "path": "/modules/2.78/bpy/types/UserPreferencesView.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> show_playback_fps = None show_splash = None show_tooltips = None show_tooltips_python = None show_view_name = None smooth_view = None timecode_style = None use_auto_perspective = None use_camera_lock_parent = None use_directional_menus = None use_global_pivot = ...
code_fim
hard
{ "lang": "python", "repo": "cmbasnett/fake-bpy-module", "path": "/modules/2.78/bpy/types/UserPreferencesView.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig, ax = plt.subplots(n_nodes, 1, figsize=(16, 8), sharex=True, sharey=True) plot_point_process(hawkes, n_points=50000, t_min=10, max_jumps=30, ax=ax) fig.tight_layout()<|fim_prefix|># repo: X-DataInitiative/tick path: /doc/modules/code_samples/plot_hawkes_multidim_simu.py """ Simulation of 3-dimensiona...
code_fim
hard
{ "lang": "python", "repo": "X-DataInitiative/tick", "path": "/doc/modules/code_samples/plot_hawkes_multidim_simu.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: X-DataInitiative/tick path: /doc/modules/code_samples/plot_hawkes_multidim_simu.py """ Simulation of 3-dimensional hawkes process ========================================== """ import numpy as np import matplotlib.pyplot as plt from tick.hawkes import SimuHawkesExpKernels from tick.plot import p...
code_fim
medium
{ "lang": "python", "repo": "X-DataInitiative/tick", "path": "/doc/modules/code_samples/plot_hawkes_multidim_simu.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vgg4resnet/arxiv-vanity path: /arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): <|fim_suffix|> count = Render.objects.all().force_expire() ...
code_fim
medium
{ "lang": "python", "repo": "vgg4resnet/arxiv-vanity", "path": "/arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> count = Render.objects.all().force_expire() print(f"Marked {count} renders as expired")<|fim_prefix|># repo: vgg4resnet/arxiv-vanity path: /arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py from django.core.management.base import BaseCommand, CommandError from ...mode...
code_fim
medium
{ "lang": "python", "repo": "vgg4resnet/arxiv-vanity", "path": "/arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def handle(self, *args, **options): count = Render.objects.all().force_expire() print(f"Marked {count} renders as expired")<|fim_prefix|># repo: vgg4resnet/arxiv-vanity path: /arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py from django.core.management.base impor...
code_fim
medium
{ "lang": "python", "repo": "vgg4resnet/arxiv-vanity", "path": "/arxiv_vanity/papers/management/commands/mark_all_renders_as_expired.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: georgepsarakis/regularize path: /tests/test_pattern.py import unittest import re from regularize import Pattern, pattern class TestPattern(unittest.TestCase): def setUp(self): self.pattern = pattern().lowercase_ascii_letters(closed=True) @staticmethod def _to_list(pattern_...
code_fim
medium
{ "lang": "python", "repo": "georgepsarakis/regularize", "path": "/tests/test_pattern.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ascii_alpha_numeric = pattern(). \ lowercase_ascii_letters(). \ uppercase_ascii_letters(). \ any_number() domain_pattern = \ ascii_alpha_numeric.close_bracket() + \ ascii_alpha_numeric.literal('-').quantify(1, 61) # At l...
code_fim
hard
{ "lang": "python", "repo": "georgepsarakis/regularize", "path": "/tests/test_pattern.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> switch = self.addSwitch('s1') plc1 = self.addHost( 'plc1', ip=PLC1_ADDR + NETMASK, mac=PLC1_MAC) self.addLink(plc1, switch) plc2 = self.addHost( 'plc2', ip=PLC2_ADDR + NETMASK, mac=PLC2_MAC) ...
code_fim
medium
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/examples/toy/topo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scy-phy/minicps path: /examples/toy/topo.py """ toy topology """ from mininet.topo import Topo from utils import PLC1_MAC, PLC2_MAC from utils import PLC1_ADDR, PLC2_ADDR, NETMASK class ToyTopo(Topo): def build(self): <|fim_suffix|> plc1 = self.addHost( 'plc1', ...
code_fim
medium
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/examples/toy/topo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plc2 = self.addHost( 'plc2', ip=PLC2_ADDR + NETMASK, mac=PLC2_MAC) self.addLink(plc2, switch)<|fim_prefix|># repo: scy-phy/minicps path: /examples/toy/topo.py """ toy topology """ from mininet.topo import Topo from utils import PLC1_MAC, PLC2_MAC from...
code_fim
hard
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/examples/toy/topo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OutsideContextSolutions/modoboa-radicale path: /modoboa_radicale/templatetags/radicale_tags.py """ Custom template tags. """ from django import template from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.safestring import mark_safe f...
code_fim
hard
{ "lang": "python", "repo": "OutsideContextSolutions/modoboa-radicale", "path": "/modoboa_radicale/templatetags/radicale_tags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Render access rules for a given calendar.""" from django.forms import forms cpt = 1 result = "" while True: fname = "username_%d" % cpt if fname not in form.fields: break rfieldname = "read_access_%d" % cpt wfieldname = "write_access_%d" ...
code_fim
hard
{ "lang": "python", "repo": "OutsideContextSolutions/modoboa-radicale", "path": "/modoboa_radicale/templatetags/radicale_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Menu located inside the left column. :param ``User`` user: current user :rtype: string :return: the menu rendered as HTML code """ entries = [ {"name": "newusercalendar", "label": _("Add calendar"), "img": "fa fa-plus", "modal": True, ...
code_fim
hard
{ "lang": "python", "repo": "OutsideContextSolutions/modoboa-radicale", "path": "/modoboa_radicale/templatetags/radicale_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }