text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>Configure urls for rest api. """ from django.conf.urls import url, include from rest_framework import routers from repo_health.gh_projects.views import GhProjectViewSet router = routers.DefaultRouter(trailing_slash=False) router.register('gh-projects', GhProjectViewSet, base_name='gh-project') urlpatte...
code_fim
medium
{ "lang": "python", "repo": "jakeharding/repo-health", "path": "/repo_health/rest_api/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakeharding/repo-health path: /repo_health/rest_api/__init__.py """ __init__.py - (C) Copyright - 2017 This software is copyrighted to contributors listed in CONTRIBUTIONS.md. SPDX-License-Identifier: MIT <|fim_suffix|>Configure urls for rest api. """ from django.conf.urls import url, include ...
code_fim
medium
{ "lang": "python", "repo": "jakeharding/repo-health", "path": "/repo_health/rest_api/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ariloulaleelay/yaost path: /yaost/path.py # coding: utf8 import logging from math import acos, pi, sqrt from .base import Node from .vector import Vector logger = logging.getLogger(__name__) def point_orientation(a, b, c): """Returns the orientation of the triangle a, b, c. Return T...
code_fim
hard
{ "lang": "python", "repo": "ariloulaleelay/yaost", "path": "/yaost/path.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def tx(self, x): return self.translate(x=x) def ty(self, y): return self.translate(y=y) def tz(self, z): return self.translate(z=z) def extrude(self, *args, **kwargs): return self.polygon().extrude(*args, **kwargs) def stitch_slices(slices, convexity=10...
code_fim
hard
{ "lang": "python", "repo": "ariloulaleelay/yaost", "path": "/yaost/path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cvigoe/DRL4MAAS path: /rlkit/rlkit/data_management/mb_start_selectors.py """ Methods for collecting starts for model based methods. Author: Ian Char """ import abc from typing import Optional import numpy as np from rlkit.data_management.offline_data_store import OfflineDataStore class StartS...
code_fim
hard
{ "lang": "python", "repo": "cvigoe/DRL4MAAS", "path": "/rlkit/rlkit/data_management/mb_start_selectors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class DataStartStateSelector(StartSelector): def __init__( self, data: OfflineDataStore, true_starts: Optional[np.ndarray] = None, prop_true: float = 0, ): """Constructor. Args: data: The data. true_starts: St...
code_fim
medium
{ "lang": "python", "repo": "cvigoe/DRL4MAAS", "path": "/rlkit/rlkit/data_management/mb_start_selectors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_starts(self, num_starts: int) -> np.ndarray: """Get start states.""" return np.random.uniform( self._low_bounds, self._high_bounds, (num_starts, len(self._low_bounds)), )<|fim_prefix|># repo: cvigoe/DRL4MAAS path: /rlkit/rlkit/data_m...
code_fim
hard
{ "lang": "python", "repo": "cvigoe/DRL4MAAS", "path": "/rlkit/rlkit/data_management/mb_start_selectors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #if the individual is not yet added to the friend_dict if individual not in friend_dict: friend_dict[individual] = set() # add the individual set of immediate friends of 'individual' # using a set, so there are no duplicate names friend_dict[individual].add(friend)<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "ken-sok/Social-Network-Analysis", "path": "/immed_fri.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ken-sok/Social-Network-Analysis path: /immed_fri.py #adapted from University of Melbourne's sample solution def get_friendly_dict(friend_list): ''' this function takes list of friendship links 'friend_list' between 2 people as argument, finds the immediate friend of each person and ret...
code_fim
hard
{ "lang": "python", "repo": "ken-sok/Social-Network-Analysis", "path": "/immed_fri.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> opt_fname = "{}/options.yaml".format(opt.output_path) if os.path.isfile(opt_fname): with open(opt_fname) as file: opt_old = yaml.safe_load(file) if opt!=opt_old: # prompt if options are not identical opt_new_fname = "{}/options_temp.yaml".format(...
code_fim
hard
{ "lang": "python", "repo": "albertotono/signed-distance-SRN", "path": "/options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: albertotono/signed-distance-SRN path: /options.py import numpy as np import os,sys,time import torch import random import string import yaml from easydict import EasyDict as edict import util from util import log # torch.backends.cudnn.enabled = False torch.backends.cudnn.benchmark = False torc...
code_fim
hard
{ "lang": "python", "repo": "albertotono/signed-distance-SRN", "path": "/options.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def override_options(opt,opt_over,key_stack=None,safe_check=False): for key,value in opt_over.items(): if isinstance(value,dict): # parse child options (until leaf nodes are reached) opt[key] = override_options(opt.get(key,dict()),value,key_stack=key_stack+[key],safe_ch...
code_fim
hard
{ "lang": "python", "repo": "albertotono/signed-distance-SRN", "path": "/options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pareenj/cycleGAN-PyTorch path: /main.py import os from argparse import ArgumentParser import model as md from utils import create_link import test as tst # To get arguments from commandline def get_args(): parser = ArgumentParser(description='cycleGAN PyTorch') parser.add_argument('--ep...
code_fim
medium
{ "lang": "python", "repo": "pareenj/cycleGAN-PyTorch", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> create_link(args.dataset_dir) if args.training: print("Training") model = md.cycleGAN(args) model.train(args) if args.testing: print("Testing") tst.test(args) if __name__ == '__main__': main()<|fim_prefix|># repo: pareenj/cycleGAN-PyTorch path: /main.py import os...
code_fim
hard
{ "lang": "python", "repo": "pareenj/cycleGAN-PyTorch", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args = get_args() create_link(args.dataset_dir) if args.training: print("Training") model = md.cycleGAN(args) model.train(args) if args.testing: print("Testing") tst.test(args) if __name__ == '__main__': main()<|fim_prefix|># repo: pareenj/cycleGAN-PyTorch pat...
code_fim
medium
{ "lang": "python", "repo": "pareenj/cycleGAN-PyTorch", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taareek/CSE_303_SEC_02_GROUP_07 path: /users/views.py from django.shortcuts import render, redirect #from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from .forms import UserRegisterForm from django.contrib.auth.decorators import login_required def regis...
code_fim
medium
{ "lang": "python", "repo": "taareek/CSE_303_SEC_02_GROUP_07", "path": "/users/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def department_head(request): return render(request, 'users/dhead.html') def registrars_office(request): return render(request, 'users/officeregister.html') def vc(request): return render(request,'users/Vc.html' ) def dean(request): return render(request, 'users/Dean.html') def departm...
code_fim
medium
{ "lang": "python", "repo": "taareek/CSE_303_SEC_02_GROUP_07", "path": "/users/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lupyuen/RaspberryPiImage path: /home/pi/GrovePi/Software/Python/others/temboo/Library/Zendesk/MonitoredTwitterHandles/__init__.py from temboo.Library.Zendesk.MonitoredTwitterHandles.GetMonitoredTwitterHandle import GetMonitoredTwitterHandle, GetMonitoredTwitterHandleInputSet, GetMonitoredTwitterH...
code_fim
medium
{ "lang": "python", "repo": "lupyuen/RaspberryPiImage", "path": "/home/pi/GrovePi/Software/Python/others/temboo/Library/Zendesk/MonitoredTwitterHandles/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> temboo.Library.Zendesk.MonitoredTwitterHandles.ListMonitoredTwitterHandles import ListMonitoredTwitterHandles, ListMonitoredTwitterHandlesInputSet, ListMonitoredTwitterHandlesResultSet, ListMonitoredTwitterHandlesChoreographyExecution<|fim_prefix|># repo: lupyuen/RaspberryPiImage path: /home/pi/GrovePi/...
code_fim
medium
{ "lang": "python", "repo": "lupyuen/RaspberryPiImage", "path": "/home/pi/GrovePi/Software/Python/others/temboo/Library/Zendesk/MonitoredTwitterHandles/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def predict(self, image_array): outputs = self.model.predict(image_array[None, :, :, :]) self.parse_outputs(outputs) def parse_outputs(self, outputs): res = [] for output in outputs: for i in range(output.shape[0]): res.append(output[i]...
code_fim
hard
{ "lang": "python", "repo": "ethanburrell/DonkeySelfDriving-v1", "path": "/src/predict_server.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ethanburrell/DonkeySelfDriving-v1 path: /src/predict_server.py #!/usr/bin/env python ''' Predict Server Create a server to accept image inputs and run them against a trained neural network. This then sends the steering output back to the client. Author: Tawn Kramer ''' from __future__ import prin...
code_fim
hard
{ "lang": "python", "repo": "ethanburrell/DonkeySelfDriving-v1", "path": "/src/predict_server.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> res = [] for output in outputs: for i in range(output.shape[0]): res.append(output[i]) self.on_parsed_outputs(res) def on_parsed_outputs(self, outputs): self.outputs = outputs self.steering_angle = 0.0 self.throttle = 0.2 ...
code_fim
hard
{ "lang": "python", "repo": "ethanburrell/DonkeySelfDriving-v1", "path": "/src/predict_server.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> "complete beams such that last word is complete word" for (_, v) in self.beams.items(): lastPrefix = v.textual.wordDev if lastPrefix == "" or lm.isWord(lastPrefix): continue # get word candidates for this prefix words = lm.ge...
code_fim
hard
{ "lang": "python", "repo": "Calamari-OCR/calamari", "path": "/calamari_ocr/thirdparty/ctcwordbeamsearch/Beam.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Calamari-OCR/calamari path: /calamari_ocr/thirdparty/ctcwordbeamsearch/Beam.py from __future__ import division from __future__ import print_function import copy class Optical: "optical score of beam" def __init__(self, prBlank=0, prNonBlank=0): self.prBlank = prBlank # prob o...
code_fim
hard
{ "lang": "python", "repo": "Calamari-OCR/calamari", "path": "/calamari_ocr/thirdparty/ctcwordbeamsearch/Beam.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # no complete word in text, then use unigram of all possible next words numWords = len(beam.textual.wordHist) prSum = 0 if numWords == 0: for w in nextWords: prSum += beam.lm...
code_fim
hard
{ "lang": "python", "repo": "Calamari-OCR/calamari", "path": "/calamari_ocr/thirdparty/ctcwordbeamsearch/Beam.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: carlestapi/BAFFLE path: /code/Phidget22Python/Phidget22/MeshMode.py import sys import ctypes class MeshMode: <|fim_suffix|> if val == self.MESHMODE_ROUTER: return "MESHMODE_ROUTER" if val == self.MESHMODE_SLEEPYENDDEVICE: return "MESHMODE_SLEEPYENDDEVICE" return "<invalid enumeration v...
code_fim
medium
{ "lang": "python", "repo": "carlestapi/BAFFLE", "path": "/code/Phidget22Python/Phidget22/MeshMode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def getName(self, val): if val == self.MESHMODE_ROUTER: return "MESHMODE_ROUTER" if val == self.MESHMODE_SLEEPYENDDEVICE: return "MESHMODE_SLEEPYENDDEVICE" return "<invalid enumeration value>"<|fim_prefix|># repo: carlestapi/BAFFLE path: /code/Phidget22Python/Phidget22/MeshMode...
code_fim
medium
{ "lang": "python", "repo": "carlestapi/BAFFLE", "path": "/code/Phidget22Python/Phidget22/MeshMode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df2 = cp_df.merge(cz_df, how ='outer', left_on='desc', right_on='name') df2.drop('name', axis=1, inplace=True) df2= df2[df2['TG'].isna() == False] df_main = df_main.merge(df2, how ='outer', left_on=['tomatch','TG'], right_on=['CODE','TG']) df_main = df3.merge(df2, how ='outer', left_on=['tomatch','TG']...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/python-examples-main", "path": "/stackoverflow-solutions/submission-scripts/SO_Q55676043_SKU_By_Parts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkMoretto/python-examples-main path: /stackoverflow-solutions/submission-scripts/SO_Q55676043_SKU_By_Parts.py """ Ref: https://stackoverflow.com/questions/55676043/building-a-feed-by-manipulating-data-from-another-feed-using-python-pandas#55676043 """ import pandas as pd pd.options.mode.ch...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/python-examples-main", "path": "/stackoverflow-solutions/submission-scripts/SO_Q55676043_SKU_By_Parts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>df3['desc'] = [catprod[k] for k in catprod.keys() for i in df3['tomatch']] for i in df3['ITEM CODE']: for k in catprod.keys(): if i.startswith(k): df3['desc'] = catprod[k] for i, row in df3.iterrows(): if '2755' in df3['ITEM CODE'][i] and '24' in df3['TG'][i]: cod...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/python-examples-main", "path": "/stackoverflow-solutions/submission-scripts/SO_Q55676043_SKU_By_Parts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ddm1004/plaso path: /plaso/formatters/sam_users.py # -*- coding: utf-8 -*- """The SAM users Windows Registry event formatter.""" from __future__ import unicode_literals <|fim_suffix|> DATA_TYPE = 'windows:registry:sam_users' FORMAT_STRING_PIECES = [ '[{key_path}]', 'Username: {u...
code_fim
hard
{ "lang": "python", "repo": "ddm1004/plaso", "path": "/plaso/formatters/sam_users.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> FORMAT_STRING_PIECES = [ '[{key_path}]', 'Username: {username}', 'Full name: {fullname}', 'Comments: {comments}', 'RID: {account_rid}', 'Login count: {login_count}'] FORMAT_STRING_SHORT_PIECES = [ '{username}', 'RID: {account_rid}', 'Login count: ...
code_fim
hard
{ "lang": "python", "repo": "ddm1004/plaso", "path": "/plaso/formatters/sam_users.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> DATA_TYPE = 'windows:registry:sam_users' FORMAT_STRING_PIECES = [ '[{key_path}]', 'Username: {username}', 'Full name: {fullname}', 'Comments: {comments}', 'RID: {account_rid}', 'Login count: {login_count}'] FORMAT_STRING_SHORT_PIECES = [ '{username}', ...
code_fim
medium
{ "lang": "python", "repo": "ddm1004/plaso", "path": "/plaso/formatters/sam_users.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tonk/ara path: /tests/unit/test_app.py from flask.ext.testing import TestCase import pytest import ara.webapp as w import ara.models as m from ara.models import db class TestApp(TestCase): '''Tests for the ARA web interface''' SQLALCHEMY_DATABASE_URI = 'sqlite://' TESTING = True ...
code_fim
hard
{ "lang": "python", "repo": "tonk/ara", "path": "/tests/unit/test_app.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_list_playbook(self): self.ansible_run() res = self.client.get('/playbook/') self.assertEqual(res.status_code, 200) def test_list_playbook_incomplete(self): self.ansible_run(complete=False) res = self.client.get('/playbook/') self.assertEqua...
code_fim
hard
{ "lang": "python", "repo": "tonk/ara", "path": "/tests/unit/test_app.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for x in self.attributes: if x['key'] == name: return x['value'] return default class Endpoints(ListResource): endpoint_path = 'endpoints' item_resource = Endpoint<|fim_prefix|># repo: EugeneSqr/carrierx-python path: /carrierx/resources/core/endpoints...
code_fim
medium
{ "lang": "python", "repo": "EugeneSqr/carrierx-python", "path": "/carrierx/resources/core/endpoints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> endpoint_path = 'endpoints' create_fields = ( 'addresses', 'attributes', 'capacity', 'name', 'partner_sid', 'transformations', 'type', ) retrieve_fields = ( 'endpoint_sid', 'addresses', 'attributes', 'p...
code_fim
medium
{ "lang": "python", "repo": "EugeneSqr/carrierx-python", "path": "/carrierx/resources/core/endpoints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EugeneSqr/carrierx-python path: /carrierx/resources/core/endpoints.py from operator import itemgetter from carrierx.resources.base import ItemResource, ListResource class Endpoint(ItemResource): <|fim_suffix|> endpoint_path = 'endpoints' create_fields = ( 'addresses', 'a...
code_fim
medium
{ "lang": "python", "repo": "EugeneSqr/carrierx-python", "path": "/carrierx/resources/core/endpoints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "Generate all sentences for folder of wiki text files." for path in glob.glob(location): with open(path) as f: contents = '<contents>'+f.read()+'</contents>' root = html.fromstring(contents) for doc in root.findall('doc'): for chunk in do...
code_fim
medium
{ "lang": "python", "repo": "evanmiltenburg/Dutch-checker", "path": "/plainwiki.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: evanmiltenburg/Dutch-checker path: /plainwiki.py # Use Python 3, or face the Unicode horror! # Standard library: import glob import gzip # Additional modules: import nltk.data from nltk.tokenize import word_tokenize from lxml import etree,html sent_tokenizer = nltk.data.load('tokenizers/punkt/...
code_fim
medium
{ "lang": "python", "repo": "evanmiltenburg/Dutch-checker", "path": "/plainwiki.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> string_field = StringField() texts = ['str1', 'str2', 'str3', '1', '0'] for text in texts: self.assertEqual(string_field.to_python(text), text) def test_list_field(self): list_field = ListField() expected_vals = [1, 2, 3.2, 'test'] values = ...
code_fim
hard
{ "lang": "python", "repo": "eHanlin/csv-map-converter", "path": "/tests/test_fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eHanlin/csv-map-converter path: /tests/test_fields.py import unittest, sys, os sys.path.insert(0, os.path.abspath('.')) from csv_map_converter.models.fields.base import * class TestField(unittest.TestCase): def __get_long_type(self): if sys.version_info.major > 2: nu...
code_fim
hard
{ "lang": "python", "repo": "eHanlin/csv-map-converter", "path": "/tests/test_fields.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_string_list_field(self): list_field = ListField(StringField()) input_vals = ['test1', 'test2', ''] expected_vals = input_vals values = list_field.to_python(input_vals) for index, value in enumerate(values): self.assertEqual(value, e...
code_fim
hard
{ "lang": "python", "repo": "eHanlin/csv-map-converter", "path": "/tests/test_fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mugeshk97/mobile-price-classification path: /src/get_data.py import pandas as pd import yaml import argparse import logging logging.basicConfig(filename='logs/log.txt', filemode= 'a', format='%(asctime)s %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%...
code_fim
medium
{ "lang": "python", "repo": "mugeshk97/mobile-price-classification", "path": "/src/get_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--config', help = 'config file path', default= 'params.yaml') args = parser.parse_args() config = load_config(args.config) load_data(config)<|fim_prefix|># repo: mugeshk97/mobile-price-classification ...
code_fim
hard
{ "lang": "python", "repo": "mugeshk97/mobile-price-classification", "path": "/src/get_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> param = yaml.safe_load(open(path)) return param def load_data(config): data_path = config['data_src']['main_data'] feature_config = config['features'] try: data = pd.read_csv(data_path) data = data[feature_config['selected']] data.to_csv(feature_config['path'],...
code_fim
medium
{ "lang": "python", "repo": "mugeshk97/mobile-price-classification", "path": "/src/get_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bainco/bainco.github.io path: /course-files/homework/hw04/shapes.py from random import randint def make_rectangle(canvas, top_left, width, height, fill_color="#3D9970", tag=None): x, y = top_left return canvas.create_rectangle( [(x, y), (x + width, y + height)], fill=fill...
code_fim
medium
{ "lang": "python", "repo": "bainco/bainco.github.io", "path": "/course-files/homework/hw04/shapes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' demo function that show you how to draw a bubble, given the convenience functions that are available in this module ''' make_circle( canvas, center, diameter / 2, stroke_width=1, outline='white', color=None, tag=tag )<|fim...
code_fim
hard
{ "lang": "python", "repo": "bainco/bainco.github.io", "path": "/course-files/homework/hw04/shapes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># link_library_message = '%sLinking Static Library %s$TARGET%s' % \ link_library_message = '%sLinking Static Library %s$TARGET%s: $LINKCOM' % \ (colors['blue'], colors['cyan'], colors['end']) # link_shared_library_message = '%sLinking Shared Library %s$TARGET%s' % \ link_shared_library_message = '%sLi...
code_fim
hard
{ "lang": "python", "repo": "media-io/plugins", "path": "/SConstruct", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>env = Environment() if 'TERM' in os.environ: env['ENV']['TERM'] = os.environ['TERM'] env.Append( CXXCOMSTR = compile_source_message, CCCOMSTR = compile_source_message, SHCCCOMSTR = compile_shared_source_message, SHCXXCOMSTR = compile_shared_source_message, ARCOMSTR = link_library_...
code_fim
hard
{ "lang": "python", "repo": "media-io/plugins", "path": "/SConstruct", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: media-io/plugins path: /SConstruct import os import sys EnsureSConsVersion(2, 3, 0) buildMode = ARGUMENTS.get('mode', 'release') if not (buildMode in ['debug', 'release']): raise Exception("Can't select build mode ['debug', 'release']") external_include_paths=[] external_lib_paths=[] def ...
code_fim
hard
{ "lang": "python", "repo": "media-io/plugins", "path": "/SConstruct", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Robert-Hammond/CNN_Testing path: /src/custom_images/draw.py import tkinter as tk from tkinter import * from PIL import Image, ImageTk import os import random category = 'sides' ink_color = (255, 255, 255) example_img = None total_symbols = 0 # data variables grid = [0 for j in range(28*28)] cur...
code_fim
hard
{ "lang": "python", "repo": "Robert-Hammond/CNN_Testing", "path": "/src/custom_images/draw.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> center_grid() # grid values are between 0 and 1, so expand this to between 0 and 255 for i in range(len(grid)): grid[i] = round(grid[i] * 255) if sum(grid) < 255: clear_canvas() return # create image img = Image.new('L', (28, 28)) img.putdata(grid) ...
code_fim
hard
{ "lang": "python", "repo": "Robert-Hammond/CNN_Testing", "path": "/src/custom_images/draw.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> setup( ext_modules=[ Extension( "libdiscid._discid", ["libdiscid/_discid.pyx", "libdiscid/discid-wrapper.c"], define_macros=define_macros, include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, ...
code_fim
hard
{ "lang": "python", "repo": "sebastinas/python-libdiscid", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebastinas/python-libdiscid path: /setup.py #!/usr/bin/python3 import os.path import os import sys from setuptools import setup, Extension try: import pkgconfig have_pkgconfig = True def pkgconfig_exists(package): <|fim_suffix|>except ImportError: have_pkgconfig = False if h...
code_fim
medium
{ "lang": "python", "repo": "sebastinas/python-libdiscid", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ( 'customer_email', 'full_name', 'number', 'sold_at', 'is_mail_send' ) search_fields = ( 'customer_email', 'customer_name', 'customer_surname', 'keycode', 'number', ) ordering = ('-sold_at', '-number') l...
code_fim
hard
{ "lang": "python", "repo": "monobot/web", "path": "/tickets/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: monobot/web path: /tickets/admin.py from django.contrib import admin from django.http import HttpResponse from import_export.admin import ImportExportActionModelAdmin from events.tasks import send_ticket from .models import Article, Ticket, TicketCategory class ArticleInline(admin.StackedInli...
code_fim
hard
{ "lang": "python", "repo": "monobot/web", "path": "/tickets/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yidan-Zhang/IRSTD path: /Figures/plot_model_results.py """ Plot csv data. """ import pandas as pd import matplotlib.pyplot as plt import numpy as np plt.rc('text', usetex=True) plt.rcParams.update({'font.size': 14}) df = pd.read_csv("../testing-models.csv", delimiter=';') df = df.sort_values(...
code_fim
hard
{ "lang": "python", "repo": "Yidan-Zhang/IRSTD", "path": "/Figures/plot_model_results.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># rects1 = ax.barh(x - WIDTH/2, niou__vals, WIDTH, label='nIoU', color=('#0F76AF')) rects1 = ax.barh(x, speed_vals, WIDTH, label='FPS', color=('#0000FF'), alpha=0.6, edgecolor='black') # rects2 = ax.barh(x + WIDTH/2, fb_vals, WIDTH, label='fb', color=('#D64349')) ax.invert_yaxis() # plt.xlabel(r"$F_\beta...
code_fim
hard
{ "lang": "python", "repo": "Yidan-Zhang/IRSTD", "path": "/Figures/plot_model_results.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Teldrin89/SDDeepLearning path: /cnn_cat_dog_validation.py # file prepared for validation of the model for categorization # of dogs and cats (checked with jupyter notebook - requires additional settings) # the part of the validation will look the same as it has to prepare the test image # in the s...
code_fim
medium
{ "lang": "python", "repo": "Teldrin89/SDDeepLearning", "path": "/cnn_cat_dog_validation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # use the same size as in training script IMG_SIZE = 50 # load the image as array with cv2 as gray scale img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE) # resize the array to the image size new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) # return the proper array...
code_fim
medium
{ "lang": "python", "repo": "Teldrin89/SDDeepLearning", "path": "/cnn_cat_dog_validation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qqalexqq/monkeys path: /migrations/versions/10d66bb5392e_.py """empty message Revision ID: 10d66bb5392e Revises: None Create Date: 2015-01-03 01:06:20.677463 """ # revision identifiers, used by Alembic. revision = '10d66bb5392e' down_revision = None from alembic import op import sqlalchemy as...
code_fim
hard
{ "lang": "python", "repo": "qqalexqq/monkeys", "path": "/migrations/versions/10d66bb5392e_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('monkeys', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=False), sa.Column('age', sa.Integer(), nullable=False), sa.Column('email', sa.String(), nulla...
code_fim
medium
{ "lang": "python", "repo": "qqalexqq/monkeys", "path": "/migrations/versions/10d66bb5392e_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_table('friends') op.drop_index(op.f('ix_monkeys_name'), table_name='monkeys') op.drop_table('monkeys') ### end Alembic commands ###<|fim_prefix|># repo: qqalexqq/monkeys path: /migrations/versions/10...
code_fim
hard
{ "lang": "python", "repo": "qqalexqq/monkeys", "path": "/migrations/versions/10d66bb5392e_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: missionpinball/mpf-mc path: /mpfmc/integration/test_Sound.py from mpfmc.tests.MpfIntegrationTestCase import MpfIntegrationTestCase class TestSound(MpfIntegrationTestCase): def get_machine_path(self): <|fim_suffix|> def test_sound_player_with_conditionals(self): self.machine.vari...
code_fim
medium
{ "lang": "python", "repo": "missionpinball/mpf-mc", "path": "/mpfmc/integration/test_Sound.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_sound_player_with_conditionals(self): self.machine.variables.set_machine_var("factory_reset_current_selection", 1) self.mock_mc_event("sounds_play") self.advance_time_and_run(1) self.assertMcEventNotCalled("sounds_play") self.machine.variables.set_machi...
code_fim
medium
{ "lang": "python", "repo": "missionpinball/mpf-mc", "path": "/mpfmc/integration/test_Sound.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gelman/ep-stan path: /epstan/test_olse.py """Sckript for testing olse method for estimating the precision matrix, see util.olse. The most recent version of the code can be found on GitHub: https://github.com/gelman/ep-stan """ # Licensed under the 3-clause BSD license. # http://opensource.org/...
code_fim
hard
{ "lang": "python", "repo": "gelman/ep-stan", "path": "/epstan/test_olse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if rand_distr_every_iter: # Generate random distr if oracle: S1 = random_cov(d) m1 = np.random.randn(d) + 0.8*np.random.randn() else: if indep_distr: S1 = random_cov(d) m1 = np.random.randn(d) + 0.8*np.random.r...
code_fim
hard
{ "lang": "python", "repo": "gelman/ep-stan", "path": "/epstan/test_olse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def convert_created_time(cls, value, **_): return int(value.timestamp() * 1000) @classmethod def convert_last_edited_time(cls, **kwargs): return cls.convert_created_time(**kwargs) @classmethod def convert_created_by(cls, value, **_): return ex...
code_fim
hard
{ "lang": "python", "repo": "arturtamborski/notion-py", "path": "/notion/converter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arturtamborski/notion-py path: /notion/converter.py from datetime import datetime, date from random import choice from typing import Any, Callable from uuid import uuid1 from notion.block.collection.common import NotionDate from notion.markdown import markdown_to_notion, notion_to_markdown from ...
code_fim
hard
{ "lang": "python", "repo": "arturtamborski/notion-py", "path": "/notion/converter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return value[0][0] if value else None @classmethod def convert_multi_select(cls, value, **_): if not value: return [] return [v.strip() for v in value[0][0].split(",")] @classmethod def convert_email(cls, **kwargs): return cls.convert_select(*...
code_fim
hard
{ "lang": "python", "repo": "arturtamborski/notion-py", "path": "/notion/converter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@cookie def scihubber(url, **kwargs): """ Takes user url and traverses sci-hub proxy system until pdf is found. When successful, returns either sci-hub pdfcache or libgen pdf url """ a = urlparse(url) geturl = "http://%s.sci-hub.org/%s?%s" % (a.hostname, a.path, a.query) def _...
code_fim
hard
{ "lang": "python", "repo": "leorassi/paperbot", "path": "/modules/scihub.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: leorassi/paperbot path: /modules/scihub.py """ Integration with http://sci-hub.org/ """ import requests from urlparse import urlparse import itertools from lxml import etree from StringIO import StringIO import urllib import os LIBGEN_URL = "http://libgen.org/scimag/get.php?doi=" scihub_cooki...
code_fim
hard
{ "lang": "python", "repo": "leorassi/paperbot", "path": "/modules/scihub.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @cookie def scihub_dl(url, **kwargs): re = requests.get(url, **kwargs) return re.content @cookie def scihubber(url, **kwargs): """ Takes user url and traverses sci-hub proxy system until pdf is found. When successful, returns either sci-hub pdfcache or libgen pdf url """ a =...
code_fim
hard
{ "lang": "python", "repo": "leorassi/paperbot", "path": "/modules/scihub.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kodeama/-Anki-Shinmeikai-Addon path: /Anki 2.1/shinmeikai_definitions/__init__.py #!/usr/bin/python # coding: utf8 # #Shinmeikai Definitions Addon # #Lets the user get the shinmeikai definition for one or multiple<|fim_suffix|>ecab from the japanese support pugin, so the japanese #support plugin ...
code_fim
medium
{ "lang": "python", "repo": "Kodeama/-Anki-Shinmeikai-Addon", "path": "/Anki 2.1/shinmeikai_definitions/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ecab from the japanese support pugin, so the japanese #support plugin is necessary for this feature. # #To edit the config go to: #C:\Users\USER\AppData\Roaming\Anki2\addons\shinmeikai_definitions\config.py # #Github: #Youtube: import shinmeikai_definitions.main<|fim_prefix|># repo: Kodeama/-Anki-Shinme...
code_fim
medium
{ "lang": "python", "repo": "Kodeama/-Anki-Shinmeikai-Addon", "path": "/Anki 2.1/shinmeikai_definitions/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from gql.gql.enum_utils import enum_field from ..enum.property_kind import PropertyKind @dataclass class PropertyTypeInput(DataClassJsonMixin): name: str type: PropertyKind = enum_field(PropertyKind) id: Optional[str] = None externalId: Optional[str] = None nodeType: Optional[str] = N...
code_fim
medium
{ "lang": "python", "repo": "kyaaqba/magma", "path": "/symphony/cli/pyinventory/graphql/input/property_type.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyaaqba/magma path: /symphony/cli/pyinventory/graphql/input/property_type.py #!/usr/bin/env python3 # @generated AUTOGENERATED file. Do not Change! from dataclasses import dataclass from datetime import datetime from functools import partial from gql.gql.datetime_utils import DATETIME_FIELD from...
code_fim
medium
{ "lang": "python", "repo": "kyaaqba/magma", "path": "/symphony/cli/pyinventory/graphql/input/property_type.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: thispl/boss path: /boss/boss/report/pf_report/pf_report.py # Copyright (c) 2013, TeamPRO and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from datetime import datetime from calendar import monthrange from frappe import _, m...
code_fim
hard
{ "lang": "python", "repo": "thispl/boss", "path": "/boss/boss/report/pf_report/pf_report.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_conditions(filters): conditions = "" if filters.get("from_date"): conditions += " start_date >= %(from_date)s" if filters.get("to_date"): conditions += " and end_date >= %(to_date)s" if filters.get("client"): conditions += " and client_name = %(client)s" if fil...
code_fim
hard
{ "lang": "python", "repo": "thispl/boss", "path": "/boss/boss/report/pf_report/pf_report.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fedora-python/pyp2rpm path: /tests/test_data/isholiday-0.1/isholiday.py import datetime def getholidays(year): """Return a set public holidays in CZ as (day, month) tuples.""" holidays = { (1, 1), # Novy rok (1, 5), # Svatek prace (8, 5), # Den vitezstvi ...
code_fim
medium
{ "lang": "python", "repo": "fedora-python/pyp2rpm", "path": "/tests/test_data/isholiday-0.1/isholiday.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (date.day, date.month) in getholidays(date.year) if __name__ == "__main__": for y in range(2016, 2025): print("{}: {}".format(y, getholidays(y))) testdates = [(2016, 3, 28), (2017, 3, 28), (2017, 4, 14)] for date in testdates: d = datetime.date(*date) print...
code_fim
hard
{ "lang": "python", "repo": "fedora-python/pyp2rpm", "path": "/tests/test_data/isholiday-0.1/isholiday.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'api-base/', include('apps.l_core.api.base.router')), url(r'api-doc/', db_structure_view), ]<|fim_prefix|># repo: bkopanichuk/sevsed2 path: /apps/l_core/urls.py """test_proj URL Configuration The `urlpatterns` list routes URLs to viewsets. For more information please see: ...
code_fim
medium
{ "lang": "python", "repo": "bkopanichuk/sevsed2", "path": "/apps/l_core/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bkopanichuk/sevsed2 path: /apps/l_core/urls.py """test_proj URL Configuration The `urlpatterns` list routes URLs to viewsets. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function viewsets 1. Add an import: from my_app import viewse...
code_fim
medium
{ "lang": "python", "repo": "bkopanichuk/sevsed2", "path": "/apps/l_core/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitter-badger/vcell path: /pythonScripts/VCell_VisIt/VCellProxyClientExample.py import sys import vtk sys.path.append('./') import vcellProxy vcellProxy2 = vcellProxy.VCellProxyHandler() try: vcellProxy2.open() <|fim_suffix|> simList = vcellProxy2.getClient().getSimsFromOpenModels() ...
code_fim
hard
{ "lang": "python", "repo": "gitter-badger/vcell", "path": "/pythonScripts/VCell_VisIt/VCellProxyClientExample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> simList = vcellProxy2.getClient().getSimsFromOpenModels() print('\n') print(simList) sim = simList[0] variables = vcellProxy2.getClient().getVariableList(sim) timePoints = vcellProxy2.getClient().getTimePoints(sim) print(variables) print(timePoints) var = variables[0] ...
code_fim
hard
{ "lang": "python", "repo": "gitter-badger/vcell", "path": "/pythonScripts/VCell_VisIt/VCellProxyClientExample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Varriount/orgextended path: /orgplist.py import sublime import sublime_plugin import os import base64 import urllib.request import OrgExtended.asettings as sets import OrgExtended.orgutil.util as util import uuid import re import logging from OrgExtended.orgutil.addmethod import * log = loggin...
code_fim
hard
{ "lang": "python", "repo": "Varriount/orgextended", "path": "/orgplist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def GetInt(self,name,defaultValue): v = self.Get(name,defaultValue) try: return int(v) except: return defaultValue def GetBool(self,name): v = self.Get(name,"no") if(isinstance(v,list) and len(v) == 1): v = v[0] i...
code_fim
hard
{ "lang": "python", "repo": "Varriount/orgextended", "path": "/orgplist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaysongiroux/pal path: /pal/filter/trace.py from pal.filter.abstract_filter import AbstractFilter <|fim_suffix|> if(reg.name.lower().startswith("trfcr")): return False elif(reg.name.lower().startswith("htrfcr")): return False else: retur...
code_fim
medium
{ "lang": "python", "repo": "jaysongiroux/pal", "path": "/pal/filter/trace.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "trace registers" def do_filter(self, reg): if(reg.name.lower().startswith("trfcr")): return False elif(reg.name.lower().startswith("htrfcr")): return False else: return True<|fim_prefix|># repo: jaysongiroux/pal path: /pal/f...
code_fim
easy
{ "lang": "python", "repo": "jaysongiroux/pal", "path": "/pal/filter/trace.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eroicaleo/LearningPython path: /interview/leet/260_Single_Number_III.py #!/usr/bin/env python # The thinking process, like the single number I # If we xor all the numbers together, we get a number that is a ^ b # a, b appears only once. <|fim_suffix|>class Solution: def singleNumber(self, n...
code_fim
easy
{ "lang": "python", "repo": "eroicaleo/LearningPython", "path": "/interview/leet/260_Single_Number_III.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a = functools.reduce(operator.xor, nums) b = functools.reduce(operator.xor, filter(lambda n: n & (a & -a), nums)) return [a^b, b] sol = Solution() nums = [1,2,1,3,2,5] print(sol.singleNumber(nums))<|fim_prefix|># repo: eroicaleo/LearningPython path: /interview/leet/260_Single_Num...
code_fim
easy
{ "lang": "python", "repo": "eroicaleo/LearningPython", "path": "/interview/leet/260_Single_Number_III.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: right = mid - 1 return ans def q(self, t: int) -> int: time = self.binarySearch(t) return self.leaders[time] # Your TopVotedCandidate object will be instantiated and called as such: # obj = TopVotedCandidate(persons, times) # param_1 = obj...
code_fim
hard
{ "lang": "python", "repo": "rpm1995/LeetCode", "path": "/911_Online_Election.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpm1995/LeetCode path: /911_Online_Election.py class TopVotedCandidate: def __init__(self, persons: List[int], times: List[int]): self.persons = persons self.times = times self.leaders = [] leader = -1 counts = {-1: -1} <|fim_suffix|> if c...
code_fim
hard
{ "lang": "python", "repo": "rpm1995/LeetCode", "path": "/911_Online_Election.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._version = bento_service.version service_name = bento_service.name namespace = bentoml_config("instrument").get("default_namespace") self._metric = Summary( name=service_name + "_oracle_metric", documentation=" Oracle Metric", name...
code_fim
hard
{ "lang": "python", "repo": "marlesson/meta-bandit-selector", "path": "/lib/monitoring.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._selected_arm = Counter(name=service_name + "_arm_total", documentation='Total number selected arm', namespace=namespace, labelnames=["endpoint", "service_version", "...
code_fim
hard
{ "lang": "python", "repo": "marlesson/meta-bandit-selector", "path": "/lib/monitoring.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marlesson/meta-bandit-selector path: /lib/monitoring.py from bentoml import BentoService, config as bentoml_config from prometheus_client import Histogram, Counter, Gauge, Summary from prometheus_client.context_managers import ExceptionCounter from config import Config _DEFAULT_ENDPOINT = "predic...
code_fim
hard
{ "lang": "python", "repo": "marlesson/meta-bandit-selector", "path": "/lib/monitoring.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_outer_vertices(self): p1 = [Point(1, 1), Point(2, 1), Point(2, 2), Point(1, 1)] p2 = [Point(0, 0), Point(3, 0), Point(3, 3), Point(0, 0)] p3 = [Point(4, 0), Point(5, 0), Point(5, 1), Point(4, 0)] mp = [[p1, p2], [p3]] f = QgsFeature(QgsFields()) ...
code_fim
hard
{ "lang": "python", "repo": "OSM-es/CatAtom2Osm", "path": "/test/geo/test_geometry.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: OSM-es/CatAtom2Osm path: /test/geo/test_geometry.py import unittest from qgis.core import QgsFeature, QgsFields from catatom2osm.geo import Geometry, Point class TestGeometry(unittest.TestCase): def test_get_multipolygon(self): p = [[Point(0, 0), Point(1, 0), Point(1, 1), Point(0,...
code_fim
hard
{ "lang": "python", "repo": "OSM-es/CatAtom2Osm", "path": "/test/geo/test_geometry.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> p1 = [Point(1, 1), Point(2, 1), Point(2, 2), Point(1, 1)] p2 = [Point(0, 0), Point(3, 0), Point(3, 3), Point(0, 0)] p3 = [Point(4, 0), Point(5, 0), Point(5, 1), Point(4, 0)] mp = [[p1, p2], [p3]] f = QgsFeature(QgsFields()) f.setGeometry(Geometry.fromMultiPo...
code_fim
hard
{ "lang": "python", "repo": "OSM-es/CatAtom2Osm", "path": "/test/geo/test_geometry.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }