text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: HeadReaper-hc/registration_tutorial path: /src/thorax/affine/niftireg/tools/fix_boundary_artifact_mri_convert.py import nibabel as nib import argparse import pdb, traceback, sys def main(): try: parser = argparse.ArgumentParser(description='Fix the boundary issue of mri_roi resamplin...
code_fim
hard
{ "lang": "python", "repo": "HeadReaper-hc/registration_tutorial", "path": "/src/thorax/affine/niftireg/tools/fix_boundary_artifact_mri_convert.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> img_art_data[ 0, :, :] = args.pad_val img_art_data[-1, :, :] = args.pad_val img_art_data[ :, 0, :] = args.pad_val img_art_data[ :, -1, :] = args.pad_val img_art_data[ :, :, 0] = args.pad_val img_art_data[ :, :, -1] = args.pad_val print(f'O...
code_fim
medium
{ "lang": "python", "repo": "HeadReaper-hc/registration_tutorial", "path": "/src/thorax/affine/niftireg/tools/fix_boundary_artifact_mri_convert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /Others/indeeednow/indeednow-qualb/a.py # -*- coding: utf-8 -*- <|fim_suffix|> if __name__ == '__main__': main()<|fim_middle|> def main(): x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) print(abs(x2 - x1) + abs(y2 - y1) + 1)
code_fim
medium
{ "lang": "python", "repo": "KATO-Hiro/AtCoder", "path": "/Others/indeeednow/indeednow-qualb/a.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) print(abs(x2 - x1) + abs(y2 - y1) + 1) if __name__ == '__main__': main()<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /Others/indeeednow/indeednow-qualb/a.py # -*- coding: utf-8 -*- <|fim_middle|>def main():
code_fim
easy
{ "lang": "python", "repo": "KATO-Hiro/AtCoder", "path": "/Others/indeeednow/indeednow-qualb/a.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def head(self, *args, **kwargs): return self._request("head", *args, **kwargs) def options(self, *args, **kwargs): return self._request("options", *args, **kwargs) def patch(self, *args, **kwargs): return self._request("patch", *args, **kwargs) def post(self, *ar...
code_fim
hard
{ "lang": "python", "repo": "filfreire/questions-three", "path": "/questions_three/http_client/http_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: filfreire/questions-three path: /questions_three/http_client/http_client.py import requests from uuid import uuid4 from twin_sister import dependency from questions_three.constants import TestEvent from questions_three.event_broker import EventBroker, subscribe_event_handlers from questions_thr...
code_fim
hard
{ "lang": "python", "repo": "filfreire/questions-three", "path": "/questions_three/http_client/http_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tillt/Soundcloud-Artwork-Extractor path: /extract.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Soundcloud Cover Artwork URL Extractor. """ from html.parser import HTMLParser import sys import urllib.request <|fim_suffix|> if len(sys.argv) != 2: print('Usage: {} URL'.format(sys.a...
code_fim
hard
{ "lang": "python", "repo": "tillt/Soundcloud-Artwork-Extractor", "path": "/extract.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if prop == 'og:image' and 'content' in attr: content = attr['content'] self.image = content if len(sys.argv) != 2: print('Usage: {} URL'.format(sys.argv[0])) exit(1) url = sys.argv[1] request = urllib.request.Request(url) with urllib.request.urlopen(...
code_fim
hard
{ "lang": "python", "repo": "tillt/Soundcloud-Artwork-Extractor", "path": "/extract.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>p = figure(plot_width=400, plot_height=400, tools=[box_select], title="Select Below", x_range=Range1d(start=0.0, end=1.0), y_range=Range1d(start=0.0, end=1.0)) rect = Rect(x='x', y='y', width='width', height='heigh...
code_fim
medium
{ "lang": "python", "repo": "enterstudio/bokeh", "path": "/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_tools.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: enterstudio/bokeh path: /sphinx/source/docs/user_guide/examples/interaction_callbacks_for_tools.py from bokeh.models import CustomJS, ColumnDataSource, BoxSelectTool, Range1d, Rect from bokeh.plotting import figure, output_file, show output_file("boxselecttool_callback.html") source = ColumnDat...
code_fim
hard
{ "lang": "python", "repo": "enterstudio/bokeh", "path": "/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_tools.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: meqash/sito path: /bin/noise/noise_migration_s.py #!/usr/bin/env python # by TR from obspy.core import UTCDateTime as UTC from sito.noisexcorr import setHIDist from sito.noise_migration import migrate, migrate2, migrate3 from sito.util.imaging import xcorr_cmap from obspy.signal.util import utlGe...
code_fim
hard
{ "lang": "python", "repo": "meqash/sito", "path": "/bin/noise/noise_migration_s.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># data = np.load('/home/richter/Results/IPOC/xcorr/1bit/migration/data_some_stations_method3_5Hz_1500x1500_interference.npy') # from mpl_toolkits.basemap import Basemap # for key in ipoc: # try: # data = np.load('/home/richter/Results/IPOC/xcorr/1bit/migration/data_station_%s_2...
code_fim
hard
{ "lang": "python", "repo": "meqash/sito", "path": "/bin/noise/noise_migration_s.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ekraka/EDHB path: /scripts/module.py import os import sys import subprocess def pdb_xyz(file): f=open(file,'r') list1=f.readlines() f.close() d={} id=0 for line in list1: if len(line.strip().split())==0: continue if "TER" in line.split()[0]: ...
code_fim
hard
{ "lang": "python", "repo": "ekraka/EDHB", "path": "/scripts/module.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> inp_d = get_inp() if os.system(inp_d['babel_path']+' '+path+' '+path.split('.')[0]+'.xyz')==0: return 0 sym={'15':'P','14':'Si','1':'H','7':'N','8':'O','6':'C','53':'I','36':'Kr','9':'F','16':'S'} if path.split('.')[-1]=='fchk': make_fchk(path,sym) filter_xyz(path,5...
code_fim
hard
{ "lang": "python", "repo": "ekraka/EDHB", "path": "/scripts/module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('account', '0005_auto_20210203_1123'), ] operations = [ migrations.AddField( model_name='account', name='avatar_url', field=models.TextField(blank=True, null=True), ), ]<|...
code_fim
easy
{ "lang": "python", "repo": "frank3054/segmentoj", "path": "/account/migrations/0006_account_avatar_url.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frank3054/segmentoj path: /account/migrations/0006_account_avatar_url.py # Generated by Django 3.1.5 on 2021-02-04 12:15 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('account', '0005_auto_20210203_1123'), ] operations = [ migrations.AddF...
code_fim
easy
{ "lang": "python", "repo": "frank3054/segmentoj", "path": "/account/migrations/0006_account_avatar_url.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Reports the overall status of automatic update checking for OS X updates, App Store app updates, and Gatekeeper and XProtect configurations """ status = "disabled" pref = CFPreferencesCopyAppValue( "AutomaticCheckEnabled", "/Library/Preferences/com.apple.SoftwareUpdate"...
code_fim
medium
{ "lang": "python", "repo": "chilcote/unearth", "path": "/artifacts/updates_check_status.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": print("<result>%s</result>" % fact()[factoid])<|fim_prefix|># repo: chilcote/unearth path: /artifacts/updates_check_status.py from CoreFoundation import CFPreferencesCopyAppValue factoid = "updates_check_status" def fact(): """ Reports the overall status of auto...
code_fim
medium
{ "lang": "python", "repo": "chilcote/unearth", "path": "/artifacts/updates_check_status.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chilcote/unearth path: /artifacts/updates_check_status.py from CoreFoundation import CFPreferencesCopyAppValue factoid = "updates_check_status" def fact(): <|fim_suffix|> return {factoid: status} if __name__ == "__main__": print("<result>%s</result>" % fact()[factoid])<|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "chilcote/unearth", "path": "/artifacts/updates_check_status.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> keys_emb = concat_func(keys_emb_list, mask=True) deep_input_emb = concat_func(dnn_input_emb_list) query_emb = concat_func(query_emb_list, mask=True) hist = AttentionSequencePoolingLayer(att_hidden_size, att_activation, weight_normalization=att_weigh...
code_fim
hard
{ "lang": "python", "repo": "sangyongjia/DeepCTR", "path": "/deepctr/models/star.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sangyongjia/DeepCTR path: /deepctr/models/star.py # -*- coding:utf-8 -*- from itertools import chain import tensorflow as tf from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import Dense, Flatten from ..feature_column import build_input_features, SparseFeat, ...
code_fim
hard
{ "lang": "python", "repo": "sangyongjia/DeepCTR", "path": "/deepctr/models/star.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> embedding_dict = create_embedding_matrix(dnn_feature_columns, l2_reg_embedding, seed, prefix="") query_emb_list = embedding_lookup(embedding_dict, features, sparse_feature_columns, history_feature_list, history_feature_list, to_list=True) #item_id, cate_id ...
code_fim
hard
{ "lang": "python", "repo": "sangyongjia/DeepCTR", "path": "/deepctr/models/star.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>rootpath="/home/deepak/dropbox/aasaan/database-backups" cleanup(rootpath) rootpath="/home/deepak/dropbox/aasaan/metabase" cleanup(rootpath, cutoffdays=2)<|fim_prefix|># repo: deepakkt/aasaan path: /deploy/database_backup_clean.py #!/usr/bin/python import os from datetime import date def cleanup(rootpat...
code_fim
hard
{ "lang": "python", "repo": "deepakkt/aasaan", "path": "/deploy/database_backup_clean.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deepakkt/aasaan path: /deploy/database_backup_clean.py #!/usr/bin/python import os from datetime import date def cleanup(rootpath, cutoffdays=8): <|fim_suffix|>rootpath="/home/deepak/dropbox/aasaan/database-backups" cleanup(rootpath) rootpath="/home/deepak/dropbox/aasaan/metabase" cleanup(rootp...
code_fim
hard
{ "lang": "python", "repo": "deepakkt/aasaan", "path": "/deploy/database_backup_clean.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agonzgarc/ADL path: /research/object_detection/frames_inspector.py import pdb import random import numpy as np import functools import json import os import tensorflow as tf import imp import pickle from object_detection import trainer from object_detection import selection_funcs as sel from ob...
code_fim
hard
{ "lang": "python", "repo": "agonzgarc/ADL", "path": "/research/object_detection/frames_inspector.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #eval_train_dir='/datatmp/Experiments/Javad/tf/model/'+False_PN+'_gtR1cycle1/'+False_PN+'_gtR1cycle2eval_train/' #current_cycle_path='/datatmp/Experiments/Javad/tf/model/'+False_PN+'_gtR1cycle1/' #next_cycle_path='/datatmp/Experiments/Javad/tf/model/'+False_PN+'_gtR1cycle2/' current_active_set=[] next_a...
code_fim
hard
{ "lang": "python", "repo": "agonzgarc/ADL", "path": "/research/object_detection/frames_inspector.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ziang-Lu/Design-Patterns path: /4-Behavioral Patterns/9-Mediator Pattern/Interphone Group Example (1-to-many)/Python/model.py #!usr/bin/env python3 # -*- coding: utf-8 -*- """ Model module. """ __author__ = 'Ziang Lu' from abc import ABC class InterphoneGroup: """ InterphoneGroup cla...
code_fim
hard
{ "lang": "python", "repo": "Ziang-Lu/Design-Patterns", "path": "/4-Behavioral Patterns/9-Mediator Pattern/Interphone Group Example (1-to-many)/Python/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Concrete LeaderUser that works as "ConcreteColleague". """ __slots__ = [] def __init__(self, name: str): """ Constructor with parameter. :param name: str """ super().__init__(name) class NormalUser(User): """ Concrete NormalUser th...
code_fim
hard
{ "lang": "python", "repo": "Ziang-Lu/Design-Patterns", "path": "/4-Behavioral Patterns/9-Mediator Pattern/Interphone Group Example (1-to-many)/Python/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> steps = 0 for i in range(args.num_rollouts): vel = [] mapping_cache = {} # in case policy_agent_mapping is stochastic reward_dict = {} obs = env.reset() agent_states = DefaultMapping( lambda agent_id: state_init[mapping_cache[agent_id]]) ...
code_fim
hard
{ "lang": "python", "repo": "Autonomous-Vehicle/decentralized_bottlenecks", "path": "/flow/visualize/visualizer_rllib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Autonomous-Vehicle/decentralized_bottlenecks path: /flow/visualize/visualizer_rllib.py """Visualizer for rllib experiments. Attributes ---------- EXAMPLE_USAGE : str Example call to the function, which is :: python ./visualizer_rllib.py /tmp/ray/result_dir 1 parser : ArgumentPa...
code_fim
hard
{ "lang": "python", "repo": "Autonomous-Vehicle/decentralized_bottlenecks", "path": "/flow/visualize/visualizer_rllib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>moving = sitk.ReadImage( 'C:users/zengxiao/Desktop/ImageProcess/lena10.jpg', sitk.sitkFloat32) matcher = sitk.HistogramMatchingImageFilter() matcher.SetNumberOfHistogramLevels(1024) matcher.SetNumberOfMatchPoints(7) matcher.ThresholdAtMeanIntensityOn() moving = matcher.Execute(moving, fixed) dem...
code_fim
medium
{ "lang": "python", "repo": "jiyeqian/MedImg_Py_Library", "path": "/demo/ch6_Demons_ImDeform&Reg_demo .py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>resampler = sitk.ResampleImageFilter() resampler.SetReferenceImage(fixed) resampler.SetInterpolator(sitk.sitkLinear) resampler.SetDefaultPixelValue(100) resampler.SetTransform(outTx) out = resampler.Execute(moving) simg1 = sitk.Cast(sitk.RescaleIntensity(fixed), sitk.sitkUInt8) simg2 = sitk.Cast(sitk.Res...
code_fim
hard
{ "lang": "python", "repo": "jiyeqian/MedImg_Py_Library", "path": "/demo/ch6_Demons_ImDeform&Reg_demo .py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiyeqian/MedImg_Py_Library path: /demo/ch6_Demons_ImDeform&Reg_demo .py """ Script Name :zx_homework_1228 Author :zx Created on :2017/12/28 Last Modified :2017/12/28 Version :1.0 Modifications :zx Description :Demons图像变形配准 """ from __future__ import print_function import Simp...
code_fim
hard
{ "lang": "python", "repo": "jiyeqian/MedImg_Py_Library", "path": "/demo/ch6_Demons_ImDeform&Reg_demo .py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: unisunis/Expanda path: /src/expanda/__init__.py import re import os import math import shutil import argparse from configparser import ConfigParser from .extension import Extension from .shuffling import shuffle from .tokenization import train_tokenizer, tokenize_corpus from typing import List fr...
code_fim
hard
{ "lang": "python", "repo": "unisunis/Expanda", "path": "/src/expanda/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Remove temporary directory. print('[*] remove temporary directory.') shutil.rmtree(temporary) print('[*] finish building corpus.') def _main(): parser = argparse.ArgumentParser( prog='expanda', description='Expanda - A universal integrated corpus generator') su...
code_fim
hard
{ "lang": "python", "repo": "unisunis/Expanda", "path": "/src/expanda/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from . import buck if __name__ == '__main__': buck.main()<|fim_prefix|># repo: MMeunierSide/buck path: /python-dsl/buck_parser/__main__.py """Main module for running this tool standalone. When buck invokes this tool it generates its own main module. """ <|fim_middle|>from __future__ import absolut...
code_fim
medium
{ "lang": "python", "repo": "MMeunierSide/buck", "path": "/python-dsl/buck_parser/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MMeunierSide/buck path: /python-dsl/buck_parser/__main__.py """Main module for running this tool standalone. When buck invokes this tool it generates its own main module. """ <|fim_suffix|>if __name__ == '__main__': buck.main()<|fim_middle|>from __future__ import absolute_import from __futu...
code_fim
medium
{ "lang": "python", "repo": "MMeunierSide/buck", "path": "/python-dsl/buck_parser/__main__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cha63506/gd path: /gd/tests/test_parser.py from datetime import datetime, date, time import unittest from pretend import stub from gd import parser class Test_get_game(unittest.TestCase): """Test the gd.parser.get_game function.""" def test_get_game(self): expected = {"local_...
code_fim
hard
{ "lang": "python", "repo": "cha63506/gd", "path": "/gd/tests/test_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tree = stub(find=lambda arg: None) self.assertRaisesRegex(Exception, "Did not find a stadium.", parser.get_stadium, tree) class Test_get_actions(unittest.TestCase): """Test the gd.parser.get_actions function.""" def test_get_actions(self): ...
code_fim
hard
{ "lang": "python", "repo": "cha63506/gd", "path": "/gd/tests/test_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Test the gd.parser.get_actions function.""" def test_get_actions(self): input_value = {"tfs": "123456", "tfs_zulu": "2014-07-19T23:12:35Z", "id": "987654"} value = stub(attrib=input_value) tree = stub(findall=lambda arg: [va...
code_fim
hard
{ "lang": "python", "repo": "cha63506/gd", "path": "/gd/tests/test_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for vid in all_videos: cl = vid.split("/")[-2] video = basename(vid).split(".")[0] # creating a folder to store the frames of the video if not exists("frames/" + cl + "/" + video): os.mkdir("frames/" + cl + "/" + video) # Taking the frames .. cmnd = "ffmpeg -i "+ ...
code_fim
hard
{ "lang": "python", "repo": "marcostx/BatCNN", "path": "/extract_frames.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # creating a folder to store the frames of the video if not exists("frames/" + cl + "/" + video): os.mkdir("frames/" + cl + "/" + video) # Taking the frames .. cmnd = "ffmpeg -i "+ vid +" -vf fps=30 frames/" + cl + "/"+ video + "/"+ video +".%04d.jpg" os.system(cmn...
code_fim
hard
{ "lang": "python", "repo": "marcostx/BatCNN", "path": "/extract_frames.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcostx/BatCNN path: /extract_frames.py from glob import glob import os from os.path import basename, join, exists targetFolder = "frames" all_classes = [] all_videos = [] <|fim_suffix|> # creating a folder to store the frames of the video if not exists("frames/" + cl + "/" + video): ...
code_fim
hard
{ "lang": "python", "repo": "marcostx/BatCNN", "path": "/extract_frames.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> aggregator = dd_agent_check(rate=True) for metric in legacy_common.AGENT_DEFAULT_METRICS + legacy_common.OPERATOR_METRICS: aggregator.assert_metric(metric)<|fim_prefix|># repo: DataDog/integrations-core path: /cilium/tests/legacy/test_e2e.py # (C) Datadog, Inc. 2021-present # All rights r...
code_fim
easy
{ "lang": "python", "repo": "DataDog/integrations-core", "path": "/cilium/tests/legacy/test_e2e.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataDog/integrations-core path: /cilium/tests/legacy/test_e2e.py # (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) <|fim_suffix|>pytestmark = [common.requires_legacy_environment] @pytest.mark.e2e def test_check_ok(dd_agent_check)...
code_fim
medium
{ "lang": "python", "repo": "DataDog/integrations-core", "path": "/cilium/tests/legacy/test_e2e.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tskit-dev/tskit path: /python/tests/test_utilities.py # MIT License # # Copyright (c) 2019-2022 Tskit Developers # # 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 witho...
code_fim
hard
{ "lang": "python", "repo": "tskit-dev/tskit", "path": "/python/tests/test_utilities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ts = msprime.simulate(50, random_seed=1) ts = ts.decapitate(np.max(ts.tables.nodes.time) / 2) ts = tsutil.jukes_cantor(ts, 5, 2, seed=2) self.verify(ts) def test_silent_mutations(self): ts = msprime.simulate(50, random_seed=1) ts = tsutil.jukes_cantor(t...
code_fim
hard
{ "lang": "python", "repo": "tskit-dev/tskit", "path": "/python/tests/test_utilities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def reconnect(): c.set_callback(sub_cb) c.connect() publish_payload(STATE_TOPIC, STATE) publish_payload(BRIGHTNESS_STATE_TOPIC, 0) publish_payload(RGB_STATE_TOPIC, LIGHT_STATE) publish_payload(KILL_STATE_TOPIC, "alive") c.subscribe(COMMAND_TOPIC) c.subscribe(BRIGHTNESS_COMM...
code_fim
hard
{ "lang": "python", "repo": "Sakartu/esp_mqtt_ledstrip", "path": "/mlight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sakartu/esp_mqtt_ledstrip path: /mlight.py from hsv_to_rgb import hsv_to_rgb as htr from rgb_to_hsv import rgb_to_hsv as rth from simple import MQTTClient from neopixel import NeoPixel from machine import Pin from time import sleep from sys import exit import ubinascii import machine import netwo...
code_fim
hard
{ "lang": "python", "repo": "Sakartu/esp_mqtt_ledstrip", "path": "/mlight.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ramen-Shaman/Reco-PC-Server path: /modules/restart_module.py # Module: restart # Description: Restarts system # Usage: !restart or !restart secondsToRestart # Dependencies: time, os import time, os, asyncio, configs <|fim_suffix|> if minutes != 0: await asyncio.slee...
code_fim
hard
{ "lang": "python", "repo": "Ramen-Shaman/Reco-PC-Server", "path": "/modules/restart_module.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if minutes != 0: await asyncio.sleep(minutes) os.system("reboot") else: await ctx.send("Can't restart system.") await asyncio.sleep(3)<|fim_prefix|># repo: Ramen-Shaman/Reco-PC-Server path: /modules/restart_module.py # Module: restart # Description: R...
code_fim
hard
{ "lang": "python", "repo": "Ramen-Shaman/Reco-PC-Server", "path": "/modules/restart_module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.system("Shutdown.exe -r -t {0}".format(minutes)) elif configs.operating_sys == "Linux": minutes=minutes*60 if minutes != 0: await asyncio.sleep(minutes) os.system("reboot") else: await ctx.send("Can't restart system.") await ...
code_fim
medium
{ "lang": "python", "repo": "Ramen-Shaman/Reco-PC-Server", "path": "/modules/restart_module.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gwk/pithy path: /pithy/tree.py # Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/. from types import GeneratorType from typing import Callable, Generator, Iterable, Iterator, Protocol, TypeVar, Union from .exceptions import OmitNode from .iterable imp...
code_fim
medium
{ "lang": "python", "repo": "gwk/pithy", "path": "/pithy/tree.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def transform_tree(root:_T, get_children:_GetChildrenFn[_T], visit:_TransformVisitor[_T, _R]) -> _R: ''' `transform_tree` visits nodes, leaves-first, with the `visit` function, thereby generating a transformed tree. The `visit` function takes three parameters: * node: the current node. * sta...
code_fim
medium
{ "lang": "python", "repo": "gwk/pithy", "path": "/pithy/tree.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>rowser() # # vr_controller = pyosirix.frontmost_vr_controller() # viewer_controller = pyosirix.frontmost_viewer() # print(viewer_controller.modality) # print(viewer_controller.cur_dcm().source_file)<|fim_prefix|># repo: timothy22000/pyosirix path: /osirix/test_package.py # from testpyosir...
code_fim
hard
{ "lang": "python", "repo": "timothy22000/pyosirix", "path": "/osirix/test_package.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: timothy22000/pyosirix path: /osirix/test_package.py # from testpyosirix import Osirix, OsirixService # from testpyosirix import Osirix # import sys # print(sys.path) # sys.path.append("/Users/admintmun/.pyenv/versions/3.7.8/envs/test/lib/python3.7/site-packages") if<|fim_suffix|>rowser() # # ...
code_fim
hard
{ "lang": "python", "repo": "timothy22000/pyosirix", "path": "/osirix/test_package.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 1024 * 1024)] # # osirix_service = OsirixService(channel_opt=channel_opt, domain=domain, port=port).get_service() # pyosirix = Osirix(osirix_service) # # browser_controller = pyosirix.current_browser() # # vr_controller = pyosirix.frontmost_vr_controller() # viewer_controller ...
code_fim
hard
{ "lang": "python", "repo": "timothy22000/pyosirix", "path": "/osirix/test_package.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sathoune/typer-oo-example path: /typer_example/main_menu.py import typer from typer_example.tournament_menu import TournamentMenu class MainMenu: <|fim_suffix|> def print_menu(self): number = typer.style("1. ", bold=True) typer.echo(number + "Tournois") number = typer...
code_fim
hard
{ "lang": "python", "repo": "sathoune/typer-oo-example", "path": "/typer_example/main_menu.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> number = typer.style("1. ", bold=True) typer.echo(number + "Tournois") number = typer.style("2. ", bold=True) typer.echo(number + "Gérer les joueurs") def user_selection(self): selection = typer.prompt("Entrez votre sélection: ") typer.echo("\n") ...
code_fim
hard
{ "lang": "python", "repo": "sathoune/typer-oo-example", "path": "/typer_example/main_menu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ort ExoTransmitOpacity from .opacity import Opacity<|fim_prefix|># repo: ucl-exoplanets/TauREx3_public path: /taurex/opacity/__init__.py from .pickleopacity import PickleOpacity from .interpolateopacity import InterpolatingOpacity from .h<|fim_middle|>df5opacity import HDF5Opacity from .exotransmit imp
code_fim
easy
{ "lang": "python", "repo": "ucl-exoplanets/TauREx3_public", "path": "/taurex/opacity/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ucl-exoplanets/TauREx3_public path: /taurex/opacity/__init__.py from .pickleopacity import PickleOpacity from .int<|fim_suffix|>ort ExoTransmitOpacity from .opacity import Opacity<|fim_middle|>erpolateopacity import InterpolatingOpacity from .hdf5opacity import HDF5Opacity from .exotransmit imp
code_fim
medium
{ "lang": "python", "repo": "ucl-exoplanets/TauREx3_public", "path": "/taurex/opacity/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: broadinstitute/CellBender path: /cellbender/remove_background/tests/test_estimation.py """Test functions in estimation.py""" import pandas as pd import pytest import scipy.sparse as sp import numpy as np import torch from cellbender.remove_background.estimation import Mean, MAP, \ SingleSamp...
code_fim
hard
{ "lang": "python", "repo": "broadinstitute/CellBender", "path": "/cellbender/remove_background/tests/test_estimation.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Test the mean estimator""" def _add_offsets_to_truth(truth: np.ndarray, offset_dict: Dict[int, int]): return truth + np.array([offset_dict.get(m, 0) for m in range(len(truth))]) offset_dict = log_prob_coo['offsets'] # the input print(log_prob_coo) print('input log pro...
code_fim
hard
{ "lang": "python", "repo": "broadinstitute/CellBender", "path": "/cellbender/remove_background/tests/test_estimation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # test np.testing.assert_array_equal(out_per_m, log_prob_coo['cdfs']) @pytest.mark.parametrize('n_chunks, parallel_compute', ([1, False], [2, False], [2, True]), ids=['1chunk', '2chunks_1cpu', '2chunks_parallel']) @pyte...
code_fim
hard
{ "lang": "python", "repo": "broadinstitute/CellBender", "path": "/cellbender/remove_background/tests/test_estimation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: L1nkZ/Bourgeon path: /examples/autopot.py import json from enum import IntEnum from typing import List, Dict, Any import bourgeon import ragnarok_client as client from bourgeon import ui from ragnarok_client import Mode class Configuration: def __init__(self, path: str): with open(...
code_fim
hard
{ "lang": "python", "repo": "L1nkZ/Bourgeon", "path": "/examples/autopot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def on_mode_switch(mode_type: Mode, _map_name: str) -> None: """ OnModeSwitch callback. """ global current_mode current_mode = mode_type def on_tick() -> None: """ OnTick callback. """ global ap_window ap_window.handle_messages() if current_mode == Mode.Game ...
code_fim
hard
{ "lang": "python", "repo": "L1nkZ/Bourgeon", "path": "/examples/autopot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = self.reshape_array(input_data) self.k_means.fit(data) print('Training Labels : ', self.k_means.labels_) def predict(self, input_data, replays): i = 0 data = self.reshape_array(input_data) prediction = self.k_means.predict(data) build_dict...
code_fim
hard
{ "lang": "python", "repo": "loginn/sc2-build-classifier", "path": "/Clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for p in prediction: build_dict.append((p, replays[i])) i += 1 return build_dict<|fim_prefix|># repo: loginn/sc2-build-classifier path: /Clustering.py import numpy from sklearn.cluster import KMeans class Clustering: def __init__(self, k=5): self.k = ...
code_fim
medium
{ "lang": "python", "repo": "loginn/sc2-build-classifier", "path": "/Clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: loginn/sc2-build-classifier path: /Clustering.py import numpy from sklearn.cluster import KMeans class Clustering: def __init__(self, k=5): self.k = k self.k_means = KMeans(n_clusters=self.k) def reshape_array(self, input_data): data = numpy.asarray(input_data) ...
code_fim
medium
{ "lang": "python", "repo": "loginn/sc2-build-classifier", "path": "/Clustering.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DmitryCS/model_server path: /example_client/image_transformation_client.py # # Copyright (c) 2021 Intel Corporation # # 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": "DmitryCS/model_server", "path": "/example_client/image_transformation_client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> channels = cv2.split(img) number_of_channels = img.shape[-1] if len(values) != number_of_channels: print('mean values must match number of channels') exit(1) i = 0 for i in range(number_of_channels): channels[i] -= values[i] img = cv2.merge(channels) img...
code_fim
hard
{ "lang": "python", "repo": "DmitryCS/model_server", "path": "/example_client/image_transformation_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if args['mean_values']: img = mean(img, args['mean_values']) if layout == 'NCHW': h, w, c = img.shape img = img.transpose(2,0,1).reshape(1, c, h, w) else: img = img.reshape(1, img.shape[0], img.shape[1], img.shape[2]) request.inputs[name].CopyFrom(make_ten...
code_fim
hard
{ "lang": "python", "repo": "DmitryCS/model_server", "path": "/example_client/image_transformation_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theRealSuperMario/tikzplotlib path: /test/test_image_plot_lower.py import matplotlib.pyplot as plt from helpers import assert_equality # the picture 'lena.png' with origin='lower' is flipped upside-down. # So it has to be upside-down in the pdf-file as well. <|fim_suffix|> def test(): asse...
code_fim
hard
{ "lang": "python", "repo": "theRealSuperMario/tikzplotlib", "path": "/test/test_image_plot_lower.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test(): assert_equality(plot, "test_image_plot_lower_reference.tex") return<|fim_prefix|># repo: theRealSuperMario/tikzplotlib path: /test/test_image_plot_lower.py import matplotlib.pyplot as plt from helpers import assert_equality # the picture 'lena.png' with origin='lower' is flipped ups...
code_fim
hard
{ "lang": "python", "repo": "theRealSuperMario/tikzplotlib", "path": "/test/test_image_plot_lower.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test(): assert_equality(plot, "test_image_plot_lower_reference.tex") return<|fim_prefix|># repo: theRealSuperMario/tikzplotlib path: /test/test_image_plot_lower.py import matplotlib.pyplot as plt from helpers import assert_equality # the picture 'lena.png' with origin='lower' is flipped upsi...
code_fim
hard
{ "lang": "python", "repo": "theRealSuperMario/tikzplotlib", "path": "/test/test_image_plot_lower.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> publishForceCmd([0,10,0,0,0,0]) #test joint srv - move robot to 180 pos if (interactive == True): nb = raw_input('Moving robot to candle like position, press key') result = joint_position_client([180]*7) #test joint velocity control if (interactive == True): nb = raw_input...
code_fim
hard
{ "lang": "python", "repo": "Wang-Ruohan/kinova-ros-self", "path": "/fake_pub/scripts/testActionsvr.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wang-Ruohan/kinova-ros-self path: /fake_pub/scripts/testActionsvr.py #! /usr/bin/env python """A test program to test action servers for the JACO and MICO arms.""" import roslib; roslib.load_manifest('kinova_demo') import rospy import actionlib import kinova_msgs.msg import geometry_msgs.msg impo...
code_fim
hard
{ "lang": "python", "repo": "Wang-Ruohan/kinova-ros-self", "path": "/fake_pub/scripts/testActionsvr.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def publishCatesianVelocityCommands(cartVel): topic_name = '/' + prefix + 'driver/in/cartesian_velocity' #publish joint torque commands pub = rospy.Publisher(topic_name, kinova_msgs.msg.PoseVelocity, queue_size=1) poseVelCmd = kinova_msgs.msg.PoseVelocity() poseVelCmd.twist_linear_x = cartVel[0] pos...
code_fim
hard
{ "lang": "python", "repo": "Wang-Ruohan/kinova-ros-self", "path": "/fake_pub/scripts/testActionsvr.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Driver code if __name__ == "__main__": print("1) Enter 1 to ADD a HOST:\n2) Enter 2 to ADD a TASK:") choice = int(input("Enter choice:")) if choice==1: conn = sqlite3.connect("/home/knife/MyPlaxonicWork/youtube-viewer/server.db") cur = conn.cursor() add_client() ...
code_fim
hard
{ "lang": "python", "repo": "Akash-chowrasia/Viveedh", "path": "/database/add_data_to_database.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Akash-chowrasia/Viveedh path: /database/add_data_to_database.py ''' This module adds data to databse by asking to the server operator from console. ''' import sqlite3 import csv def add_client(): ''' This function add's new host data to client's table. ''' num...
code_fim
medium
{ "lang": "python", "repo": "Akash-chowrasia/Viveedh", "path": "/database/add_data_to_database.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcomusy/vedo path: /examples/basic/tube_radii.py """Use array to vary radius and color of a line represented as a tube""" from vedo import * <|fim_suffix|>############################### a simple tube( along ln t1 = Tube(ln, c="blue", r=0.08) ############################### vary radius rads =...
code_fim
medium
{ "lang": "python", "repo": "marcomusy/vedo", "path": "/examples/basic/tube_radii.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>############################### vary color cols = list(range(N)) cols = make_bands(cols, 5) # make color bins t3 = Tube(ln, r=rads, c=cols, res=24) ############################### visualize plt = Plotter(N=3, axes=dict(text_scale=4)) plt.at(0).show(t1, __doc__) plt.at(1).show(t2) plt.at(2).show(t3, view...
code_fim
hard
{ "lang": "python", "repo": "marcomusy/vedo", "path": "/examples/basic/tube_radii.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>############################### vary radius rads = [0.3*(cos(6.0*ir/N))**2+0.1 for ir in range(N)] t2 = Tube(ln, r=rads, c="tomato", res=24) ############################### vary color cols = list(range(N)) cols = make_bands(cols, 5) # make color bins t3 = Tube(ln, r=rads, c=cols, res=24) ##############...
code_fim
medium
{ "lang": "python", "repo": "marcomusy/vedo", "path": "/examples/basic/tube_radii.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template_name = 'user/userlist.html' model = User paginate_by = 8<|fim_prefix|># repo: mingziV5/opsweb_test path: /accounts/user/__init__.py from django.views.generic import ListView from django.contrib.auth.models import User from django.contrib.auth.mixins import LoginRequiredMixin from . i...
code_fim
easy
{ "lang": "python", "repo": "mingziV5/opsweb_test", "path": "/accounts/user/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mingziV5/opsweb_test path: /accounts/user/__init__.py from django.views.generic import ListView from django.contrib.auth.models import User from django.contrib.auth.mixins import LoginRequiredMixin from . import views <|fim_suffix|> template_name = 'user/userlist.html' model = User pa...
code_fim
easy
{ "lang": "python", "repo": "mingziV5/opsweb_test", "path": "/accounts/user/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaiSakethAluru/DE-LIMIT path: /CNN_GRU/Models/model.py import torch import torch.nn as nn import numpy as np def global_max_pooling(tensor, dim, topk): """Global max pooling""" ret, _ = torch.topk(tensor, topk, dim) return ret <|fim_suffix|> super(CNN_GRU, self).__init__() ...
code_fim
medium
{ "lang": "python", "repo": "SaiSakethAluru/DE-LIMIT", "path": "/CNN_GRU/Models/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if labels is not None: loss_fct = nn.CrossEntropyLoss(weight=torch.tensor(self.weights).cuda()) loss = loss_fct(output.view(-1, self.num_labels), labels.view(-1)) return loss,output return output<|fim_prefix|># repo: SaiSakethAluru/DE-LIMIT path: /CNN_GRU/Models...
code_fim
hard
{ "lang": "python", "repo": "SaiSakethAluru/DE-LIMIT", "path": "/CNN_GRU/Models/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Return geometries of two element grid.""" grid = bempp.api.shapes.cube(h=0.5) space = bempp.api.function_space(grid, *space_type) function = bempp.api.GridFunction( space, coefficients=np.random.rand(space.global_dof_count) ) bempp.api.export(os.path.join(folder, filenam...
code_fim
hard
{ "lang": "python", "repo": "chenglong92/bempp-cl", "path": "/test/unit/space/test_function_io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> space, coefficients=np.random.rand(space.global_dof_count) ) bempp.api.export(os.path.join(folder, filename), grid_function=function)<|fim_prefix|># repo: chenglong92/bempp-cl path: /test/unit/space/test_function_io.py """Unit tests for function io.""" import os import pytest import bemp...
code_fim
hard
{ "lang": "python", "repo": "chenglong92/bempp-cl", "path": "/test/unit/space/test_function_io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenglong92/bempp-cl path: /test/unit/space/test_function_io.py """Unit tests for function io.""" import os import pytest import bempp.api import numpy as np <|fim_suffix|> """Return geometries of two element grid.""" grid = bempp.api.shapes.cube(h=0.5) space = bempp.api.function_spa...
code_fim
hard
{ "lang": "python", "repo": "chenglong92/bempp-cl", "path": "/test/unit/space/test_function_io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bobort/cheese path: /drill/admin.py from django.contrib import admin from django import forms from drill.models import DrillTopic, Question, DrillTracking def process_qa(topic, qas): """ The qas string is delimited as so: The first line is 5 pipes: ||||| After that is the question ...
code_fim
medium
{ "lang": "python", "repo": "bobort/cheese", "path": "/drill/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class DrillAdmin(admin.ModelAdmin): model = DrillTopic form = DrillModelForm search_fields = ('name', ) ordering = ('name',) admin.site.register(DrillTopic, DrillAdmin) admin.site.register(Question) admin.site.register(DrillTracking)<|fim_prefix|># repo: bobort/cheese path: /drill/admin...
code_fim
medium
{ "lang": "python", "repo": "bobort/cheese", "path": "/drill/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DrillAdmin(admin.ModelAdmin): model = DrillTopic form = DrillModelForm search_fields = ('name', ) ordering = ('name',) admin.site.register(DrillTopic, DrillAdmin) admin.site.register(Question) admin.site.register(DrillTracking)<|fim_prefix|># repo: bobort/cheese path: /drill/admi...
code_fim
hard
{ "lang": "python", "repo": "bobort/cheese", "path": "/drill/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with detection_graph.as_default(): with tf.Session(graph=detection_graph) as sess: for image_path in UN_PROCESS_IMAGE_PATHS: if not image_path.__contains__(".jpg"): continue; image = Image.open(image_path) image_np...
code_fim
hard
{ "lang": "python", "repo": "meepo8th/models", "path": "/object_detection/detection_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: meepo8th/models path: /object_detection/detection_test.py import os import shutil import numpy as np import tensorflow as tf import time from PIL import Image from matplotlib import pyplot as plt import pylab from object_detection.utils import visualization_utils as vis_util from object_detectio...
code_fim
hard
{ "lang": "python", "repo": "meepo8th/models", "path": "/object_detection/detection_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def detect(UN_PROCESS_IMAGE_PATHS): with detection_graph.as_default(): with tf.Session(graph=detection_graph) as sess: for image_path in UN_PROCESS_IMAGE_PATHS: if not image_path.__contains__(".jpg"): continue; image = Image.open...
code_fim
hard
{ "lang": "python", "repo": "meepo8th/models", "path": "/object_detection/detection_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Create a new kubernetes job to run IPED""" try: image = api.payload['image'] IPEDJAR = api.payload['IPEDJAR'] EVIDENCE_PATH = api.payload['EVIDENCE_PATH'] OUTPUT_PATH = api.payload['OUTPUT_PATH'] IPE...
code_fim
hard
{ "lang": "python", "repo": "setecrs/iped_jobs", "path": "/iped_jobs/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: setecrs/iped_jobs path: /iped_jobs/app.py #!/usr/bin/env python3 import os import http import logging from flask import Flask, make_response, request from flask_restplus import Resource, Api, fields from werkzeug.exceptions import BadRequest from .k8s import K8s DEBUG = ('DEBUG' in os.environ)...
code_fim
hard
{ "lang": "python", "repo": "setecrs/iped_jobs", "path": "/iped_jobs/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print 'factorial of the the 10 first natural numbers\n' for i in xrange(1, 11,1): print 'factorial %d = %d'% (i, factorial(i))<|fim_prefix|># repo: junteudjio/algorithms_in_python path: /algorithms_in_python/_4_recursion/examples/factorial.py __author__ = 'Junio...
code_fim
medium
{ "lang": "python", "repo": "junteudjio/algorithms_in_python", "path": "/algorithms_in_python/_4_recursion/examples/factorial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junteudjio/algorithms_in_python path: /algorithms_in_python/_4_recursion/examples/factorial.py __author__ = 'Junior Teudjio' def factorial(n): <|fim_suffix|> if __name__ == '__main__': print 'factorial of the the 10 first natural numbers\n' for i in xrange(1, 11,1): print 'factor...
code_fim
medium
{ "lang": "python", "repo": "junteudjio/algorithms_in_python", "path": "/algorithms_in_python/_4_recursion/examples/factorial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }