text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def getChordType(rootNote,thirdNote,fifthNote): intervals = (getInterval(rootNote,thirdNote),getInterval(thirdNote,fifthNote)) if (intervals == (4,3)): return "Major" elif (intervals == (3,4)): return "Minor" elif (intervals == (3,3)): return "Diminished" elif (intervals == (4,4)): return "Au...
code_fim
hard
{ "lang": "python", "repo": "PsychedelicPasta/pyFrets", "path": "/guitarfretboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _is_sym_size_node(node: Node): return ( node.op == "call_function" and node.target == torch.ops.aten.sym_size.default or node.target == torch.ops.aten.sym_numel.default or node.target == torch.ops.aten.sym_numel or node.target == torch.ops.aten.sym_size ...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/ao/quantization/quantizer/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/pytorch path: /torch/ao/quantization/quantizer/utils.py from typing import List, Optional import torch from torch.ao.quantization.quantizer.quantizer import ( QuantizationAnnotation, QuantizationConfig, QuantizationSpec, ) from torch.fx import Node __all__ = [ "get_input...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/ao/quantization/quantizer/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hmajid2301/EmotionCommotion path: /EmotionCommotion/dataset creation/audioChopper.py import scipy.io.wavfile as wav # Reads wav file import sys import csv import ntpath import numpy as np import pandas as pd import os from glob import glob import sys from types import * import json #Use soxi ...
code_fim
hard
{ "lang": "python", "repo": "hmajid2301/EmotionCommotion", "path": "/EmotionCommotion/dataset creation/audioChopper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #wav.read gets the sample rate and creates an audio variable which allows use of the audio data at filepath [sample_rate, audio] = wav.read(filepath) print("sample rate = " + str(sample_rate)) #len(audio)/sample_rate=length of audio in seconds #for loop to iterate over each triple for i in range...
code_fim
hard
{ "lang": "python", "repo": "hmajid2301/EmotionCommotion", "path": "/EmotionCommotion/dataset creation/audioChopper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print out current run_uuid run_uuid = mlflow.active_run().info.run_uuid print("MLflow Run ID: %s" % run_uuid) # log parameters params = self.get_params() for k, v in params.items(): if k not in ['build_fn', 'callbac...
code_fim
hard
{ "lang": "python", "repo": "kleysonr/snsdl", "path": "/snsdl/keras/wrappers/mlflow_classifier.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # # save model locally # pathdir = "keras_models/" + run_uuid # model_dir = self.get_directory_path(pathdir, False) # ktrain_cls.keras_save_model(model, model_dir) # # Write out TensorFlow events as a run artifact # print("Uploading ...
code_fim
hard
{ "lang": "python", "repo": "kleysonr/snsdl", "path": "/snsdl/keras/wrappers/mlflow_classifier.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kleysonr/snsdl path: /snsdl/keras/wrappers/mlflow_classifier.py import os import copy import mlflow import pandas as pd from keras.callbacks import CSVLogger from snsdl.keras.wrappers import BaseWrapper class MlflowClassifier(BaseWrapper): """ Implementation of the mlflow classifier API for ...
code_fim
hard
{ "lang": "python", "repo": "kleysonr/snsdl", "path": "/snsdl/keras/wrappers/mlflow_classifier.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>= int(input(f'Quantidade de gols no jogo {j+1}: ')) partidas.append(j+1) partidas.append(g) jogador['jogos'] = partidas campeonato.append(jogador.copy()) print(campeonato) for c in campeonato: nome = c['nome'] jogos = c['jogos'] print(f'Vamos analisar o joga...
code_fim
hard
{ "lang": "python", "repo": "felipesch92/PythonExercicios", "path": "/ex093.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: felipesch92/PythonExercicios path: /ex093.py # Crie um programa que gerencie o aproveitamento de um jogador # de futebol. O programa vai ler o nome do jogador e quantas partidas # ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. # No final, tudo isso será guardado em um dici...
code_fim
hard
{ "lang": "python", "repo": "felipesch92/PythonExercicios", "path": "/ex093.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>os'] print(f'Vamos analisar o jogador {nome}') t = 0 for k, j in enumerate(jogos): if k % 2 == 0: print(f'No jogo {j} foram ', end='') else: print(f'{j} gols') t += j print(f'No total foram {t} gols.')<|fim_prefix|># repo: felipesch92/Pyt...
code_fim
hard
{ "lang": "python", "repo": "felipesch92/PythonExercicios", "path": "/ex093.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self) -> ConfigNodePropertyString: """Gets the com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency of this ComAdobeCqScreensOfflinecontentImpl...
code_fim
hard
{ "lang": "python", "repo": "shinesolutions/swagger-aem-osgi", "path": "/clients/python-flask/generated/openapi_server/models/com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_properties.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency.setter def com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency(self, com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_schedule_frequency: ...
code_fim
hard
{ "lang": "python", "repo": "shinesolutions/swagger-aem-osgi", "path": "/clients/python-flask/generated/openapi_server/models/com_adobe_cq_screens_offlinecontent_impl_bulk_offline_update_service_impl_properties.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> browser_dict[row[0]] = (urls_id,urls,urls_title,urls_visit_count,urls_typed_count,urls_last_visit_time,urls_hidden,visits_time,visits_from_visit,visits_duration,visits_transition) row = browser_cursor.fetchone() browser_cursor.close() browser_conn.close() browser_output_file...
code_fim
hard
{ "lang": "python", "repo": "scorelab/OpenMF", "path": "/scripts/browser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scorelab/OpenMF path: /scripts/browser.py ''' script for extracting browsers history ''' import sys import sqlite3 import os import json import datetime import urllib from scripts import dbm from scripts.os_check import SEP from scripts.utils import ROOT_DIR, mkdir OUTPUT = ROOT_DIR ''' loca...
code_fim
hard
{ "lang": "python", "repo": "scorelab/OpenMF", "path": "/scripts/browser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ultimatenhapper/zipline-reloaded path: /tests/utils/test_sentinel.py from copy import copy, deepcopy from pickle import loads, dumps import sys from weakref import ref from zipline.utils.sentinel import sentinel import pytest @pytest.fixture(scope="function") def clear_cache(): yield se...
code_fim
hard
{ "lang": "python", "repo": "ultimatenhapper/zipline-reloaded", "path": "/tests/utils/test_sentinel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_memo(self): assert sentinel("a") is sentinel("a") def test_copy(self): a = sentinel("a") assert copy(a) is a def test_deepcopy(self): a = sentinel("a") assert deepcopy(a) is a def test_repr(self): assert repr(sentinel("a")) == "se...
code_fim
hard
{ "lang": "python", "repo": "ultimatenhapper/zipline-reloaded", "path": "/tests/utils/test_sentinel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IBM/simulai path: /tests/parallelism/test_modelpool_esn.py 2022. # 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.apache.org/licenses/LIC...
code_fim
hard
{ "lang": "python", "repo": "IBM/simulai", "path": "/tests/parallelism/test_modelpool_esn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> esn_2 = EchoStateNetwork.restore(default_model_dir, "my_esn") esn_2.fit(input_data=esn_input_data, target_data=outs) esn_2.set_reference(esn.default_state) esn_2.reset() outs_2 = [] for step in range(esn_input...
code_fim
hard
{ "lang": "python", "repo": "IBM/simulai", "path": "/tests/parallelism/test_modelpool_esn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IBM/simulai path: /tests/parallelism/test_modelpool_esn.py _data[1:] pool_config = { "template": "independent_series", "n_inputs": field_train_data.shape[1] + forcings_train_data.shape[1], "n_outputs": field_train_data.shape[1], "n_auxiliar...
code_fim
hard
{ "lang": "python", "repo": "IBM/simulai", "path": "/tests/parallelism/test_modelpool_esn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: array.array: New, initialized array """ return array.array(FLOAT_TYPECODE, *args, **kwargs)<|fim_prefix|># repo: radiasoft/pykern path: /pykern/pkarray.py # -*- coding: utf-8 -*- """Wrapper for :mod:`array` to simplify and make future compatible. Not a complete wrapper. New ...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/pykern", "path": "/pykern/pkarray.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: radiasoft/pykern path: /pykern/pkarray.py # -*- coding: utf-8 -*- """Wrapper for :mod:`array` to simplify and make future compatible. Not a complete wrapper. New routines added as required. <|fim_suffix|>def new_double(*args, **kwargs): """Creates a new double ("d") array Args are the ...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/pykern", "path": "/pykern/pkarray.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def new_float(*args, **kwargs): """Creates a new float ("f") array Args are the same as :func:`array.array` except for typecode, which is passed by this module. Returns: array.array: New, initialized array """ return array.array(FLOAT_TYPECODE, *args, **kwargs)<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/pykern", "path": "/pykern/pkarray.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eriche2016/pytorch_projects_misc path: /golden_examples/tutorials/08 - Language Model/main.py # Some part of the code was referenced from below. # https://github.com/pytorch/examples/tree/master/word_language_model import torch import torch.nn as nn import numpy as np from torch.autograd import...
code_fim
hard
{ "lang": "python", "repo": "eriche2016/pytorch_projects_misc", "path": "/golden_examples/tutorials/08 - Language Model/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Loss and Optimizer criterion = nn.CrossEntropyLoss() optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate) # Truncated Backpropagation def detach(states): return [Variable(state.data) for state in states] # Training for epoch in range(num_epochs): # Initial hidden and memory sta...
code_fim
hard
{ "lang": "python", "repo": "eriche2016/pytorch_projects_misc", "path": "/golden_examples/tutorials/08 - Language Model/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Training for epoch in range(num_epochs): # Initial hidden and memory states states = (Variable(torch.zeros(num_layers, batch_size, hidden_size)), Variable(torch.zeros(num_layers, batch_size, hidden_size))) for i in range(0, ids.size(1) - seq_length, seq_length): # ...
code_fim
hard
{ "lang": "python", "repo": "eriche2016/pytorch_projects_misc", "path": "/golden_examples/tutorials/08 - Language Model/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoodRx/structlog-sentry path: /test/test_sentry_processor.py import logging import pytest from structlog_sentry import SentryJsonProcessor, SentryProcessor class MockLogger: def __init__(self, name): self.name = name def test_sentry_disabled(): processor = SentryProcessor(ac...
code_fim
hard
{ "lang": "python", "repo": "GoodRx/structlog-sentry", "path": "/test/test_sentry_processor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_sentry_json_ignore_logger_using_event_dict_record(mocker): m_ignore_logger = mocker.patch("structlog_sentry.ignore_logger") m_logger = MockLogger("MockLogger") event_data = { "level": "info", "event": "message", "_record": MockLogger("RecordLogger"), } ...
code_fim
hard
{ "lang": "python", "repo": "GoodRx/structlog-sentry", "path": "/test/test_sentry_processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("level", ["debug", "info", "warning"]) def test_sentry_log_specific_keys_as_tags(mocker, level): m_capture_event = mocker.patch("structlog_sentry.capture_event") event_data = { "level": level, "event": level + " message", "info1": "info1", ...
code_fim
hard
{ "lang": "python", "repo": "GoodRx/structlog-sentry", "path": "/test/test_sentry_processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/netatmo/switch.py """Support for Netatmo/BTicino/Legrande switches.""" from __future__ import annotations import logging from typing import Any, cast from pyatmo import modules as NaModules from homeassistant.components.switch import SwitchEn...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/netatmo/switch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Representation of a Netatmo switch device.""" def __init__( self, netatmo_device: NetatmoDevice, ) -> None: """Initialize the Netatmo device.""" super().__init__(netatmo_device.data_handler) self._switch = cast(NaModules.Switch, netatmo_device.devic...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/netatmo/switch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: netenglabs/suzieq path: /suzieq/poller/worker/services/service_manager.py schema_dir: str, output_queue: asyncio.Queue, run_mode: str, cfg: Dict, default_interval: int = 15, **kwargs) -> None: """Ins...
code_fim
hard
{ "lang": "python", "repo": "netenglabs/suzieq", "path": "/suzieq/poller/worker/services/service_manager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Raises: SqPollerConfError: raised in case of wrong service name in 'include only' or exclude list Returns: List[str]: the list of services to executed in the poller """ return self.get_service_list(service_only, ...
code_fim
hard
{ "lang": "python", "repo": "netenglabs/suzieq", "path": "/suzieq/poller/worker/services/service_manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> filename: str, svc_def: Dict, nos: str, cmds_desc: Union[Dict, List]): """Given a command description check whether initialize the textfsm finite state machine for the output parsing...
code_fim
hard
{ "lang": "python", "repo": "netenglabs/suzieq", "path": "/suzieq/poller/worker/services/service_manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- d_dimensions : int Number of dimensions to estimate the volume norm : int, default=2 The type of ball to get the volume. * 2 : euclidean distance * 1 : manhattan distance * 0 : chebyshev distance Returns ------...
code_fim
hard
{ "lang": "python", "repo": "superpig99/pysim", "path": "/pysim/information/knn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # volume of unit ball def volume_unit_ball(d_dimensions: int, norm=2) -> float: """Volume of the d-dimensional unit ball Parameters ---------- d_dimensions : int Number of dimensions to estimate the volume norm : int, default=2 The type of ball to get the vol...
code_fim
hard
{ "lang": "python", "repo": "superpig99/pysim", "path": "/pysim/information/knn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: superpig99/pysim path: /pysim/information/knn.py from typing import Optional, Union, Dict, List import numpy as np from sklearn.base import BaseEstimator from sklearn.neighbors import NearestNeighbors from scipy import stats from scipy.special import gamma, psi from sklearn.utils import check_arr...
code_fim
hard
{ "lang": "python", "repo": "superpig99/pysim", "path": "/pysim/information/knn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return y/x #price per unit def xperpound(x): return x/8 #price per oz. def buyxgetyfree(x,y): return x/(x+y) #price per unit #Finds type of custom deal def findDeal(i): if deals[i][0] != 0: return 0 elif deals[i][2] != 0: return 1 elif deals[i][4] != 0: return 2 #Gives processed data on a cu...
code_fim
hard
{ "lang": "python", "repo": "DevTheDev/CodeKata", "path": "/GroceryStore.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: DevTheDev/CodeKata path: /GroceryStore.py #Grocery Store Pricer #Stock in terms of "name":[units, price, wholesale cost] stock = { "can":[50, 9.45, 0.5], "chip":[100, 6.75, 0.2], "soda":[46, 5.00, 0.46], "water":[30, 2.25, 0.1], "spice":[400, 0.5, 0.05], "milk":[49, 2.5, 0.56], "ice cream"...
code_fim
hard
{ "lang": "python", "repo": "DevTheDev/CodeKata", "path": "/GroceryStore.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>#Gives processed data on a custom deal def listCustomDeals(i): print "There are " + str(stock[i][0]) + " units of " + str(i) + " remaining." type = findDeal(i) if type == 0: p = xforydollar(deals[i][0], deals[i][1]) print "This " + str(i) + " costs us $" + str(stock[i][2]*stock[i][0]) + "." print...
code_fim
hard
{ "lang": "python", "repo": "DevTheDev/CodeKata", "path": "/GroceryStore.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: zmlabe/SeaIceQBO path: /Scripts/Data_Analysis/plot_FIGURE_JetStreamLocations.py """ Manuscript figure for regional locations of the jet Notes ----- Author : Zachary Labe Date : 19 October 2018 """ ### Import modules import numpy as np import matplotlib.pyplot as plt import datetime im...
code_fim
hard
{ "lang": "python", "repo": "zmlabe/SeaIceQBO", "path": "/Scripts/Data_Analysis/plot_FIGURE_JetStreamLocations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ### Begin smoothing of N days climovarq = [] for s in range(climovar.shape[1]): climovarqq=np.convolve(climovar[:,s], np.ones((N,))/N, mode='valid') climovarq.append(climovarqq) empty = np.empty((96,N-1)) empty[:] = np.nan climovarn = np.append(empty,np.asa...
code_fim
hard
{ "lang": "python", "repo": "zmlabe/SeaIceQBO", "path": "/Scripts/Data_Analysis/plot_FIGURE_JetStreamLocations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def predict(self, input_text): return np.asarray([[self.model.generate_issue_title(body[0])[1]] for body in input_text])<|fim_prefix|># repo: elsonrodriguez/examples path: /github_issue_summarization/notebooks/issue_summarization.py """Generates predictions using a stored model. Uses trained model...
code_fim
hard
{ "lang": "python", "repo": "elsonrodriguez/examples", "path": "/github_issue_summarization/notebooks/issue_summarization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open('body_pp.dpkl', 'rb') as body_file: body_pp = dpickle.load(body_file) with open('title_pp.dpkl', 'rb') as title_file: title_pp = dpickle.load(title_file) self.model = Seq2Seq_Inference(encoder_preprocessor=body_pp, decoder_preprocessor=t...
code_fim
medium
{ "lang": "python", "repo": "elsonrodriguez/examples", "path": "/github_issue_summarization/notebooks/issue_summarization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: elsonrodriguez/examples path: /github_issue_summarization/notebooks/issue_summarization.py """Generates predictions using a stored model. Uses trained model files to generate a prediction. """ from __future__ import print_function import numpy as np import dill as dpickle from keras.models imp...
code_fim
hard
{ "lang": "python", "repo": "elsonrodriguez/examples", "path": "/github_issue_summarization/notebooks/issue_summarization.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model = CardQuantity extra = 1 class DesignCardInline(admin.TabularInline): model = DesignCard extra = 1 class ProductCardAdmin(admin.ModelAdmin): inlines = (QuantityInline,) list_display = ('__unicode__', 'job_list', 'status', 'prod_notes', 'client_notes', 'contact', 'assignedus...
code_fim
medium
{ "lang": "python", "repo": "connorbolick/wiboserver", "path": "/wibo1/cards/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: connorbolick/wiboserver path: /wibo1/cards/admin.py from cards.models import JobCard, ProductCard, CardQuantity, DesignCard from django.contrib import admin def make_archived(modeladmin, request, queryset): for obj in queryset: obj.archive() make_archived.short_description = "Archive...
code_fim
medium
{ "lang": "python", "repo": "connorbolick/wiboserver", "path": "/wibo1/cards/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> suggestions = [] for currency in cls.currencies: if currency.lower().startswith(prefix): suggestions.append(currency) return suggestions def get_rate(symbols): rate = _RATES.get(symbols) if rate: return rate csv = urllib2.ur...
code_fim
hard
{ "lang": "python", "repo": "csytan/pycmds", "path": "/modules/.svn/text-base/finance.py.svn-base", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: csytan/pycmds path: /modules/.svn/text-base/finance.py.svn-base import urllib2 import pycmds _RATES = {} class Currency(str): currencies = { 'Maltese Lira (MTL)': 'MTL', 'Ukraine Hryvnia (UAH)': 'UAH', 'Rwanda Franc (RWF)': 'RWF', 'Mauritania Ougulya (MRO)...
code_fim
hard
{ "lang": "python", "repo": "csytan/pycmds", "path": "/modules/.svn/text-base/finance.py.svn-base", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kissmetrics/py-KISSmetrics path: /KISSmetrics/query_string.py # -*- coding: utf-8 -*- KEY_KEY = '_k' PERSON_KEY = '_p' EVENT_NAME_KEY = '_n' TIME_KEY = '_t' TIME_FLAG_KEY = '_d' ALIAS_KEY = '_n' try: from urllib import urlencode except ImportError: from urllib.parse import urlencode ...
code_fim
hard
{ "lang": "python", "repo": "kissmetrics/py-KISSmetrics", "path": "/KISSmetrics/query_string.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :returns: URL encoded string representing query string :rtype: str .. note:: When a ``timestamp`` is provided, the ``TIME_FLAG_KEY`` will be set to ``1`` and included. """ if properties is None: properties = {} query_dict = {KEY_KEY: key, PERSON_KEY: per...
code_fim
hard
{ "lang": "python", "repo": "kissmetrics/py-KISSmetrics", "path": "/KISSmetrics/query_string.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (current_output_0 == current_output_1): print("calling bdd for output " + str(current_output_0) + " from files " + str(aigs[0] + " and " + str(aigs[1] + ":"))) print(current_expr_0) print(current_expr_1) p = Popen("./evalBDD " + "'" + st...
code_fim
hard
{ "lang": "python", "repo": "gumadeiras/inf-cad-para-sistemas-digitais", "path": "/aig_parser/aig_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gumadeiras/inf-cad-para-sistemas-digitais path: /aig_parser/aig_wrapper.py #!/usr/bin/env python import os import sys import re import subprocess from subprocess import Popen, PIPE from AIGnode import AIGnode from string import ascii_lowercase from pprint import pprint # usage: python wrapper....
code_fim
hard
{ "lang": "python", "repo": "gumadeiras/inf-cad-para-sistemas-digitais", "path": "/aig_parser/aig_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p = Popen("./evalBDD " + "'" + str(current_expr_0) + "' '" + str(current_expr_1) + "'", stdout = PIPE, stderr = PIPE, shell = True) stdout = p.communicate()[0].decode('utf-8').strip() print(stdout)<|fim_prefix|># repo: gumadeiras/inf-cad-para-sistemas-digitais path: /aig_parser/aig_wrapper.py #!...
code_fim
hard
{ "lang": "python", "repo": "gumadeiras/inf-cad-para-sistemas-digitais", "path": "/aig_parser/aig_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> issue = self.gather_ticket() issue.owner = None self.store_issue(issue) self.store_new_event(issue, "ticket owner removed", datetime.datetime.now(), self.gather_creator(), self.editor_prompt("Comment")) tkt.commands.aliases...
code_fim
hard
{ "lang": "python", "repo": "teepark/tkt", "path": "/tkt/plugins/claiming.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: teepark/tkt path: /tkt/plugins/claiming.py import datetime import re import tkt.commands import tkt.config import tkt.models tkt.models.Issue.fields.append("owner") tkt.models.Issue.display.append("owner") tkt.commands.Search.options.append({ 'short': '-o', 'long': '--owner', 'typ...
code_fim
hard
{ "lang": "python", "repo": "teepark/tkt", "path": "/tkt/plugins/claiming.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Ownedby(tkt.commands.Command): usage = "<user regex>" usageinfo = "list the tickets owned by a particular user" def main(self): if not (self.parsed_args and self.parsed_args[0]): self.fail("a search string is required") searcher = re.compile(self.parsed_args...
code_fim
hard
{ "lang": "python", "repo": "teepark/tkt", "path": "/tkt/plugins/claiming.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: frank2411/cookiecutter_flasktemplate path: /{{cookiecutter.project_name}}/tests/test_rabbitmq_manager.py import pytest from unittest.mock import patch from {{cookiecutter.project_name}}_api.rabbitmq_manager import RabbitMQPublisher, RabbitMQPublisherException class TestRabbitMQPublisher: ...
code_fim
medium
{ "lang": "python", "repo": "frank2411/cookiecutter_flasktemplate", "path": "/{{cookiecutter.project_name}}/tests/test_rabbitmq_manager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @patch('{{cookiecutter.project_name}}_api.rabbitmq_manager.pika.BlockingConnection') def test_rabbitmq_publisher_fail_connection(self, mocked_connection, app): mocked_connection.side_effect = ValueError("on connect collapsed") with app.app_context(): with pytest.raise...
code_fim
medium
{ "lang": "python", "repo": "frank2411/cookiecutter_flasktemplate", "path": "/{{cookiecutter.project_name}}/tests/test_rabbitmq_manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert publisherror.value assert publisherror.value.message == 'Connection Problem' @patch('{{cookiecutter.project_name}}_api.rabbitmq_manager.pika.BlockingConnection') def test_rabbitmq_publisher_fail_publish(self, mocked_connection, app): mocked_connection.return_value.c...
code_fim
hard
{ "lang": "python", "repo": "frank2411/cookiecutter_flasktemplate", "path": "/{{cookiecutter.project_name}}/tests/test_rabbitmq_manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> request = urllib.urlopen(url % search_terms) payload = json.loads(request.read()) feed = payload['feed'] entries = feed['entry'][0] links = entries['link'] finalLink = links[0]['href'] print(finalLink) index = len(sys.argv) query = "" for x in range(1, index): query += sys.argv...
code_fim
hard
{ "lang": "python", "repo": "trevor-umeda/hayate-bot", "path": "/modules/youtube.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> url = 'http://gdata.youtube.com/feeds/api/videos?orderBy=relevance&max-results=1&alt=json&q=%s' def SearchAndPrint(search_terms): request = urllib.urlopen(url % search_terms) payload = json.loads(request.read()) feed = payload['feed'] entries = feed['entry'][0] links = entries['link'] ...
code_fim
medium
{ "lang": "python", "repo": "trevor-umeda/hayate-bot", "path": "/modules/youtube.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: trevor-umeda/hayate-bot path: /modules/youtube.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import sys import json import urllib from datetime import datetime, timedelta <|fim_suffix|>def SearchAndPrint(search_terms): reque...
code_fim
medium
{ "lang": "python", "repo": "trevor-umeda/hayate-bot", "path": "/modules/youtube.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Garinmckayl/researchhub-backend path: /src/paper/migrations/0039_auto_20200402_2319.py # Generated by Django 2.2.11 on 2020-04-02 23:19 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='paper', name='doi...
code_fim
medium
{ "lang": "python", "repo": "Garinmckayl/researchhub-backend", "path": "/src/paper/migrations/0039_auto_20200402_2319.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='paper', name='doi', field=models.CharField(blank=True, default=None, max_length=255, null=True, unique=True), ), ]<|fim_prefix|># repo: Garinmckayl/researchhub-backend path: /src/paper/migrations...
code_fim
medium
{ "lang": "python", "repo": "Garinmckayl/researchhub-backend", "path": "/src/paper/migrations/0039_auto_20200402_2319.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juan-edesk/delta-core path: /migrations/versions/f6a0e5e4490a_.py """empty message Revision ID: f6a0e5e4490a Revises: 7fbc4dda2333 Create Date: 2020-10-01 17:41:05.962900 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used ...
code_fim
hard
{ "lang": "python", "repo": "juan-edesk/delta-core", "path": "/migrations/versions/f6a0e5e4490a_.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> op.rename_table("mother_test", "test") op.execute("ALTER SEQUENCE mother_test_id_seq RENAME TO test_id_seq") op.execute("ALTER INDEX mother_test_pkey RENAME TO test_pkey") op.execute( 'ALTER TABLE test RENAME CONSTRAINT "mother_test_test_resolution_id_fkey" TO "test_test_resolution...
code_fim
hard
{ "lang": "python", "repo": "juan-edesk/delta-core", "path": "/migrations/versions/f6a0e5e4490a_.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> op.execute( 'ALTER TABLE test_retries RENAME CONSTRAINT "test_retries_test_id_fkey" TO "test_retries_test_history_id_fkey"' ) op.alter_column("test_retries", "test_id", new_column_name="test_history_id") op.alter_column("test_history", "mother_test_id", new_column_name="test_id") ...
code_fim
hard
{ "lang": "python", "repo": "juan-edesk/delta-core", "path": "/migrations/versions/f6a0e5e4490a_.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def configure(): """ Configure logging Pick up the log level from the env var LOGLEVEL, otherwise default to INFO """ # TODO: Simple configuration of what to log and where to log it to level_name = getenv("LOGLEVEL", "INFO") level = getattr(logging, level_name) logging.bas...
code_fim
medium
{ "lang": "python", "repo": "radiac/mara", "path": "/mara/app/logging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: radiac/mara path: /mara/app/logging.py import asyncio import logging import sys from os import getenv class Whitelist(logging.Filter): def __init__(self, *whitelist): self.whitelist = [logging.Filter(name) for name in whitelist] def filter(self, record): return any(f.fi...
code_fim
hard
{ "lang": "python", "repo": "radiac/mara", "path": "/mara/app/logging.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': args = docopt.docopt(__doc__) # First get release version used to create the file to be converted version_stripped = args['--release'].replace('.', '') release_base_name = '_'.join(('h5py_wrapper', version_stripped)) try: h5w_old = importlib.import_mo...
code_fim
medium
{ "lang": "python", "repo": "tommybutler/mlearnpy2", "path": "/home--tommy--mypy/mypy/bin/convert_h5file.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: tommybutler/mlearnpy2 path: /home--tommy--mypy/mypy/bin/convert_h5file.py #!/home/tommy/mypy/mypy/bin/python2 # encoding: utf8 """ Conversion script to convert files from a previous release version to the current version. Usage: convert_h5file [-h|--help] [<files>...] [--save-backup] [-v|--verb...
code_fim
hard
{ "lang": "python", "repo": "tommybutler/mlearnpy2", "path": "/home--tommy--mypy/mypy/bin/convert_h5file.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> dirpath = 'c:/RetrieveOnly100%DATAFROMSUMO_RANDOMSEED(One time)-DATASET-WithoutReplicatedVID' for key, value in setting.items(): for percent in percentage: for history in time_lagged_observation: fig = plt.figure() data = pd.read_csv( ...
code_fim
hard
{ "lang": "python", "repo": "EEM0N/Smart-Mobility-Chula", "path": "/Bottleneck Based Gridlock Prediction in Urban Road Network Using Long Short-Term Memory/ConfusionMatrixxAfterDefense.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: EEM0N/Smart-Mobility-Chula path: /Bottleneck Based Gridlock Prediction in Urban Road Network Using Long Short-Term Memory/ConfusionMatrixxAfterDefense.py import pandas as pd import seaborn as sn import matplotlib.pyplot as plt import numpy as np percentage = ['1%','5%','10%','15%','20%','25%'...
code_fim
hard
{ "lang": "python", "repo": "EEM0N/Smart-Mobility-Chula", "path": "/Bottleneck Based Gridlock Prediction in Urban Road Network Using Long Short-Term Memory/ConfusionMatrixxAfterDefense.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kryvokhyzha/examples-and-courses path: /Information-security-labs/Lab5/vulnerability1/create_reg_key.py import winreg from main import prepare_info_about_computer_hash <|fim_suffix|>with reg_key: winreg.SetValueEx(reg_key, 'Signature', 0, winreg.REG_SZ, prepare_info_about_computer_hash()...
code_fim
medium
{ "lang": "python", "repo": "kryvokhyzha/examples-and-courses", "path": "/Information-security-labs/Lab5/vulnerability1/create_reg_key.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with reg_key: winreg.SetValueEx(reg_key, 'Signature', 0, winreg.REG_SZ, prepare_info_about_computer_hash())<|fim_prefix|># repo: kryvokhyzha/examples-and-courses path: /Information-security-labs/Lab5/vulnerability1/create_reg_key.py import winreg from main import prepare_info_about_computer_hash ...
code_fim
medium
{ "lang": "python", "repo": "kryvokhyzha/examples-and-courses", "path": "/Information-security-labs/Lab5/vulnerability1/create_reg_key.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: signalfx/jaeger-client-python path: /tests/test_throttler.py # Modified by SignalFx # Copyright (c) 2018 Uber Technologies, 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 Li...
code_fim
hard
{ "lang": "python", "repo": "signalfx/jaeger-client-python", "path": "/tests/test_throttler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_throttler_init_polling(throttler): # noinspection PyProtectedMember throttler._init_polling() throttler.close() # noinspection PyProtectedMember throttler._init_polling() def test_throttler_delayed_polling(throttler): throttler.credits = {'test-operation': 0} # noin...
code_fim
hard
{ "lang": "python", "repo": "signalfx/jaeger-client-python", "path": "/tests/test_throttler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _render_error_page(status_code, error_message=None): templates = { 404: "errors/404.html", 410: "errors/404.html", 500: "errors/500.html", 503: "errors/500.html", } if status_code not in templates: status_code = 500 return render_template( ...
code_fim
medium
{ "lang": "python", "repo": "robot2051/dto-digitalmarketplace-buyer-frontend", "path": "/app/main/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@main.app_errorhandler(500) def internal_server_error(e): return _render_error_page(500) @main.app_errorhandler(503) def service_unavailable(e): return _render_error_page(503, e.response) def _render_error_page(status_code, error_message=None): templates = { 404: "errors/404.html",...
code_fim
medium
{ "lang": "python", "repo": "robot2051/dto-digitalmarketplace-buyer-frontend", "path": "/app/main/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robot2051/dto-digitalmarketplace-buyer-frontend path: /app/main/errors.py # coding=utf-8 from flask import render_template from . import main from ..api_client.error import APIError @main.app_errorhandler(APIError) def api_error_handler(e): return _render_error_page(e.status_code) @main....
code_fim
medium
{ "lang": "python", "repo": "robot2051/dto-digitalmarketplace-buyer-frontend", "path": "/app/main/errors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antipatico/pytoyir path: /modules/cli.py from .utils import lazyInt def confirm(question): print(question, "(y/N) ", end="") return input() in ["y", "yes", "Y", "YES"] def selectOptionsText(question, options): <|fim_suffix|> selection = lazyInt(input(question)) if selec...
code_fim
medium
{ "lang": "python", "repo": "antipatico/pytoyir", "path": "/modules/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: r = range(len(options)) for i in r: print(i, options[i]) selection = lazyInt(input(question)) if selection in r: return options[selection]<|fim_prefix|># repo: antipatico/pytoyir path: /modules/cli.py from .utils import lazyInt de...
code_fim
medium
{ "lang": "python", "repo": "antipatico/pytoyir", "path": "/modules/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@bp.route("/", methods=["POST"]) def create(): return StylesheetSchema.create() @bp.route("/", methods=["GET"]) def get_all(): return StylesheetSchema.get_all() @bp.route("/<int:template_id>/", methods=["GET"]) def get(template_id: int): return StylesheetSchema.get(template_id) @bp.route...
code_fim
medium
{ "lang": "python", "repo": "pbehnke/doku", "path": "/doku/blueprints/api/v1/stylesheet.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pbehnke/doku path: /doku/blueprints/api/v1/stylesheet.py from flask import Blueprint, request, jsonify from marshmallow import ValidationError, EXCLUDE from werkzeug.datastructures import FileStorage from werkzeug.exceptions import BadRequest from doku.models import db from doku.models.document ...
code_fim
medium
{ "lang": "python", "repo": "pbehnke/doku", "path": "/doku/blueprints/api/v1/stylesheet.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> style: Stylesheet = get_or_404( db.session.query(Stylesheet).filter_by(id=stylesheet_id) ) schema = StylesheetSchema( unknown=EXCLUDE, session=db.session, instance=style, partial=True ) data = dict(request.form.copy()) if request.json is not None: data.upda...
code_fim
medium
{ "lang": "python", "repo": "pbehnke/doku", "path": "/doku/blueprints/api/v1/stylesheet.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/models path: /research/cv/DecoMR/utils/objfile.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 at # # http://...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/DecoMR/utils/objfile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> material = None for line in open(filepath, "r"): if line.startswith('#'): continue values = line.split() if not values: continue if values[0] == 'v': # v = map(float, values[1:4]) v = [float(x) for x in values[1:4]] vertices.appen...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/DecoMR/utils/objfile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vertices = [] normals = [] vt_texcoords = [] faces = [] material = None for line in open(filepath, "r"): if line.startswith('#'): continue values = line.split() if not values: continue if values[0] == 'v': # v = map(float, values[1:4])...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/DecoMR/utils/objfile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scooter23/grins path: /mm/editor/ViewDialog.py __version__ = "$Id$" # A class to handle standard geometry loading and saving for views etc. # This works both with BasicDialog or GLDialog as base class. # Specify this as the first base class, before the *Dialog base class. # (Now this also define...
code_fim
hard
{ "lang": "python", "repo": "scooter23/grins", "path": "/mm/editor/ViewDialog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # views can override this to return their focus node return None # def globalsetfocus(self, node): # views can override this to allow their focus to be 'pushed' pass # def fixtitle(self): # views can override this to fix their title after the ...
code_fim
hard
{ "lang": "python", "repo": "scooter23/grins", "path": "/mm/editor/ViewDialog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return name = self.geom_name posname = name + 'winpos' sizename = name + 'winsize' h, v = MMAttrdefs.getattr(self.root, posname) width, height = MMAttrdefs.getattr(self.root, sizename) self.last_geometry = h, v, width, height # Experimental c...
code_fim
hard
{ "lang": "python", "repo": "scooter23/grins", "path": "/mm/editor/ViewDialog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> string_cap = "\n SEARCH FILES BY REGULAR EXPRESSION IN REPO '{}' (Sample expresion is {})\n".format( repository["name"], sample_regex) print(string_cap) find = FindStringV3(entries=tree_entries, owner=owner, repo=repository["name"]) search_result = find.find...
code_fim
hard
{ "lang": "python", "repo": "crazy-djactor/github_graphql_repoinfo", "path": "/get_files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: crazy-djactor/github_graphql_repoinfo path: /get_files.py import threading from queue import Queue from findstring import * from recursive_tree import * from get_repo import * import json class SearchThread(threading.Thread): def __init__(self, que, find_v4_in, entry, search_string, root_...
code_fim
hard
{ "lang": "python", "repo": "crazy-djactor/github_graphql_repoinfo", "path": "/get_files.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("\n SEARCH STRING IN FILTERED FILES IN REPO '{}' (Sample string is {})\n".format(repository["name"], sample_search_string)) find_v4 = FindString(owner, repository["name"], [], "") ...
code_fim
hard
{ "lang": "python", "repo": "crazy-djactor/github_graphql_repoinfo", "path": "/get_files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: azavea/raster-vision path: /rastervision_pytorch_backend/rastervision/pytorch_backend/pytorch_learner_backend_config.py from typing import Optional, List import logging from rastervision.pipeline.config import (register_config, Field) from rastervision.pipeline.file_system import get_tmp_dir fro...
code_fim
hard
{ "lang": "python", "repo": "azavea/raster-vision", "path": "/rastervision_pytorch_backend/rastervision/pytorch_backend/pytorch_learner_backend_config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError() def filter_commands(self, commands: List[str]) -> List[str]: nochip = isinstance(self.data, GeoDataConfig) if nochip and 'chip' in commands: commands = [c for c in commands if c != 'chip'] return commands def get_img_channel...
code_fim
hard
{ "lang": "python", "repo": "azavea/raster-vision", "path": "/rastervision_pytorch_backend/rastervision/pytorch_backend/pytorch_learner_backend_config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> subprocess.call(self.args) return 0 class Choice(Item): """asks what they would like to do, and acts accordingly""" def __init__(self, msg="continue?", opts={'y': lambda: 0, 'n': lambda: 1}, ignorecase=True): self.msg = self.form(msg, opts) self.opts = _CaseInsen...
code_fim
hard
{ "lang": "python", "repo": "Michael78912/tbip", "path": "/tbip/uiutils/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Michael78912/tbip path: /tbip/uiutils/__init__.py """this package is all the cross-UI "Items" for displaying all of the things needed in an installer, a README, License, etc... and a tool for actually installing itself. """ from enum import Enum import getpass import sys import subprocess import...
code_fim
hard
{ "lang": "python", "repo": "Michael78912/tbip", "path": "/tbip/uiutils/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dethada/LSCVM-Tool path: /execute.py #!/usr/bin/env python3 from typing import List, Dict import argparse import common def add(stack: List[int]): val1: int = stack.pop() val2: int = stack.pop() stack.append(val1 + val2) def mul(stack: List[int]): val1: int = stack.pop() v...
code_fim
hard
{ "lang": "python", "repo": "Dethada/LSCVM-Tool", "path": "/execute.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }