text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: machakann/asyncomplete-ezfilter.vim path: /python3/asyncomplete_ezfilter.py import re class AsyncompleteEzfilter: def match_filter(self, items, start, *, ignorecase=True): if ignorecase: pat = re.compile(re.escape(start), re.I) else: pat = re.compile(...
code_fim
hard
{ "lang": "python", "repo": "machakann/asyncomplete-ezfilter.vim", "path": "/python3/asyncomplete_ezfilter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> thr = float(thr) n = len(base) matchlist = [] for x in items: lead = x['word'][:n] x['_distance'] = self.jaro_winkler_distance(lead, base, **kwargs) if x['_distance'] <= thr: matchlist.append(x) matchlist.sort(key=...
code_fim
hard
{ "lang": "python", "repo": "machakann/asyncomplete-ezfilter.vim", "path": "/python3/asyncomplete_ezfilter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if a == "" and b == "": return 1.0 elif a == "" or b == "": return 0.0 if ignorecase: a = a.upper() b = b.upper() if a == b: return 1.0 na = len(a) nb = len(b) c, acommons, bcommons = self._...
code_fim
hard
{ "lang": "python", "repo": "machakann/asyncomplete-ezfilter.vim", "path": "/python3/asyncomplete_ezfilter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PetrochukM/PyTorch-NLP path: /tests/datasets/test_multi30k.py import os import mock from torchnlp.datasets import multi30k_dataset from tests.datasets.utils import urlretrieve_side_effect multi30k_directory = 'tests/_test_data/multi30k' @mock.patch("urllib.request.urlretrieve") def test_mult...
code_fim
medium
{ "lang": "python", "repo": "PetrochukM/PyTorch-NLP", "path": "/tests/datasets/test_multi30k.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> mock_urlretrieve.side_effect = urlretrieve_side_effect # Check a row are parsed correctly train, dev, test = multi30k_dataset( directory=multi30k_directory, test=True, dev=True, train=True) assert len(train) > 0 assert len(dev) > 0 assert len(test) > 0 assert train[0] ...
code_fim
medium
{ "lang": "python", "repo": "PetrochukM/PyTorch-NLP", "path": "/tests/datasets/test_multi30k.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kadantte/anime-downloader path: /anime_downloader/players/iina.py from anime_downloader.players.baseplayer import BasePlayer from anime_downloader.players.mpv import get_mpv_configfile from anime_downloader import config from anime_downloader.config import Config import os class iina(BasePlaye...
code_fim
medium
{ "lang": "python", "repo": "Kadantte/anime-downloader", "path": "/anime_downloader/players/iina.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> STOP = 50 NEXT = 51 CONNECT_ERR = 2 def _get_executable_windows(self): return 'iina.exe' def _get_executable_posix(self): return 'iina' @property def args(self): # Doesnt use the referer if it's none launchArgs = Config['watch']['iina_argument...
code_fim
medium
{ "lang": "python", "repo": "Kadantte/anime-downloader", "path": "/anime_downloader/players/iina.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: joshmitcho/mcmasterq path: /csvGenerate.py from sys import argv # ------------- CSV 1: Edit Original ------------- dFile = open(argv[1], 'r') dData = dFile.read().split('\n') dFile.close() dFile = open(argv[1], 'w') if (dData[0][0] == 'p'): dFile.write(dData[0] + '\n') else: dFile.write('pa...
code_fim
hard
{ "lang": "python", "repo": "joshmitcho/mcmasterq", "path": "/csvGenerate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>master = [] for entry in range(len(aList[0])): numNums = len(aList[0][entry][-1]) for i in range(numNums): sub = [aList[0][entry][0]] for line in aList[:len(aList)]: sub.append(line[entry][-1][i]) master.append(sub) aFile.write('ranking') for i in range(len(aList)): aFile.write(';qsort' + s...
code_fim
hard
{ "lang": "python", "repo": "joshmitcho/mcmasterq", "path": "/csvGenerate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>aList = aList[:len(aList)-1] master = [] for entry in range(len(aList[0])): numNums = len(aList[0][entry][-1]) for i in range(numNums): sub = [aList[0][entry][0]] for line in aList[:len(aList)]: sub.append(line[entry][-1][i]) master.append(sub) aFile.write('ranking') for i in range(len(aLis...
code_fim
hard
{ "lang": "python", "repo": "joshmitcho/mcmasterq", "path": "/csvGenerate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: meeron/pybinn path: /test_pybinn.py from time import time from datetime import datetime from io import BytesIO import pybinn class TestPyBinn: """PyBinn tests""" def setup_method(self, method): """Setup method""" self._test = [ True, False, None, ...
code_fim
hard
{ "lang": "python", "repo": "meeron/pybinn", "path": "/test_pybinn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_dict_with_bytes_key(self): test_dict = { b'12345678': "this is test value" } assert test_dict == pybinn.loads(pybinn.dumps(test_dict)) class MockObj: DATATYPE = b'\xf0' def __init__(self, name): self.name = name class MockObjEncoder(pyb...
code_fim
hard
{ "lang": "python", "repo": "meeron/pybinn", "path": "/test_pybinn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PlatONnetwork/client-sdk-python path: /tests/sdk_test1.py from client_sdk_python import Web3, HTTPProvider from client_sdk_python.eth import PlatON from client_sdk_python.packages.platon_keys.utils import bech32,address from hexbytes import HexBytes from client_sdk_python.packages.eth_utils impor...
code_fim
hard
{ "lang": "python", "repo": "PlatONnetwork/client-sdk-python", "path": "/tests/sdk_test1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>w3.personal.unlockAccount(from_address, "123456", 999999) data={ "from": from_address, "to": to_address, "value": 1, "gas": 1000000, "gasPrice": 1000000000, } # provider = RPC connection http://10.1.1.2:6789 transaction_hex = HexBytes(platon.sendTransaction(data)).hex() # b'{"jsonrpc":...
code_fim
hard
{ "lang": "python", "repo": "PlatONnetwork/client-sdk-python", "path": "/tests/sdk_test1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># sendtransaction to_address = 'lax1qqqjkfwu854vf3ze2dpy5gctmxy3gdgzsngj66' ## Address = bech32.bech32_decode(from_address) # hrpgot, data = bech32.decode("lax", from_address) # from_address = to_checksum_address(bytes(data)).lower() # # arguments = tuple(address.split(",")) # hrpgot, data = bech32.decode...
code_fim
hard
{ "lang": "python", "repo": "PlatONnetwork/client-sdk-python", "path": "/tests/sdk_test1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Yucky, but easiest way to convert nested default dict to nested dict. d = json.loads(json.dumps(d)) return d<|fim_prefix|># repo: uptick/pyworkflowmax path: /workflowmax/utils.py import json import re from collections import defaultdict <|fim_middle|> def xml_to_dict(xml): nodes = re....
code_fim
hard
{ "lang": "python", "repo": "uptick/pyworkflowmax", "path": "/workflowmax/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: uptick/pyworkflowmax path: /workflowmax/utils.py import json import re from collections import defaultdict <|fim_suffix|> # Yucky, but easiest way to convert nested default dict to nested dict. d = json.loads(json.dumps(d)) return d<|fim_middle|>def xml_to_dict(xml): nodes = re....
code_fim
hard
{ "lang": "python", "repo": "uptick/pyworkflowmax", "path": "/workflowmax/utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> nodes = re.findall('(<([^>]*)>(.*?)</\\2>)', xml, re.DOTALL) if len(nodes) == 0: return xml d = defaultdict(list) for node in nodes: d[node[1]].append(xml_to_dict(node[2])) # Yucky, but easiest way to convert nested default dict to nested dict. d = json.loads(json....
code_fim
easy
{ "lang": "python", "repo": "uptick/pyworkflowmax", "path": "/workflowmax/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SVMadhavaReddy/KryptoBot path: /kryptobot/ta/pyti_directional_indicators.py from .generic_indicator import GenericIndicator from pyti.directional_indicators import positive_directional_movement, negative_directional_movement, positive_directional_index, negative_directional_index, average_directi...
code_fim
hard
{ "lang": "python", "repo": "SVMadhavaReddy/KryptoBot", "path": "/kryptobot/ta/pyti_directional_indicators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, market, interval, periods, params=None): super().__init__(market, interval, periods, None, None, params) self.value = {} def next_calculation(self, candle): if self.get_datawindow() is not None: high = self.get_high() low = self.g...
code_fim
medium
{ "lang": "python", "repo": "SVMadhavaReddy/KryptoBot", "path": "/kryptobot/ta/pyti_directional_indicators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fseimb/moviebot-1 path: /moviebot/controller/messenger.py """This file contains a Messenger class which sends post requests to the facebook API.""" import requests class Messenger: def __init__(self, user_id, token): """Initializes structs and uri's for Messenger.""" self....
code_fim
hard
{ "lang": "python", "repo": "fseimb/moviebot-1", "path": "/moviebot/controller/messenger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Posts a button template of type url_button. Args: title: button title options: structs with values Returns: post request containing url_button json and url_button uri """ buttons = self.create_buttons(options) templa...
code_fim
hard
{ "lang": "python", "repo": "fseimb/moviebot-1", "path": "/moviebot/controller/messenger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def buttons_template(self, buttons, text): """Sends a button template with different button types. Args: buttons: list of buttons text: template title Returns: post request with button template json and button template uri ...
code_fim
hard
{ "lang": "python", "repo": "fseimb/moviebot-1", "path": "/moviebot/controller/messenger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dcramer/cask-server path: /cask/cask/migrations/0001_initial.py # Generated by Django 2.1 on 2018-08-09 21:59 import uuid import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> depende...
code_fim
hard
{ "lang": "python", "repo": "dcramer/cask-server", "path": "/cask/cask/migrations/0001_initial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("spirits", "0001_initial"), ("world", "0001_initial"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="CheckIn", fields=[ ( "...
code_fim
hard
{ "lang": "python", "repo": "dcramer/cask-server", "path": "/cask/cask/migrations/0001_initial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name="CheckIn", fields=[ ( "id", models.UUIDField( default=uuid.uuid4, editable=False, primary_key=True...
code_fim
hard
{ "lang": "python", "repo": "dcramer/cask-server", "path": "/cask/cask/migrations/0001_initial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>_description=open('README.md').read(), license='MIT', author='Amir Ziai, Quan Hua', keywords=['ai', 'tensorflow', 'deep learning'], url='https://github.com/aiwithtf/aiwithtf' )<|fim_prefix|># repo: aiwithtf/aiwithtf path: /setup.py from setuptools import setup, find_packages setup( n...
code_fim
medium
{ "lang": "python", "repo": "aiwithtf/aiwithtf", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiwithtf/aiwithtf path: /setup.py from setuptools import setup, find_packages setup( name='aiwithtf', version='0.0.1', packages=find_packages(), description='Artificial Intelligence with TensorFlow', long<|fim_suffix|>keywords=['ai', 'tensorflow', 'deep learning'], url='h...
code_fim
medium
{ "lang": "python", "repo": "aiwithtf/aiwithtf", "path": "/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> engine.qcircuit.cx(qep_target, any_piece_ancilla) engine.qcircuit.cx(qtarget, any_piece_ancilla) engine.qcircuit.x(any_piece_ancilla) engine.qcircuit.unitary(iSwap_controlled, [qep_target, captured_ancilla1, any_piece_ancilla]) engine.qcircuit.unitary(iSwap_controlled, [qtarget...
code_fim
hard
{ "lang": "python", "repo": "hsrijay/quantum-chess", "path": "/quantum-chess/qchess/engines/qiskit/qutils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsrijay/quantum-chess path: /quantum-chess/qchess/engines/qiskit/qutils.py import math from qiskit import QuantumCircuit, QuantumRegister from qiskit.quantum_info.operators import Operator from qiskit import Aer from qiskit import execute from qiskit.tools.visualization import plot_histogr...
code_fim
hard
{ "lang": "python", "repo": "hsrijay/quantum-chess", "path": "/quantum-chess/qchess/engines/qiskit/qutils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #perform the other jump engine.qcircuit.x(path_ancilla2) engine.qcircuit.ccx(path_ancilla1, path_ancilla2, control_ancilla) engine.qcircuit.unitary(iSwap_controlled, [qsingle, qdouble2, control_ancilla]) engine.qcircuit.x(path_ancilla2) def perform_split_slide(engine, source, ta...
code_fim
hard
{ "lang": "python", "repo": "hsrijay/quantum-chess", "path": "/quantum-chess/qchess/engines/qiskit/qutils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> title = "[MSS] FPS benchmark" fps = 0 sct = mss.mss() last_time = time.time() while time.time() - last_time < 1: img = numpy.asarray(sct.grab(mon)) fps += 1 return fps def main(): sct = mss.mss() g = get_percents(sct, 1920, 1080, 0) while True: ...
code_fim
medium
{ "lang": "python", "repo": "jaketerrito/melee_ai", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while time.time() - last_time < 1: img = numpy.asarray(sct.grab(mon)) fps += 1 return fps def main(): sct = mss.mss() g = get_percents(sct, 1920, 1080, 0) while True: print(next(g)) main()<|fim_prefix|># repo: jaketerrito/melee_ai path: /test.py import time i...
code_fim
medium
{ "lang": "python", "repo": "jaketerrito/melee_ai", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaketerrito/melee_ai path: /test.py import time import mss import numpy import matplotlib.pyplot as plt from PIL import Image from percentages import get_percents # Screenshot stress test def screen_record_efficient(): # 800x600 windowed mode mon = {"top": 0, "left": 0, "width": 320, "he...
code_fim
medium
{ "lang": "python", "repo": "jaketerrito/melee_ai", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> yield make_batch(user, project, cycle, batch_request) @pytest.fixture def create_cycletest_request(): yield { 'startDate': datetime.datetime.utcnow().timestamp(), 'cellId': 'cell', 'batteryType': 'NiCd', 'channel': '2', 'comments': 'comments', 'publ...
code_fim
hard
{ "lang": "python", "repo": "OpenChemistry/edp", "path": "/server/tests/conftest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture def cycle_request(): return { 'startDate': datetime.datetime.utcnow().timestamp(), 'title': 'title', 'public': True } @pytest.fixture def make_cycle(server): from girder.plugins.edp.models.cycle import Cycle cycles = [] def _make_cycle(user, pr...
code_fim
hard
{ "lang": "python", "repo": "OpenChemistry/edp", "path": "/server/tests/conftest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenChemistry/edp path: /server/tests/conftest.py import pytest import datetime import json import six import os from pytest_girder.assertions import assertStatus from girder.models.upload import Upload from girder.models.file import File from girder.models.folder import Folder @pytest.fixture ...
code_fim
hard
{ "lang": "python", "repo": "OpenChemistry/edp", "path": "/server/tests/conftest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: alanl/ida-msdn-annotator path: /msdn-annotator/qt4/IDB_MSDN_Annotator/xml_parser_structure.py """ Parse XML file containing MSDN structure documentation. Author: Bingchang, Liu Copyright 2016 VARAS, IIE of CAS TODO: License Based on Fireeye's' code at https://github.com/fireeye/flare-...
code_fim
hard
{ "lang": "python", "repo": "alanl/ida-msdn-annotator", "path": "/msdn-annotator/qt4/IDB_MSDN_Annotator/xml_parser_structure.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.inTitle = 0 self.mapping = {} self.current_step = 0 self.structures = [] self._logger = logging.getLogger(__name__ + '.' + self.__class__.__name__) def startElement(self, name, attributes): if name == "msdn": pass elif ...
code_fim
hard
{ "lang": "python", "repo": "alanl/ida-msdn-annotator", "path": "/msdn-annotator/qt4/IDB_MSDN_Annotator/xml_parser_structure.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeopoldWalther/UDND-Data-Structures-and-Algorithms path: /Project_2/problem_2/problem_2.py # You are given a target value to search. If found in the array return its index, otherwise return -1. # You can assume there are no duplicates in the array and your algorithm's runtime complexity must be O...
code_fim
hard
{ "lang": "python", "repo": "LeopoldWalther/UDND-Data-Structures-and-Algorithms", "path": "/Project_2/problem_2/problem_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif input_list[end] >= input_list[mid]: # then right side ordered if input_list[end] >= target > input_list[mid]: # then target value in right side return rotated_array_search_recursive(input_list, target, mid+1, end) else: return rotated_array_search_recursi...
code_fim
hard
{ "lang": "python", "repo": "LeopoldWalther/UDND-Data-Structures-and-Algorithms", "path": "/Project_2/problem_2/problem_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @contextlib.contextmanager def _build_context(self): if self.settings.compiler == "Visual Studio": with tools.vcvars(self.settings): ...
code_fim
hard
{ "lang": "python", "repo": "ericLemanissier/conan-center-index", "path": "/recipes/xorg-proto/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericLemanissier/conan-center-index path: /recipes/xorg-proto/all/conanfile.py from conan import ConanFile from conan.tools.files import rmdir, mkdir, save, load, get, apply_conandata_patches from conans import AutoToolsBuildEnvironment, tools import contextlib import glob import os import re impo...
code_fim
hard
{ "lang": "python", "repo": "ericLemanissier/conan-center-index", "path": "/recipes/xorg-proto/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # self.info.header_only() would be fine too, but keep the os to add c3i test coverage for Windows. del self.info.settings.arch del self.info.settings.build_type del self.info.settings.compiler def source(self): get(self, **self.conan_data["sources"][self.versio...
code_fim
hard
{ "lang": "python", "repo": "ericLemanissier/conan-center-index", "path": "/recipes/xorg-proto/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tzoiker/aiomisc path: /aiomisc/plugins.py import logging import os from types import MappingProxyType from typing import Callable, Mapping def setup_plugins() -> Mapping[str, Callable]: <|fim_suffix|>if __name__ == "__main__": from aiomisc_log import LogFormat, basic_config basic_confi...
code_fim
hard
{ "lang": "python", "repo": "tzoiker/aiomisc", "path": "/aiomisc/plugins.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plugins: Mapping[str, Callable] = setup_plugins() __all__ = ("plugins",) if __name__ == "__main__": from aiomisc_log import LogFormat, basic_config basic_config(log_format=LogFormat.plain) logging.info("Available %s plugins.", len(plugins)) for name in plugins: print(name)<|fi...
code_fim
hard
{ "lang": "python", "repo": "tzoiker/aiomisc", "path": "/aiomisc/plugins.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CaiBirdHSA/xinvert path: /tests/testIshida.py # -*- coding: utf-8 -*- """ Created on 2021.04.23 @author: MiniUFO Copyright 2018. All rights reserved. Use is subject to license terms. """ #%% classical cases import numpy as np import xarray as xr from xgrads.xgrads import open_CtlDataset xnum = ...
code_fim
hard
{ "lang": "python", "repo": "CaiBirdHSA/xinvert", "path": "/tests/testIshida.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ax = axes[0] plot(h1.where(h1!=undef)/1e6*depth, ax=ax, ptype='both', cmap='greens', fmt='%1.0f', ylabel='y-coordinate (m)', cbarpos='horizontal', clevs=np.linspace(-90, 90, 37), xlabel='x-coordinate (m)') ax.set_title('R = R0', fontsize=fontsize) # p=ax.quiver(xgrid.values[::skip,::skip+2], ygr...
code_fim
hard
{ "lang": "python", "repo": "CaiBirdHSA/xinvert", "path": "/tests/testIshida.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> op = core.CreateOperator( 'LearningRate', 'data', 'out', policy="hill", base_lr=base_lr, num_iter=num_iter, start_multiplier=start_multiplier, gamma=gamma, power=power, end_multi...
code_fim
hard
{ "lang": "python", "repo": "sunpan822/caffe2", "path": "/caffe2/python/operator_test/learning_rate_op_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> iter = np.random.randint(low=1, high=1e5, size=1) num_iter = int(np.random.randint(low=1e2, high=1e3, size=1)) start_multiplier = 1e-4 gamma = 1.0 power = 0.5 end_multiplier = 1e-2 base_lr = float(np.random.random(1)) def ref(iter): ...
code_fim
hard
{ "lang": "python", "repo": "sunpan822/caffe2", "path": "/caffe2/python/operator_test/learning_rate_op_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunpan822/caffe2 path: /caffe2/python/operator_test/learning_rate_op_test.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core import caffe2.python.hypothesis_test_ut...
code_fim
hard
{ "lang": "python", "repo": "sunpan822/caffe2", "path": "/caffe2/python/operator_test/learning_rate_op_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: villesavolainen/python-cozify path: /cozify/cloud_api.py """Module for handling Cozify Cloud API 1:1 functions Attributes: cloudBase(str): API endpoint including version """ import json import requests from .Error import APIError, AuthenticationError, ConnectionError cloudBase = 'https:/...
code_fim
hard
{ "lang": "python", "repo": "villesavolainen/python-cozify", "path": "/cozify/cloud_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: requests.response: Requests response object. """ if data: return put('/hub/remote' + apicall, headers=headers, data=data, raw=True) else: return get('/hub/remote' + apicall, headers=headers, raw=True) def _call(*, call, method, ...
code_fim
hard
{ "lang": "python", "repo": "villesavolainen/python-cozify", "path": "/cozify/cloud_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """1:1 implementation of user/hubkeys Args: cloud_token(str) Cloud remote authentication token. Returns: dict: Map of hub_id: hub_token pairs. """ headers = {'Authorization': cloud_token} return get('/user/hubkeys', headers=headers, **kwargs) def refreshsession(...
code_fim
hard
{ "lang": "python", "repo": "villesavolainen/python-cozify", "path": "/cozify/cloud_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1ucian0/qiskit-terra path: /qiskit/result/distributions/quasi.py # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree ...
code_fim
hard
{ "lang": "python", "repo": "1ucian0/qiskit-terra", "path": "/qiskit/result/distributions/quasi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: dict: A dictionary where the keys are binary strings in the format ``"0110"`` """ n = self._num_bits if num_bits is None else num_bits return {format(key, "b").zfill(n): value for key, value in self.items()} def hex_probabilities(se...
code_fim
hard
{ "lang": "python", "repo": "1ucian0/qiskit-terra", "path": "/qiskit/result/distributions/quasi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OlegDurandin/dtree2vec path: /dep_tree_embedding.py from typing import List import networkx as nx import pandas as pd from tqdm import tqdm from joblib import Parallel, delayed from gensim.models.doc2vec import Doc2Vec, TaggedDocument # This file contain realization of different represent...
code_fim
hard
{ "lang": "python", "repo": "OlegDurandin/dtree2vec", "path": "/dep_tree_embedding.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DepTreeEmbedding: def __init__(self, extractorInstance, doc2vecargs: dict ): self.Extractor = extractorInstance self.doc2vecargs = doc2vecargs self.workers = self.doc2vecargs['workers'] self.model_fit = ...
code_fim
hard
{ "lang": "python", "repo": "OlegDurandin/dtree2vec", "path": "/dep_tree_embedding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return str(locale.currency(self.price, grouping=True)) def seller_string(self): return " ".join([self.seller.first_name, self.seller.last_name]) def liked_by_current_user(self, user_id): likes = self.likes.filter(id=user_id) # If user has liked this product ...
code_fim
hard
{ "lang": "python", "repo": "solanum-tuberosums/djangazon", "path": "/website/models/product_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: solanum-tuberosums/djangazon path: /website/models/product_model.py """ djangazon model configuration for product """ from django.db import models from django.db.models import Sum from django.contrib.auth.models import User from website.models.product_category_model import ProductCategory import...
code_fim
hard
{ "lang": "python", "repo": "solanum-tuberosums/djangazon", "path": "/website/models/product_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xpspectre/test-ci path: /tests/test_run.py import unittest from test_ci.run import add, sub <|fim_suffix|> def test_add(self): self.assertEqual(add(1, 2), 3) def test_sub(self): self.assertEqual(sub(5, 4), 1)<|fim_middle|> class RunTest(unittest.TestCase):
code_fim
easy
{ "lang": "python", "repo": "xpspectre/test-ci", "path": "/tests/test_run.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_add(self): self.assertEqual(add(1, 2), 3) def test_sub(self): self.assertEqual(sub(5, 4), 1)<|fim_prefix|># repo: xpspectre/test-ci path: /tests/test_run.py import unittest from test_ci.run import add, sub <|fim_middle|> class RunTest(unittest.TestCase):
code_fim
easy
{ "lang": "python", "repo": "xpspectre/test-ci", "path": "/tests/test_run.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(add(1, 2), 3) def test_sub(self): self.assertEqual(sub(5, 4), 1)<|fim_prefix|># repo: xpspectre/test-ci path: /tests/test_run.py import unittest from test_ci.run import add, sub <|fim_middle|> class RunTest(unittest.TestCase): def test_add(self):
code_fim
easy
{ "lang": "python", "repo": "xpspectre/test-ci", "path": "/tests/test_run.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_tags(tags_list): # Takes a list of tags, prepares each tag and joins them into a string by the pipe character return prepare_feature("|".join(tags_list)) def remove_unsafe_characters(string: str, unsafe_characters=None) -> str: # Any characters to exclude, generally these are things...
code_fim
hard
{ "lang": "python", "repo": "Valzavator/YouTubeTrendingVideosAnalysis", "path": "/processing_tool/data_preprocessing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Valzavator/YouTubeTrendingVideosAnalysis path: /processing_tool/data_preprocessing.py import json from util.args import Args def match_category_id_with_category_title(videos_data: list, category_id_file_path=None) -> list: if videos_data is None: raise ValueError('Videos data can`t...
code_fim
hard
{ "lang": "python", "repo": "Valzavator/YouTubeTrendingVideosAnalysis", "path": "/processing_tool/data_preprocessing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PrincetonUniversity/PsyNeuLink path: /psyneulink/library/compositions/pytorchllvmhelper.py from psyneulink.core import llvm as pnlvm __all__ = ["gen_inject_vec_binop", "gen_inject_vec_add", "gen_inject_vec_sub", "gen_inject_vec_hadamard", "gen_inject_m...
code_fim
hard
{ "lang": "python", "repo": "PrincetonUniversity/PsyNeuLink", "path": "/psyneulink/library/compositions/pytorchllvmhelper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> m1_ptr = builder.gep(m1, [ctx.int32_ty(0), ctx.int32_ty(0), ctx.int32_ty(0)]) m2_ptr = builder.gep(m2, [ctx.int32_ty(0), ctx.int32_ty(0), ctx.int32_ty(0)]) output_ptr = builder.gep(output_mat, [ctx.int32_ty(0), ctx.int32_ty(0), ctx.int32_ty(0)]) builtin = ctx.import_llvm_function(op) ...
code_fim
hard
{ "lang": "python", "repo": "PrincetonUniversity/PsyNeuLink", "path": "/psyneulink/library/compositions/pytorchllvmhelper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: buncybunny/PBR path: /configs_TFA/cascade_rcnn/TFA_voc/cascade_rcnn_r50_fpn_1x_cos_all_fast_test.py _base_ = [ '../../_base_/models/TFA_voc/cascade_rcnn_r5<|fim_suffix|>plit1_ft_all_3shot.py', '../../_base_/default_runtime.py' ]<|fim_middle|>0_fpn_cos_all.py', '../../_base_/data/TFA_voc/s...
code_fim
medium
{ "lang": "python", "repo": "buncybunny/PBR", "path": "/configs_TFA/cascade_rcnn/TFA_voc/cascade_rcnn_r50_fpn_1x_cos_all_fast_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>_all.py', '../../_base_/schedules/TFA_voc/schedule_1x_split1_ft_all_3shot.py', '../../_base_/default_runtime.py' ]<|fim_prefix|># repo: buncybunny/PBR path: /configs_TFA/cascade_rcnn/TFA_voc/cascade_rcnn_r50_fpn_1x_cos_all_fast_test.py _base_ = [ '../../_base_/models/TFA_voc/cascade_rcnn_r5<|fim_...
code_fim
easy
{ "lang": "python", "repo": "buncybunny/PBR", "path": "/configs_TFA/cascade_rcnn/TFA_voc/cascade_rcnn_r50_fpn_1x_cos_all_fast_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def mouseMoveEvent(self, e): super(GameView, self).mouseMoveEvent(e) # self.mouseMove.emit(e) self.controller.mouseMoveEvent(e) def mousePressEvent(self, e): super(GameView, self).mousePressEvent(e) self.controller.mousePressEvent(e) def mouseReleaseEv...
code_fim
medium
{ "lang": "python", "repo": "ikamensh/pydolons", "path": "/ui/core/GameView.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikamensh/pydolons path: /ui/core/GameView.py from PySide2 import QtWidgets, QtCore from ui.core.gameconfig.GameConfiguration import GameConfiguration class GameView(QtWidgets.QGraphicsView): resized = QtCore.Signal() wheel_change = QtCore.Signal() keyPress = QtCore.Signal(QtCore.QEv...
code_fim
hard
{ "lang": "python", "repo": "ikamensh/pydolons", "path": "/ui/core/GameView.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def mouseReleaseEvent(self, e): super(GameView, self).mouseReleaseEvent(e) self.controller.mouseReleaseEvent(e) def resizeEvent(self, e): self.timer.start(50) super().resizeEvent(e) def slotAlarmTimer(self): w, h = self.width(), self.height() i...
code_fim
medium
{ "lang": "python", "repo": "ikamensh/pydolons", "path": "/ui/core/GameView.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: nohtyprm/tango path: /src/tangolib/optparse.py '''module optparse Parsing command and environment options. ''' def parse_options(input, keysep='=', itemsep=','): #import pdb; pdb.set_trace() opts = dict() i = 0 parse_key = True current_key = "" current_value = "" wh...
code_fim
hard
{ "lang": "python", "repo": "nohtyprm/tango", "path": "/src/tangolib/optparse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif ch == itemsep or i+1 == len(input): # if next character is item separator if i+1 < len(input): ch2 = input[i+1] if ch2 == itemsep: # protected item separator, put into key name ...
code_fim
hard
{ "lang": "python", "repo": "nohtyprm/tango", "path": "/src/tangolib/optparse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> X.ww.init() y = ww.init_series(y) return X, y<|fim_prefix|># repo: Open-Sources-Project/evalml path: /evalml/demos/breast_cancer.py import pandas as pd import woodwork as ww from sklearn.datasets import load_breast_cancer as load_breast_cancer_sk <|fim_middle|>def load_breast_cancer(): ...
code_fim
hard
{ "lang": "python", "repo": "Open-Sources-Project/evalml", "path": "/evalml/demos/breast_cancer.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Open-Sources-Project/evalml path: /evalml/demos/breast_cancer.py import pandas as pd import woodwork as ww from sklearn.datasets import load_breast_cancer as load_breast_cancer_sk <|fim_suffix|> X.ww.init() y = ww.init_series(y) return X, y<|fim_middle|>def load_breast_cancer(): ...
code_fim
hard
{ "lang": "python", "repo": "Open-Sources-Project/evalml", "path": "/evalml/demos/breast_cancer.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ColorOfLight/kaist-musynth path: /code-pool/max-min5.py n = int(input()) k = int(input()) vals = [] for i in range(<|fim_suffix|>[-1] for i in range(n-k+1): diff = vals[i+k-1]-vals[i] if diff < minDiff: minDiff = diff print(minDiff)<|fim_middle|>n): vals.append(int(input())) v...
code_fim
medium
{ "lang": "python", "repo": "ColorOfLight/kaist-musynth", "path": "/code-pool/max-min5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>[-1] for i in range(n-k+1): diff = vals[i+k-1]-vals[i] if diff < minDiff: minDiff = diff print(minDiff)<|fim_prefix|># repo: ColorOfLight/kaist-musynth path: /code-pool/max-min5.py n = int(input()) k = int(input()) vals = [] for i in range(<|fim_middle|>n): vals.append(int(input())) v...
code_fim
medium
{ "lang": "python", "repo": "ColorOfLight/kaist-musynth", "path": "/code-pool/max-min5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if diff < minDiff: minDiff = diff print(minDiff)<|fim_prefix|># repo: ColorOfLight/kaist-musynth path: /code-pool/max-min5.py n = int(input()) k = int(input()) vals = [] for i in range(n): vals.append(int(input())) vals.sort() minDiff = vals<|fim_middle|>[-1] for i in range(n-k+1): di...
code_fim
easy
{ "lang": "python", "repo": "ColorOfLight/kaist-musynth", "path": "/code-pool/max-min5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(1, 0, 1, 1) self._ui.output_canvas.setLayout(layout) layout.addWidget(self._output_widget) spacer = QtWidgets.QSpacerItem(5, 5, QtWidgets.QSizePolicy.Minimum, ...
code_fim
hard
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/dialogs/link_editor/qt/link_equation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: astrofrog/glue path: /glue/dialogs/link_editor/qt/link_equation.py from __future__ import absolute_import, division, print_function import os from inspect import getargspec from qtpy import QtWidgets from qtpy import PYSIDE from glue import core from glue.config import link_function, link_helpe...
code_fim
hard
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/dialogs/link_editor/qt/link_equation.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Create and add a single argument widget to the input canvas :param arguement: The argument name (string) """ widget = ArgumentWidget(argument) widget.editor.textChanged.connect(nonpartial(self._update_add_enabled)) self._ui.input_canvas.layout().addWidge...
code_fim
hard
{ "lang": "python", "repo": "astrofrog/glue", "path": "/glue/dialogs/link_editor/qt/link_equation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ckcollab/vargas_text path: /get_comments.py # Import reddit module import praw # Connect to reddit as our generator (reddit requires # you to specify user agent, apparently) reddit = praw.Reddit(user_agent='Vargas Markov Generator') user = reddit.get_redditor('_vargas_') <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "ckcollab/vargas_text", "path": "/get_comments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> comment_text = comment.body + "\n" output.write(comment_text)<|fim_prefix|># repo: ckcollab/vargas_text path: /get_comments.py # Import reddit module import praw # Connect to reddit as our generator (reddit requires # you to specify user agent, apparently) reddit = praw.Reddit(user_age...
code_fim
medium
{ "lang": "python", "repo": "ckcollab/vargas_text", "path": "/get_comments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># setup DB session engine = create_engine(cfg.SQLALCHEMY_DATABASE_URI) session = create_db_session(engine) # setup PRAW handler handler = None if cfg.MULTIPROCESS: handler = praw.handlers.MultiprocessHandler() # setup and open connection to Reddit user_agent = "Reddit analytics scraper by /u/{}".for...
code_fim
medium
{ "lang": "python", "repo": "PsyBorgs/redditanalyser", "path": "/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Attributes of interest for comment objects # note: including `author` slows comment requests considerably COMMENT_ATTRS = [ 'id', 'created_utc', # 'author', 'body', 'score', 'ups', 'downs', 'subreddit', 'subreddit_id', 'controversiality', 'is_root', 'paren...
code_fim
hard
{ "lang": "python", "repo": "PsyBorgs/redditanalyser", "path": "/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PsyBorgs/redditanalyser path: /app/__init__.py # -*- coding: utf-8 -*- import logging import praw from settings import Config from .database import create_engine, create_db_session logging.basicConfig(level="WARNING") logger = logging.getLogger(__name__) # Project configuration settings cfg ...
code_fim
medium
{ "lang": "python", "repo": "PsyBorgs/redditanalyser", "path": "/app/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(0, 11): print('{} x {} = {}'.format(pro, i, pro*i))<|fim_prefix|># repo: mrgomides/VemPython path: /desafios/exe049.py # Projeto: VemPython/exe049 # Autor: rafael # Data: 16/03/18 - 17:29 # Objetivo: TODO Refaça o DESAFIO 9, mostrando a tabuada de um número que o usuário escolher, só q...
code_fim
easy
{ "lang": "python", "repo": "mrgomides/VemPython", "path": "/desafios/exe049.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrgomides/VemPython path: /desafios/exe049.py # Projeto: VemPython/exe049 # Autor: rafael # Data: 16/03/18 - 17:29 # Objetivo: TODO Refaça o DESAFIO 9, mostrando a tabuada de um número que o usuário escolher, só que agora utilizando um laço for <|fim_suffix|>for i in range(0, 11): print('{} ...
code_fim
easy
{ "lang": "python", "repo": "mrgomides/VemPython", "path": "/desafios/exe049.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> class Energized_Buff(BuffingAbility): def __init__(self, name, value, duration=None): super().__init__(name, value, duration or 15) def oninit(self, adv, afrom=None): def l_energized(e): if e.stack >= 5: adv.Buff(*self.buff_args).on() adv.Even...
code_fim
hard
{ "lang": "python", "repo": "b1ueb1ues/dl", "path": "/ability/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: b1ueb1ues/dl path: /ability/__init__.py afflict = name.split('_', 1)[1] super().__init__(name, [(f'{afflict}_{mtype}', morder, value, cond)]) else: super().__init__(name, [(mtype, morder, value, cond)]) class Critical_Chance(ConditionalModifierAbility): def _...
code_fim
hard
{ "lang": "python", "repo": "b1ueb1ues/dl", "path": "/ability/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.value = value super().__init__(name) def oninit(self, adv, afrom=None): adv.afflict_guard = self.value adv.dragonform.disabled = False ability_dict['ag'] = Affliction_Guard class Energy_Prep(Ability): def __init__(self, name, value): self.energy_coun...
code_fim
hard
{ "lang": "python", "repo": "b1ueb1ues/dl", "path": "/ability/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_map_index(self): index = Row(relid=1, schemaname='public', relname='table1', indexrelname='index1', idx_scan=100, idx_tup_read=700, idx_tup_fetch=80, indisunique=True) mapped_index = IndexesDatabaseHandler.map_index(index) self.assertEquals('public.table1.index1', mapp...
code_fim
hard
{ "lang": "python", "repo": "pitluga/elephunk", "path": "/tests/elephunk/handlers/indexes_database_handler_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pitluga/elephunk path: /tests/elephunk/handlers/indexes_database_handler_test.py from unittest import TestCase from tornado.escape import json_decode from elephunk.handlers import IndexesDatabaseHandler from elephunk.database import Row class IndexesDatabaseHandlerTest(TestCase): def test_b...
code_fim
hard
{ "lang": "python", "repo": "pitluga/elephunk", "path": "/tests/elephunk/handlers/indexes_database_handler_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxfischer2781/apmon_py path: /examples/log_levels.py """ # This is an example that shows how Log Levels can be used. # The logLevel can also be specified in the configuration file like: # xApMon_loglevel = INFO """ from __future__ import print_function from builtins import range import apmon imp...
code_fim
hard
{ "lang": "python", "repo": "maxfischer2781/apmon_py", "path": "/examples/log_levels.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(1, 100): print('Sending i =', i) if i == 20: apm.setLogLevel("NOTICE") if i == 50: apm.setLogLevel("DEBUG") apm.sendParameters("MyCluster", "MyNode", {'val_i':i}) apm.sendTimedParameters("MyClusterOld", "MyNodeOld", time.time() - 5*3600, {'val_ii': i}) ...
code_fim
hard
{ "lang": "python", "repo": "maxfischer2781/apmon_py", "path": "/examples/log_levels.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> """Reorder template according to direct graph of keyword dependencies Parameters ---------- template : JSONDict Returns ------- ordered : JSONDict Notes ----- This function reorders the template in place. Warnings -------- We are assuming that there ...
code_fim
hard
{ "lang": "python", "repo": "dev-cafe/parselglossy", "path": "/parselglossy/check_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dev-cafe/parselglossy path: /parselglossy/check_template.py # -*- coding: utf-8 -*- # # parselglossy -- Generic input parsing library, speaking in tongues # Copyright (C) 2020 Roberto Di Remigio, Radovan Bast, and contributors. # # This file is part of parselglossy. # # Permission is hereby grant...
code_fim
hard
{ "lang": "python", "repo": "dev-cafe/parselglossy", "path": "/parselglossy/check_template.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: github/codeql path: /python/ql/src/Statements/UnnecessaryElseClause.py def pointless_else(container): for item in container: if of_interest(item): return item else: raise NotFoundException() <|fim_suffix|>def with_break(container): for item in container: ...
code_fim
medium
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/src/Statements/UnnecessaryElseClause.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for item in container: if of_interest(item): return item raise NotFoundException() def with_break(container): for item in container: if of_interest(item): found = item break else: raise NotFoundException() return found<|fim_p...
code_fim
easy
{ "lang": "python", "repo": "github/codeql", "path": "/python/ql/src/Statements/UnnecessaryElseClause.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }