text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: mathybit/dash-login path: /auth.py import base64 from flask_login import UserMixin import hashlib import json import random import smtplib import ssl import string import uuid AUTH_CONFIG_FILE = "./config/auth.json" USERS_FILE = "./config/userdb.json" with open(AUTH_CONFIG_FILE) as f: config =...
code_fim
hard
{ "lang": "python", "repo": "mathybit/dash-login", "path": "/auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def QuantityTypeClassFactory(unit): class QuantityType(TypeDecorator): """ Custom type to handle `~astropy.units.Quantity` objects. """ impl = REAL def process_bind_param(self, value, dialect): if isinstance(value, Quantity): return value.to(unit)....
code_fim
medium
{ "lang": "python", "repo": "adrn/TwoFace", "path": "/twoface/db/quantity_type.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adrn/TwoFace path: /twoface/db/quantity_type.py # Third-party from sqlalchemy.types import TypeDecorator, REAL from astropy.units import Quantity __all__ = ['QuantityTypeClassFactory'] def QuantityTypeClassFactory(unit): <|fim_suffix|> impl = REAL def process_bind_param(self, va...
code_fim
medium
{ "lang": "python", "repo": "adrn/TwoFace", "path": "/twoface/db/quantity_type.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juryowl/hypothesis path: /hypothesis/diagnostic/density.py import hypothesis import numpy as np import torch from hypothesis.diagnostic import BaseDiagnostic from scipy.integrate import nquad <|fim_suffix|> def __init__(self, space, epsilon=0.1): super(DensityDiagnostic, self).__i...
code_fim
medium
{ "lang": "python", "repo": "juryowl/hypothesis", "path": "/hypothesis/diagnostic/density.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.areas = [] self.results = [] def test(self, function): area, _ = nquad(function, self.space) passed = abs(1 - area) <= self.epsilon self.areas.append(area) self.results.append(passed) return passed<|fim_prefix|># repo: juryowl/hypothesis ...
code_fim
hard
{ "lang": "python", "repo": "juryowl/hypothesis", "path": "/hypothesis/diagnostic/density.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> area, _ = nquad(function, self.space) passed = abs(1 - area) <= self.epsilon self.areas.append(area) self.results.append(passed) return passed<|fim_prefix|># repo: juryowl/hypothesis path: /hypothesis/diagnostic/density.py import hypothesis import numpy as np impo...
code_fim
hard
{ "lang": "python", "repo": "juryowl/hypothesis", "path": "/hypothesis/diagnostic/density.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: peterSW/transclip path: /test/test_transclip.py #!/usr/bin/env python import unittest from transclip import transclip from transactions import Transaction from transactions import TransactionFormat class TestSingleTransaction(unittest.TestCase): def setUp(self): self.transaction1 =...
code_fim
hard
{ "lang": "python", "repo": "peterSW/transclip", "path": "/test/test_transclip.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(self.transaction1.credit, transclip(self.text).credit) def test_extract_balance(self): self.assertEqual(self.transaction1.balance, transclip(self.text).balance) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: peterSW/transclip path: /test...
code_fim
hard
{ "lang": "python", "repo": "peterSW/transclip", "path": "/test/test_transclip.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dsbaule/INE5452 path: /Simulado 02/URI/06 - Level Order Tree Traversal.py class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert(self, value): if self.value >= value: self.insert_left(value) ...
code_fim
hard
{ "lang": "python", "repo": "Dsbaule/INE5452", "path": "/Simulado 02/URI/06 - Level Order Tree Traversal.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tree = None numbers = [int(x) for x in input().split()] for number in numbers: if tree == None: tree = Node(number) else: tree.insert(number) output_string = '' node_queue = [tree] while len(node_queu...
code_fim
hard
{ "lang": "python", "repo": "Dsbaule/INE5452", "path": "/Simulado 02/URI/06 - Level Order Tree Traversal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#Total Revenue: total_revenue = purchase_data["Price"].sum() print(total_revenue) #Data Frame: purchasing_analysis = pd.DataFrame({"Number of Unique Items": [count_unique_items_df], "Average Price": [average_price], "Number of Purc...
code_fim
hard
{ "lang": "python", "repo": "jennifermarie6sl/pandas-challenge", "path": "/HeroesOfPymoli/HeroesOfPymoli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#calc total: Total Count grouped_by_gender = drop_dupes_df.groupby("Gender") #Calcs: total_gender = grouped_by_gender.count()["SN"].values #total_gender summed_gender = total_gender.sum() #summed_gender percent_per_gender = (total_gender / summed_gender) *100 #percent_per_gender #DataFrame Appending and...
code_fim
hard
{ "lang": "python", "repo": "jennifermarie6sl/pandas-challenge", "path": "/HeroesOfPymoli/HeroesOfPymoli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jennifermarie6sl/pandas-challenge path: /HeroesOfPymoli/HeroesOfPymoli.py import pandas as pd import os # File to Load (Remember to Change These) file_to_load = os.path.join(".", "Desktop", "pandas-challenge", "HeroesOfPymoli", "Resources", "purchase_data.csv") # Read Purchasing File and store ...
code_fim
hard
{ "lang": "python", "repo": "jennifermarie6sl/pandas-challenge", "path": "/HeroesOfPymoli/HeroesOfPymoli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tejasvaidhyadev/covid-twitter-sentiment-classification path: /interactive.py "Evaluate the model""" import os import json import torch import random import logging import argparse import numpy as np import util as util from torch.utils.data import DataLoader, RandomSampler, SequentialSampler from...
code_fim
hard
{ "lang": "python", "repo": "tejasvaidhyadev/covid-twitter-sentiment-classification", "path": "/interactive.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dataloader_tester = DataLoader(dataset_test, sampler=SequentialSampler(dataset_test), batch_size=1) result = interAct(model, encoded_query, dataloader_tester, params_runtime, args) return result def main(): model = ...
code_fim
hard
{ "lang": "python", "repo": "tejasvaidhyadev/covid-twitter-sentiment-classification", "path": "/interactive.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def BertNerResponse(model, queryString): model, params_runtime, tokenizer,args = model # tokenzing query with open('experiment/interactive/sentences.txt', 'w') as f: f.write(queryString) encoded_query = tokenizer.batch_encode_plus( [queryString,], add_special_toke...
code_fim
hard
{ "lang": "python", "repo": "tejasvaidhyadev/covid-twitter-sentiment-classification", "path": "/interactive.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JiangHongSh/TestGit path: /2018-11-19/yahoo/html_parser.py # -*- coding: utf-8 -*- import re import urllib.parse from urllib import parse from bs4 import BeautifulSoup class HtmlParser(object): <|fim_suffix|> if page_url is None or html_cont is None: return soup = Beau...
code_fim
medium
{ "lang": "python", "repo": "JiangHongSh/TestGit", "path": "/2018-11-19/yahoo/html_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_new_data(self, page_url, soup): res_data={} res_data['url']=page_url title_node=soup.find('header').find("h1") res_data['title']=title_node.get_text() summary_node = soup.findAll('p') res_data['summary']=summary_node img_node = soup.find...
code_fim
hard
{ "lang": "python", "repo": "JiangHongSh/TestGit", "path": "/2018-11-19/yahoo/html_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> prefix_list = [] links_shortened = {} for filename in [f for f in listdir(mypath) if isfile(join(mypath, f))]: if not filename.startswith("list_"): continue with open(mypath + filename, "r") as f: soup = BeautifulSoup(f.read(), "html.parser") ...
code_fim
hard
{ "lang": "python", "repo": "mattyjones/policy_sentry", "path": "/utils/get_links.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> links_dict = {} for key, value in sorted(links_shortened.items()): links_dict[key] = value with open('./policy_sentry/shared/links.yml', 'w+') as outfile: yaml.dump(links_dict, outfile, default_flow_style=False) outfile.close() if __name__ == '__main__': create_servi...
code_fim
hard
{ "lang": "python", "repo": "mattyjones/policy_sentry", "path": "/utils/get_links.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattyjones/policy_sentry path: /utils/get_links.py #!/usr/bin/env python """ Parses the AWS HTML docs to create a YML file that understands the mapping between services and HTML files. We store the HTML files in this manner so that the user can be more confident in the integrity of the data - tha...
code_fim
hard
{ "lang": "python", "repo": "mattyjones/policy_sentry", "path": "/utils/get_links.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def invoke(self, params): request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" # 二进制方式打开图片文件 access_token = self.getAccessToken() request_url = request_url + "?access_token=" + access_token headers = {'content-type': 'application/x-www-form-ur...
code_fim
hard
{ "lang": "python", "repo": "pengjinfu/douyin_robot", "path": "/common/apiutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pengjinfu/douyin_robot path: /common/apiutil.py # -*- coding: UTF-8 -*- import base64 import requests def setParams(array, key, value): array[key] = value class AiPlatImage(object): def __init__(self, ak, sk): self.ak = ak self.sk = sk self.data = {} se...
code_fim
hard
{ "lang": "python", "repo": "pengjinfu/douyin_robot", "path": "/common/apiutil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def getAccessToken(self): # client_id 为官网获取的AK, client_secret 为官网获取的SK host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=' + self.ak + '&client_secret=' + self.sk response = requests.get(host) if response: return respon...
code_fim
hard
{ "lang": "python", "repo": "pengjinfu/douyin_robot", "path": "/common/apiutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Inria-Asclepios/simul-atrophy path: /scripts/warpAtDifferentScales.py #!/usr/bin/env python import subprocess import sys import argparse as ag import bish_utils as bu def get_input_options(): ''' Command line interface, get user input options. ''' parser = ag.ArgumentParser() par...
code_fim
hard
{ "lang": "python", "repo": "Inria-Asclepios/simul-atrophy", "path": "/scripts/warpAtDifferentScales.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def main(): ''' Warp input image using the input velocity field at different scales. The scales are integrated by considering input field as a SVF and using either forward Euler or scaling and squaring. ''' #executables work_dir = "/user/bkhanal/home/works/" svf_exp = work_...
code_fim
hard
{ "lang": "python", "repo": "Inria-Asclepios/simul-atrophy", "path": "/scripts/warpAtDifferentScales.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if type is not None and os.path.exists(self.path): os.unlink(self.path)<|fim_prefix|># repo: jimkwon/trampoline path: /workflows/snakesupport.py __all__ = ['TemporaryDirectory', 'DeleteOnError'] import tempfile import shutil import os <|fim_middle|>class TemporaryDirectory(object): ...
code_fim
hard
{ "lang": "python", "repo": "jimkwon/trampoline", "path": "/workflows/snakesupport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimkwon/trampoline path: /workflows/snakesupport.py __all__ = ['TemporaryDirectory', 'DeleteOnError'] import tempfile import shutil import os class TemporaryDirectory(object): def __init__(self, dir='.'): self.dir = dir self.path = None def __enter__(self): self...
code_fim
medium
{ "lang": "python", "repo": "jimkwon/trampoline", "path": "/workflows/snakesupport.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, path, opener=None): self.path = path self.opener = opener def __enter__(self): if self.opener is None: return open(self.path, 'wb') else: return self.opener(self.path, 'wb') def __exit__(self, type, value, traceback):...
code_fim
hard
{ "lang": "python", "repo": "jimkwon/trampoline", "path": "/workflows/snakesupport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CCQC/janus path: /janus/janus.py from janus.driver import run_janus import argparse import sys def main(): <|fim_suffix|> print('running janus') print('input file is {}'.format(file_in)) print('output file is {}'.format(file_out)) run_janus(filename=file_in) if __name__ == '__ma...
code_fim
hard
{ "lang": "python", "repo": "CCQC/janus", "path": "/janus/janus.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> sys.stdout = open(file_out, 'w') print('running janus') print('input file is {}'.format(file_in)) print('output file is {}'.format(file_out)) run_janus(filename=file_in) if __name__ == '__main__': main()<|fim_prefix|># repo: CCQC/janus path: /janus/janus.py from janus.driver imp...
code_fim
hard
{ "lang": "python", "repo": "CCQC/janus", "path": "/janus/janus.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print('running janus') print('input file is {}'.format(file_in)) print('output file is {}'.format(file_out)) run_janus(filename=file_in) if __name__ == '__main__': main()<|fim_prefix|># repo: CCQC/janus path: /janus/janus.py from janus.driver import run_janus import argparse import s...
code_fim
hard
{ "lang": "python", "repo": "CCQC/janus", "path": "/janus/janus.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ##### appeding the all the values calcualtes upstairs#### ln = [] Continue = True if Continue: for each in colListForWriting: ...
code_fim
hard
{ "lang": "python", "repo": "CNIC-Proteomics/SHIFTS-update", "path": "/Vertex/Comet_PTM_processingScript.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CNIC-Proteomics/SHIFTS-update path: /Vertex/Comet_PTM_processingScript.py __author__ = "nbagwan" import glob import os import pdb import numpy import all_stats separations = "/" ##### this is the sirst step of shifts, which begins with creating the output folder as per the user input ##### #...
code_fim
hard
{ "lang": "python", "repo": "CNIC-Proteomics/SHIFTS-update", "path": "/Vertex/Comet_PTM_processingScript.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('name', 'value', 'resource') list_filter = ('attribute', 'value') admin.site.register(models.Value, ValueAdmin) class ChangeAdmin(admin.ModelAdmin): list_display = ('id', 'user', 'event', 'resource_name', 'resource_id', 'get_change_at', 'resource_name', 's...
code_fim
hard
{ "lang": "python", "repo": "gmjosack/nsot", "path": "/nsot/admin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gmjosack/nsot path: /nsot/admin.py from __future__ import unicode_literals from custom_user.admin import EmailUserAdmin from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.contrib import admin from django.utils.translation import ugettext_lazy ...
code_fim
hard
{ "lang": "python", "repo": "gmjosack/nsot", "path": "/nsot/admin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class NetworkAdmin(BaseChildAdmin): base_model = models.Network mptt_level_indent = 10 mptt_indent_field = 'cidr' list_display = ('cidr', 'network_address', 'prefix_length', 'ip_version', 'is_ip', 'parent', 'site') list_filter = ('prefix_length', 'is_ip', 'ip_versio...
code_fim
hard
{ "lang": "python", "repo": "gmjosack/nsot", "path": "/nsot/admin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def build_syminfo_lib_cache(lib_path): _syminfo_lib_cache.append(None) for number in range(230): _syminfo_lib_cache.append([]) with open(lib_path) as file_iter: for line in file_iter: l = line.strip() if (l == "begin_spacegroup"): number = None symbols = {} ...
code_fim
hard
{ "lang": "python", "repo": "cctbx/cctbx_project", "path": "/iotbx/mtz/extract_from_symmetry_lib.py", "mode": "spm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_prefix|># repo: cctbx/cctbx_project path: /iotbx/mtz/extract_from_symmetry_lib.py from __future__ import absolute_import, division, print_function from cctbx import sgtbx import libtbx.load_env import os.path as op from six.moves import range if (libtbx.env.has_module("ccp4io")): for _ in ["libccp4/data", "da...
code_fim
hard
{ "lang": "python", "repo": "cctbx/cctbx_project", "path": "/iotbx/mtz/extract_from_symmetry_lib.py", "mode": "psm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_suffix|> d = tmp_path / "table" d.mkdir() path = str(d / f"t_{str(t_ref)}_{poly_trend}{ext}") samples.write(path) samples2 = JokerSamples.read(path) assert samples2.poly_trend == samples.poly_trend if t_ref is not None: assert np.allclose(samples2.t_ref.mjd, samples.t_ref.mjd) ...
code_fim
hard
{ "lang": "python", "repo": "adrn/thejoker", "path": "/thejoker/tests/test_samples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k in samples.par_names: assert u.allclose(samples2[k], samples[k]) def _get_dtype_compare_cases(): d1s = [] d2s = [] evals = [] # True d1 = [{'name': 'P', 'unit': 'd', 'datatype': 'float64'}, {'name': 'e', 'datatype': 'float64'}, {'name': 'omega',...
code_fim
hard
{ "lang": "python", "repo": "adrn/thejoker", "path": "/thejoker/tests/test_samples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adrn/thejoker path: /thejoker/tests/test_samples.py # Third-party from astropy.time import Time import astropy.units as u from astropy.tests.helper import quantity_allclose import h5py import numpy as np import pytest # Project from ..samples import JokerSamples from ..samples_helpers import _cu...
code_fim
hard
{ "lang": "python", "repo": "adrn/thejoker", "path": "/thejoker/tests/test_samples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dot %.0f =%.0f'%(beta,K_vk,K_pok,K_ok,K_p)<|fim_prefix|># repo: shlopack/cursovaya path: /template/4_15.py template = 'K_{\\text{П}}=\\beta \cdot K_{\\text{ВК}} \cdot K_{\\text{ПОК}} \cdot K_<|fim_middle|>{\\text{OK}}=%.4f \cdot %.1f \cdot %.0f \c
code_fim
easy
{ "lang": "python", "repo": "shlopack/cursovaya", "path": "/template/4_15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shlopack/cursovaya path: /template/4_15.py template = 'K_{\\text{П}}=\\beta \cdot K_{<|fim_suffix|>dot %.0f =%.0f'%(beta,K_vk,K_pok,K_ok,K_p)<|fim_middle|>\\text{ВК}} \cdot K_{\\text{ПОК}} \cdot K_{\\text{OK}}=%.4f \cdot %.1f \cdot %.0f \c
code_fim
medium
{ "lang": "python", "repo": "shlopack/cursovaya", "path": "/template/4_15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shlopack/cursovaya path: /template/4_15.py template = 'K_{\\text{П}}=\\beta \cdot K_{\\text{ВК}} \cdot K_{\\text{ПОК}} \cdot K_<|fim_suffix|>dot %.0f =%.0f'%(beta,K_vk,K_pok,K_ok,K_p)<|fim_middle|>{\\text{OK}}=%.4f \cdot %.1f \cdot %.0f \c
code_fim
easy
{ "lang": "python", "repo": "shlopack/cursovaya", "path": "/template/4_15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pymag09/magnet path: /config/plugins/consul/consul.py import sys from os import environ try: import consul except ImportError as e: print('Required module is missing. Use "pip3 install python-consul" to resolve the problem.') sys.exit(1) import configparser class PluginConfigNotFoun...
code_fim
hard
{ "lang": "python", "repo": "pymag09/magnet", "path": "/config/plugins/consul/consul.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for dc in self.load_all_data_consul(): index, nodes = self.consul_api.catalog.nodes(dc=dc) for node in nodes: node_index, node_data = self.consul_api.catalog.node(node['Node'], dc=dc) key = "%s/%s/%s" % ("ansible/groups", dc, node['Node']) ...
code_fim
hard
{ "lang": "python", "repo": "pymag09/magnet", "path": "/config/plugins/consul/consul.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: linyc74/lstm_dna path: /lstm_dna/annotate.py import numpy as np from typing import List, Tuple, Optional from ngslite import Chromosome, FeatureArray, GenericFeature, translate, rev_comp from lstm_dna.predictor import Predictor class DNARegion: min_orf_coverage = 0.9 start_codons = ('A...
code_fim
hard
{ "lang": "python", "repo": "linyc74/lstm_dna", "path": "/lstm_dna/annotate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> regions = self.correct_regions( regions=regions, dna=dna) features = regions_to_features( regions=regions, seqname=self.seqname, genome_size=len(dna) ) return features def get_forward_features(self) -> Featu...
code_fim
hard
{ "lang": "python", "repo": "linyc74/lstm_dna", "path": "/lstm_dna/annotate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Colocar la funcion que comienza el plot x = [1,2,3,4,5] y = [2,4,6,8,10] ax = self.graph_1.figure.add_subplot(111) ax.plot(x,y) self.graph_1.draw() ax = self.graph_2.figure.add_subplot(111) y = [1,4,9,16,25] ax.plot(x,y) self...
code_fim
medium
{ "lang": "python", "repo": "ChristianDosSantos/Proyectos_2", "path": "/Proyecto_2/GUI/Sensor_gui_2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def tick (self): self.textBrowser_i.setText("X Axis = 0.00") #self.textBrowser_i.append("0.00") self.textBrowser_i.setFont(QtGui.QFont("Ubuntu Medium Bold",18)) #self.textBrowser_2.setText(ValueB) self.textBrowser_2.append("0.00") self.textBrowser_2.setF...
code_fim
hard
{ "lang": "python", "repo": "ChristianDosSantos/Proyectos_2", "path": "/Proyecto_2/GUI/Sensor_gui_2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChristianDosSantos/Proyectos_2 path: /Proyecto_2/GUI/Sensor_gui_2.py import matplotlib matplotlib.use('Qt4Agg') import sys from PyQt4 import QtCore, QtGui, uic import matplotlib.pyplot as plt from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends...
code_fim
medium
{ "lang": "python", "repo": "ChristianDosSantos/Proyectos_2", "path": "/Proyecto_2/GUI/Sensor_gui_2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abuendia/computervision-recipes path: /utils_cv/action_recognition/data.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os from pathlib import Path from urllib.request import urlretrieve import warnings import decord from einops.layers.tor...
code_fim
hard
{ "lang": "python", "repo": "abuendia/computervision-recipes", "path": "/utils_cv/action_recognition/data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def show_batch(batch, sample_length, mean=DEFAULT_MEAN, std=DEFAULT_STD): """ Args: batch (list[torch.tensor]): List of sample (clip) tensors sample_length (int): Number of frames to show for each sample mean (tuple): Normalization mean std (tuple): Normalization st...
code_fim
hard
{ "lang": "python", "repo": "abuendia/computervision-recipes", "path": "/utils_cv/action_recognition/data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Temporal noise self.random_shift = random_shift self.temporal_jitter = temporal_jitter # Video transforms # 1. resize trfms = [ transforms.ToTensorVideo(), transforms.ResizeVideo(im_scale, resize_keep_ratio), ] # 2....
code_fim
hard
{ "lang": "python", "repo": "abuendia/computervision-recipes", "path": "/utils_cv/action_recognition/data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PatiMohit/ZazuML path: /ObjectDetNet/dataloop_services/push_deploy.py import dtlpy as dl import os def deploy_predict_item(package, model_id, checkpoint_id): input_to_init = {'model_id': model_id, 'checkpoint_id': checkpoint_id} service_obj = package.services.deplo...
code_fim
hard
{ "lang": "python", "repo": "PatiMohit/ZazuML", "path": "/ObjectDetNet/dataloop_services/push_deploy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> item_input = dl.FunctionIO(type='Item', name='item') model_input = dl.FunctionIO(type='Json', name='model_id') checkpoint_input = dl.FunctionIO(type='Json', name='checkpoint_id') predict_item_function = dl.PackageFunction(name='predict_single_item', inputs=[item_input], outputs=[], ...
code_fim
hard
{ "lang": "python", "repo": "PatiMohit/ZazuML", "path": "/ObjectDetNet/dataloop_services/push_deploy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def estimateAge(): # Today's date today=datetime.datetime.now() # Write the header line ageFile.write("URI" + "," + "Mementos" + "," + "Creation Date" + "," + "Age" +'\n'); # The histogram file contains our 1000 URIs and number of mementos # skip the header row: URI, memento...
code_fim
medium
{ "lang": "python", "repo": "correnm/cs595-f13", "path": "/Supporting Files/Assignment 02/Python Files/EstimateAge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Today's date today=datetime.datetime.now() # Write the header line ageFile.write("URI" + "," + "Mementos" + "," + "Creation Date" + "," + "Age" +'\n'); # The histogram file contains our 1000 URIs and number of mementos # skip the header row: URI, memento uriFile = open('...
code_fim
medium
{ "lang": "python", "repo": "correnm/cs595-f13", "path": "/Supporting Files/Assignment 02/Python Files/EstimateAge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: correnm/cs595-f13 path: /Supporting Files/Assignment 02/Python Files/EstimateAge.py # Utilities from Hany's Carbon Date too import codecs import datetime from server import index # Initialize the file for our final results ageFile = codecs.open('C:/Python27/myFiles/Assignment 2/uri_age.txt','w',...
code_fim
hard
{ "lang": "python", "repo": "correnm/cs595-f13", "path": "/Supporting Files/Assignment 02/Python Files/EstimateAge.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>######### for n in range(1,100): turtle.left(90) turtle.forward(n*3) input()<|fim_prefix|># repo: cp-helsinge/eksempler path: /turtle_test3.py import turtle ################################################### # range = antal gange # rigth or left = grader til højre eller venstre # forw...
code_fim
medium
{ "lang": "python", "repo": "cp-helsinge/eksempler", "path": "/turtle_test3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cp-helsinge/eksempler path: /turtle_test3.py import turtle ################################################### # range = antal gange # rigt<|fim_suffix|>######### for n in range(1,100): turtle.left(90) turtle.forward(n*3) input()<|fim_middle|>h or left = grader til højre eller ...
code_fim
medium
{ "lang": "python", "repo": "cp-helsinge/eksempler", "path": "/turtle_test3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/ParlAI path: /parlai/zoo/sensitive_topics_classifier/build.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Pretrained Tran...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/ParlAI", "path": "/parlai/zoo/sensitive_topics_classifier/build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model_name = 'sensitive_topics_classifier' mdir = os.path.join(get_model_dir(datapath), model_name) version = 'v1' if not built(mdir, version): opt = {'datapath': datapath} fnames = ['sensitive_topics_classifier2.tgz'] download_models( opt, f...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/ParlAI", "path": "/parlai/zoo/sensitive_topics_classifier/build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Task1 function of API2 Returns: [str]: [Return string] """ logger.info("In API3 task2 function") return "task2 success!" if __name__ == "__main__": app.run(host="localhost", port=8300,debug=True)<|fim_prefix|># repo: Azure-Samples/azure-monitor-opencensus-python path:...
code_fim
hard
{ "lang": "python", "repo": "Azure-Samples/azure-monitor-opencensus-python", "path": "/azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure-Samples/azure-monitor-opencensus-python path: /azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_3.py """REST API Module using AppLogger""" import logging import json from flask import Flask, jsonify import requests import sys import os sys.path.append(os.path.join(os.ge...
code_fim
hard
{ "lang": "python", "repo": "Azure-Samples/azure-monitor-opencensus-python", "path": "/azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logger.info("Calling API 2") response = requests.get(url='http://localhost:8100/') print(f"response = {response.content}") return jsonify({'data': 'Success API3'}) def task1(): """Task1 function of API3 Returns: [str]: [Return string] """ logger.info("In API3 tas...
code_fim
hard
{ "lang": "python", "repo": "Azure-Samples/azure-monitor-opencensus-python", "path": "/azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wimleers/DistributedManyInARow path: /src/DistributedGame/VectorClock.py class VectorClockError(Exception): pass class KeyMismatchError(VectorClockError): pass class VectorClock(object): def __init__(self, vectorClockString=None): self.clock = {} if vectorClockString is not...
code_fim
hard
{ "lang": "python", "repo": "wimleers/DistributedManyInARow", "path": "/src/DistributedGame/VectorClock.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def __lt__(self, other): self._mergeKeys(other) self._binaryOperationCheck(other) for id, value in self.clock.items(): if value >= other.clock[id]: return False return True def __le__(self, other): self._mergeKeys(other) ...
code_fim
hard
{ "lang": "python", "repo": "wimleers/DistributedManyInARow", "path": "/src/DistributedGame/VectorClock.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> t = soup.findAll(attrs={"class":"refsect1"}) description = '' for p in t[1].findAll('p'): description = "%s %s"%(description,p) description = openclosetags.sub('',description) t = soup.findAll(text=re.compile('Options')) if len(t) != 0: if str(t[0].next.string) != 'None': synops...
code_fim
hard
{ "lang": "python", "repo": "zeke/zeroclickinfo-fathead", "path": "/share/fathead/UNCLEAN/parse_svn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zeke/zeroclickinfo-fathead path: /share/fathead/UNCLEAN/parse_svn.py from BeautifulSoup import BeautifulSoup import re import os import sys openclosediv = re.compile('''<div.*?>|</div>''',re.DOTALL) openclosep = re.compile('''<p.*?>|</p>''',re.DOTALL) opencloseh3 = re.compile('''<h3.*?>|</h3>'''...
code_fim
hard
{ "lang": "python", "repo": "zeke/zeroclickinfo-fathead", "path": "/share/fathead/UNCLEAN/parse_svn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> t = soup.findAll(text=re.compile('Options')) if len(t) != 0: if str(t[0].next.string) != 'None': synopsis = "%s %s"%(synopsis,str(t[0].next.string)) t = soup.findAll(text=re.compile('Alternate names')) if len(t) != 0: if openclosetags.sub('',str(t[0].next)) != 'None': previous...
code_fim
hard
{ "lang": "python", "repo": "zeke/zeroclickinfo-fathead", "path": "/share/fathead/UNCLEAN/parse_svn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """MSCoCo at multiple resolutions.""" def dataset_filename(self): return "image_ms_coco_tokens32k" def preprocess_example(self, example, mode, hparams): image = example["inputs"] # Get resize method. Include a default if not specified, or if it's not in # TensorFlow's collection of...
code_fim
hard
{ "lang": "python", "repo": "yyht/BERT", "path": "/t2t_bert/utils/tensor2tensor/data_generators/mscoco.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yyht/BERT path: /t2t_bert/utils/tensor2tensor/data_generators/mscoco.py # coding=utf-8 # Copyright 2019 The Tensor2Tensor Authors. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "yyht/BERT", "path": "/t2t_bert/utils/tensor2tensor/data_generators/mscoco.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vocab_symbolizer = get_vocab() _get_mscoco(tmp_dir) caption_filepath = ( _MSCOCO_TRAIN_CAPTION_FILE if training else _MSCOCO_EVAL_CAPTION_FILE) caption_filepath = os.path.join(tmp_dir, caption_filepath) prefix = _MSCOCO_TRAIN_PREFIX if training else _MSCOCO_EVAL_PREFIX caption_file = io....
code_fim
hard
{ "lang": "python", "repo": "yyht/BERT", "path": "/t2t_bert/utils/tensor2tensor/data_generators/mscoco.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: goodtune/vitriolic path: /tournamentcontrol/competition/migrations/0043_alter_ground_external_identifier.py # Generated by Django 3.2.13 on 2022-07-30 10:58 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name="ground",...
code_fim
medium
{ "lang": "python", "repo": "goodtune/vitriolic", "path": "/tournamentcontrol/competition/migrations/0043_alter_ground_external_identifier.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ("competition", "0042_ground_external_identifier"), ] operations = [ migrations.AlterField( model_name="ground", name="external_identifier", field=models.CharField( bla...
code_fim
easy
{ "lang": "python", "repo": "goodtune/vitriolic", "path": "/tournamentcontrol/competition/migrations/0043_alter_ground_external_identifier.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 'molfile': DefaultMappings.NO_INDEX_TEXT_NO_OFFSETS, # EXAMPLES: # .mol and .sdf files with \n embedded } } molecule_synonyms = { 'properties': { 'molecule_synonym': DefaultMappings.ALT_NAME, # EXAMPLES: # 'Acetiamine' , 'Quinazoline-2,4-Diol' ,...
code_fim
hard
{ "lang": "python", "repo": "chembl/chembl_ws_2_es", "path": "/src/glados/es/ws2es/mappings/es_chembl_molecule_n_drug_shared_mapping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chembl/chembl_ws_2_es path: /src/glados/es/ws2es/mappings/es_chembl_molecule_n_drug_shared_mapping.py cotropin-lipotropin precursor' , 'Orticumab heavy chain' , 'Solitomab' , 'Demciz # umab light chain' , 'Lampalizumab heavy chain' , 'Romosozumab heavy chain' , 'Blisibim ...
code_fim
hard
{ "lang": "python", "repo": "chembl/chembl_ws_2_es", "path": "/src/glados/es/ws2es/mappings/es_chembl_molecule_n_drug_shared_mapping.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonjheiler/demographic_change_olg path: /src/model_code/solve.py """Solve for household policy functions.""" import numpy as np from src.model_code.within_period import get_consumption from src.model_code.within_period import get_hc_effort from src.model_code.within_period import util ######...
code_fim
hard
{ "lang": "python", "repo": "simonjheiler/demographic_change_olg", "path": "/src/model_code/solve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Consumption consumption = get_consumption( assets_this_period=assets_this_period, assets_next_period=assets_next_period, pension_benefit=np.float64(0.0), labor_input=labor_input, interest_rate=interest_rate, wage_rate=wage_rate, income_tax_...
code_fim
hard
{ "lang": "python", "repo": "simonjheiler/demographic_change_olg", "path": "/src/model_code/solve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: total = int(apples) * apple_cost print(total) except ValueError: print("Error - You have to enter a number")<|fim_prefix|># repo: dojojon/pygamezero_examples path: /hello_world.py print("Hello Dojo") apples = input("How many apples would you like to buy? ") <|fim_middle|>apple_cos...
code_fim
easy
{ "lang": "python", "repo": "dojojon/pygamezero_examples", "path": "/hello_world.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dojojon/pygamezero_examples path: /hello_world.py print("Hello Dojo") apples = input("How many apples would you like to buy? ") apple_cost = .50 <|fim_suffix|>except ValueError: print("Error - You have to enter a number")<|fim_middle|>try: total = int(apples) * apple_cost print...
code_fim
medium
{ "lang": "python", "repo": "dojojon/pygamezero_examples", "path": "/hello_world.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for personVersionToTest in ["6", "8", "12", "12.1.0"]: personGUID = "testGUID" mockResponse, mockResponseHeaders, mockResponseStatusCode = TestingHelper.getPersonMockResult(personGUID=personGUID, version=personVersionToTest) person = self.getResourse( guid=personGUID, ...
code_fim
hard
{ "lang": "python", "repo": "rmetcalf9/EllucianEthosPythonClient", "path": "/tests/acceptance/test_MainClient_getResource.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(type(person).__name__, "PersonsV" + str(personVersionInResponse)) self.assertEqual(person.version, personVersionInResponse) self.assertEqual(person.dict["names"][0]["firstName"],"Joe Number 2") def test_requestingUnknownResourceNameWithGUIDratherThanID_ReturnsGenericResourc...
code_fim
hard
{ "lang": "python", "repo": "rmetcalf9/EllucianEthosPythonClient", "path": "/tests/acceptance/test_MainClient_getResource.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rmetcalf9/EllucianEthosPythonClient path: /tests/acceptance/test_MainClient_getResource.py # Tests on main client object import TestHelperSuperClass import EllucianEthosPythonClient import base64 import json import TestingHelper class helpers(TestHelperSuperClass.testClassWithHelpers): pass c...
code_fim
hard
{ "lang": "python", "repo": "rmetcalf9/EllucianEthosPythonClient", "path": "/tests/acceptance/test_MainClient_getResource.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: measiala/PUMS_Data_Dictionary path: /tests/process_line_test.py #!/usr/bin/python3 import py.test from process_line import * dd = DataDict('PUMS 2017 Dictionary') pl = PUMSDict('PUMS 2017 Layout') def test_add_title(): """ Test add title """ assert add_title('2017 ACS PUMS Data Diction...
code_fim
hard
{ "lang": "python", "repo": "measiala/PUMS_Data_Dictionary", "path": "/tests/process_line_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Process typical lines """ assert process_line('2017 ACS PUMS DATA DICTIONARY', 'Title', dd, pl, '', '', '', '') == None assert process_line('October 18, 2018', 'Rel Date', dd, pl, '', '', '', '') == None assert process_line('HOUSING RECORDS', 'Header', dd, pl, '', '', '', '') == 'H' ...
code_fim
hard
{ "lang": "python", "repo": "measiala/PUMS_Data_Dictionary", "path": "/tests/process_line_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: readthecodes/thriftpy path: /tests/test_base.py # -*- coding: utf-8 -*- import thriftpy def test_obj_equalcheck(): ab = thriftpy.load("addressbook.thrift") ab2 = thriftpy.load("addressbook.thrift") assert ab.Person(name="hello") == ab2.Person(name="hello") def test_cls_equalchec...
code_fim
hard
{ "lang": "python", "repo": "readthecodes/thriftpy", "path": "/tests/test_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert ab.Person == ab2.Person def test_isinstancecheck(): ab = thriftpy.load("addressbook.thrift") ab2 = thriftpy.load("addressbook.thrift") assert isinstance(ab.Person(), ab2.Person) assert isinstance(ab.Person(name="hello"), ab2.Person) assert isinstance(ab.PersonNotExistsEr...
code_fim
medium
{ "lang": "python", "repo": "readthecodes/thriftpy", "path": "/tests/test_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/leaderboard') def leaderboard(): return render_template('leaderboard.html') @app.route('/assignments/<int:n>') def assignment_page(n): filename = 'assignments/{!s}.html'.format(n) try: return render_template(filename) except TemplateNotFound: return abort(40...
code_fim
hard
{ "lang": "python", "repo": "notAmritpal/CGames", "path": "/cgames/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: notAmritpal/CGames path: /cgames/app.py from flask import Flask, abort, render_template from jinja2 import TemplateNotFound app = Flask(__name__) app.secret_key = 'development key' @app.route('/') def index(): return render_template('index.html') @app.route('/assignments') def assignment...
code_fim
medium
{ "lang": "python", "repo": "notAmritpal/CGames", "path": "/cgames/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/assignments/1') def game(): return render_template('assignments/1.html') @app.route('/leaderboard') def leaderboard(): return render_template('leaderboard.html') @app.route('/assignments/<int:n>') def assignment_page(n): filename = 'assignments/{!s}.html'.format(n) try: ...
code_fim
medium
{ "lang": "python", "repo": "notAmritpal/CGames", "path": "/cgames/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nzola/opwen-webapp path: /tests/opwen_email_client/util/test_os.py from unittest import TestCase from opwen_email_client.util.os import subdirectories <|fim_suffix|> self.assertEqual(len(list(subdirectories('/does-not-exist'))), 0)<|fim_middle|> class SubdirectoriesTests(TestCase): d...
code_fim
medium
{ "lang": "python", "repo": "nzola/opwen-webapp", "path": "/tests/opwen_email_client/util/test_os.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(len(list(subdirectories('/does-not-exist'))), 0)<|fim_prefix|># repo: nzola/opwen-webapp path: /tests/opwen_email_client/util/test_os.py from unittest import TestCase from opwen_email_client.util.os import subdirectories <|fim_middle|>class SubdirectoriesTests(TestCase): d...
code_fim
medium
{ "lang": "python", "repo": "nzola/opwen-webapp", "path": "/tests/opwen_email_client/util/test_os.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_handles_missing_directory(self): self.assertEqual(len(list(subdirectories('/does-not-exist'))), 0)<|fim_prefix|># repo: nzola/opwen-webapp path: /tests/opwen_email_client/util/test_os.py from unittest import TestCase from opwen_email_client.util.os import subdirectories <|fim_middl...
code_fim
easy
{ "lang": "python", "repo": "nzola/opwen-webapp", "path": "/tests/opwen_email_client/util/test_os.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vanheckelab/jambashbulk-analysis path: /npydowncast.py import sys import numpy as np from numpy import dtype, float64, float128 m = {<|fim_suffix|>items(), key=lambda x: x[1][1])]) np.save(sys.argv[1] + ".reduced.npy", newdata)<|fim_middle|>dtype(float128): dtype(float64)} data = np.load(sys.arg...
code_fim
medium
{ "lang": "python", "repo": "vanheckelab/jambashbulk-analysis", "path": "/npydowncast.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>items(), key=lambda x: x[1][1])]) np.save(sys.argv[1] + ".reduced.npy", newdata)<|fim_prefix|># repo: vanheckelab/jambashbulk-analysis path: /npydowncast.py import sys import numpy as np from numpy import dtype, float64, float128 m = {dtype(float128): dtype(float64)} data = np.load(sys.argv[1]) newdata ...
code_fim
medium
{ "lang": "python", "repo": "vanheckelab/jambashbulk-analysis", "path": "/npydowncast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Run the script """ args = parse_args() args.url = args.url.lower() if not args.url.startswith('http://') and not args.url.startswith('https://'): print "! your URL must start with http:// or https://" sys.exit(1) build_binary() fixup_bin(args.url) if __name...
code_fim
hard
{ "lang": "python", "repo": "Alpha0King/pop-nedry", "path": "/build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alpha0King/pop-nedry path: /build.py import sys import subprocess import argparse import os def fixup_bin(url): """Overwrite the URL placeholder with the user's supplied URL """ f = open('build\\pop-nedry.bin', 'r+b') f.seek(0x1dd) f.write(url) f.close() def build_binary...
code_fim
medium
{ "lang": "python", "repo": "Alpha0King/pop-nedry", "path": "/build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }