text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>if __name__ == "__main__": try: suite = eval(sys.argv[1]) # Selected tests except: suite = None # All tests nose.run(suite)<|fim_prefix|># repo: outbounder/amonone path: /runtests.py import os import sys import nose # Changes the enviroment in backends/mongodb os.environ['AMON_TEST_ENV'] = "T...
code_fim
easy
{ "lang": "python", "repo": "outbounder/amonone", "path": "/runtests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: outbounder/amonone path: /runtests.py import os import sys import nose # Changes the enviroment in backends/mongodb os.environ['AMON_TEST_ENV'] = "True" <|fim_suffix|># Example usage # python runtests -w amon/ if __name__ == "__main__": try: suite = eval(sys.argv[1]) # Selected tests exce...
code_fim
medium
{ "lang": "python", "repo": "outbounder/amonone", "path": "/runtests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Example usage # python runtests -w amon/ if __name__ == "__main__": try: suite = eval(sys.argv[1]) # Selected tests except: suite = None # All tests nose.run(suite)<|fim_prefix|># repo: outbounder/amonone path: /runtests.py import os import sys import nose # Changes the enviroment in back...
code_fim
medium
{ "lang": "python", "repo": "outbounder/amonone", "path": "/runtests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrcmac/CumulusCI path: /cumulusci/tasks/metadata/tests/test_modify.py import os import unittest from glob import glob from pathlib import Path from tempfile import TemporaryDirectory import lxml.etree as ET from cumulusci.core.config import BaseGlobalConfig from cumulusci.core.config import Bas...
code_fim
hard
{ "lang": "python", "repo": "mrcmac/CumulusCI", "path": "/cumulusci/tasks/metadata/tests/test_modify.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> files = glob(str(Path(__file__).parent / "/sample_package.xml")) # If you fiddle with the salesforce encoder, the code below may be # useful to ensure that it faithfully round-trips, but it only works # if run in a directory with a parent-directory which contains a f...
code_fim
hard
{ "lang": "python", "repo": "mrcmac/CumulusCI", "path": "/cumulusci/tasks/metadata/tests/test_modify.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ideasincrypto/Etherisc-bima-bolt-api path: /src/process/business.py from process.task import Task class BusinessProcess(Task): def __init__(self, id, log, *args, **kwargs): self.log_handler = log super().__init__(id, Task.TYPE_PROCESS, *args, **kwargs) def b...
code_fim
medium
{ "lang": "python", "repo": "ideasincrypto/Etherisc-bima-bolt-api", "path": "/src/process/business.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, id, process, *args, **kwargs): self.process = process super().__init__(id, Task.TYPE_TASK, *args, **kwargs) def start(self, blocking=True): super().start(blocking) def business_tx_log(self, message): self.process.log_handler.lo...
code_fim
hard
{ "lang": "python", "repo": "ideasincrypto/Etherisc-bima-bolt-api", "path": "/src/process/business.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> conn = op.get_bind() conn.execute(text("ALTER TABLE services ADD COLUMN ldap_enabled tinyint(1) default 1")) conn.execute(text("UPDATE services SET ldap_enabled = 1")) def downgrade(): pass<|fim_prefix|># repo: SURFscz/SBS path: /server/migrations/versions/5bde645fdb49_ldap_enabled_togg...
code_fim
medium
{ "lang": "python", "repo": "SURFscz/SBS", "path": "/server/migrations/versions/5bde645fdb49_ldap_enabled_toggle_for_services.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SURFscz/SBS path: /server/migrations/versions/5bde645fdb49_ldap_enabled_toggle_for_services.py """LDAP enabled toggle for services Revision ID: 5bde645fdb49 Revises: aeb043834eb1 Create Date: 2023-03-24 13:49:10.543444 """ from alembic import op from sqlalchemy import text <|fim_suffix|> co...
code_fim
medium
{ "lang": "python", "repo": "SURFscz/SBS", "path": "/server/migrations/versions/5bde645fdb49_ldap_enabled_toggle_for_services.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if feat_select=='tf' and nb_feat ==tf_feat: qsub_train_plan(task_index) time.sleep(0.5) def train_missing_models(): Z=pickle.load(open('dodge_train_crf_plan.pickle')) for task_index in Z: model_src,feat_select,nb_feat,mid=Z[task_index] model_name=g...
code_fim
hard
{ "lang": "python", "repo": "Transkribus/TranskribusDU", "path": "/TranskribusDU/tasks/make_exp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def train_missing_models(): Z=pickle.load(open('dodge_train_crf_plan.pickle')) for task_index in Z: model_src,feat_select,nb_feat,mid=Z[task_index] model_name=get_model_name(model_src,feat_select,nb_feat,mid=mid) if mid !='crf': model_file =os.path.join("./DODG...
code_fim
hard
{ "lang": "python", "repo": "Transkribus/TranskribusDU", "path": "/TranskribusDU/tasks/make_exp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Transkribus/TranskribusDU path: /TranskribusDU/tasks/make_exp.py from Dodge_Tasks import * import pickle def get_crf_jobid(): Z=pickle.load(open('dodge_train_crf_plan.pickle')) L=[] for task_index in Z: model_src,feat_select,nb_feat,mid=Z[task_index] if mid=='crf': ...
code_fim
hard
{ "lang": "python", "repo": "Transkribus/TranskribusDU", "path": "/TranskribusDU/tasks/make_exp.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, *inputs, num_beams=0): with torch.set_grad_enabled(self.training): encoder_inputs, constraints, decoder_inputs = inputs # dims: [sl, bs] for encoder and decoder # reset the states for the new batch num_utterances, max_sl, bs = encoder_inpu...
code_fim
hard
{ "lang": "python", "repo": "indeterminateoutcomesstudios/quick-nlp", "path": "/src/quicknlp/models/hred_constrained.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dropoute = get_kwarg(kwargs, name="dropout_e", default_value=0.1) # encoder embedding dropout dropoute = get_list(dropoute, 2) dropouti = get_kwarg(kwargs, name="dropout_i", default_value=0.65) # input dropout dropouti = get_list(dropouti, 2) self.constraint_embed...
code_fim
hard
{ "lang": "python", "repo": "indeterminateoutcomesstudios/quick-nlp", "path": "/src/quicknlp/models/hred_constrained.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: indeterminateoutcomesstudios/quick-nlp path: /src/quicknlp/models/hred_constrained.py from typing import List, Union import torch from quicknlp.modules import DropoutEmbeddings from quicknlp.utils import get_kwarg, get_list from .hred import HRED HParam = Union[List[int], int] class HREDCons...
code_fim
hard
{ "lang": "python", "repo": "indeterminateoutcomesstudios/quick-nlp", "path": "/src/quicknlp/models/hred_constrained.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yananzh/prokseq-v2.0 path: /scripts/libmod/errMsgFn.py def fileErrMsg(): fileErrorMsg = """ File not created or found! Please check if the file exists. Please check the permission of the directory and give permission. ...
code_fim
hard
{ "lang": "python", "repo": "yananzh/prokseq-v2.0", "path": "/scripts/libmod/errMsgFn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> samtools IS NOT FOUND! Some features of the quality check will not be done. Features such as, ... TO BE FILLED BY FIROJ This will not hamper the overall pipeline. User can also install the samtools and can specify the path in the parameter file as PATH SAMTOOLS path_to_sam_folder/sa...
code_fim
hard
{ "lang": "python", "repo": "yananzh/prokseq-v2.0", "path": "/scripts/libmod/errMsgFn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(fastqcErrorMsg) return 1 def DESeqErrMsg(): deseqErrorMsg = """ COMMON ERRORS: Please chack library("DESeq2") and library("ggplot2") are installed. """ print(deseqErrorMsg) return 1 def EdgeRErrMsg(): edgerErrorMsg = """ ...
code_fim
hard
{ "lang": "python", "repo": "yananzh/prokseq-v2.0", "path": "/scripts/libmod/errMsgFn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#NB: reduce imported symbols here a bit in a future release (possibly by #wrapping the removed function and placing in obsolete.py); from .exceptions import * from .core import * from .datasrc import * from .constants import wl2ekin, ekin2wl, ekin2ksq, wl2k, wl2ksq, constant_boltzmann #TODO: only wl2ekin,...
code_fim
hard
{ "lang": "python", "repo": "mctools/ncrystal", "path": "/NCrystal/api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mctools/ncrystal path: /NCrystal/api.py """ Meta-module providing the most commonly needed public API functions and classes from NCrystal in a single module. It can be used as: import NCrystal.api as NC Which will for now do the same as "import NCrystal as NC". However, it might be that we wil...
code_fim
hard
{ "lang": "python", "repo": "mctools/ncrystal", "path": "/NCrystal/api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: joshbelot/GettingStarted path: /tests/test_my_pkg.py """Tests the mathematical functions defined in my_pkg/trail.py """ import pytest def test_square(): """Tests the squaring function""" from my_pkg.trial import square assert 4 == square(2) def test_factorial(): <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "joshbelot/GettingStarted", "path": "/tests/test_my_pkg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_factorial(): """Tests the factorial function.""" from my_pkg.trial import factorial assert 24 == factorial(4) assert 6 == factorial(3.0) assert 1 == factorial(0) assert 1 == factorial(-1) with pytest.raises(ValueError): factorial(3.5)<|fim_prefix|># repo: jo...
code_fim
easy
{ "lang": "python", "repo": "joshbelot/GettingStarted", "path": "/tests/test_my_pkg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># headers = { # 'service-api-key': service_api_key, # 'nonce': nonce, # 'timestamp': str(timestamp), # 'Content-Type': 'application/json' # } # signature = get_signature('POST', path, nonce, timestamp, service_api_secret, body=request_body) # headers['signa...
code_fim
hard
{ "lang": "python", "repo": "qkrwnsgh1288/line-blockchain-api-caller", "path": "/caller/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qkrwnsgh1288/line-blockchain-api-caller path: /caller/utils.py from network import get_signature import os import requests import random import string import time def get_transaction_info( server_url: str, service_api_key: str, service_api_secret: str, txHash: str ): nonce ...
code_fim
hard
{ "lang": "python", "repo": "qkrwnsgh1288/line-blockchain-api-caller", "path": "/caller/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># request_body = { # 'walletSecret': walletSecret, # 'toAddress': toAddress, # 'amount': amount # } # headers = { # 'service-api-key': service_api_key, # 'nonce': nonce, # 'timestamp': str(timestamp), # 'Content-Type': 'application/json'...
code_fim
hard
{ "lang": "python", "repo": "qkrwnsgh1288/line-blockchain-api-caller", "path": "/caller/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pwicks86/Weihnachtsmann path: /test_scripts/xmas_pixels.py import board import neopixel import time from math import floor pixpin = board.D1 numpix = 60 strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.3, auto_write=False) <|fim_suffix|> while True: for j in range(2): ...
code_fim
medium
{ "lang": "python", "repo": "pwicks86/Weihnachtsmann", "path": "/test_scripts/xmas_pixels.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def xmas_cycle(): while True: for j in range(2): for i in range(len(strip)): dec = (floor(i / 2)) + j print(dec) if dec % 2 == 0: strip[i] = (255,0,0) else: strip[i] = (0,255,0) ...
code_fim
medium
{ "lang": "python", "repo": "pwicks86/Weihnachtsmann", "path": "/test_scripts/xmas_pixels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mbs = mbs if mbs else size case_generator = (lambda : get_valid_mnist()) cman = Caseman(cfunc=case_generator,vfrac=vfrac,tfrac=tfrac,cfrac=cfrac) else: data = load_data(path, cfrac) size_in = len(data[0][0]) size_out = len(data[0][1]) layers =...
code_fim
hard
{ "lang": "python", "repo": "MrWe/aiprog17", "path": "/task3/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrWe/aiprog17 path: /task3/main.py from GANN import * from casemanager import * from load_dataset import load_data, get_valid_mnist import tflowtools as TFT import json import random random.seed(123) np.random.seed(123) tf.set_random_seed(123) file_sets = ["wine", "glass", "gamma", "yeast"]; #...
code_fim
hard
{ "lang": "python", "repo": "MrWe/aiprog17", "path": "/task3/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #map_layers = # map_dendrogram = # display_weights = # display_biases = gradient_descent(epochs=epochs, dims=layers, cman=cman, lrate=lrate, showint=showint, mbs=mbs, vfrac=vfrac, tfrac=tfrac, vint=vint, cfrac=cfrac, output_activation_function=output_activation_function, h...
code_fim
hard
{ "lang": "python", "repo": "MrWe/aiprog17", "path": "/task3/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cancerregulome/gidget path: /commands/feature_matrix_construction/main/addIndicators.py # -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# import miscClin import tsvIO import sys # -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# NA_...
code_fim
hard
{ "lang": "python", "repo": "cancerregulome/gidget", "path": "/commands/feature_matrix_construction/main/addIndicators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # and then we add the pairwise indicator features ... print " " print " *** adding pairwise indicator features *** " print labelList print " " for ak in range(len(labelList)): aLabel = str(labelList[ak]) for bk in range(ak + 1, len(labelList)): bLabel =...
code_fim
hard
{ "lang": "python", "repo": "cancerregulome/gidget", "path": "/commands/feature_matrix_construction/main/addIndicators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 笔多头平仓 ABCD long_close_left_a = (s['30分钟_第N笔出井'] == '向上大井' or s['30分钟_五笔趋势类背驰'] == 'up') \ and s['30分钟_第N笔结束标记的分型强弱'] == 'strong' long_close_left_b = s['30分钟_第N笔涨跌力度'] == '向上笔新高盘背' and s['30分钟_第N笔结束标记的分型强弱'] == 'strong' long...
code_fim
hard
{ "lang": "python", "repo": "dizzy21c/czsc", "path": "/czsc/factors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dizzy21c/czsc path: /czsc/factors.py # coding: utf-8 from collections import OrderedDict from pyecharts.charts import Tab from pyecharts.components import Table from pyecharts.options import ComponentTitleOpts from .signals import KlineSignals from .utils.kline_generator import KlineGeneratorBy1M...
code_fim
hard
{ "lang": "python", "repo": "dizzy21c/czsc", "path": "/czsc/factors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> long_close_right_a = s['5分钟最近三根K线跌破30分钟第N笔下沿'] and s['30分钟_第N笔结束标记的分型强弱'] == 'strong' long_close_right_b = s['5分钟_第N笔结束标记的上边沿'] < s['30分钟_第N笔结束标记的下边沿'] \ and "向上" in s['5分钟_第N笔涨跌力度'] long_close_right_c = s['5分钟_当下笔空头两重有效阻击'] or s['5分钟_当下...
code_fim
hard
{ "lang": "python", "repo": "dizzy21c/czsc", "path": "/czsc/factors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def i_conv(batchNorm, in_planes, out_planes, kernel_size=3, stride=1, bias=True): if batchNorm: conv2d = nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, pad_mode='pad', padding=(kernel_size - 1) // 2, has_bias=bias) batchNorm2d = nn.B...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/flownet2/src/submodels/submodules.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if batchnorm: conv2d = nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, pad_mode='pad', padding=(kernel_size - 1) // 2, has_bias=False) batchNorm2d = nn.BatchNorm2d(out_planes) leakyReLU = nn.LeakyReLU(0.1) return nn.Se...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/flownet2/src/submodels/submodules.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/models path: /research/cv/flownet2/src/submodels/submodules.py # Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License a...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/flownet2/src/submodels/submodules.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>0 + pennies/100 print("The total dollar amount is:", "$" + str(round(dollarAmount, 2))) main()<|fim_prefix|># repo: Ikusey/itc110-sum2019 path: /ITC 110/projects/changeCounter.py #change.py def main(): print("This program calculates dollar amount from number or coins") quarters = int...
code_fim
medium
{ "lang": "python", "repo": "Ikusey/itc110-sum2019", "path": "/ITC 110/projects/changeCounter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>kels: ")) pennies = int(input("Pennies: ")) dollarAmount = quarters/4 + dimes/10 + nickels/20 + pennies/100 print("The total dollar amount is:", "$" + str(round(dollarAmount, 2))) main()<|fim_prefix|># repo: Ikusey/itc110-sum2019 path: /ITC 110/projects/changeCounter.py #change.py de...
code_fim
medium
{ "lang": "python", "repo": "Ikusey/itc110-sum2019", "path": "/ITC 110/projects/changeCounter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ikusey/itc110-sum2019 path: /ITC 110/projects/changeCounter.py #change.py def main(): print("This program calculates dollar amount from number or coins") <|fim_suffix|>kels: ")) pennies = int(input("Pennies: ")) dollarAmount = quarters/4 + dimes/10 + nickels/20 + pennies/100 ...
code_fim
medium
{ "lang": "python", "repo": "Ikusey/itc110-sum2019", "path": "/ITC 110/projects/changeCounter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ['Bagging', 'HyperOpt', 'Utils']<|fim_prefix|># repo: Maxence-Labesse/AutoMxL path: /build/lib/AutoMxL/Modelisation/__init__.py """ Contains modules related to modelisation <|fim_middle|>Modules : - Bagging - Classifiers - Hyperopt """
code_fim
easy
{ "lang": "python", "repo": "Maxence-Labesse/AutoMxL", "path": "/build/lib/AutoMxL/Modelisation/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Maxence-Labesse/AutoMxL path: /build/lib/AutoMxL/Modelisation/__init__.py """ Contains modules related to modelisation <|fim_suffix|>__all__ = ['Bagging', 'HyperOpt', 'Utils']<|fim_middle|>Modules : - Bagging - Classifiers - Hyperopt """
code_fim
easy
{ "lang": "python", "repo": "Maxence-Labesse/AutoMxL", "path": "/build/lib/AutoMxL/Modelisation/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" __all__ = ['Bagging', 'HyperOpt', 'Utils']<|fim_prefix|># repo: Maxence-Labesse/AutoMxL path: /build/lib/AutoMxL/Modelisation/__init__.py """ Contains modules related to modelisation <|fim_middle|>Modules : - Bagging - Classifiers - Hyperopt
code_fim
easy
{ "lang": "python", "repo": "Maxence-Labesse/AutoMxL", "path": "/build/lib/AutoMxL/Modelisation/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def divisorGen(n): """ http://stackoverflow.com/questions/171765/what-is-the-best-way-to-get-all-the-divisors-of-a-number """ factors = list(prime_factor_generator(n)) nfactors = len(factors) if nfactors == 0: return f = [0] * nfactors while True: yield redu...
code_fim
hard
{ "lang": "python", "repo": "danui/project-euler", "path": "/solutions/python/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danui/project-euler path: /solutions/python/util.py def n_choose_k(n, k): if k > (n//2): return n_choose_k(n, n-k) x = 1 y = 1 for i in xrange(k): x *= n-i y *= 1+i return x // y def triangle_number(n): return n * (n+1) // 2 def sum_of_range(s, t ...
code_fim
hard
{ "lang": "python", "repo": "danui/project-euler", "path": "/solutions/python/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ http://stackoverflow.com/questions/171765/what-is-the-best-way-to-get-all-the-divisors-of-a-number """ factors = list(prime_factor_generator(n)) nfactors = len(factors) if nfactors == 0: return f = [0] * nfactors while True: yield reduce(lambda x, y: x*y...
code_fim
hard
{ "lang": "python", "repo": "danui/project-euler", "path": "/solutions/python/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gamichaelh/fHDHR path: /fHDHR/plugins/plugin.py import os import imp from .plugin_utils import Plugin_Utils class Plugin(): """ Methods for a Plugin. """ def __init__(self, config, logger, db, versions, plugin_name, plugin_path, plugin_conf, plugin_manifest): self.conf...
code_fim
hard
{ "lang": "python", "repo": "gamichaelh/fHDHR", "path": "/fHDHR/plugins/plugin.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> @property def version(self): """ Shortcut to plugin manifest value for version. """ return self.manifest["version"] @property def type(self): """ Shortcut to plugin manifest value for type. """ return self.manifest["type"] ...
code_fim
hard
{ "lang": "python", "repo": "gamichaelh/fHDHR", "path": "/fHDHR/plugins/plugin.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: MurphyMarkW/python-flask-s3 path: /flasks3/drivers/driver.py import abc class S3StorageDriverABC(object): """S3 Storage driver abstract base class. <|fim_suffix|> @abc.abstractmethod def buckets(self, user=None): """Returns an iterable of buckets. """ raise N...
code_fim
medium
{ "lang": "python", "repo": "MurphyMarkW/python-flask-s3", "path": "/flasks3/drivers/driver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns an iterable of buckets. """ raise NotImplementedError('TODO') @abc.abstractmethod def keys(self, bucket, user=None): """Returns an iterable of keys within a bucket. """ raise NotImplementedError('TODO')<|fim_prefix|># repo: MurphyMarkW/py...
code_fim
medium
{ "lang": "python", "repo": "MurphyMarkW/python-flask-s3", "path": "/flasks3/drivers/driver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns an iterable of keys within a bucket. """ raise NotImplementedError('TODO')<|fim_prefix|># repo: MurphyMarkW/python-flask-s3 path: /flasks3/drivers/driver.py import abc class S3StorageDriverABC(object): """S3 Storage driver abstract base class. Defines interfa...
code_fim
hard
{ "lang": "python", "repo": "MurphyMarkW/python-flask-s3", "path": "/flasks3/drivers/driver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass class NA_MasterYi_Top_Morgana(Ratings): pass class NA_MasterYi_Top_Nami(Ratings): pass class NA_MasterYi_Top_Nasus(Ratings): pass class NA_MasterYi_Top_Nautilus(Ratings): pass class NA_MasterYi_Top_Nidalee(Ratings): pass class NA_MasterYi_Top_Nocturne(Ratings): pass ...
code_fim
hard
{ "lang": "python", "repo": "koliupy/loldib", "path": "/loldib/getratings/models/NA/na_masteryi/na_masteryi_top.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: koliupy/loldib path: /loldib/getratings/models/NA/na_masteryi/na_masteryi_top.py from getratings.models.ratings import Ratings class NA_MasterYi_Top_Aatrox(Ratings): pass class NA_MasterYi_Top_Ahri(Ratings): pass class NA_MasterYi_Top_Akali(Ratings): pass class NA_MasterYi_Top_A...
code_fim
hard
{ "lang": "python", "repo": "koliupy/loldib", "path": "/loldib/getratings/models/NA/na_masteryi/na_masteryi_top.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(self.__data_list) == 0: raise Exception("get_sorted_tup:尚未初始化数据") else: self.__sort() return self.__data_list def get_sorted_list(self): return [x[1] for x in self.get_sorted_tup()] def __sort(self): N = len(self.__data_l...
code_fim
medium
{ "lang": "python", "repo": "WhiteRobe/Python-alg", "path": "/KeySort.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_sorted_list(self): return [x[1] for x in self.get_sorted_tup()] def __sort(self): N = len(self.__data_list) aux = [None for _ in range(0, N)] count = [0 for _ in range(0, self.__R+1)] for i in range(0, N): count[self.__data_list[i][1][0]...
code_fim
hard
{ "lang": "python", "repo": "WhiteRobe/Python-alg", "path": "/KeySort.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WhiteRobe/Python-alg path: /KeySort.py class KeySort: # T(N) = 11N+2R+1 # D(N) = 2N+R # Stable? __data_list = [] __R = None def set_data(self, data_tup, R): # set data like [(0, 1), (index, value^)] value^ should be like (group_key, item_properties) # $gro...
code_fim
hard
{ "lang": "python", "repo": "WhiteRobe/Python-alg", "path": "/KeySort.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WesIngwersen/perdu path: /perdu/searching/utils.py import unicodedata REPLACEMENTS = [ ("market for ", ""), ("Market for ", ""), (", at regional storehouse", ""), (", at plant", ""), (", AP-42", ""), (", m3", ""), ] REPLACEMENTS.extend([(", {}".format(x), "") for x in ran...
code_fim
medium
{ "lang": "python", "repo": "WesIngwersen/perdu", "path": "/perdu/searching/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> string = unicodedata.normalize("NFKD", string).strip() for x, y in REPLACEMENTS: string = string.replace(x, y) return string def add_score(obj): new = dict(obj.items()) new["score"] = obj.score return new<|fim_prefix|># repo: WesIngwersen/perdu path: /perdu/searching/uti...
code_fim
medium
{ "lang": "python", "repo": "WesIngwersen/perdu", "path": "/perdu/searching/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> local("python setup.py sdist")<|fim_prefix|># repo: yijiull/loopix-1 path: /fabfile.py from fabric.api import env, sudo, run, settings, cd, local from fabric.decorators import runs_once, roles, parallel from fabric.tasks import execute <|fim_middle|>@runs_once def package():
code_fim
easy
{ "lang": "python", "repo": "yijiull/loopix-1", "path": "/fabfile.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yijiull/loopix-1 path: /fabfile.py from fabric.api import env, sudo, run, settings, cd, local from fabric.decorators import runs_once, roles, parallel from fabric.tasks import execute <|fim_suffix|> local("python setup.py sdist")<|fim_middle|>@runs_once def package():
code_fim
easy
{ "lang": "python", "repo": "yijiull/loopix-1", "path": "/fabfile.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> vocab = list(idf) wordids = dict((w,i) for i,w in enumerate(vocab)) X=[(i, wordids[w], ws[w]/sum(ws.values())*idf[w]) for i,ws in enumerate(docs) for w in ws if w in wordids] ii,jj,xx = zip(*X) X=sparse.coo_matrix((xx, (ii, jj)), shape=[len(docs), len(vocab)]) X=X.toc...
code_fim
hard
{ "lang": "python", "repo": "jseppanen/textpile", "path": "/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> import warnings # suppress a million of these: # score += numpy.sum(cnt * logsumexp(Elogthetad + Elogbeta[:, id]) for id, cnt in doc) # /usr/local/lib/python2.7/dist-packages/gensim/models/ldamodel.py:634: DeprecationWarning: using a non-integer number instead of an integer will result i...
code_fim
hard
{ "lang": "python", "repo": "jseppanen/textpile", "path": "/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jseppanen/textpile path: /model.py from __future__ import division from sklearn.linear_model import SGDClassifier from sklearn.cross_validation import StratifiedKFold from scipy import sparse from collections import defaultdict import re import numpy as np import sys def train(docs, labels, regu...
code_fim
hard
{ "lang": "python", "repo": "jseppanen/textpile", "path": "/model.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> VR = V.Validate_NMR_Restraints() self.assertAlmostEqual( VR.get_dihedral_angle(array([-39.343, - 18.738, 25.524]), array([-38.452, - 19.489, 26.2]), array([-38.82, - 20.666, 27.017]), array([-39.206, - 20.263, ...
code_fim
hard
{ "lang": "python", "repo": "kumar-physics/RestraintsValidation", "path": "/test_validate_NMR_Restraints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kumar-physics/RestraintsValidation path: /test_validate_NMR_Restraints.py from unittest import TestCase from numpy import array import Validate_NMR_Restraints as V class TestValidate_NMR_Restraints(TestCase): # def test_generate_json(self): # self.fail() # # def test_restrai...
code_fim
hard
{ "lang": "python", "repo": "kumar-physics/RestraintsValidation", "path": "/test_validate_NMR_Restraints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif (val == 2): #Moves LEFT new_xpos = x[-1] - 1 new_ypos = y[-1] x = np.append(x, new_xpos) y = np.append(y, new_ypos) elif (val == 3): #Moves DOWN new_xpos = x[-1] new_ypos = y[-1] - 1 ...
code_fim
hard
{ "lang": "python", "repo": "DAguirreAg/Dragon-curve-generator", "path": "/Dragon_Curve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif (val == 1): #Moves UP new_xpos = x[-1] new_ypos = y[-1] + 1 x = np.append(x, new_xpos) y = np.append(y, new_ypos) elif (val == 2): #Moves LEFT new_xpos = x[-1] - 1 new_ypos = y[-1] ...
code_fim
hard
{ "lang": "python", "repo": "DAguirreAg/Dragon-curve-generator", "path": "/Dragon_Curve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DAguirreAg/Dragon-curve-generator path: /Dragon_Curve.py ############################## # # # Created by: Daniel Aguirre # # Date: 2019/05/07 # # # ############################## # Imports import numpy as np import matplo...
code_fim
hard
{ "lang": "python", "repo": "DAguirreAg/Dragon-curve-generator", "path": "/Dragon_Curve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> except: # catch all other exceptions, e.g. errors due to non-convergent training etc. logging.exception("Error occured.") avg_corr_after_train = None avg_corr_before_train = None last_step = None # save parameters and results into csv ...
code_fim
hard
{ "lang": "python", "repo": "ecker-lab/burg2021_learning_divisive_normalization", "path": "/divisive_3x3_surround_net/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecker-lab/burg2021_learning_divisive_normalization path: /divisive_3x3_surround_net/train.py import csv import logging import os import time import matplotlib import numpy as np from divisivenormalization.data import Dataset, MonkeySubDataset from divisivenormalization.models import DivisiveNet...
code_fim
hard
{ "lang": "python", "repo": "ecker-lab/burg2021_learning_divisive_normalization", "path": "/divisive_3x3_surround_net/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> training = model.train( max_iter=max_iter, learning_rate=learning_rate, batch_size=batch_size, val_steps=val_steps, save_steps=1000, early_stopping_steps=early_stopping_s...
code_fim
hard
{ "lang": "python", "repo": "ecker-lab/burg2021_learning_divisive_normalization", "path": "/divisive_3x3_surround_net/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print data_dict return X[self.key] def make_features_pipeline(features, vectorizers, clf): transformer_list = [] for feature in features: vectorizer = vectorizers[feature] transformer = (feature, Pipeline([ ('selector', ItemSelector(key=feature)),...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/ceo", "path": "/ceo/selector.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/ceo path: /ceo/selector.py import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import FeatureUnion from sklearn.pipeline import Pipeline from sklearn.svm import SVC class DenseTransformer(BaseEstimator, TransformerMixin): def transfo...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/ceo", "path": "/ceo/selector.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> transformer_list = [] for feature in features: vectorizer = vectorizers[feature] transformer = (feature, Pipeline([ ('selector', ItemSelector(key=feature)), (feature+"-vectorizer", vectorizer), ('todense', DenseTransformer()), ...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/ceo", "path": "/ceo/selector.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aesavas/HackerRank path: /Python/Sets/Set Add/solution.py """ author : Ali Emre SAVAS Link : https://www.hackerrank.<|fim_suffix|> counter = int(input()) countries = set() for _ in range(counter): countries.add(input()) print(len(countries))<|fim_middle|>com/challeng...
code_fim
medium
{ "lang": "python", "repo": "aesavas/HackerRank", "path": "/Python/Sets/Set Add/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>(counter): countries.add(input()) print(len(countries))<|fim_prefix|># repo: aesavas/HackerRank path: /Python/Sets/Set Add/solution.py """ author : Ali Emre SAVAS Link : https://www.hackerrank.com/challenges/py-set-add/problem """ if __name__ == "__main__": <|fim_middle|> counter =...
code_fim
medium
{ "lang": "python", "repo": "aesavas/HackerRank", "path": "/Python/Sets/Set Add/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nsbgit/IIT-S21-CS-484 path: /Old Materials/Additional Github/dvtate/cs484/assignment3/tree.py # Load the necessary libraries import matplotlib.pyplot as plt import numpy import pandas import sklearn.cluster as cluster import sklearn.metrics as metrics import sklearn.tree as tree # Read data df =...
code_fim
hard
{ "lang": "python", "repo": "nsbgit/IIT-S21-CS-484", "path": "/Old Materials/Additional Github/dvtate/cs484/assignment3/tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Print column names that were assigned by pandas.get_dummies print('Some labels:') for i, col in enumerate(one_hot_inputs): print('X[%s] = %s' % (i, col)) if i > 10: break print('\n') # Find misclassification rate for test data one_hot_inputs = pandas.get_dummies( test_data[['CAR_T...
code_fim
hard
{ "lang": "python", "repo": "nsbgit/IIT-S21-CS-484", "path": "/Old Materials/Additional Github/dvtate/cs484/assignment3/tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Sorted List\n") print(*list) if __name__ == "__main__": main()<|fim_prefix|># repo: AnupKumarPanwar/Python path: /sorts/odd_even_transposition_single_threaded.py """ This is a non-parallelized implementation of odd-even transpostiion sort. Normally the swaps in each set happen simul...
code_fim
hard
{ "lang": "python", "repo": "AnupKumarPanwar/Python", "path": "/sorts/odd_even_transposition_single_threaded.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnupKumarPanwar/Python path: /sorts/odd_even_transposition_single_threaded.py """ This is a non-parallelized implementation of odd-even transpostiion sort. Normally the swaps in each set happen simultaneously, without that the algorithm is no better than bubble sort. """ <|fim_suffix|> list...
code_fim
hard
{ "lang": "python", "repo": "AnupKumarPanwar/Python", "path": "/sorts/odd_even_transposition_single_threaded.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vallard/ucsmsdk_samples path: /ucsmsdk_samples/server/adapter_policy.py # Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://ww...
code_fim
hard
{ "lang": "python", "repo": "vallard/ucsmsdk_samples", "path": "/ucsmsdk_samples/server/adapter_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ from ucsmsdk.mometa.adaptor.AdaptorHostEthIfProfile import \ AdaptorHostEthIfProfile obj = handle.query_dn(parent_dn) if not obj: raise ValueError("org '%s' does not exist" % parent_dn) mo = AdaptorHostEthIfProfile(parent_mo_or_dn=obj, name=name, descr=descr) ...
code_fim
hard
{ "lang": "python", "repo": "vallard/ucsmsdk_samples", "path": "/ucsmsdk_samples/server/adapter_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #SeriesとDataFrameの計算 X Y X series3 = dframe2.ix[2] #6.0 7.0 8.0 print(dframe2) ''' X Y Z A 0 1 2 B 3 4 5 C 6 7 8 ''' print(dframe2 - series3) #series3が、dframe2の全行から引かれる ''' X Y Z A -6 -6 -6 B -3 -3 -3 C 0...
code_fim
hard
{ "lang": "python", "repo": "000ubird/PythonTest", "path": "/src/セクション4/lecture20.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 000ubird/PythonTest path: /src/セクション4/lecture20.py ''' Created on 2018/08/27 @author: User ''' import numpy as np from numpy.random import randn from pandas import Series, DataFrame from pandas.tests.frame.test_validate import dataframe from bokeh.layouts import column <|fim_suffix|> dframe...
code_fim
hard
{ "lang": "python", "repo": "000ubird/PythonTest", "path": "/src/セクション4/lecture20.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #もとのデータを入れたい場合 print(dframe1.add(dframe2, fill_value=0)) ''' X Y Z A 0.0 2.0 2.0 B 5.0 7.0 5.0 C 6.0 7.0 8.0 ''' #SeriesとDataFrameの計算 X Y X series3 = dframe2.ix[2] #6.0 7.0 8.0 print(dframe2) ''' X Y Z A ...
code_fim
hard
{ "lang": "python", "repo": "000ubird/PythonTest", "path": "/src/セクション4/lecture20.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if(config.debug): log_debug("Current config:") pprint(vars(config)) if not prompt_yesno_question("[DEBUG] Continue?"): sys.exit() maven = Maven(config, github) input("\nPlease close all eclipse instances as of potential race conditions on maven builds causing errors. Press return if ...
code_fim
hard
{ "lang": "python", "repo": "sanjaykumarcg/tools-cobigen", "path": "/scripts/src/create_release.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sanjaykumarcg/tools-cobigen path: /scripts/src/create_release.py import os import sys import logging import yaml from pprint import pprint from github.Milestone import Milestone from tools.config import Config from tools.github import GitHub from tools.git_repo import GitRepo from tools.validat...
code_fim
hard
{ "lang": "python", "repo": "sanjaykumarcg/tools-cobigen", "path": "/scripts/src/create_release.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>############################# __log_step("Validate merge commit...") ############################# list_of_changed_files = git_repo.get_changed_files_of_last_commit() is_pom_changed = False for file_name in list_of_changed_files: file_name = file_name.replace('/', os.sep) if not file_name.startswi...
code_fim
hard
{ "lang": "python", "repo": "sanjaykumarcg/tools-cobigen", "path": "/scripts/src/create_release.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> organization.add_post(role='Mayor', label=self.division_name, division_id=self.division_id) for seat_number in range(1, 9): organization.add_post(role='Councillor', label='Surrey (seat {})'.format(seat_number), division_id=self.division_id) yield organization<|fim_pref...
code_fim
medium
{ "lang": "python", "repo": "cmonagle/scrapers-ca", "path": "/ca_bc_surrey/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_organizations(self): organization = Organization(self.name, classification=self.classification) organization.add_post(role='Mayor', label=self.division_name, division_id=self.division_id) for seat_number in range(1, 9): organization.add_post(role='Councillo...
code_fim
hard
{ "lang": "python", "repo": "cmonagle/scrapers-ca", "path": "/ca_bc_surrey/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmonagle/scrapers-ca path: /ca_bc_surrey/__init__.py from __future__ import unicode_literals from utils import CanadianJurisdiction from pupa.scrape import Organization <|fim_suffix|> classification = 'legislature' division_id = 'ocd-division/country:ca/csd:5915004' division_name = 'S...
code_fim
medium
{ "lang": "python", "repo": "cmonagle/scrapers-ca", "path": "/ca_bc_surrey/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> resp = self.api.locateMyIP() self.assertFalse(resp.country_code is None) resp = self.api.locateGivenIP("8.8.8.8") self.assertFalse(resp.country_code is "US")<|fim_prefix|># repo: taxamo/taxamo-python path: /taxamo/test/test_geoip_api.py """ Copyright 2014-2021 by Taxamo...
code_fim
medium
{ "lang": "python", "repo": "taxamo/taxamo-python", "path": "/taxamo/test/test_geoip_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resp = self.api.locateGivenIP("8.8.8.8") self.assertFalse(resp.country_code is "US")<|fim_prefix|># repo: taxamo/taxamo-python path: /taxamo/test/test_geoip_api.py """ Copyright 2014-2021 by Taxamo Licensed under the Apache License, Version 2.0 (the "License"); you may not use t...
code_fim
hard
{ "lang": "python", "repo": "taxamo/taxamo-python", "path": "/taxamo/test/test_geoip_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: taxamo/taxamo-python path: /taxamo/test/test_geoip_api.py """ Copyright 2014-2021 by Taxamo Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apa...
code_fim
medium
{ "lang": "python", "repo": "taxamo/taxamo-python", "path": "/taxamo/test/test_geoip_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/DLGHWINF-MIB.py ", "MibTableRow", "MibTableColumn", "Integer32", "MibIdentifier", "IpAddress", "Counter32", "ObjectIdentity", "Counter64", "Unsigned32", "Gauge32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvent...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DLGHWINF-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/DLGHWINF-MIB.py oduced by pysmi-0.3.4 at Mon Apr 29 18:32:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBui...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DLGHWINF-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dentServiceChangeDate.setStatus('mandatory') dlgHiIdentTrapMask = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiIdentTrapMask.setStatus('mandatory') dlgHiIdentSystemServicesTable = MibTable((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6), )...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DLGHWINF-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(uf.find(1), 1) self.assertEqual(uf.find(2), 1) def test_union(self): uf = UnionFind([[1,2,3],[4,5],[6,7,8,9,0]]) self.assertEqual(uf.find(2), 1) self.assertEqual(uf.find(5), 4) uf.union(2,5) self.assertEqual(uf.find(1), 1) ...
code_fim
hard
{ "lang": "python", "repo": "santoshpy/algorithms-1", "path": "/test_union_find.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: santoshpy/algorithms-1 path: /test_union_find.py import unittest from union_find import UnionFind class TestUnionFind(unittest.TestCase): def test_find(self): uf = UnionFind([[1,2,3],[4,5],[6,7,8,9,0]]) self.assertEqual(uf.find(1), 1) self.assertEqual(uf.find(2), 1) ...
code_fim
hard
{ "lang": "python", "repo": "santoshpy/algorithms-1", "path": "/test_union_find.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }