text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def download_request(self, request, spider): scheme = urlparse_cached(request).scheme try: handler = self._handlers[scheme].download_request except KeyError: msg = self._notconfigured.get(scheme, \ 'no handler a...
code_fim
hard
{ "lang": "python", "repo": "zymITsky/ants", "path": "/ants/crawl/downloader/handlers/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if use_venv: create_venv("{}/{}".format(path, name)) init_python_package(root_package) generate_xml(root_package, name) generate_start_file(root_package, name) generate_modules_file(root_package, name) generate_generate_file(root_package, name) if web: genera...
code_fim
hard
{ "lang": "python", "repo": "ThomasKenyeres/Gofri", "path": "/gofri/lib/project_generator/generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThomasKenyeres/Gofri path: /gofri/lib/project_generator/generator.py import os from gofri.lib.project_generator.templates import * from gofri.lib.project_generator.tools import get_project_name, make_python_packages, init_python_package from gofri.lib.project_generator.venv_generator import crea...
code_fim
medium
{ "lang": "python", "repo": "ThomasKenyeres/Gofri", "path": "/gofri/lib/project_generator/generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>SYSTEM_DOC_CATEGORY = [ { 'name': 'default', 'label': u'默认分类', 'priority': 1, 'systems': [] }, { 'name': 'user_base_service', 'label': u'基础用户服务', 'priority': 10, 'systems': ['BK_LOGIN', 'BK_PAAS', 'CMSI'] }, { 'nam...
code_fim
hard
{ "lang": "python", "repo": "nannan00/bk-PaaS", "path": "/paas-ce/paas/esb/esb/management/utils/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nannan00/bk-PaaS path: /paas-ce/paas/esb/esb/management/utils/constants.py # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All right...
code_fim
hard
{ "lang": "python", "repo": "nannan00/bk-PaaS", "path": "/paas-ce/paas/esb/esb/management/utils/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>next"), path('prev', views.prev_track, name="prev"), path('pause', views.pause, name="pause"), path('play', views.play, name="play") ]<|fim_prefix|># repo: Machina123/PythonAssignment path: /spotify/urls.py from django.urls import path from . import views urlpatterns = [ path('', views.i...
code_fim
hard
{ "lang": "python", "repo": "Machina123/PythonAssignment", "path": "/spotify/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Machina123/PythonAssignment path: /spotify/urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index, name="index"), path('authcode', views.authcode, n<|fim_suffix|>next"), path('prev', views.prev_track, name="prev"), path('pause', views.pause,...
code_fim
hard
{ "lang": "python", "repo": "Machina123/PythonAssignment", "path": "/spotify/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wiktorlazarski/SherlockNet path: /scripts/data_clean.py import argparse import os import re import string def normalize_text(text): """Normalize text. Args: text (str): in text Returns: str: normalized text """ text = text.lstrip() remove_punctuations =...
code_fim
hard
{ "lang": "python", "repo": "wiktorlazarski/SherlockNet", "path": "/scripts/data_clean.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): args = parse_args() for book in os.listdir(args.raw_data): book_path = os.path.join(args.raw_data, book) out_path = os.path.join(args.out_data, book) normalize_file(book_path, out_path) if __name__ == "__main__": main()<|fim_prefix|># repo: wiktorlazars...
code_fim
hard
{ "lang": "python", "repo": "wiktorlazarski/SherlockNet", "path": "/scripts/data_clean.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def retrieve(self, request, pk=None): """ Returns pageinfo if a url is requested, the default otherwise """ try: inUrl = request.query_params.get('url', None ) #if inUrl is None: # inUrl = 'https://google.com' pageinfo = PageInfo( url=inUrl ) except KeyError: return Response(stat...
code_fim
hard
{ "lang": "python", "repo": "zsolthajdu/django_pageinfo", "path": "/pageinfo/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zsolthajdu/django_pageinfo path: /pageinfo/views.py from django.http import JsonResponse from rest_framework.response import Response from rest_framework import viewsets, status from .serializers import PageInfoSerializer from .pageinfo import PageInfo # # # class PageInfoViewSet( viewsets.Vie...
code_fim
hard
{ "lang": "python", "repo": "zsolthajdu/django_pageinfo", "path": "/pageinfo/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE) application = get_wsgi_application()<|fim_prefix|># repo: arturtamborski/wypok path: /wypok/wypok/wsgi.py import os from django.core.wsgi import get_wsgi_application <|fim_middle|>from .settings import DJANGO_SETTINGS_MODULE
code_fim
easy
{ "lang": "python", "repo": "arturtamborski/wypok", "path": "/wypok/wypok/wsgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE) application = get_wsgi_application()<|fim_prefix|># repo: arturtamborski/wypok path: /wypok/wypok/wsgi.py import os from django.core.wsgi import get_wsgi_application <|fim_middle|>from .settings import DJANGO_SETTINGS_MODULE
code_fim
easy
{ "lang": "python", "repo": "arturtamborski/wypok", "path": "/wypok/wypok/wsgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arturtamborski/wypok path: /wypok/wypok/wsgi.py import os from django.core.wsgi import get_wsgi_application <|fim_suffix|> os.environ.setdefault("DJANGO_SETTINGS_MODULE", DJANGO_SETTINGS_MODULE) application = get_wsgi_application()<|fim_middle|>from .settings import DJANGO_SETTINGS_MODULE
code_fim
easy
{ "lang": "python", "repo": "arturtamborski/wypok", "path": "/wypok/wypok/wsgi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from pyb import ADC from time import sleep PIN_NAMES = ["S8", "S10", "S12", "S19", "S23", "S26"] print( "Preparing ADCs for pins : %s" % PIN_NAMES ) adcs = [ (pin_name, ADC(pin_name)) for pin_name in PIN_NAMES ] while True: for pin_name, adc in adcs: val = adc.read() volt = val * 3.3 / 4095 print...
code_fim
hard
{ "lang": "python", "repo": "mchobby/pyboard-driver", "path": "/PYBStick/examples/adc_all.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: mchobby/pyboard-driver path: /PYBStick/examples/adc_all.py """ adc_all.py - read all the ADC available on the PYBStick and returns the value * Author(s): Meurisse D. from MCHobby (shop.mchobby.be). Fiche produit: ---> https://shop.mchobby.be/fr/micropython/1830-pybstick-lite-26-micropython-et-a...
code_fim
medium
{ "lang": "python", "repo": "mchobby/pyboard-driver", "path": "/PYBStick/examples/adc_all.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>def _get_default_parameters(parameters, ignore_kwargs: Sequence[str]): empty = inspect.Parameter.empty for paramname in parameters: if paramname in ignore_kwargs: continue defval = parameters[paramname].default if defval == empty: continue ...
code_fim
hard
{ "lang": "python", "repo": "udemirezen/xitorch", "path": "/xitorch/_docstr/api_docstr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: udemirezen/xitorch path: /xitorch/_docstr/api_docstr.py import inspect from typing import Union, Any, Mapping, Sequence, Optional, Callable, List, \ Generator, Tuple, ItemsView def get_methods_docstr( cls_or_func: Callable, methods: Union[Sequence[Callable], Mapping[str...
code_fim
hard
{ "lang": "python", "repo": "udemirezen/xitorch", "path": "/xitorch/_docstr/api_docstr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for name, method in generator: # get the signatures sigparams = inspect.signature(method).parameters kwargs_sig_list = ['method="%s"' % name] kwargs_sig_list2 = ["%s=%s" % (pname, val) for pname, val in _get_default_parameters(sigparams, ignore_kwargs)] kwa...
code_fim
hard
{ "lang": "python", "repo": "udemirezen/xitorch", "path": "/xitorch/_docstr/api_docstr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fga-eps-mds/2018.1-Dr-Down-sdcurve path: /height/api/tests/test_height_curve.py from rest_framework.test import APITestCase from core import Constants from height.models import HeightCurve from height.curves import ( HeightCurveMaleYears, HeightCurveMaleMonths, HeightCurveFemaleYears, Hei...
code_fim
hard
{ "lang": "python", "repo": "fga-eps-mds/2018.1-Dr-Down-sdcurve", "path": "/height/api/tests/test_height_curve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> graphic = HeightCurve( gender=Constants.MALE, age=Constants.YEARS ) self.assertEqual( graphic.make(), self.male_years ) self.assertEqual( graphic.make(HeightCurve.TITLE), self.male_years['title'...
code_fim
hard
{ "lang": "python", "repo": "fga-eps-mds/2018.1-Dr-Down-sdcurve", "path": "/height/api/tests/test_height_curve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: sbs = SBSearch('postgresql://@/big_query_test', min_edge_length=0.005) except Exception as e: raise ValueError( "Failed db connection, is it created and online?" ) from e sbs.source = 'example_survey' if args.action == 'add': sbs.db.drop_spatial_index() for i in range(10...
code_fim
hard
{ "lang": "python", "repo": "Small-Bodies-Node/sbsearch", "path": "/test-extras/big-query.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> t = Time.now() obs = sbs.find_observations_by_ephemeris(eph) print('{} found in {:.1f}'.format(len(obs), (Time.now() - t).to('s'))) # sbs.padding = 1 # t = Time.now() # obs = sbs.find_observations_by_ephemeris(eph) # print('{} found in {:1f} with {} arcmin padding'.format( ...
code_fim
hard
{ "lang": "python", "repo": "Small-Bodies-Node/sbsearch", "path": "/test-extras/big-query.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Small-Bodies-Node/sbsearch path: /test-extras/big-query.py # Licensed with the 3-clause BSD license. See LICENSE for details. # generate a 1,000,000 observation database and query it import argparse import numpy as np from numpy.random import rand from astropy.time import Time import astropy.u...
code_fim
hard
{ "lang": "python", "repo": "Small-Bodies-Node/sbsearch", "path": "/test-extras/big-query.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>data = json.dumps( data, indent=2, ensure_ascii=False, ) f = open('data/croatia-data/raw.json', 'w') f.write(data) f.close()<|fim_prefix|># repo: natanaelteck/covid19 path: /data/croatia-data/crawler.py import requests import json url = 'https://www.koronavirus.hr/json/?action=po_danima_zup...
code_fim
easy
{ "lang": "python", "repo": "natanaelteck/covid19", "path": "/data/croatia-data/crawler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>f = open('data/croatia-data/raw.json', 'w') f.write(data) f.close()<|fim_prefix|># repo: natanaelteck/covid19 path: /data/croatia-data/crawler.py import requests import json url = 'https://www.koronavirus.hr/json/?action=po_danima_zupanijama' data = requests.get(url=url).json() <|fim_middle|>data = js...
code_fim
medium
{ "lang": "python", "repo": "natanaelteck/covid19", "path": "/data/croatia-data/crawler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: natanaelteck/covid19 path: /data/croatia-data/crawler.py import requests import json url = 'https://www.koronavirus.hr/json/?action=po_danima_zupanijama' <|fim_suffix|>data = json.dumps( data, indent=2, ensure_ascii=False, ) f = open('data/croatia-data/raw.json', 'w') f.write(data)...
code_fim
easy
{ "lang": "python", "repo": "natanaelteck/covid19", "path": "/data/croatia-data/crawler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: roocs/mini-esgf-data path: /generate_test_data.py import argparse import hashlib import os import subprocess from glob import glob def arg_parse(): """ Parses arguments given at the command line :return: Namespace object built from attributes parsed from command line. """ p...
code_fim
hard
{ "lang": "python", "repo": "roocs/mini-esgf-data", "path": "/generate_test_data.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> lev_selector = "" lev = args.level if args.level >= 0: lev_selector = f"-d lev,0,{lev}" compression = "" if args.compress: compression = "-L 9" extra = "" if "zostoga" in file: lon_selector = "" lat_...
code_fim
hard
{ "lang": "python", "repo": "roocs/mini-esgf-data", "path": "/generate_test_data.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, maps, datasets, threads): super().__init__() layout = QHBoxLayout() panel_test = TestingPanel(maps, threads) panel_train = TrainingPanel(datasets, panel_test, threads) layout.addWidget(panel_train) layout.addWidget(panel_test) ...
code_fim
medium
{ "lang": "python", "repo": "seanwu1105/pso-car", "path": "/pso_car/gui/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: seanwu1105/pso-car path: /pso_car/gui/base.py """ Define the GUI: main window. """ from PySide2.QtWidgets import QMainWindow, QWidget, QHBoxLayout from .training_panel import TrainingPanel from .testing_panel import TestingPanel <|fim_suffix|> super().__init__() layout = QHBoxL...
code_fim
hard
{ "lang": "python", "repo": "seanwu1105/pso-car", "path": "/pso_car/gui/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, maps, datasets): super().__init__() self.setWindowTitle("Potential Significant Other") self.statusBar() # a container for threads created in GUI classes. # For more details: # https://stackoverflow.com/questions/28714630/qthread-destr...
code_fim
medium
{ "lang": "python", "repo": "seanwu1105/pso-car", "path": "/pso_car/gui/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BiaSciLab/waterbot path: /measure.py #!/usr/bin/env python # Example for RC timing reading for Raspberry Pi # are not fast enough! <|fim_suffix|> global pulses pulses = pulses+1 print (pulses) GPIO.add_event_detect(21, GPIO.RISING, callback=pulse_count) while True: print (pulse...
code_fim
medium
{ "lang": "python", "repo": "BiaSciLab/waterbot", "path": "/measure.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def pulse_count(channel): global pulses pulses = pulses+1 print (pulses) GPIO.add_event_detect(21, GPIO.RISING, callback=pulse_count) while True: print (pulses)<|fim_prefix|># repo: BiaSciLab/waterbot path: /measure.py #!/usr/bin/env python # Example for RC timing reading for Raspberry...
code_fim
medium
{ "lang": "python", "repo": "BiaSciLab/waterbot", "path": "/measure.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global pulses pulses = pulses+1 print (pulses) GPIO.add_event_detect(21, GPIO.RISING, callback=pulse_count) while True: print (pulses)<|fim_prefix|># repo: BiaSciLab/waterbot path: /measure.py #!/usr/bin/env python # Example for RC timing reading for Raspberry Pi # are not fast enough!...
code_fim
easy
{ "lang": "python", "repo": "BiaSciLab/waterbot", "path": "/measure.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> oh = OpeningHours() for days, open_time, open_time_ampm, close_time, close_time_ampm in re.findall( r"(\w+-\w+) (\d+:\d+)\s?(AM|am|PM|pm) (\d+:\d+)\s?(AM|am|PM|pm)", ld_data["openingHours"], ): start_day, end_day = days.split("-") sta...
code_fim
hard
{ "lang": "python", "repo": "alltheplaces/alltheplaces", "path": "/locations/spiders/sprouts.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alltheplaces/alltheplaces path: /locations/spiders/sprouts.py import re from scrapy.spiders import SitemapSpider from locations.hours import OpeningHours, day_range, sanitise_day from locations.structured_data_spider import StructuredDataSpider class SproutsFarmersMarket(SitemapSpider, Struct...
code_fim
hard
{ "lang": "python", "repo": "alltheplaces/alltheplaces", "path": "/locations/spiders/sprouts.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: digibyte/digibyte path: /qa/rpc-tests/listsinceblock.py #!/usr/bin/env python3 # Copyright (c) 2017 The DigiByte Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_frame...
code_fim
medium
{ "lang": "python", "repo": "digibyte/digibyte", "path": "/qa/rpc-tests/listsinceblock.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.join_network() # listsinceblock(lastblockhash) should now include tx, as seen from nodes[0] lsbres = self.nodes[0].listsinceblock(lastblockhash) found = False for tx in lsbres['transactions']: if tx['txid'] == senttx: found = True ...
code_fim
hard
{ "lang": "python", "repo": "digibyte/digibyte", "path": "/qa/rpc-tests/listsinceblock.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '%s(axiom=\'%s\', rules={%s}) at generation %d = \'%s\'' % ( self.__class__.__name__, self.axiom, ', '.join(['\'%s\':\'%s\'' % x for x in self.rules.items()]), self.generation, self.string ) class Random_L_System...
code_fim
hard
{ "lang": "python", "repo": "ic0n/L-System", "path": "/lsystem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ic0n/L-System path: /lsystem.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 23 18:49:39 2017 @author: Cling """ import re import random __all__ = ['L_System'] class L_System: axiom = None rules = None def __init__(self, axiom=None, rul...
code_fim
hard
{ "lang": "python", "repo": "ic0n/L-System", "path": "/lsystem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def reset(self): self.generation = 0 self.string = self.axiom def __getitem__(self, index): return self.string[index] def __str__(self): return self.string def __len__(self): return len(self.string) def __repr__(self): r...
code_fim
hard
{ "lang": "python", "repo": "ic0n/L-System", "path": "/lsystem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Copyright 2010 Trevor F. Smith (http://trevor.smith.name/) 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/LICENSE-2.0 Unless required by applicable law...
code_fim
hard
{ "lang": "python", "repo": "brownman/spaciblo", "path": "/spaciblo/sim/api_urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brownman/spaciblo path: /spaciblo/sim/api_urls.py """The URLS for the API (not the user readable web UI)""" import traceback from django.conf.urls.defaults import * from django.contrib.auth.models import User <|fim_suffix|>urlpatterns = patterns('', (r'^template/$', Resource(handler=TemplateHa...
code_fim
medium
{ "lang": "python", "repo": "brownman/spaciblo", "path": "/spaciblo/sim/api_urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='UserTransaction', fields=[ ('uuid_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('trans_id', models.CharField(max_le...
code_fim
hard
{ "lang": "python", "repo": "amirhoseinbidar/django-payir", "path": "/pay/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amirhoseinbidar/django-payir path: /pay/migrations/0001_initial.py # Generated by Django 2.2.1 on 2019-05-28 19:54 from django.db import migrations, models import uuid <|fim_suffix|> initial = True dependencies = [ ] operations = [ migrations.CreateModel( na...
code_fim
hard
{ "lang": "python", "repo": "amirhoseinbidar/django-payir", "path": "/pay/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paolacastro/dobby path: /dobby/cli.py import click from dobby.cherrypick import cherrypick from dobby.aggregate import aggregate settings = dict(help_option_names=['-h', '--help']) <|fim_suffix|> cli.add_command(cherrypick) cli.add_command(aggregate) if __name__ == "__main__": cli()<|fim_...
code_fim
hard
{ "lang": "python", "repo": "paolacastro/dobby", "path": "/dobby/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Hi! Dobby is the heroic house-elf that automates SampleSheet generation from Google Sheets. And, of course, Dobby is free. """ pass cli.add_command(cherrypick) cli.add_command(aggregate) if __name__ == "__main__": cli()<|fim_prefix|># repo: paolacastro/dobby path: /dobby/c...
code_fim
medium
{ "lang": "python", "repo": "paolacastro/dobby", "path": "/dobby/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>cli.add_command(cherrypick) cli.add_command(aggregate) if __name__ == "__main__": cli()<|fim_prefix|># repo: paolacastro/dobby path: /dobby/cli.py import click from dobby.cherrypick import cherrypick from dobby.aggregate import aggregate settings = dict(help_option_names=['-h', '--help']) <|fim_...
code_fim
hard
{ "lang": "python", "repo": "paolacastro/dobby", "path": "/dobby/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user_bias = tf.keras.layers.Embedding(input_dim=users_number + 1, output_dim=1)(user_id_input) item_bias = tf.keras.layers.Embedding(input_dim=items_number + 1, output_dim=1)(item_id_input) user_vecs = tf.keras.layers.Reshape([latent_dim])(user_embedding) item_vecs = tf.keras.layers.Resha...
code_fim
hard
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/svd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ilyushin/rec-tool path: /rec_tool/models/svd.py """ Singular Value Decomposition model """ import tensorflow as tf def svd(users_number: int, items_number: int): """ :param users_number: int :param items_number: int :return: SVD model """ latent_dim, max_rating, min_r...
code_fim
hard
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/svd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # define embedding size and layers. user_embedding = tf.keras.layers.Embedding( output_dim=latent_dim, input_dim=users_number + 1, input_length=1, name='user_embedding', embeddings_regularizer=tf.keras.regularizers.l2())(user_id_input) item_embedding =...
code_fim
medium
{ "lang": "python", "repo": "Ilyushin/rec-tool", "path": "/rec_tool/models/svd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f = codecs.open(path, encoding=encoding, mode='w+') try: # write BOM if the encoding requires it if encoding in cls.bomdict.keys(): f.write(cls.bomdict[encoding]) f.write(content) except UnicodeEncodeError: # fallback ...
code_fim
hard
{ "lang": "python", "repo": "benoit-l/pontoon", "path": "/vendor-local/lib/python/silme/io/file.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: benoit-l/pontoon path: /vendor-local/lib/python/silme/io/file.py from ..format import Manager from .clients import IOClient, FileFormatClient from ..core import Package, Structure, EntityList, Blob import os import sys import codecs def register(Manager): Manager.register(FileClient) class...
code_fim
hard
{ "lang": "python", "repo": "benoit-l/pontoon", "path": "/vendor-local/lib/python/silme/io/file.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#======================================================================== @classmethod def _write_source_with_encoding(cls, content, path, encoding='utf-8'): f = codecs.open(path, encoding=encoding, mode='w+') try: # write BOM if the encoding requires it if...
code_fim
hard
{ "lang": "python", "repo": "benoit-l/pontoon", "path": "/vendor-local/lib/python/silme/io/file.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> hints = knight.hints(board.board) assert_lists_equivalent(expected_hints, hints) def test_move(board): expected_hints = [[7, 3], [7, 5], [6, 2], [4, 2], [3, 3], [3, 5], [4, 6], [6, 6]] knight = board.board[4][3].piece ...
code_fim
hard
{ "lang": "python", "repo": "jrj92280/python-eve-backend", "path": "/test/unit/chess/pieces/test_knight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrj92280/python-eve-backend path: /test/unit/chess/pieces/test_knight.py import pytest from chess_game.models.board import Board from chess_game.pieces.knight import Knight from test.utils import assert_lists_equivalent <|fim_suffix|> knight = board.board[4][3].piece hints = knight.hin...
code_fim
hard
{ "lang": "python", "repo": "jrj92280/python-eve-backend", "path": "/test/unit/chess/pieces/test_knight.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not loop: loop = asyncio.get_event_loop() self._loop = loop self._session = aiohttp.ClientSession(headers=headers, loop=self._loop) def __del__(self): asyncio.ensure_future(self._session.close(), loop=self._loop) async de...
code_fim
medium
{ "lang": "python", "repo": "reddit-habs/nhlapi", "path": "/nhlapi/clients.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> class AsyncClient: def __init__(self, *, headers=None, loop=None): if not loop: loop = asyncio.get_event_loop() self._loop = loop self._session = aiohttp.ClientSession(headers=headers, loop=self._loop) def __del__(self): ...
code_fim
hard
{ "lang": "python", "repo": "reddit-habs/nhlapi", "path": "/nhlapi/clients.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|># repo: reddit-habs/nhlapi path: /nhlapi/clients.py from .props import wrap try: import requests class SyncClient: def __init__(self, headers=None): <|fim_suffix|> if not loop: loop = asyncio.get_event_loop() self._loop = loop self._ses...
code_fim
hard
{ "lang": "python", "repo": "reddit-habs/nhlapi", "path": "/nhlapi/clients.py", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rizo-R/terminal-2021 path: /datamining/replayloader.py import json import os from multiprocessing import Pool from tqdm import tqdm def reader(path): <|fim_suffix|> if __name__ == '__main__': turndata = [f for f in os.listdir('../turndata/') if f.endswith('turn')] pool = Pool(16) r...
code_fim
medium
{ "lang": "python", "repo": "Rizo-R/terminal-2021", "path": "/datamining/replayloader.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> turndata = [f for f in os.listdir('../turndata/') if f.endswith('turn')] pool = Pool(16) res = list(tqdm(pool.imap(reader, turndata)))<|fim_prefix|># repo: Rizo-R/terminal-2021 path: /datamining/replayloader.py import json import os from multiprocessing import Pool from tqdm import tqdm <|fi...
code_fim
medium
{ "lang": "python", "repo": "Rizo-R/terminal-2021", "path": "/datamining/replayloader.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: ivandir/blogScripts path: /Python/2018-09-13-dixon-coles-and-time-weighting/dixon_coles_decay_xi_5season.py import pandas as pd import numpy as np import pickle from scipy.stats import poisson,skellam from scipy.optimize import minimize, fmin from multiprocessing import Pool def calc_mean...
code_fim
hard
{ "lang": "python", "repo": "ivandir/blogScripts", "path": "/Python/2018-09-13-dixon-coles-and-time-weighting/dixon_coles_decay_xi_5season.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>epl_1318 = pd.DataFrame() for year in range(13,18): epl_1318 = pd.concat((epl_1318, pd.read_csv("http://www.football-data.co.uk/mmz4281/{}{}/E0.csv".format(year, year+1)))) epl_1318['Date'] = pd.to_datetime(epl_1318['Date'], format='%d/%m/%y') epl_1318['time_diff'] = (max(epl_1318['Date']) - epl_...
code_fim
hard
{ "lang": "python", "repo": "ivandir/blogScripts", "path": "/Python/2018-09-13-dixon-coles-and-time-weighting/dixon_coles_decay_xi_5season.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Penlect/subpub path: /test_subpub.py """Unittests for subpub module""" # Built-in import asyncio import doctest import queue import re import threading import unittest # Module import subpub from subpub import (SubPub, MqttTopic, ExceptionAwareQueue, AsyncSubPub, AsyncExcept...
code_fim
hard
{ "lang": "python", "repo": "Penlect/subpub", "path": "/test_subpub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIs(AsyncSubPub().queue_factory, asyncio.Queue) def test_custom_queue_factory(self): self.assertIs(AsyncSubPub(AsyncExceptionAwareQueue).queue_factory, AsyncExceptionAwareQueue) async def test_queue_type(self): sp = AsyncSubPub(AsyncExcepti...
code_fim
hard
{ "lang": "python", "repo": "Penlect/subpub", "path": "/test_subpub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_single_level_wildcard(self): t = MqttTopic('/+/') regex = re.compile('/([^/]*)/') self.assertEqual(t.as_regexp(), regex) def test_multi_level_wildcard(self): t = MqttTopic('#') regex = re.compile('(.*)$') self.assertEqual(t.as_regexp(), reg...
code_fim
hard
{ "lang": "python", "repo": "Penlect/subpub", "path": "/test_subpub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # If a secret key is defined, sign the request with a hash (key + content) if webhook.secret != "": prepared_request.headers["X-Hook-Signature"] = generate_signature( prepared_request.body, webhook.secret ) # Send the request with requests.Session() as session:...
code_fim
hard
{ "lang": "python", "repo": "netravnen/peering-manager", "path": "/extras/workers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: netravnen/peering-manager path: /extras/workers.py import logging import requests from django.conf import settings from django_rq import job from utils.functions import generate_signature logger = logging.getLogger("peering.manager.extras") @job("default") def process_webhook( webhook, m...
code_fim
hard
{ "lang": "python", "repo": "netravnen/peering-manager", "path": "/extras/workers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class SubidyPlaybackProvider(backend.PlaybackProvider): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.subsonic_api = self.backend.subsonic_api def translate_uri(self, translate_uri): song_id = uri.get_song_id(translate_uri) censored_u...
code_fim
medium
{ "lang": "python", "repo": "Prior99/mopidy-subidy", "path": "/mopidy_subidy/playback.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.subsonic_api = self.backend.subsonic_api def translate_uri(self, translate_uri): song_id = uri.get_song_id(translate_uri) censored_url = self.subsonic_api.get_censored_song_stream_uri(song_...
code_fim
medium
{ "lang": "python", "repo": "Prior99/mopidy-subidy", "path": "/mopidy_subidy/playback.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Prior99/mopidy-subidy path: /mopidy_subidy/playback.py import logging from mopidy import backend from mopidy_subidy import uri logger = logging.getLogger(__name__) <|fim_suffix|> def translate_uri(self, translate_uri): song_id = uri.get_song_id(translate_uri) censored_url =...
code_fim
medium
{ "lang": "python", "repo": "Prior99/mopidy-subidy", "path": "/mopidy_subidy/playback.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>erm, # is_obsolete=is_obsolete, ontology=ontology,version=ver).save() # term = "" # ident = "" # description = "" # # name = line.split("NAME")[1].strip()<|fim_prefix|># repo: sndg-arg/sndg-web path: /bioseq/managem...
code_fim
hard
{ "lang": "python", "repo": "sndg-arg/sndg-web", "path": "/bioseq/management/commands/xfam2biosql.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sndg-arg/sndg-web path: /bioseq/management/commands/xfam2biosql.py # pfam_file_path = "/data/databases/xfam/Pfam-A.hmm" # # term = "" # name = "" # ident = "" # ver = 1 # description = "" # is_obsolete = "F" # ontology = Ontology.objects.get_or_create(name="Pfam")[0] # # with open(pfam_file_path)...
code_fim
hard
{ "lang": "python", "repo": "sndg-arg/sndg-web", "path": "/bioseq/management/commands/xfam2biosql.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: francopestilli/nims path: /nimsutil/__init__.py # @author: Gunnar Schaefer from nimsutil import * <|fim_suffix|>try: import pfile except: print 'Warning: could not import pfile module'<|fim_middle|>try: import pyramid except: print 'Warning: could not import pyramid module' tr...
code_fim
medium
{ "lang": "python", "repo": "francopestilli/nims", "path": "/nimsutil/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: import pfile except: print 'Warning: could not import pfile module'<|fim_prefix|># repo: francopestilli/nims path: /nimsutil/__init__.py # @author: Gunnar Schaefer from nimsutil import * <|fim_middle|>try: import pyramid except: print 'Warning: could not import pyramid module' tr...
code_fim
medium
{ "lang": "python", "repo": "francopestilli/nims", "path": "/nimsutil/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>refactor(__name__, "ray.air.integrations.comet")<|fim_prefix|># repo: ray-project/ray path: /python/ray/air/callbacks/comet.py from ray.tune._structure_refactor import warn_structure_refactor from ray.air.integrations.come<|fim_middle|>t import * # noqa: F401, F403 warn_structure_
code_fim
easy
{ "lang": "python", "repo": "ray-project/ray", "path": "/python/ray/air/callbacks/comet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ray-project/ray path: /python/ray/air/callbacks/comet.py from ray.tune._structure_refactor import warn_s<|fim_suffix|>t import * # noqa: F401, F403 warn_structure_refactor(__name__, "ray.air.integrations.comet")<|fim_middle|>tructure_refactor from ray.air.integrations.come
code_fim
easy
{ "lang": "python", "repo": "ray-project/ray", "path": "/python/ray/air/callbacks/comet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>oping.pyx"], libraries=["oping"]) ], language_level=3) )<|fim_prefix|># repo: Svedrin/meshping path: /oping-py/setup.py from distutils.core import setup from distutils.extension i<|fim_middle|>mport Extension from Cython.Build import cythonize setup( ext_modules = cythonize([ Extension("...
code_fim
medium
{ "lang": "python", "repo": "Svedrin/meshping", "path": "/oping-py/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Svedrin/meshping path: /oping-py/setup.py from distutils.core import setup from distutils.extension i<|fim_suffix|>oping.pyx"], libraries=["oping"]) ], language_level=3) )<|fim_middle|>mport Extension from Cython.Build import cythonize setup( ext_modules = cythonize([ Extension("...
code_fim
medium
{ "lang": "python", "repo": "Svedrin/meshping", "path": "/oping-py/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pradeep-p-1999/attendence-with-mac-address path: /main/mac_python_comp.py #!/usr/bin/env python # coding: utf-8 # In[106]: from datetime import date today = date.today() # In[107]: import pandas as pd test_x='test1.csv' check_x='check.csv' test_df=pd.read_csv(test_x,header=0,encoding = '...
code_fim
hard
{ "lang": "python", "repo": "pradeep-p-1999/attendence-with-mac-address", "path": "/main/mac_python_comp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>customer_data_file = 'attendence_mac.xlsx' name_df = pd.read_excel(customer_data_file, sheetname=0, header=0, index_col=False, keep_default_na=True ) # In[139]: f=name_df['names'] f=len(f) f=f h=len(fg) # In[140]: x_c['names_fg']=fg # In[141]: l=[] for i in range(f): count=0 for j in r...
code_fim
hard
{ "lang": "python", "repo": "pradeep-p-1999/attendence-with-mac-address", "path": "/main/mac_python_comp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if p is not None and first: first = False print('First crash at', p) if len(self.carts) == 1: break print("Remaining carts:", self.carts) def check_positions(self, cart): collision = None for car...
code_fim
hard
{ "lang": "python", "repo": "jsemric/advent-of-code-2018", "path": "/day13/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsemric/advent-of-code-2018 path: /day13/main.py from pprint import pprint class Cart: STEPS = {'^': (-1,0), '>': (0,1), 'v': (1,0), '<': (0,-1)} LEFT = {'^': '<', '>': '^', 'v': '>', '<': 'v'} RIGHT = {'^': '>', '>': 'v', 'v': '<', '<': '^'} def __init__(self, direction, positi...
code_fim
hard
{ "lang": "python", "repo": "jsemric/advent-of-code-2018", "path": "/day13/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.cells = [] self.carts = [] def load(self,fname): with open(fname,'r') as f: cells = [] for i,line in enumerate(f): cells.append(line[:-1]) for j,c in enumerate(line): if c in ['>','<','^','v']: ...
code_fim
hard
{ "lang": "python", "repo": "jsemric/advent-of-code-2018", "path": "/day13/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>one, None, None, None), (u'me++\U0001f62b++,', u'me++\U0001f62b++,', 3, 1, u'[0, 1, 0]', u'[0, 1, 0]', None, None, None, None), (u'liked++it++:p++=)++\U0001f600', u'like++it++:p++=)++\U0001f600', 5, 1, u'[0, 0, 0, 1, 1]', u'[0, 0, 0, 1, 1]', None, None, None, None), (u'\U0001f62b++,++but', u'\U0001f62b++,...
code_fim
hard
{ "lang": "python", "repo": "savin-berlin/zas-rep-tools", "path": "/zas_rep_tools/tests/test_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: savin-berlin/zas-rep-tools path: /zas_rep_tools/tests/test_stats.py .pretty_print_uniq(item) right_repl = [ (36, 10000, u'[12, 3, 8]', u'[1, 4]', u'[1, 2]', u'.', u'.^5', u'.', u'.', 5, 0, None, u'symbol', u'["neutral", 0.0]', u'kan', u'["FM", {"ka^4n^5": 1, "kan^6"...
code_fim
hard
{ "lang": "python", "repo": "savin-berlin/zas-rep-tools", "path": "/zas_rep_tools/tests/test_stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: professor-l/classic-tetris-project path: /classic_tetris_project/commands/command.py import django.db import logging import re import rollbar import traceback from abc import ABC from discord import ChannelType from django.conf import settings from inspect import signature from .. import discord...
code_fim
hard
{ "lang": "python", "repo": "professor-l/classic-tetris-project", "path": "/classic_tetris_project/commands/command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if user is None and member is None and raise_invalid: # Couldn't find the user in DB or on Discord at all raise CommandException("Invalid username") else: return user @staticmethod def twitch_user_from_username(username, existing_only=True, rais...
code_fim
hard
{ "lang": "python", "repo": "professor-l/classic-tetris-project", "path": "/classic_tetris_project/commands/command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>img_png2=tk.PhotoImage(file='img_gif.png') label_img2=tk.Label(top,image=img_png2,justify=tk.RIGHT) label_img2.pack(ipadx = 65, ipady = 30) l8 = tk.Label(top, text = 'Decision Model B', bg = 'white', font=('Arial', 18), width =44, height = 2) l8.pack() l3 = tk.Label(top, textvariable = var3, bg = 'whit...
code_fim
hard
{ "lang": "python", "repo": "MingxuanGu/Voith_Hackathon", "path": "/uiVoith1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MingxuanGu/Voith_Hackathon path: /uiVoith1.py import tkinter as tk import random import csv from tkinter import * mycolor = '#%02x%02x%02x' % (0, 58, 118) window = tk.Tk() window.title ( 'Failure Processing Decision' ) window.geometry( "800x800" ) img_png=tk.PhotoImage(file='img_gif.png') la...
code_fim
hard
{ "lang": "python", "repo": "MingxuanGu/Voith_Hackathon", "path": "/uiVoith1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmihelac/django-cruds path: /cruds/templatetags/crud_tags.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import os.path from django.db import models from django import template from django.urls import ( NoReverseMatch, reverse, ) from django.utils.html import escape ...
code_fim
hard
{ "lang": "python", "repo": "bmihelac/django-cruds", "path": "/cruds/templatetags/crud_tags.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> * ``fields`` fields to include If fields is ``None`` all fields will be displayed. If fields is ``string`` comma separated field names will be displayed. if field is dictionary, key should be field name and value field verbose name. """ if fields is Non...
code_fim
hard
{ "lang": "python", "repo": "bmihelac/django-cruds", "path": "/cruds/templatetags/crud_tags.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> tests = ( # data, key, expected result ( {'a': {'b': {'c': 'd'}, 'e': 1} }, 'a.b.c', 'd'), ( ['a', ['b', 'c', ['d', 'e', 'f', 'g']]], "1.2.3", 'g'), ( ['a', ['b', 'c', ['d', 'e', 'f', 'g']]], "1.b.3", ValueError), ( ['a', ['b', 'c', 'defg']], "1.2.3", 'g'), ...
code_fim
hard
{ "lang": "python", "repo": "wallaceowen/find_node", "path": "/find_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wallaceowen/find_node path: /find_node.py #!/usr/bin/env python """find_node Search a dict, list or tuple or any nested combination for a value, given a search path. search path is a string composed of search keys separated by a path separator (defaults to '.', can be overridden if '.' is a val...
code_fim
medium
{ "lang": "python", "repo": "wallaceowen/find_node", "path": "/find_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for test in tests: try: data, key, expected = test result = find_node(data, key) except (KeyError, ValueError, IndexError) as err: if type(err) is expected: print('pass') else: print(f'Caught {type(err)} on...
code_fim
hard
{ "lang": "python", "repo": "wallaceowen/find_node", "path": "/find_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>key=True, serialize=False, verbose_name='ID')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.product')), ], ), migrations.CreateModel( name='DiscountProduct', fields=[ ('id', model...
code_fim
hard
{ "lang": "python", "repo": "DeanDupalov/my_project", "path": "/grocery_store/grocery_store/product/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>10, validators=[django.core.validators.MinValueValidator(0.0)], verbose_name='price')), ('description', models.TextField()), ('image', models.ImageField(upload_to='product')), ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), ...
code_fim
hard
{ "lang": "python", "repo": "DeanDupalov/my_project", "path": "/grocery_store/grocery_store/product/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeanDupalov/my_project path: /grocery_store/grocery_store/product/migrations/0001_initial.py # Generated by Django 3.2.5 on 2021-07-31 12:12 import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initi...
code_fim
hard
{ "lang": "python", "repo": "DeanDupalov/my_project", "path": "/grocery_store/grocery_store/product/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_friend_with_most_friends_default_arg(): user, friends = get_friend_with_most_friends() assert user == 'sara' assert sorted(list(friends)) == ['joyce', 'kevin', 'nick', 'rod'] def test_get_friend_with_most_friends_different_friendship_data(): friendships = [(0, 1), (0, 2), (...
code_fim
medium
{ "lang": "python", "repo": "ChidinmaKO/Chobe-Py-Challenges", "path": "/bites/bite123.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }