text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: aaa34169/openma path: /modules/io/test/python/ioTest.py import ma.io import unittest class IOTest(unittest.TestCase): <|fim_suffix|> self.assertRaises(IOError, ma.io.read, 'IDoNotExist.abc');<|fim_middle|> def wrong_path(self):
code_fim
easy
{ "lang": "python", "repo": "aaa34169/openma", "path": "/modules/io/test/python/ioTest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>finally: try: fin.close() except: pass try: fout.close() except: pass try: os.unlink(tmpIn) except: pass try: os.unlink(tmpOut) except: pass if verbose: print '7. error: truncated input' inp = StringIO("be...
code_fim
hard
{ "lang": "python", "repo": "neopoly/rubyfox-server", "path": "/lib/rubyfox/server/data/lib/Lib/test/test_uu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fin = open(tmpIn, 'rb') fout = open(tmpOut, 'w') uu.encode(fin, fout, tmpIn, mode=0644) fin.close() fout.close() fout = open(tmpOut, 'r') s = fout.read() fout.close() verify(s == 'begin 644 ' + tmpIn + '\n' + expected + '\n \nend\n') os.unlink(tmpIn) if verbos...
code_fim
hard
{ "lang": "python", "repo": "neopoly/rubyfox-server", "path": "/lib/rubyfox/server/data/lib/Lib/test/test_uu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neopoly/rubyfox-server path: /lib/rubyfox/server/data/lib/Lib/test/test_uu.py """ Tests for uu module. Nick Mathewson """ from test_support import verify, TestFailed, verbose, TESTFN import sys, os import uu from StringIO import StringIO teststr = "The smooth-scaled python crept over the sleepi...
code_fim
hard
{ "lang": "python", "repo": "neopoly/rubyfox-server", "path": "/lib/rubyfox/server/data/lib/Lib/test/test_uu.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>qs_ids = f.createTable("/", 'q_indices', Index, "a table of indices qs and lengths") ans_ids = f.createTable("/", 'ans_indices', SingletonIndex, "a table of indices for answer") count = 0 pos_desc = 0 pos_q = 0 pos_a = 0 def get_triple_indices(descs, qs, ans): d_idxs = np.array([desc_vocab[...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/Attentive_reader", "path": "/scripts/create_h5_files.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: 5l1v3r1/Attentive_reader path: /scripts/create_h5_files.py #!/usr/bin/env python import argparse import cPickle as pkl import sys import os import tables import numpy as np parser = argparse.ArgumentParser() parser.add_argument("--input_dir", help="Input directory for th...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/Attentive_reader", "path": "/scripts/create_h5_files.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>count = 0 pos_desc = 0 pos_q = 0 pos_a = 0 def get_triple_indices(descs, qs, ans): d_idxs = np.array([desc_vocab["NUM"] if d.isdigit() else desc_vocab[d] if d in desc_vocab \ else desc_vocab["UNK"] for d in descs] + [0], dtype="uint32") ans_idxs = np.array([ans_vocab["NUM"] if a.isdig...
code_fim
hard
{ "lang": "python", "repo": "5l1v3r1/Attentive_reader", "path": "/scripts/create_h5_files.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: IlyaTrofimov/mlforhealthlabpub path: /alg/asac/Data_Generation_Y.py # -*- coding: utf-8 -*- import numpy as np #%% Corresponding Y generation def Syn_Generation_Y1(X, W, sigma): # No of samples n = len(X) t = len(X[0][:,0]) # Initialization Output_Y = list() ...
code_fim
hard
{ "lang": "python", "repo": "IlyaTrofimov/mlforhealthlabpub", "path": "/alg/asac/Data_Generation_Y.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Output_Y.append(Temp_Y) #%% Cost Generation Output_C = list() Output_G = list() for i in range(n): Temp = X[i].copy() Temp_Y = Output_Y[i] Temp_G = X[i].copy() for j in range(t): if (Temp_Y[j] < 0...
code_fim
hard
{ "lang": "python", "repo": "IlyaTrofimov/mlforhealthlabpub", "path": "/alg/asac/Data_Generation_Y.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ustczhouyu/VTD path: /Detection/Proposed_Model/cfg.py import os train_task_id = 'SIZE256' initial_epoch = 0 epoch_num = 24 lr = 1e-3 decay = 5e-4 # clipvalue = 0.5 # default 0.5, 0 means no clip patience = 5 load_weights = True lambda_inside_score_loss = 4.0 lambda_side_vertex_code_loss = 1.0 la...
code_fim
hard
{ "lang": "python", "repo": "ustczhouyu/VTD", "path": "/Detection/Proposed_Model/cfg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>model_weights_path = 'D:\py_projects\VTD\model\east_model\epoch_weights\weights_%s.{epoch:03d}-{val_loss:.5f}.h5' \ % train_task_id saved_model_file_path = 'D:\py_projects\VTD\model\east_model\saved_model\east_model_%s.h5' % train_task_id saved_model_weights_file_path = 'D:\py_project...
code_fim
medium
{ "lang": "python", "repo": "ustczhouyu/VTD", "path": "/Detection/Proposed_Model/cfg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cosmos-Break/leetcode path: /888.公平的糖果棒交换.py # # @lc app=leetcode.cn id=888 lang=python3 # # [888] 公平的糖果棒交换 # <|fim_suffix|> set_b = set(B) diff = (sum(A) - sum(B)) // 2 for a in A: if a-diff in set_b: return [a, a-diff] # @lc code=...
code_fim
medium
{ "lang": "python", "repo": "Cosmos-Break/leetcode", "path": "/888.公平的糖果棒交换.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fairCandySwap(self, A: List[int], B: List[int]) -> List[int]: set_b = set(B) diff = (sum(A) - sum(B)) // 2 for a in A: if a-diff in set_b: return [a, a-diff] # @lc code=end<|fim_prefix|># repo: Cosmos-Break/leetcode path: /888.公平的糖果...
code_fim
easy
{ "lang": "python", "repo": "Cosmos-Break/leetcode", "path": "/888.公平的糖果棒交换.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>f = CurrentFont() markGlyphs(f, markSettings["experiment"])<|fim_prefix|># repo: thundernixon/robofont-marx path: /03--experiment.py # menuTitle : 03: Experiment - Purple # shortCut : command+control+shift+3 """ Mark currently-selected glyphs as "worked on," so it's clear they have been edited. """ ...
code_fim
medium
{ "lang": "python", "repo": "thundernixon/robofont-marx", "path": "/03--experiment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thundernixon/robofont-marx path: /03--experiment.py # menuTitle : 03: Experiment - Purple # shortCut : command+control+shift+3 """ Mark currently-selected glyphs as "worked on," so it's clear they have been edited. """ <|fim_suffix|>f = CurrentFont() markGlyphs(f, markSettings["experiment"]...
code_fim
medium
{ "lang": "python", "repo": "thundernixon/robofont-marx", "path": "/03--experiment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Count of original question_rdd: {}'.format(question_rdd.count()), file=metric_fptr) question_rdd = question_rdd.map(lambda x: self._process_row(x)).filter(lambda x: len(x.answers) >= 1) final_output_dir = self.output_dir # normally, we do os.path.join(self.output_dir, <.....
code_fim
hard
{ "lang": "python", "repo": "MarcinStachowiak/unsupervisedqa", "path": "/distant_supervision/squad_ner_creator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarcinStachowiak/unsupervisedqa path: /distant_supervision/squad_ner_creator.py from operator import add from .text_preprocessor import TextPreprocessor class SquadNerCreatorError(Exception): pass """ { "qid": "57277c965951b619008f8b2b", "question": "What do people engage in aft...
code_fim
hard
{ "lang": "python", "repo": "MarcinStachowiak/unsupervisedqa", "path": "/distant_supervision/squad_ner_creator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ctr=0 for position in matrix: x, y = position ''' for each cell there can be maximum 6 neighbours [ ][ ][ ] [ ][*][ ] [ ][ ][ ] ''' #top mid, top right, mid right, bot right, bot mid, bot left, mid left, top left ...
code_fim
hard
{ "lang": "python", "repo": "rameela20/toolkitten", "path": "/summer-of-code/week-02/wk2-hackathon-submissions/soc02h-bs-rameela-azeez.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rameela20/toolkitten path: /summer-of-code/week-02/wk2-hackathon-submissions/soc02h-bs-rameela-azeez.py #boggle game uses 16 dices with six sides with letters #find all words and points scored #Rameela Azeez #dictionary https://raw.githubusercontent.com/jonbcard/scrabble-bot/master/src/diction...
code_fim
hard
{ "lang": "python", "repo": "rameela20/toolkitten", "path": "/summer-of-code/week-02/wk2-hackathon-submissions/soc02h-bs-rameela-azeez.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for position in matrix: search([position]) for p in paths: bogglewords.add(pathtoword(p)) def getpoints(): pointsys={0:0,1:0,2:0,3:1,4:1, 5:2, 6:3,7:5,8:11} points=0 for word in bogglewords: wordpoint=0 l=len(word) if (1 <= l ...
code_fim
hard
{ "lang": "python", "repo": "rameela20/toolkitten", "path": "/summer-of-code/week-02/wk2-hackathon-submissions/soc02h-bs-rameela-azeez.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: siddharthvaria/GI-DL path: /terra/w2v.py from gensim.models import Word2Vec import pickle def embed(size=100, window=7, min_count=2, workers=4, mout='tweets.model', vout='vocab.pkl', cout='counts.pkl'): tweets = [] lines = open('../../../tweets/tsv/all.tsv', 'r').readlines()[1...
code_fim
hard
{ "lang": "python", "repo": "siddharthvaria/GI-DL", "path": "/terra/w2v.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> vocab = {} for line in lines: for w in line.split('\t')[6].split(): word = w.lower() if word not in vocab and word in model: vocab[word] = model[word] pickle.dump(vocab, open(vout, 'w')) for tweet in tweets: for word in tweet: ...
code_fim
hard
{ "lang": "python", "repo": "siddharthvaria/GI-DL", "path": "/terra/w2v.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Word2Vec(tweets, size=size, window=window, min_count=min_count, workers=workers) model.save(mout) vocab = {} for line in lines: for w in line.split('\t')[6].split(): word = w.lower() if word not in vocab and word in model: ...
code_fim
hard
{ "lang": "python", "repo": "siddharthvaria/GI-DL", "path": "/terra/w2v.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dustinpartain/pyWhat path: /tests/test_regex_identifier.py import pytest from pywhat import regex_identifier from pywhat.filter import Distribution, Filter from pywhat.helper import load_regexes database = load_regexes() r = regex_identifier.RegexIdentifier() dist = Distribution(Filter({"MinRar...
code_fim
hard
{ "lang": "python", "repo": "dustinpartain/pyWhat", "path": "/tests/test_regex_identifier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize( "match, exploit", [ ( "xoxp-514654431830-843187921057-792480346180-d44d2r9b71f954o8z2k5llt41ovpip6v", "https://slack.com/api/auth.test?token=xoxp-514654431830-843187921057-792480346180-d44d2r9b71f954o8z2k5llt41ovpip6v", ), ...
code_fim
hard
{ "lang": "python", "repo": "dustinpartain/pyWhat", "path": "/tests/test_regex_identifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( "match, description", [ # EUI-48 Identifier (Ethernet, WiFi, Bluetooth, etc) ("00:00:00:00:00:00", "Xerox Corp"), ("00-00-00-00-00-00", "Xerox Corp"), ("0000.0000.0000", "Xerox Corp"), # MasterCard Number ("5409010000000004"...
code_fim
hard
{ "lang": "python", "repo": "dustinpartain/pyWhat", "path": "/tests/test_regex_identifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def cal_loss_and_acc(ori_cand, ori_neg): # the target function zero = tf.fill(tf.shape(ori_cand), 0.0) margin = tf.fill(tf.shape(ori_cand), 0.1) with tf.name_scope("loss"): losses = tf.maximum(zero, tf.subtract(margin, tf.subtract(ori_cand, ori_neg))) # 修改过 loss = tf.redu...
code_fim
hard
{ "lang": "python", "repo": "GongFuXiong/Chinese-Medical-Question-Answering-System", "path": "/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GongFuXiong/Chinese-Medical-Question-Answering-System path: /utils.py import tensorflow as tf # ----------------------------- cal attention ------------------------------- # input_q, input_a (batch_size, rnn_size, seq_len) def cal_attention(input_q, input_a, U): batch_size = int(input_q.get_...
code_fim
hard
{ "lang": "python", "repo": "GongFuXiong/Chinese-Medical-Question-Answering-System", "path": "/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # the target function zero = tf.fill(tf.shape(ori_cand), 0.0) margin = tf.fill(tf.shape(ori_cand), 0.1) with tf.name_scope("loss"): losses = tf.maximum(zero, tf.subtract(margin, tf.subtract(ori_cand, ori_neg))) # 修改过 loss = tf.reduce_sum(losses) # cal accurancy w...
code_fim
medium
{ "lang": "python", "repo": "GongFuXiong/Chinese-Medical-Question-Answering-System", "path": "/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: godatadriven/whirl path: /examples/localhost-ssh-example/dag.py from datetime import timedelta, datetime from airflow import DAG from airflow.providers.ssh.operators.ssh import SSHOperator <|fim_suffix|>ssh_copy = SSHOperator( ssh_conn_id='local_ssh', task_id='test_ssh_operator', com...
code_fim
hard
{ "lang": "python", "repo": "godatadriven/whirl", "path": "/examples/localhost-ssh-example/dag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dag = DAG(dag_id='whirl-local-ssh-example', default_args=default_args, schedule_interval='@once', dagrun_timeout=timedelta(seconds=120)) ssh_copy = SSHOperator( ssh_conn_id='local_ssh', task_id='test_ssh_operator', command="cp /opt/airflow/airflow.cfg /tmp/copied...
code_fim
medium
{ "lang": "python", "repo": "godatadriven/whirl", "path": "/examples/localhost-ssh-example/dag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ssh_copy = SSHOperator( ssh_conn_id='local_ssh', task_id='test_ssh_operator', command="cp /opt/airflow/airflow.cfg /tmp/copied_airflow.cfg", dag=dag)<|fim_prefix|># repo: godatadriven/whirl path: /examples/localhost-ssh-example/dag.py from datetime import timedelta, datetime from airflow ...
code_fim
hard
{ "lang": "python", "repo": "godatadriven/whirl", "path": "/examples/localhost-ssh-example/dag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_version(self): import jicgeometry self.assertTrue(isinstance(jicgeometry.__version__, str))<|fim_prefix|># repo: JIC-CSB/jicgeometry path: /tests/basic_unit_tests.py """Do some basic tests.""" import unittest class TestBasics(unittest.TestCase): <|fim_middle|> """Test th...
code_fim
medium
{ "lang": "python", "repo": "JIC-CSB/jicgeometry", "path": "/tests/basic_unit_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # This throws an error if the module cannot be imported. import jicgeometry def test_version(self): import jicgeometry self.assertTrue(isinstance(jicgeometry.__version__, str))<|fim_prefix|># repo: JIC-CSB/jicgeometry path: /tests/basic_unit_tests.py """Do some basic ...
code_fim
easy
{ "lang": "python", "repo": "JIC-CSB/jicgeometry", "path": "/tests/basic_unit_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JIC-CSB/jicgeometry path: /tests/basic_unit_tests.py """Do some basic tests.""" import unittest class TestBasics(unittest.TestCase): """Test the basics of the jicgeometry package.""" def test_import_package(self): <|fim_suffix|> def test_version(self): import jicgeometry ...
code_fim
medium
{ "lang": "python", "repo": "JIC-CSB/jicgeometry", "path": "/tests/basic_unit_tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KyawThuHtun/OpenCV-with-Python path: /coding-exercises-avairds/week1-loading-image/image-properties.py import cv2 as cv # import opencv library import numpy as np # import numpy library <|fim_suffix|>img[50:200, 50:100] = [255, 100, 0] #Modifying pixel cv.imshow("Ronaldo", img) # showing ...
code_fim
hard
{ "lang": "python", "repo": "KyawThuHtun/OpenCV-with-Python", "path": "/coding-exercises-avairds/week1-loading-image/image-properties.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cv.imshow("Ronaldo", img) # showing image in your screen cv.waitKey(0) # Duration of image display cv.destroyAllWindows() # Window Destroy<|fim_prefix|># repo: KyawThuHtun/OpenCV-with-Python path: /coding-exercises-avairds/week1-loading-image/image-properties.py import cv2 as cv # import opencv l...
code_fim
hard
{ "lang": "python", "repo": "KyawThuHtun/OpenCV-with-Python", "path": "/coding-exercises-avairds/week1-loading-image/image-properties.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Accessing image properties print(img.size) print(img.shape) print(img.dtype) img[50:200, 50:100] = [255, 100, 0] #Modifying pixel cv.imshow("Ronaldo", img) # showing image in your screen cv.waitKey(0) # Duration of image display cv.destroyAllWindows() # Window Destroy<|fim_prefix|># repo: KyawTh...
code_fim
medium
{ "lang": "python", "repo": "KyawThuHtun/OpenCV-with-Python", "path": "/coding-exercises-avairds/week1-loading-image/image-properties.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsbischof/photon_correlation path: /python/photon_correlation/GN.py import csv import bz2 import os from .util import is_cross_correlation class GN(object): def __init__(self, filename=None, stream=None, bins=None, counts=None): self._counts = dict() if fil...
code_fim
hard
{ "lang": "python", "repo": "tsbischof/photon_correlation", "path": "/python/photon_correlation/GN.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open_f(filename) as stream_in: return(self.from_stream(csv.reader(stream_in))) def to_file(self, filename): with open(filename, "w") as stream_out: writer = csv.writer(stream_out) for line in self.to_stream(): writer.writerow(l...
code_fim
hard
{ "lang": "python", "repo": "tsbischof/photon_correlation", "path": "/python/photon_correlation/GN.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Plotting the results using matplotlib chromosomes = ["I", "II", "III", "IV", "V", "VI"] fig, axes = plt.subplots(ncols=2, figsize=(12, 4)) axes[0].imshow(counts, cmap="RdBu_r", norm=colors.SymLogNorm(1), extent=(0, len(counts), 0, len(counts))) [axes[0].axhline(i, linewidth=1, color="#...
code_fim
hard
{ "lang": "python", "repo": "hiclib/iced", "path": "/examples/normalization/plot_ice_normalization.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hiclib/iced path: /examples/normalization/plot_ice_normalization.py """ ================================== Normalizing a contact count matrix ================================== This example showcases some basic filtering and normalization. """ import matplotlib.pyplot as plt from matplotlib imp...
code_fim
medium
{ "lang": "python", "repo": "hiclib/iced", "path": "/examples/normalization/plot_ice_normalization.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>axes[0].imshow(counts, cmap="RdBu_r", norm=colors.SymLogNorm(1), extent=(0, len(counts), 0, len(counts))) [axes[0].axhline(i, linewidth=1, color="#000000") for i in lengths.cumsum()] [axes[0].axvline(i, linewidth=1, color="#000000") for i in lengths.cumsum()] axes[0].set_title("Raw contact...
code_fim
hard
{ "lang": "python", "repo": "hiclib/iced", "path": "/examples/normalization/plot_ice_normalization.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>print('Detected the infile ' + input_fastq) print('Prefix is set to ' + OUT_PREFIX) #Preparing output files paired_output_file_name = OUT_PREFIX + "_paired.fastq" paired_output_file = open(paired_output_file_name, "w") paired_output_file.close() paired_output_file = open(paired_output_file_name, "a") u...
code_fim
hard
{ "lang": "python", "repo": "merckey/virID", "path": "/bin/python/process_read_pairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import time import os import errno current_date_time = time.strftime("%c") #if the log_file wasn't input, just print message to screen if log_file == '': print(message) print(current_date_time) return None #Make the log file directory if necessary ...
code_fim
hard
{ "lang": "python", "repo": "merckey/virID", "path": "/bin/python/process_read_pairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: merckey/virID path: /bin/python/process_read_pairs.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 31 12:13:08 2019 @author: jnom """ import argparse import os import time import pathlib print('The purpose of this script is to take read files and split them into 1) pa...
code_fim
hard
{ "lang": "python", "repo": "merckey/virID", "path": "/bin/python/process_read_pairs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while contents_chunk: try: block = self.blocks[-1] try: # This can fail because either (1) all the pages in block have been # used or (2) object index has been exhausted. block.update_obj(conten...
code_fim
hard
{ "lang": "python", "repo": "opendata-stuttgart/airrohr-firmware-flasher", "path": "/spiffsGen/spiffsgen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: opendata-stuttgart/airrohr-firmware-flasher path: /spiffsGen/spiffsgen.py self.span_ix_len = span_ix_len self.packed = packed self.aligned = aligned self.obj_name_len = obj_name_len self.meta_len = meta_len self.page_ix_len = page_ix_len self....
code_fim
hard
{ "lang": "python", "repo": "opendata-stuttgart/airrohr-firmware-flasher", "path": "/spiffsGen/spiffsgen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.is_full(): raise SpiffsFullError('the image size has been exceeded') block = SpiffsBlock(len(self.blocks), self.blocks_lim, self.build_config) self.blocks.append(block) self.remaining_blocks -= 1 return block def is_full(self): retu...
code_fim
hard
{ "lang": "python", "repo": "opendata-stuttgart/airrohr-firmware-flasher", "path": "/spiffsGen/spiffsgen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eteq/astropy path: /astropy/io/misc/asdf/setup_package.py # Licensed under a 3-clause BSD style license import os def get_package_data(): <|fim_suffix|> # In the package directory, install to the subdirectory 'schemas' schemas = [os.path.join('schemas', s) for s in schemas] return {'...
code_fim
hard
{ "lang": "python", "repo": "eteq/astropy", "path": "/astropy/io/misc/asdf/setup_package.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # In the package directory, install to the subdirectory 'schemas' schemas = [os.path.join('schemas', s) for s in schemas] return {'astropy.io.misc.asdf': schemas}<|fim_prefix|># repo: eteq/astropy path: /astropy/io/misc/asdf/setup_package.py # Licensed under a 3-clause BSD style license impo...
code_fim
hard
{ "lang": "python", "repo": "eteq/astropy", "path": "/astropy/io/misc/asdf/setup_package.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>orders = ['daisies', 'periwinkle', 'tulips', 'roses'] orders.append('juli') print(orders)<|fim_prefix|># repo: StyvenSoft/degree-python path: /Lesson4_ListinPython/6-ListAppend.py # Podemos agregar un solo elemento a una lista usando .append () empty_list = [] empty_list.append(1) print(empty_list) #...
code_fim
medium
{ "lang": "python", "repo": "StyvenSoft/degree-python", "path": "/Lesson4_ListinPython/6-ListAppend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StyvenSoft/degree-python path: /Lesson4_ListinPython/6-ListAppend.py # Podemos agregar un solo elemento a una lista usando .append () empty_list = [] empty_list.append(1) print(empty_list) # [1] <|fim_suffix|>orders = ['daisies', 'periwinkle', 'tulips', 'roses'] orders.append('juli') print(o...
code_fim
medium
{ "lang": "python", "repo": "StyvenSoft/degree-python", "path": "/Lesson4_ListinPython/6-ListAppend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass elif m and not data: data.append(m.group()) elif not m: pass data.append(subject.text) writer.writerow(data) name = os.path.splitext(sys.argv[1])[0] writeCSV(name) print('Spreadsheet created.')<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "fsulib/metadataWorkflowResources", "path": "/pullTags/csvRelationships.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fsulib/metadataWorkflowResources path: /pullTags/csvRelationships.py import xml.etree.ElementTree as ET import csv import sys import os import re def writeCSV(fileName): purl = re.compile('((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)') pid = re.compile('fsu:[0-9]*') header ...
code_fim
hard
{ "lang": "python", "repo": "fsulib/metadataWorkflowResources", "path": "/pullTags/csvRelationships.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spac3lord/eip path: /LoanBroker/AwsStepFunctions/PubSub/GetAggregate.py import boto3 import json import logging logger = logging.getLogger() logger.setLevel(logging.INFO) <|fim_suffix|>def lambda_handler(event, context): logger.info(event) key = event['Id'] table = dynamo.Table('MortgageQ...
code_fim
easy
{ "lang": "python", "repo": "spac3lord/eip", "path": "/LoanBroker/AwsStepFunctions/PubSub/GetAggregate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def lambda_handler(event, context): logger.info(event) key = event['Id'] table = dynamo.Table('MortgageQuotes') record = table.get_item(Key={'Id': key }, ConsistentRead=True) if 'Item' in record: return {'Quotes' : record['Item']['Quotes'] } else: logger.info("No aggregate for key %s" ...
code_fim
easy
{ "lang": "python", "repo": "spac3lord/eip", "path": "/LoanBroker/AwsStepFunctions/PubSub/GetAggregate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joliebig/featurehouse_fstmerge_examples path: /eXe/rev3426-3500/left-trunk-3500/twisted/cred/__init__.py """ Twisted Cred Support for verifying credentia<|fim_suffix|>wn as the module twisted.internet.passport.) """<|fim_middle|>ls, and providing services to users based on those credentials. (Thi...
code_fim
medium
{ "lang": "python", "repo": "joliebig/featurehouse_fstmerge_examples", "path": "/eXe/rev3426-3500/left-trunk-3500/twisted/cred/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>wn as the module twisted.internet.passport.) """<|fim_prefix|># repo: joliebig/featurehouse_fstmerge_examples path: /eXe/rev3426-3500/left-trunk-3500/twisted/cred/__init__.py """ Twisted Cred Support for verifying credentials, and providing services to users based on tho<|fim_middle|>se credentials. (Thi...
code_fim
easy
{ "lang": "python", "repo": "joliebig/featurehouse_fstmerge_examples", "path": "/eXe/rev3426-3500/left-trunk-3500/twisted/cred/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: syntheticgio/vcf_window_tracker path: /windower.py #!/usr/bin/python import pyvcf import argparse import pysam import csv # import _thread # import threading WINDOW_SIZE = 10000 CHROMOSOMES = [249250621, 243199373, 198022430, 191154276, 180915260, 171115067, 159138663, 146364022, 141213431, 135...
code_fim
hard
{ "lang": "python", "repo": "syntheticgio/vcf_window_tracker", "path": "/windower.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i = 0 for vcf in vcf_list: i += 1 vcf_data = vcf.Reader(filename=vcf) # Create windows create_windows(vcf_data) # thread1 = myThread(i, "Thread-{}".format(i)) if __name__ == "__main__": parser = argparse.ArgumentParser(description='Process VCF file.'...
code_fim
hard
{ "lang": "python", "repo": "syntheticgio/vcf_window_tracker", "path": "/windower.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> todo.mark_as_invalid('Todo does not refer to an allowed version.') return False<|fim_prefix|># repo: wolfgangmuender/InspectorTodo path: /src/inspectortodo/validator/versions_validator.py from .base_validator import BaseValidator class VersionsValidator(BaseValidator): def __init__...
code_fim
hard
{ "lang": "python", "repo": "wolfgangmuender/InspectorTodo", "path": "/src/inspectortodo/validator/versions_validator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wolfgangmuender/InspectorTodo path: /src/inspectortodo/validator/versions_validator.py from .base_validator import BaseValidator class VersionsValidator(BaseValidator): <|fim_suffix|> super().__init__() if current_version in versions: self.allowed_versions = versions...
code_fim
hard
{ "lang": "python", "repo": "wolfgangmuender/InspectorTodo", "path": "/src/inspectortodo/validator/versions_validator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> file = open("izhikevich1/{0}_{1}.dat".format(name, index), 'rb') data = numpy.load(file) return (data, file) def plot_sim(name, index): from scipy import stats data, file = load_sim_data(name, index) figure(figsize=(12,12)) suptitle("Duration: {0}, Input: {1}, Connectivity: {2...
code_fim
hard
{ "lang": "python", "repo": "HaoWillSi/learnability", "path": "/izhikevich1.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HaoWillSi/learnability path: /izhikevich1.py #!/usr/bin/env python # -*- coding: utf-8 -*- from lif import * from syn import * from da_stdp import * timestep = 1.0*ms neuron_count = 1000 excitatory_count = 800 minimum_excitatory_weight = 0.0 maximum_excitatory_weight = 0.75 inhibitory_weight = -...
code_fim
hard
{ "lang": "python", "repo": "HaoWillSi/learnability", "path": "/izhikevich1.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> from multiprocessing import Pool pool = Pool(processes=4) pool.map(fn, inputs) pool.close() pool.join() from functools import partial return partial(easy_parallelize, fn) def packed_run_sim(packed_args): run_sim(*packed_args) run_sim.parallel = parallel...
code_fim
hard
{ "lang": "python", "repo": "HaoWillSi/learnability", "path": "/izhikevich1.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>class UDPListen(IListen): def __init__(self, addr=('0.0.0.0', 0)): # listeners are all couroutines waiting for a connections self.listeners = deque() self.conns = {} self.uv = uv_server() self.task = getcurrent() self.listening = False self.han...
code_fim
hard
{ "lang": "python", "repo": "wangkai2014/flower", "path": "/flower/net/udp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # emit last message conn.queue.append(msg) if conn.cr.balance < 0: # someone is waiting, return last message conn.cr.send(self.queue.popleft()) elif len(self.listeners): listener = self.lis...
code_fim
hard
{ "lang": "python", "repo": "wangkai2014/flower", "path": "/flower/net/udp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangkai2014/flower path: /flower/net/udp.py # -*- coding: utf-8 - # # This file is part of flower. See the NOTICE for more information. from collections import deque from flower.core import channel, schedule, getcurrent, bomb from flower.core.uv import uv_server from flower.net.base import List...
code_fim
hard
{ "lang": "python", "repo": "wangkai2014/flower", "path": "/flower/net/udp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("The minimum sepal width in cm is:", numpy.min(sepal_width)) print("The maximum sepal width in cm is:", numpy.max(sepal_width)) print("The mean sepal width in cm is:", numpy.mean(sepal_width)) print("The median sepal width in cm is:", numpy.median(sepal_width)) # The 3rd column is the petal le...
code_fim
hard
{ "lang": "python", "repo": "jruther/Programming-Project_2018", "path": "/roughwork.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jruther/Programming-Project_2018 path: /roughwork.py # roughwork sheet used while running various coding exercises for Iris poject import matplotlib.pyplot as mp mp.hist(firstcol) mp.show() # Justin Rutherford 10.4.18 # running some investigations on the Iris data set import numpy ...
code_fim
hard
{ "lang": "python", "repo": "jruther/Programming-Project_2018", "path": "/roughwork.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("The minimum petal width in cm is:", numpy.min(petal_width)) print("The maximum petal width in cm is:", numpy.max(petal_width)) print("The mean petal width in cm is:", numpy.mean(petal_width)) print("The median petal width in cm is:", numpy.median(petal_width)) # Now we have the comprehensive ...
code_fim
hard
{ "lang": "python", "repo": "jruther/Programming-Project_2018", "path": "/roughwork.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super().__init__() self.logger = logging.getLogger("tamarco.memory_analyzer") self.memory_watcher_task = None async def start(self): self.logger.info(f"Starting Memory Analyzer resource") self.memory_watcher_task = asyncio.ensure_future(...
code_fim
medium
{ "lang": "python", "repo": "System73/tamarco", "path": "/tamarco/resources/debug/memory_analizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def stop(self): self.logger.info(f"Stopping Memory Analyzer resource") self.memory_watcher_task.cancel() async def memory_watcher(self): try: while True: await self.objgraph_save() await asyncio.sleep(TIME_BETWEEN_SNAPSHOTS...
code_fim
hard
{ "lang": "python", "repo": "System73/tamarco", "path": "/tamarco/resources/debug/memory_analizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: System73/tamarco path: /tamarco/resources/debug/memory_analizer.py import asyncio import datetime import logging import objgraph from tamarco.core.patterns import Singleton from tamarco.resources.bases import BaseResource TIME_BETWEEN_SNAPSHOTS = 30 class MemoryAnalyzerResource(BaseResource,...
code_fim
medium
{ "lang": "python", "repo": "System73/tamarco", "path": "/tamarco/resources/debug/memory_analizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>MOS65XX_INS_INVALID = 0 MOS65XX_INS_ADC = 1 MOS65XX_INS_AND = 2 MOS65XX_INS_ASL = 3 MOS65XX_INS_BBR = 4 MOS65XX_INS_BBS = 5 MOS65XX_INS_BCC = 6 MOS65XX_INS_BCS = 7 MOS65XX_INS_BEQ = 8 MOS65XX_INS_BIT = 9 MOS65XX_INS_BMI = 10 MOS65XX_INS_BNE = 11 MOS65XX_INS_BPL = 12 MOS65XX_INS_BRA = 13 MOS65XX_INS_BRK = ...
code_fim
hard
{ "lang": "python", "repo": "capstone-engine/capstone", "path": "/bindings/python/capstone/mos65xx_const.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: capstone-engine/capstone path: /bindings/python/capstone/mos65xx_const.py from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_FP, CS_OP_PRED, CS_OP_SPECIAL, CS_OP_MEM # For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [mos65xx_const.py] MOS65XX_REG_INVALID = 0 MOS65XX_REG_ACC = 1 MOS65...
code_fim
hard
{ "lang": "python", "repo": "capstone-engine/capstone", "path": "/bindings/python/capstone/mos65xx_const.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: richardkefa/News_Articales path: /app/__init__.py from flask import Flask from config import config_options def creat_app(config_name): <|fim_suffix|> #setting config from .requests import Configure_request Configure_request(app) return app<|fim_middle|> #initializing application app...
code_fim
hard
{ "lang": "python", "repo": "richardkefa/News_Articales", "path": "/app/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #setting config from .requests import Configure_request Configure_request(app) return app<|fim_prefix|># repo: richardkefa/News_Articales path: /app/__init__.py from flask import Flask from config import config_options <|fim_middle|>def creat_app(config_name): #initializing application app...
code_fim
hard
{ "lang": "python", "repo": "richardkefa/News_Articales", "path": "/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikelikespie/blogofile path: /blogofile/util.py import re import os import urlparse import logging import pygments import pygments.formatters import pygments.lexers import pygments.util import config logger = logging.getLogger("blogofile.util") SLASHFIX = re.compile(r'/+') html_escape_table ...
code_fim
hard
{ "lang": "python", "repo": "mikelikespie/blogofile", "path": "/blogofile/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """See if a given path matches the ignore patterns""" for p in config.compiled_ignore_patterns: if p.match(path): return True return False def mkdir(newdir): """works the way a good mkdir should :) - already exists, silently complete - regular file in the way, ...
code_fim
hard
{ "lang": "python", "repo": "mikelikespie/blogofile", "path": "/blogofile/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: makepath/xarray-spatial path: /xrspatial/tests/test_terrain.py import dask.array as da import numpy as np import xarray as xr from xrspatial import generate_terrain from xrspatial.tests.general_checks import cuda_and_cupy_available from xrspatial.utils import has_cuda_and_cupy def create_test_...
code_fim
hard
{ "lang": "python", "repo": "makepath/xarray-spatial", "path": "/xrspatial/tests/test_terrain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # vanilla numpy version data_numpy = create_test_arr() terrain_numpy = generate_terrain(data_numpy) # cupy data_cupy = create_test_arr(backend='cupy') terrain_cupy = generate_terrain(data_cupy) np.testing.assert_allclose(terrain_numpy.data, terrain_cupy.data.get(), rtol=1e-05...
code_fim
hard
{ "lang": "python", "repo": "makepath/xarray-spatial", "path": "/xrspatial/tests/test_terrain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: corenel/jetson-inference path: /python/examples/detectnet-camera.py #!/usr/bin/python # # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Softw...
code_fim
hard
{ "lang": "python", "repo": "corenel/jetson-inference", "path": "/python/examples/detectnet-camera.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print the detections print("detected {:d} objects in image".format(len(detections))) for detection in detections: print(detection) # render the image display.RenderOnce(img, width, height) # update the title bar display.SetTitle("{:s} | Network {:.0f} FPS".format(opt.network, net.GetNetworkF...
code_fim
hard
{ "lang": "python", "repo": "corenel/jetson-inference", "path": "/python/examples/detectnet-camera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># process frames until user exits while display.IsOpen(): # capture the image img, width, height = camera.CaptureRGBA() # detect objects in the image (with overlay) detections = net.Detect(img, width, height, opt.overlay) # print the detections print("detected {:d} objects in image".format(len(det...
code_fim
hard
{ "lang": "python", "repo": "corenel/jetson-inference", "path": "/python/examples/detectnet-camera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class BaseSparsityAlgoController(CompressionAlgorithmController): def __init__(self, target_model: NNCFNetwork, sparsified_module_info: List[SparseModuleInfo]): super().__init__(target_model) self.sparsified_module_info = sparsified_module_info def freeze(self): ...
code_fim
hard
{ "lang": "python", "repo": "DmitriySidnev/openvino_training_extensions", "path": "/pytorch_toolkit/nncf/nncf/sparsity/base_algo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DmitriySidnev/openvino_training_extensions path: /pytorch_toolkit/nncf/nncf/sparsity/base_algo.py """ Copyright (c) 2019-2020 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 cop...
code_fim
hard
{ "lang": "python", "repo": "DmitriySidnev/openvino_training_extensions", "path": "/pytorch_toolkit/nncf/nncf/sparsity/base_algo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sparsified_weights_count = self.sparsified_weights_count for minfo in self.sparsified_module_info: drow = {h: 0 for h in header} drow["Name"] = minfo.module_name drow["Weight's Shape"] = list(minfo.module.weight.size()) mask = minfo.operand....
code_fim
hard
{ "lang": "python", "repo": "DmitriySidnev/openvino_training_extensions", "path": "/pytorch_toolkit/nncf/nncf/sparsity/base_algo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: blockspacer/RLBots path: /RLBotPythonExample-master/Test2/Test2.py obj.acceleration_world[0], obj.acceleration_world[1], obj.acceleration_world[2], obj.coordinate_system.Qcar_to_world, obj.control_variables.boost, obj.control_variables.torques[0], obj...
code_fim
hard
{ "lang": "python", "repo": "blockspacer/RLBots", "path": "/RLBotPythonExample-master/Test2/Test2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> controller = con.Controller() controller.throttle = 0.5 controller.steer = 0.75 k_min, k_actual = DrivingEquations.get_turning_radius(self.car, controller) # print('k_min', k_min, 'k_actual', k_actual, 'omegaz', self.car.wz, 'vel_mag', np.linalg.norm(self.car.veloci...
code_fim
hard
{ "lang": "python", "repo": "blockspacer/RLBots", "path": "/RLBotPythonExample-master/Test2/Test2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blockspacer/RLBots path: /RLBotPythonExample-master/Test2/Test2.py .sx_star, self.sz_star, self.ball_sx, self.ball_sz, self.ball_vz, self.pitch_star = self.optimizer.optimize2D(self.s_ti, self.s_tf, self.v_ti, self.v_tf, self.r_ti, self.omega_ti, self.ball_si, self.ball_vi) # self.t_s...
code_fim
hard
{ "lang": "python", "repo": "blockspacer/RLBots", "path": "/RLBotPythonExample-master/Test2/Test2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ^ SyntaxError: invalid syntax >>> os.system('clear') 0 >>> def product_of_two_numbers(a,b) File "<stdin>", line 1 def product_of_two_numbers(a,b) ^ SyntaxError: invalid syntax >>> def product_of_two_numbers(a,b): ... print(a * b) ... >>> product_of_t...
code_fim
hard
{ "lang": "python", "repo": "ajbd2106/learn-programming-with-python-", "path": "/00-python-shell/Section2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ^ IndentationError: expected an indented block >>> def _1print(): ... print("test") ... >>> for i in range(1,11) File "<stdin>", line 1 for i in range(1,11) ^ SyntaxError: invalid syntax >>> for i in range(1,11): ... print(i) ... 1 2 3 4 5 6 7 8 9 10 >>> def def()...
code_fim
hard
{ "lang": "python", "repo": "ajbd2106/learn-programming-with-python-", "path": "/00-python-shell/Section2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajbd2106/learn-programming-with-python- path: /00-python-shell/Section2.py Last login: Mon May 14 15:45:09 on ttys003 Rangas-MacBook-Pro:~ rangaraokaranam$ python3 Python 3.6.5 (default, Mar 30 2018, 06:42:10) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin Type "help", "cop...
code_fim
hard
{ "lang": "python", "repo": "ajbd2106/learn-programming-with-python-", "path": "/00-python-shell/Section2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return heading def _create_test_func(nb_name, nb_path, clearoutput=True): """ Create str with test function to write to the test module. Parameters ---------- nb_name : str name of the notebook. nb_path : str relative path to the notebook. clearoutput : b...
code_fim
hard
{ "lang": "python", "repo": "MAMBA-python/course-material", "path": "/autotest/create_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MAMBA-python/course-material path: /autotest/create_tests.py # -*- coding: utf-8 -*- """ Created on Wed Apr 29 13:04:21 2020 @author: onno_ """ import os import sys # These notebooks are excluded because they contain errors on purpose _exclude_nb_list = [ 'use_Jupyter.ipynb', 'py_explo...
code_fim
hard
{ "lang": "python", "repo": "MAMBA-python/course-material", "path": "/autotest/create_tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def load_recovered_key_shares(self, poll_timeout=1.0): eventFilter = None # will terminate as soon as key_shares for while len(self.key_shares) < len(self.qualified_nodes): if eventFilter is None: eventFilter = self.contract.events.KeyShareRecovery.c...
code_fim
hard
{ "lang": "python", "repo": "fakke-xll/EthDKG", "path": "/ethdkg/ethnode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if disputes is None: disputes = super().compute_disputes() txs = {} for issuer, dispute in disputes.items(): shared_key = point_to_eth(dispute[0]) shared_key_correctness_proof = dispute[1] receivers = (node for node in self.nodes if n...
code_fim
hard
{ "lang": "python", "repo": "fakke-xll/EthDKG", "path": "/ethdkg/ethnode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fakke-xll/EthDKG path: /ethdkg/ethnode.py import math import time from typing import List, Tuple from .node import Node from .crypto import PointG1, PointG2, FQ, FQ2, G1, H1, normalize from . import utils from . import crypto from . import logging def point_to_eth(p: PointG1) -> Tuple[int, in...
code_fim
hard
{ "lang": "python", "repo": "fakke-xll/EthDKG", "path": "/ethdkg/ethnode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }