text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def test_XmlDumpRedirect(self): """Test XmlDump correctly parsing whether a page is a redirect.""" get_entries('article-pyrus.xml', allrevisions=True) pages = list(xmlreader.XmlDump( join_xml_data_path('article-pyrus.xml')).parse()) self.assertTrue(pages[0]....
code_fim
hard
{ "lang": "python", "repo": "wikimedia/pywikibot", "path": "/tests/xmlreader_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: czarrar/recipe_rec path: /scripts_v1/22_Save_Proximity_model.py # %% Packages import os os.chdir('/Users/czarrar/Dropbox/Circle/Jerb/recipe_rec/scripts') import recipe_rec import importlib recipe_rec = importlib.reload(recipe_rec) # %% Read in ingredients recipe_file = '../data/30_ingredients+a...
code_fim
hard
{ "lang": "python", "repo": "czarrar/recipe_rec", "path": "/scripts_v1/22_Save_Proximity_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># %% Test Recipes + Try Out a Simple Proximity Model test_recipes = [ 'caramels water chopped pecans Rice Krispies milk chocolate chips shortening', 'peanut butter sugar large egg room temperature vanilla extract milk chocolate kisses', 'semisweet chocolate chips, water, large egg yolk lightly beaten,...
code_fim
hard
{ "lang": "python", "repo": "czarrar/recipe_rec", "path": "/scripts_v1/22_Save_Proximity_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># %% Test loading it back import numpy as np recs2 = recipe_rec.RecipeRec.load_model('z_model.p') np.all(recs.model.features == recs2.model.features) # %% Test Recipes + Try Out a Simple Proximity Model test_recipes = [ 'caramels water chopped pecans Rice Krispies milk chocolate chips shortening', 'pe...
code_fim
medium
{ "lang": "python", "repo": "czarrar/recipe_rec", "path": "/scripts_v1/22_Save_Proximity_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zudi-lin/pytorch_connectomics path: /connectomics/data/dataset/collate.py from __future__ import print_function, division import numpy as np import torch __all__ = [ 'collate_fn_train', 'collate_fn_test'] #################################################################### # Collate Fun...
code_fim
hard
{ "lang": "python", "repo": "zudi-lin/pytorch_connectomics", "path": "/connectomics/data/dataset/collate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # custom memory pinning method on custom type def pin_memory(self): self._pin_batch() return self def _pin_batch(self): self.out_input = self.out_input.pin_memory() for i in range(len(self.out_target_l)): self.out_target_l[i] = self.out_target_l[i]....
code_fim
hard
{ "lang": "python", "repo": "zudi-lin/pytorch_connectomics", "path": "/connectomics/data/dataset/collate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class AuthAPIView(APIView): def dispatch(self, request, *args, **kwargs): # 헤더에 담긴 토큰 값 읽어오기 token = request.META.get('HTTP_AUTHORIZATION', '') # 토큰값 앞에 있는 배리어 체크 if len(token) > 7: data = decode_jwt(token[7:]) try: request.user ...
code_fim
hard
{ "lang": "python", "repo": "KangJuSeong/sellerShop_server", "path": "/shoppingmall_back/utils/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.response(data, message, status) class AuthAPIView(APIView): def dispatch(self, request, *args, **kwargs): # 헤더에 담긴 토큰 값 읽어오기 token = request.META.get('HTTP_AUTHORIZATION', '') # 토큰값 앞에 있는 배리어 체크 if len(token) > 7: data = decode_jwt(toke...
code_fim
hard
{ "lang": "python", "repo": "KangJuSeong/sellerShop_server", "path": "/shoppingmall_back/utils/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KangJuSeong/sellerShop_server path: /shoppingmall_back/utils/views.py from django.http import JsonResponse from django.views import View from django.contrib.auth import get_user_model from utils.functions import decode_jwt <|fim_suffix|>class APIView(View): @classmethod def raw_response...
code_fim
medium
{ "lang": "python", "repo": "KangJuSeong/sellerShop_server", "path": "/shoppingmall_back/utils/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arpit0891/Project-Euler path: /p271.py import eulerlib # First we observe that the modulus 13082761331670030 can be factorized as # 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23 * 29 * 31 * 37 * 41 * 43, # which happens to be the product of the first 14 prime numbers. # # Due to the laws of modular a...
code_fim
medium
{ "lang": "python", "repo": "arpit0891/Project-Euler", "path": "/p271.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Assuming that p and q are coprime, 0 <= a < p, and 0 <= b < q, this returns the unique # integer x in the range [0, p*q) such that x satisfies (x = a mod p) and (x = b mod q). def chinese_remainder_theorem(a, p, b, q): return (a + (b - a) * eulerlib.reciprocal_mod(p % q, q) * p) % (p * q) if __name__...
code_fim
hard
{ "lang": "python", "repo": "arpit0891/Project-Euler", "path": "/p271.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/785A/cdf_785A.py class CodeforcesTask785ASolution: def __init__(self): self.result = '' self.n = 0 self.polyhedrons = [] def read_input(self): self.n = int(input()) for x in range(self.n): sel...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/785A/cdf_785A.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> polyhedrons = { 'Tetrahedron': 4, 'Cube': 6, 'Octahedron': 8, 'Dodecahedron': 12, 'Icosahedron': 20 } faces = 0 for p in self.polyhedrons: faces += polyhedrons[p] self.result = str(faces) d...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/785A/cdf_785A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.n = int(input()) for x in range(self.n): self.polyhedrons.append(input()) def process_task(self): polyhedrons = { 'Tetrahedron': 4, 'Cube': 6, 'Octahedron': 8, 'Dodecahedron': 12, 'Icosahedron': 20 ...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/785A/cdf_785A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Youngfellows/PythonStudy path: /study/day07/03_创建一个迭代器.py """ 创建一个迭代器 把一个类作为一个迭代器使用需要在类中实现两个方法 __iter__() 与 __next__() 。 如果你已经了解的面向对象编程,就知道类都有一个构造函数,Python 的构造函数为 __init__(), 它会在对象初始化的时候执行。 更多内容查阅:Python3 面向对象 __iter__() 方法返回一个特殊的迭代器对象, 这个迭代器对象实现了 __next__() 方法并通过 StopIterati...
code_fim
medium
{ "lang": "python", "repo": "Youngfellows/PythonStudy", "path": "/study/day07/03_创建一个迭代器.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> myclass = MyNumber() # 创建迭代器 my_iter = iter(myclass) # 迭代元素 print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter))<|fim_prefix|># repo: Youngfellows/PythonStudy path: /study/day07/03_创建一个迭代器.py """ 创建一个迭代器 把一个类作为一个迭...
code_fim
hard
{ "lang": "python", "repo": "Youngfellows/PythonStudy", "path": "/study/day07/03_创建一个迭代器.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 迭代元素 print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter)) print(next(my_iter))<|fim_prefix|># repo: Youngfellows/PythonStudy path: /study/day07/03_创建一个迭代器.py """ 创建一个迭代器 把一个类作为一个迭代器使用需要在类中实现两个方法 __iter__() 与 __next__() 。 如果你已经了解的面向对象编...
code_fim
hard
{ "lang": "python", "repo": "Youngfellows/PythonStudy", "path": "/study/day07/03_创建一个迭代器.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name self.sizeByte = sizeByte self.lastUpdateTime = lastUpdateTime self.uploadTime = uploadTime self.publicURL = publicURL self.internalURL = internalURL<|fim_prefix|># repo: jdcloud-api/jdcloud-sdk-python path: /jdcloud_sdk/services/rds/models/...
code_fim
hard
{ "lang": "python", "repo": "jdcloud-api/jdcloud-sdk-python", "path": "/jdcloud_sdk/services/rds/models/ErrorLog.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdcloud-api/jdcloud-sdk-python path: /jdcloud_sdk/services/rds/models/ErrorLog.py # coding=utf8 # Copyright 2018 JDCLOUD.COM # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licen...
code_fim
medium
{ "lang": "python", "repo": "jdcloud-api/jdcloud-sdk-python", "path": "/jdcloud_sdk/services/rds/models/ErrorLog.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gittyeric/room-layout-optimizer path: /optimizer.py room_minus_obstacles = box(0, 0, room_width, room_height) for obstacle in obstacles: room_minus_obstacles = room_minus_obstacles.difference(obstacle.shape) now2 = int(round(time.time() * 1000)) for i in range(point_len...
code_fim
hard
{ "lang": "python", "repo": "gittyeric/room-layout-optimizer", "path": "/optimizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cost = 0 # Add an unreasonable extra cost for physically overlapping obstacle placements for i in range(len(input_shapes)): for j in range(i + 1, len(all_shapes)): shape_i = all_shapes[i] shape_j = all_shapes[j] intersecti...
code_fim
hard
{ "lang": "python", "repo": "gittyeric/room-layout-optimizer", "path": "/optimizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gittyeric/room-layout-optimizer path: /optimizer.py mizer(): def __init__(self, room_width, room_height, max_fatness_width, obstacles, trips, fixed_obstacles=[], preview_dim...
code_fim
hard
{ "lang": "python", "repo": "gittyeric/room-layout-optimizer", "path": "/optimizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> res = {} res['provinces'] = fetch_province(response) res.update(fetch_global(response)) timestamp, content = fetch_timeline(response) timeline = { 'timestamp': timestamp, 'content': content } return res, timeline def fetch_html(): '...
code_fim
medium
{ "lang": "python", "repo": "CS-UIT-AI-CLUB/covid-stat", "path": "/src/utils/fetch_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def fetch_html(): ''' Fetch latest HTML content from Bo Y Te. ''' # Send a request to Bo Y Te response = requests.get('https://ncov.moh.gov.vn/', verify=False).content.decode() return response<|fim_prefix|># repo: CS-UIT-AI-CLUB/covid-stat path: /src/utils/fetch_data.p...
code_fim
hard
{ "lang": "python", "repo": "CS-UIT-AI-CLUB/covid-stat", "path": "/src/utils/fetch_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CS-UIT-AI-CLUB/covid-stat path: /src/utils/fetch_data.py import requests from .fetch_province import fetch_province from .fetch_global import fetch_global from .fetch_timeline import fetch_timeline def fetch_data(): <|fim_suffix|> def fetch_html(): ''' Fetch latest HTML content ...
code_fim
hard
{ "lang": "python", "repo": "CS-UIT-AI-CLUB/covid-stat", "path": "/src/utils/fetch_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># (maybe next section can be moved to script that imports the data) # for det, runs in general.detruns.iteritems(): # for run in runs: # p = 'globals/data/' + det + '/' + run # try: # os.makedirs(p) # except OSError: # print 'Error: "%(p)s" already exists' ...
code_fim
medium
{ "lang": "python", "repo": "maxisi/polHTC", "path": "/scripts/makestruct.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxisi/polHTC path: /scripts/makestruct.py #! /usr/bin/env python ''' Creates basic file structure for polarization analysis (if not already existent). ''' <|fim_suffix|># for det, runs in general.detruns.iteritems(): # for run in runs: # p = 'globals/data/' + det + '/' + run # ...
code_fim
hard
{ "lang": "python", "repo": "maxisi/polHTC", "path": "/scripts/makestruct.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># for det, runs in general.detruns.iteritems(): # for run in runs: # p = 'globals/data/' + det + '/' + run # try: # os.makedirs(p) # except OSError: # print 'Error: "%(p)s" already exists' % locals()<|fim_prefix|># repo: maxisi/polHTC path: /scripts/makestr...
code_fim
hard
{ "lang": "python", "repo": "maxisi/polHTC", "path": "/scripts/makestruct.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> attr = '%s:scheduler_hints' % Scheduler_hints.alias scheduler_hints_body = dict.fromkeys((attr,), body.get(attr)) hints = self._extract_scheduler_hints(req, body=scheduler_hints_body) if 'volume' in body: body['volume']['scheduler_hints'] = hints yield ...
code_fim
medium
{ "lang": "python", "repo": "shangdehao1/cinder", "path": "/cinder/api/contrib/scheduler_hints.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class SchedulerHintsController(wsgi.Controller): @validation.schema(scheduler_hints.create) def _extract_scheduler_hints(self, req, body): hints = {} attr = '%s:scheduler_hints' % Scheduler_hints.alias if body.get(attr) is not None: hints.update(body.get(attr))...
code_fim
medium
{ "lang": "python", "repo": "shangdehao1/cinder", "path": "/cinder/api/contrib/scheduler_hints.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shangdehao1/cinder path: /cinder/api/contrib/scheduler_hints.py # Copyright 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "shangdehao1/cinder", "path": "/cinder/api/contrib/scheduler_hints.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for r in reader: if callable(ffunc) and ffunc(r): continue writer.write(r) reader.close() writer.close()<|fim_prefix|># repo: LeaveYeah/bioprocs path: /bioprocs/scripts/tfbs/pMotifFilter.py from bioprocs.utils.meme import MemeReader, MemeWriter infile = {{ i.infile | quote}} outfile = {{ o.outfile ...
code_fim
medium
{ "lang": "python", "repo": "LeaveYeah/bioprocs", "path": "/bioprocs/scripts/tfbs/pMotifFilter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeaveYeah/bioprocs path: /bioprocs/scripts/tfbs/pMotifFilter.py from bioprocs.utils.meme import MemeReader, MemeWriter infile = {{ i.infile | quote}} outfile = {{ o.outfile | quote}} # if filter has multiple lines, treat the first lines as helper and last line as the funciton # now load the fir...
code_fim
medium
{ "lang": "python", "repo": "LeaveYeah/bioprocs", "path": "/bioprocs/scripts/tfbs/pMotifFilter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathieui/torrent_free path: /torrent_free.py #!/usr/bin/env python3 """ Usage: ./torrent_free.py [-h] [-f] source destination This script converts a torrent bound to a private tracker to a public torrent with eventual trackers and webseeds associated. Since the private flag has been removed, to...
code_fim
hard
{ "lang": "python", "repo": "mathieui/torrent_free", "path": "/torrent_free.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>def main(results): """ Main function, takes the results from argparse. """ torrent = lt.bdecode(results.source.read()) results.source.close() if not torrent: print('The source file does not seem to be a proper torrent file.') results.destination.close() exi...
code_fim
hard
{ "lang": "python", "repo": "mathieui/torrent_free", "path": "/torrent_free.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> """ Write the modified torrent to the disk. """ try: fd.write(lt.bencode(torrent)) fd.close() except IOError: return False return True def main(results): """ Main function, takes the results from argparse. """ torrent = lt.bdecode(results.so...
code_fim
hard
{ "lang": "python", "repo": "mathieui/torrent_free", "path": "/torrent_free.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathan-a-macleod/TWS-TerminalWindowingSystem path: /src/Programs/TWS-BackgroundChanger/main.py from CoreLib.Windows.windowClass import * # Import the library like this global SetThemeColors from CoreLib.setcolor import SetThemeColors # Import other libraries like this: global datetime import d...
code_fim
hard
{ "lang": "python", "repo": "nathan-a-macleod/TWS-TerminalWindowingSystem", "path": "/src/Programs/TWS-BackgroundChanger/main.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Add a message at the top of the config file lines[0] = "This File Is Automatically Generated By TWS-Settings, Do Not Edit This File!\n" # Write the changes to the file (only what is different) with open("config.cfg", "w") as f: f.writelines(lines) ...
code_fim
hard
{ "lang": "python", "repo": "nathan-a-macleod/TWS-TerminalWindowingSystem", "path": "/src/Programs/TWS-BackgroundChanger/main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': arduino = serial.Serial(port='COM4', baudrate=9600, timeout=1) run_on_video(0, '', conf_thresh=0.5, do_detect=send_message_arduino, do_running=print_message_arduino) arduino.close()<|fim_prefix|># repo: martinsam16/FaceMaskDetection path: /app.py from pytorch_infer...
code_fim
medium
{ "lang": "python", "repo": "martinsam16/FaceMaskDetection", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(arduino.readlines()) if __name__ == '__main__': arduino = serial.Serial(port='COM4', baudrate=9600, timeout=1) run_on_video(0, '', conf_thresh=0.5, do_detect=send_message_arduino, do_running=print_message_arduino) arduino.close()<|fim_prefix|># repo: martinsam16/FaceMaskDetection ...
code_fim
easy
{ "lang": "python", "repo": "martinsam16/FaceMaskDetection", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: martinsam16/FaceMaskDetection path: /app.py from pytorch_infer import run_on_video import serial def send_message_arduino(): <|fim_suffix|>def print_message_arduino(): print(arduino.readlines()) if __name__ == '__main__': arduino = serial.Serial(port='COM4', baudrate=9600, timeout=1) ...
code_fim
easy
{ "lang": "python", "repo": "martinsam16/FaceMaskDetection", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkf/compapp path: /src/compapp/plugins/timing.py import time try: import resource except ImportError: resource = None from ..interface import Plugin from ..descriptors import Link def _getrusage_self(): """ See: getrusage(2) """ rusage = resource.getrusage(resource.RUSA...
code_fim
medium
{ "lang": "python", "repo": "tkf/compapp", "path": "/src/compapp/plugins/timing.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> meta = Link('..meta') def pre_run(self): self.timing = {} self.timing['pre'] = gettimings() def post_run(self): self.timing['post'] = gettimings() self.meta.record('timing', self.timing)<|fim_prefix|># repo: tkf/compapp path: /src/compapp/plugins/timing.py im...
code_fim
hard
{ "lang": "python", "repo": "tkf/compapp", "path": "/src/compapp/plugins/timing.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: njlxyaoxinwei/esper path: /app/esper/commercial_detect.py import esper.rekall from rekall.interval_list import IntervalList from rekall.temporal_predicates import not_pred, overlaps, or_pred, equal, before, after """ All thresholds """ TRANSCRIPT_DELAY = 6 MIN_TRANSCRIPT = 0.3 MIN_BLACKFRAME =...
code_fim
hard
{ "lang": "python", "repo": "njlxyaoxinwei/esper", "path": "/app/esper/commercial_detect.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # get blank intervals blank_intervals = whole_video.minus(IntervalList([ (start_sec, end_sec - TRANSCRIPT_DELAY, 0) for text, start_sec, end_sec in transcript ])).coalesce().filter_length( min_length=MIN_BLANKWINDOW, max_length=MAX_BLANKWINDOW) # add in blank i...
code_fim
hard
{ "lang": "python", "repo": "njlxyaoxinwei/esper", "path": "/app/esper/commercial_detect.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuheng2cqupt/FATE path: /federatedml/ftl/test/whitebox_autoencoder_test.py # # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
code_fim
hard
{ "lang": "python", "repo": "liuheng2cqupt/FATE", "path": "/federatedml/ftl/test/whitebox_autoencoder_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tf.reset_default_graph() autoencoder.restore_model(model_parameters) init_op = tf.global_variables_initializer() with tf.Session() as session: autoencoder.set_session(session) session.run(init_op) Wh = autoencoder.Wh.eval() W...
code_fim
hard
{ "lang": "python", "repo": "liuheng2cqupt/FATE", "path": "/federatedml/ftl/test/whitebox_autoencoder_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jordimart/findmenu-ng-django path: /src/backend/backend/restaurants/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-05-06 16:33 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> initial = True depend...
code_fim
hard
{ "lang": "python", "repo": "jordimart/findmenu-ng-django", "path": "/src/backend/backend/restaurants/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: peterthorpe5/public_scripts path: /ITS_copy_number/convert_busco_coodinates_to_GFF.py #!/usr/bin/env python #author: Peter Thorpe September 2016. The James Hutton Insitute,Dundee,UK. #Title: #script to convert the BUSCO coordinates to GFF for bedtools #imports import os import sys from sys impo...
code_fim
hard
{ "lang": "python", "repo": "peterthorpe5/public_scripts", "path": "/ITS_copy_number/convert_busco_coodinates_to_GFF.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>parser.add_option("-o", "--out_file", dest="out_file", default="ITS_GFF.out", help="outfile for the busco regions in GFF format") (options, args) = parser.parse_args() busco = options.busco prefix = options.prefix out_file = options.out_file #run the program if ...
code_fim
hard
{ "lang": "python", "repo": "peterthorpe5/public_scripts", "path": "/ITS_copy_number/convert_busco_coodinates_to_GFF.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: appetito/pika path: /tests/unit/channel_tests.py ies = spec.BasicProperties(content_type='text/plain') mandatory = False immediate = True self.obj.basic_publish(exchange, routing_key, body, properties, mandatory, immediate) logger.war...
code_fim
hard
{ "lang": "python", "repo": "appetito/pika", "path": "/tests/unit/channel_tests.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_confirm_delivery_callback_without_nowait_selectok(self): self.obj._set_state(self.obj.OPEN) expectation = [self.obj.channel_number, spec.Confirm.SelectOk, self.obj._on_selectok] self.obj.confirm_delivery(logging.debug) self.obj.callbacks....
code_fim
hard
{ "lang": "python", "repo": "appetito/pika", "path": "/tests/unit/channel_tests.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: appetito/pika path: /tests/unit/channel_tests.py e(mock_callback, 'foo', nowait=True) rpc.assert_called_once_with(spec.Queue.Delete(0, 'foo'), mock_callback, []) def test_queue_purge_raises_channel_closed(self): self.assertRaises(exceptions...
code_fim
hard
{ "lang": "python", "repo": "appetito/pika", "path": "/tests/unit/channel_tests.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: uktrade/lite-exporter-frontend path: /ui_automation_tests/fixtures/manage_case.py from http import HTTPStatus from pytest import fixture <|fim_suffix|> @fixture(scope="function") def approve_case(api_test_client, context): status = api_test_client.cases.finalise_case(context.app_id, "approv...
code_fim
hard
{ "lang": "python", "repo": "uktrade/lite-exporter-frontend", "path": "/ui_automation_tests/fixtures/manage_case.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> status = api_test_client.cases.finalise_case(context.app_id, "approve") assert status == HTTPStatus.OK, "Case cannot be finalised"<|fim_prefix|># repo: uktrade/lite-exporter-frontend path: /ui_automation_tests/fixtures/manage_case.py from http import HTTPStatus from pytest import fixture <|fim_...
code_fim
hard
{ "lang": "python", "repo": "uktrade/lite-exporter-frontend", "path": "/ui_automation_tests/fixtures/manage_case.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobpropertie...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> statusOn = True allowedTypes = ['bool'] StoredValue = True cutEtMin = 100.0*Units.GeV cutEtaMax = 2.5 nPassed = 2 Triggers = ["HLT_j110"] primRPVLLDESDM.add_JobProperty(Emerging_DiJet110FilterFlags) class Emerging_DiJet175FilterFlags(JobProperty): stat...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> statusOn = True jetCollectionName = "AntiKt4EMTopoJets" hltJetCollectionName = "HLT_xAOD__JetContainer_a4tcemsubjesFS" pass primRPVLLDESDM.add_JobProperty(Emerging_containerFlags) # ----- PRESCALED DI-JET TRIGGER TEST ----- # class Emerging_DiJet110FilterFlags(JobProperty): ...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/EmergingFlags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kcyu2014/nas-landmarkreg path: /nasws/cnn/policy/darts_policy/darts_search_policy.py arts_train_model from . import utils_for_nasbench as darts_nasbench_utils from . import utils as darts_utils from .model_search import Network as DARTSWSNetwork from .architect import Architect Rank = namedtupl...
code_fim
hard
{ "lang": "python", "repo": "kcyu2014/nas-landmarkreg", "path": "/nasws/cnn/policy/darts_policy/darts_search_policy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kcyu2014/nas-landmarkreg path: /nasws/cnn/policy/darts_policy/darts_search_policy.py import utils as project_utils import torchvision.datasets as dset from collections import namedtuple, deque from torch.utils.tensorboard import SummaryWriter from nasws.cnn.policy.cnn_general_search_policies im...
code_fim
hard
{ "lang": "python", "repo": "kcyu2014/nas-landmarkreg", "path": "/nasws/cnn/policy/darts_policy/darts_search_policy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.args.search_space == 'nasbench': # matrix, ops = darts_nasbench_utils.parse_arch_to_model_spec_matrix_op(arch, self.args.child_num_cells) # model_spec = ModelSpec_v2(matrix, ops) # return model_spec return self.nasbench_model_specs[arch] ...
code_fim
hard
{ "lang": "python", "repo": "kcyu2014/nas-landmarkreg", "path": "/nasws/cnn/policy/darts_policy/darts_search_policy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertFalse(evaluate('not 10 > 5')) self.assertTrue(evaluate('not 5 > 10')) class VariablesTestCase(TestCase): def test_calculating_with_variables(self): self.assertEqual(evaluate('a + b', a=2, b=3), 5) def test_comparisons_with_variable(self): self.assertTr...
code_fim
hard
{ "lang": "python", "repo": "despawnerer/computer", "path": "/tests/test_evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class BooleanTestCase(TestCase): def test_and(self): self.assertTrue(evaluate('10 > 5 and 10 > 6')) self.assertFalse(evaluate('10 < 5 and 10 > 6')) self.assertFalse(evaluate('10 > 5 and 10 < 6')) self.assertFalse(evaluate('10 < 5 and 10 < 6')) def test_or(self): ...
code_fim
hard
{ "lang": "python", "repo": "despawnerer/computer", "path": "/tests/test_evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: despawnerer/computer path: /tests/test_evaluation.py from unittest import TestCase from computer import ( evaluate, BadExpression, UndefinedVariable, UnsupportedOperation, ) class BasicMathTestCase(TestCase): def test_addition(self): self.assertEqual(evaluate('2 + 2...
code_fim
hard
{ "lang": "python", "repo": "despawnerer/computer", "path": "/tests/test_evaluation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HuyaneMatsu/hata path: /hata/discord/application/application/tests/test__put_owner_into.py import vampytest from ....user import User, ZEROUSER from ...team import Team from ..fields import put_owner_into def test__put_owner_into(): <|fim_suffix|> for input_value, defaults, expected_outpu...
code_fim
medium
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/application/application/tests/test__put_owner_into.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> """ Tests whether ``put_owner_into`` works as intended. """ user = User.precreate(202211270016) team = Team.precreate(202211270017) for input_value, defaults, expected_output in ( (ZEROUSER, False, {}), (ZEROUSER, True, {'owner': None, 'team': None}), (...
code_fim
medium
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/application/application/tests/test__put_owner_into.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def test__marcher_3d__speed_func_orientation(self): h = 1 diam = 2 ni, nj, nk = (2, 3, 4) nx, ny, nz = (nj, ni, nk) ix, ij, iz = (1, 0, 2) xdiam, ydiam, zdiam = ((nx - 1)/diam, (ny - 1)/diam, (nz - 1)/diam) lx = np.linspace(-xdiam, xdiam, nx) ...
code_fim
hard
{ "lang": "python", "repo": "sampotter/olim", "path": "/test/pyolim.test", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sampotter/olim path: /test/pyolim.test #!/usr/bin/env python3 import sys sys.path.insert(0, '@CMAKE_CURRENT_SOURCE_DIR@/misc/py') import pyolim as olim import numpy as np import speedfuncs3d as sf3d import unittest from itertools import product as prod <|fim_suffix|> ni, nj, nk = (2, 3...
code_fim
hard
{ "lang": "python", "repo": "sampotter/olim", "path": "/test/pyolim.test", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@sio.on('get_public_keys') def on_get_public_keys(data): global x sio.emit('receive_public_key',x) #once notified by the server, send own public key to server for distributing across all clients #servers notification on round complete @sio.on('clear_round') def on_clear_round(data): #resetting all var...
code_fim
hard
{ "lang": "python", "repo": "pia-nyk/CRA.FL", "path": "/client/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pia-nyk/CRA.FL path: /client/client.py import socketio import json import pyDHE import time from pymemcache.client import base #import logging as log from secure_aggregation import SecureAggregation from flclienthelper import FLClientHelper from keras import backend as K from keras.models import ...
code_fim
hard
{ "lang": "python", "repo": "pia-nyk/CRA.FL", "path": "/client/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # SET ROI print("FPS", fps, " Width: ", fw, " Height: ", fh) if newfw != fw: print('Reducing the dimensions to {}x{}'.format(newfw, newfh)) # INIT platereader pe = PlateExtractor() # OPTIONS numFrames = 60 # every x frame show info processPerNFrames = 2 # ever...
code_fim
hard
{ "lang": "python", "repo": "alpdeniz/plateExtractor", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alpdeniz/plateExtractor path: /main.py #!/usr/bin/python3 from Levenshtein import distance import sys from time import time import cv2, imutils from classes.plate import PlateExtractor, plateUtils allPlates = {} candidatePlates = {} # meh def mergeFrameReadings(plateArray): for newPlate in ...
code_fim
hard
{ "lang": "python", "repo": "alpdeniz/plateExtractor", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # READ FRAMES counter = 0 skippedFrameCounter = 0 previousFrame = None start = time() while True: try: ret, frame = cap.read() if not ret: raise Exception("No data") if newfw != fw: frame = imutils.resize(f...
code_fim
hard
{ "lang": "python", "repo": "alpdeniz/plateExtractor", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameter.NUMBER_EVENTS : int, Parameter.MAX_STACK : int, Parameter.POWER_ON_RESET : int, Parameter.POWER_FAIL_RESET : int, Parameter.SERIAL_BYTE_ERROR : int, Parameter.COMMAND_BUFFER_OVERFLOW : int, Parameter.SERIAL_RECEIVE_OVERFLOW : int, Parameter.LOW_BATTERY : int, ...
code_fim
hard
{ "lang": "python", "repo": "oceanobservatories/mi-instrument", "path": "/mi/instrument/seabird/sbe54tps/test/params.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: oceanobservatories/mi-instrument path: /mi/instrument/seabird/sbe54tps/test/params.py from mi.instrument.seabird.sbe54tps.driver import Parameter PARAMS = { # # Common fields in all commands # Parameter.DEVICE_TYPE : str, Parameter.SERIAL_NUMBER : str, # # StatusDat...
code_fim
hard
{ "lang": "python", "repo": "oceanobservatories/mi-instrument", "path": "/mi/instrument/seabird/sbe54tps/test/params.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Deferred(object): """Deferred result object Not thread-safe. """ def __init__(self, broker, task): self.broker = broker self.task = task self._status = None @property def id(self): return self.task.id @property def name(self): ...
code_fim
hard
{ "lang": "python", "repo": "millerdev/WorQ", "path": "/worq/task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): status = self.status if status is None: status = 'incomplete' args = (self.name, self.broker.name, self.id, status) return '<Deferred %s [%s:%s] %s>' % args class TaskSpace(object): """Task namespace container""" def __init__(s...
code_fim
hard
{ "lang": "python", "repo": "millerdev/WorQ", "path": "/worq/task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: millerdev/WorQ path: /worq/task.py # WorQ - Python task queue # # Copyright (c) 2012 Daniel Miller # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction...
code_fim
hard
{ "lang": "python", "repo": "millerdev/WorQ", "path": "/worq/task.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhruvramani/transition path: /rl/test_env.py import numpy as np import sys sys.path.insert(0, '../gym') # Environment sys.path.insert(0, '../') # Baselines import gym env_names = [ # Jaco primitive skills 'JacoCatch-v1', 'JacoPick-v1', 'JacoToss-v1', 'JacoHit-v1', # Jaco complex ta...
code_fim
medium
{ "lang": "python", "repo": "dhruvramani/transition", "path": "/rl/test_env.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>timesteps = 10 for env_name in env_names: env = gym.make(env_name) print(env_name, env.observation_space, env.action_space) env.reset() for _ in range(timesteps): ob, reward, done, info = env.step(env.action_space.sample()) print(reward) if done: env.re...
code_fim
hard
{ "lang": "python", "repo": "dhruvramani/transition", "path": "/rl/test_env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaraco/calendra path: /calendra/europe/bulgaria.py from copy import copy from datetime import timedelta, date from ..core import OrthodoxCalendar, SAT, SUN from ..registry_tools import iso_register @iso_register('BG') class Bulgaria(OrthodoxCalendar): 'Bulgaria' FIXED_HOLIDAYS = Ortho...
code_fim
hard
{ "lang": "python", "repo": "jaraco/calendra", "path": "/calendra/europe/bulgaria.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_shifted_holidays(self, days): for holiday, label in days: if holiday.weekday() == SUN: yield ( holiday + timedelta(days=1), f'{label} shift' ) elif holiday.weekday() == SAT: ...
code_fim
medium
{ "lang": "python", "repo": "jaraco/calendra", "path": "/calendra/europe/bulgaria.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for holiday, label in days: if holiday.weekday() == SUN: yield ( holiday + timedelta(days=1), f'{label} shift' ) elif holiday.weekday() == SAT: yield ( holiday + time...
code_fim
hard
{ "lang": "python", "repo": "jaraco/calendra", "path": "/calendra/europe/bulgaria.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lincis/observer path: /dht22.py #import adafruit_dht #import board import Adafruit_DHT as dht from Observer.Observer import Observer from prometheus_client import Gauge class ObserverDH22(Observer): <|fim_suffix|># temperature = self.dhtDevice.temperature # humidity = self.dhtDevic...
code_fim
hard
{ "lang": "python", "repo": "lincis/observer", "path": "/dht22.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def observe(self): # temperature = self.dhtDevice.temperature # humidity = self.dhtDevice.humidity humidity, temperature = dht.read_retry(dht.DHT22, 18) self.logger.info('Temp=%.1f*C Humidity=%.1f' % (temperature, humidity)) return { 'dht22_temperatur...
code_fim
hard
{ "lang": "python", "repo": "lincis/observer", "path": "/dht22.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amwelch/a10sdk-python path: /a10sdk/core/router/router_log_file.py from a10sdk.common.A10BaseClass import A10BaseClass class File(A10BaseClass): """Class Description:: Logging to file. Class file supports CRUD Operations and inherits from `common/A10BaseClass`. This class ...
code_fim
hard
{ "lang": "python", "repo": "amwelch/a10sdk-python", "path": "/a10sdk/core/router/router_log_file.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ln-nicolas/easybackup path: /src/easybackup/adapters/__init__.py from .docker_container_directory import DockerContainerDirectory from .docker_container_sql import DockerContainerSql from .ftp<|fim_suffix|> import LocalBackupCreator, LocalRepositoryAdapter, LocalToLocal<|fim_middle|> import FtpRe...
code_fim
medium
{ "lang": "python", "repo": "ln-nicolas/easybackup", "path": "/src/easybackup/adapters/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import FtpRepositoryAdapter, LocalToFtp, FtpToLocal from .local import LocalBackupCreator, LocalRepositoryAdapter, LocalToLocal<|fim_prefix|># repo: ln-nicolas/easybackup path: /src/easybackup/adapters/__init__.py from .docker_container_directory import DockerContainerDirector<|fim_middle|>y from .docke...
code_fim
medium
{ "lang": "python", "repo": "ln-nicolas/easybackup", "path": "/src/easybackup/adapters/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FIT4003-GADV/prototype path: /dev_server.py """ Spins up a Flask HTTP server to serve requests for alt-text generation (for development purposes). """ from absl import app from flask import Flask from flask import jsonify from flask import request from base_workflow import BaseWorkflow PORT = 5...
code_fim
hard
{ "lang": "python", "repo": "FIT4003-GADV/prototype", "path": "/dev_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(argv): del argv flask_app.run(debug=True, port=PORT) if __name__ == '__main__': app.run(main)<|fim_prefix|># repo: FIT4003-GADV/prototype path: /dev_server.py """ Spins up a Flask HTTP server to serve requests for alt-text generation (for development purposes). """ from absl impo...
code_fim
hard
{ "lang": "python", "repo": "FIT4003-GADV/prototype", "path": "/dev_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: slohmes/sp16-wit-python-workshops path: /session1.py # Sarah Lohmeier, 2/22/16 # SESSION 1: Programming Basics # In this workshop, we'll set up Cloud9 and write our first script in Python. # Topics: executing scripts, intro to programming, comments, data types, logging, variables, functions, loo...
code_fim
hard
{ "lang": "python", "repo": "slohmes/sp16-wit-python-workshops", "path": "/session1.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> i = 0 while i < x: print i i = i + 1 #printDigits(3) # range(x) is the same as an array of the first ten digits: [0,1,2,3,4,5,6,7,8,9] result = [] for x in range(10): result.append(x) #print result # if we want the computer to only do something under certain conditions, ...
code_fim
hard
{ "lang": "python", "repo": "slohmes/sp16-wit-python-workshops", "path": "/session1.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: madberry/x84 path: /games/sots/start.py # sword of the samurai bbs door clone import db deps = ['bbs', 'games/sots/data_province', 'games/sots/data_text', 'games/sots/gamedb', 'games/sots/events'] import random debugKill=0 <|fim_suffix|> if callEvent == Event.newSamurai and not ret...
code_fim
hard
{ "lang": "python", "repo": "madberry/x84", "path": "/games/sots/start.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if callEvent == Event.newSamurai and not retvalue: # failed to create a new samurai return retvalue elif callEvent == Event.quit: # user quit return retvalue return<|fim_prefix|># repo: madberry/x84 path: /games/sots/start.py # sword of the samurai bbs door clone impor...
code_fim
medium
{ "lang": "python", "repo": "madberry/x84", "path": "/games/sots/start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> retvalue = callEvent(eventHandler, *args) if callEvent == Event.newSamurai and not retvalue: # failed to create a new samurai return retvalue elif callEvent == Event.quit: # user quit return retvalue return<|fim_prefix|># repo: madberry/x84 path: /games/sots/start....
code_fim
hard
{ "lang": "python", "repo": "madberry/x84", "path": "/games/sots/start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThomasSweijen/pygef path: /pygef/tests.py import unittest import pygef.utils as utils from datetime import datetime from pygef.gef import MAP_QUANTITY_NUMBER_COLUMN_NAME_CPT from pygef.gef import ParseCPT as gef from pygef.gef import ParseBORE as bore import pandas as pd from pandas.util.testing ...
code_fim
hard
{ "lang": "python", "repo": "ThomasSweijen/pygef", "path": "/pygef/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s = "'Kz1s1'" v = utils.soil_quantification(s) self.assertEqual(v, [0, 0.05, 0.9, 0, 0, 0.05]) def test_parse_data_soil_code(self): df = pd.DataFrame({'Soil_code': ['Kz', 'Kz1', 'Kz2']}) data_s = [["'Kz'", "''"], ["'Kz1'", "''"], ["'Kz2'", "''"]] df_par...
code_fim
hard
{ "lang": "python", "repo": "ThomasSweijen/pygef", "path": "/pygef/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spring-2018-csc-226/t04 path: /t04_refactored.py iscover a staircase going up the mountain.") print("Your curiosity overcomes you, and you decide to climb up the staircase.") sleep(delay) dead = False elif direction == "Right": # So sad to die so close to the g...
code_fim
hard
{ "lang": "python", "repo": "spring-2018-csc-226/t04", "path": "/t04_refactored.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main_9(): # Our main function for our chapter to help us organize. print("") print("You see a chair to you left, 'odd place for a chair,' you think.") sleep(delay*2) print("") print("To your right you see a Berea College official hat signed by President Lyle...
code_fim
hard
{ "lang": "python", "repo": "spring-2018-csc-226/t04", "path": "/t04_refactored.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: # Neutral Choice print() print("You start to get bored and hungry while running around aimlessly in the dark") sleep(delay) print() print("After searching for a few hours with no luck, you decide to make your way towards the exit and go home for th...
code_fim
hard
{ "lang": "python", "repo": "spring-2018-csc-226/t04", "path": "/t04_refactored.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }