text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> for filename in ('x.gcda', 'x.gcno'): src_path = os.path.join(out_dir, filename) dst_path = os.path.join(directory, filename) os.rename(src_path, dst_path) def clean(): for filename in os.listdir('.'): if os.path.isdir(filename): try: ...
code_fim
hard
{ "lang": "python", "repo": "quark-zju/cov", "path": "/cov/test-data/rebuild.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse(self, response): MicrodataParser.convert_to_json_ld(response.selector) item = LinkedDataParser.parse(response, "Store") if item: item["ref"] = response.url item["name"] = item["name"].strip() item["lat"] = response.xpath("//@data-la...
code_fim
hard
{ "lang": "python", "repo": "alltheplaces/alltheplaces", "path": "/locations/spiders/fatface.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> for url in self.start_urls: if "/international/" in url: yield Request(url=url, cookies={"selectedLocale": "en_IE"}) elif "us.fatface.com" in url: yield Request(url=url, cookies={"selectedLocale": "en_US"}) else: y...
code_fim
hard
{ "lang": "python", "repo": "alltheplaces/alltheplaces", "path": "/locations/spiders/fatface.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alltheplaces/alltheplaces path: /locations/spiders/fatface.py from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Request, Rule from locations.linked_data_parser import LinkedDataParser from locations.microdata_parser import MicrodataParser class FatFaceSpid...
code_fim
medium
{ "lang": "python", "repo": "alltheplaces/alltheplaces", "path": "/locations/spiders/fatface.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: akshay-ap/aquarius path: /tests/ddos/ddo_sample_updates.py # # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # json_before = { "@context": "https://w3id.org/future-method/v1", "created": "2016-02-08T16:02:20Z", "dataToken": "0xC7EC1970B09224B317c52d92f...
code_fim
hard
{ "lang": "python", "repo": "akshay-ap/aquarius", "path": "/tests/ddos/ddo_sample_updates.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>-02-08T16:02:20Z", "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja", "signatureValue": "QNB13Y7Q9...1tzjn4w==", }, "service": [ { "attributes": {"main": {"cost": "10", "timeout": "0"}}, "type": "access", "index": 0, "serviceEn...
code_fim
hard
{ "lang": "python", "repo": "akshay-ap/aquarius", "path": "/tests/ddos/ddo_sample_updates.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> "uri": "http://skos.um.es/unescothes/C01194/turtle", "mediaType": "text/turtle", }, ], "links": [ { "name": "Sample of Asset Data", ...
code_fim
hard
{ "lang": "python", "repo": "akshay-ap/aquarius", "path": "/tests/ddos/ddo_sample_updates.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: polltooh/tf_od path: /script/dataset_builder.py import functools import tensorflow as tf import anchor_lib import bbox_lib import matcher def convert_to_dense(tensor): if isinstance(tensor, tf.SparseTensor): tensor = tf.sparse_tensor_to_dense(tensor) return tensor def parser...
code_fim
hard
{ "lang": "python", "repo": "polltooh/tf_od", "path": "/script/dataset_builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> preprocess_data_anchor = functools.partial( preprocess_data, anchors=anchors, pos_iou_threshold=pos_iou_threshold, neg_iou_threshold=neg_iou_threshold, neg_label_value=neg_label_value, ignore_label_value=ignore_label_value, image_arg_dict=image_arg_dict) ds = ds.ma...
code_fim
hard
{ "lang": "python", "repo": "polltooh/tf_od", "path": "/script/dataset_builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_periodic_update_schedule(self): factory = self.replay_flight_data('mu-perodic-update-schedule') session = factory() project_id = 'cloud-custodian' region = 'us-central1' sched_client = session.client('cloudscheduler', 'v1beta1', 'projects.locations.job...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tools/c7n_gcp/tests/test_mu_gcp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /tools/c7n_gcp/tests/test_mu_gcp.py # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import json import time import os import shutil import sys from c7n.exceptions import PolicyValidationError from c7n.testing import functiona...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tools/c7n_gcp/tests/test_mu_gcp.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # check function exists func_info = func_client.execute_command( 'get', {'name': 'projects/{}/locations/{}/functions/instance-off'.format( project_id, region)}) self.assertEqual( "https://{}-{}.cloudfunctions.net/{}".format( r...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tools/c7n_gcp/tests/test_mu_gcp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: raokrutarth/manufacturing-os path: /src/graph_funcs.py def addEdge(graph, u, v): graph[u].append(v) # definition of function def generate_edges(graph): edges = [] # for each node in graph for node in graph: # for each neighbour node of a single node ...
code_fim
hard
{ "lang": "python", "repo": "raokrutarth/manufacturing-os", "path": "/src/graph_funcs.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|># function to find the shortest path def find_shortest_path(graph, start, end, path=[]): path = path + [start] if start == end: return path shortest = None for node in graph[start]: if node not in path: newpath = find_shortest_path(graph, node, end, path) ...
code_fim
hard
{ "lang": "python", "repo": "raokrutarth/manufacturing-os", "path": "/src/graph_funcs.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> # function to find the shortest path def find_shortest_path(graph, start, end, path=[]): path = path + [start] if start == end: return path shortest = None for node in graph[start]: if node not in path: newpath = find_shortest_path(graph, node, end, path) ...
code_fim
hard
{ "lang": "python", "repo": "raokrutarth/manufacturing-os", "path": "/src/graph_funcs.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: XiomRB/tytus path: /parser/team28/controllers/error_controller.py from utils.decorators import singleton from models.error import Error from models.type_error import get_type_error @singleton class ErrorController(object): def __init__(self): self._idError = 0 self._errorsLi...
code_fim
hard
{ "lang": "python", "repo": "XiomRB/tytus", "path": "/parser/team28/controllers/error_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def addExecutionError(self, noType, errorType, desc, line, column): numberError, description = get_type_error(noType) self._idExecutionError += 1 description += desc self._executionErrorList.append(Error(self._idExecutionError, errorType, numberError, ...
code_fim
hard
{ "lang": "python", "repo": "XiomRB/tytus", "path": "/parser/team28/controllers/error_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: srusskih/SublimeJEDI path: /dependencies/jedi/third_party/django-stubs/django-stubs/forms/widgets.pyi from decimal import Decimal from itertools import chain from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Set, Tuple, Type, Union from django.core.fi...
code_fim
hard
{ "lang": "python", "repo": "srusskih/SublimeJEDI", "path": "/dependencies/jedi/third_party/django-stubs/django-stubs/forms/widgets.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Textarea(Widget): template_name: str = ... class DateTimeBaseInput(TextInput): format_key: str = ... format: Optional[str] = ... def __init__(self, attrs: Optional[_OptAttrs] = ..., format: Optional[str] = ...): ... class DateInput(DateTimeBaseInput): ... class DateTimeInput(DateTi...
code_fim
hard
{ "lang": "python", "repo": "srusskih/SublimeJEDI", "path": "/dependencies/jedi/third_party/django-stubs/django-stubs/forms/widgets.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r = serial.rx(1) if len(r)==0: cout("ERROR: no reply\n") else: cout("REPLY: %s\n" % s2hex(r)) #break tick += 0.05 if tick > time.time(): time.sleep( tick - time.time() ) serial.close()<|fim_prefix|># repo: duparq/uProg path: /hw/testmod/main-0.py #!/usr/b...
code_fim
hard
{ "lang": "python", "repo": "duparq/uProg", "path": "/hw/testmod/main-0.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: duparq/uProg path: /hw/testmod/main-0.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os.path sys.path.insert(1,os.path.normpath(sys.path[0]+"/hwa/python")) sys.path.insert(2,os.path.normpath(sys.path[1]+"/pyserial-3.0")) import __builtin__ import premain from utils import s2...
code_fim
hard
{ "lang": "python", "repo": "duparq/uProg", "path": "/hw/testmod/main-0.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> \ apk del .build-deps; EXPOSE 8080 VOLUME /application CMD python app.py<|fim_prefix|># repo: crmne/aiohttp-prometheus path: /examples/webapp1/Dockerfile.py3 FROM python:3.6.1-alpine ADD . /application WORKDIR /application RUN set -e; \ apk add --no-cache --virtual .build-deps \ gcc \ libc-dev \ ...
code_fim
medium
{ "lang": "python", "repo": "crmne/aiohttp-prometheus", "path": "/examples/webapp1/Dockerfile.py3", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: crmne/aiohttp-prometheus path: /examples/webapp1/Dockerfile.py3 FROM python:3.6.1-alpine ADD . /application WORKDIR /application RUN set<|fim_suffix|> linux-headers \ git \ ; \ pip install -r src/requirements.txt; \ apk del .build-deps; EXPOSE 8080 VOLUME /application CMD python app.p...
code_fim
medium
{ "lang": "python", "repo": "crmne/aiohttp-prometheus", "path": "/examples/webapp1/Dockerfile.py3", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Return stylized day block for printing.""" if day == 0: return " " elif day > 0 and day < 10: return " " + str(day) + " " return " " + str(day) def print_calendar(month, year): """Print calendar of a month of year.""" print MONTH_NAME[month - 1] + ', ' + str(...
code_fim
hard
{ "lang": "python", "repo": "motmaytinh/pocket-calendar", "path": "/CalendarUtils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def calculate_date(month, year): """Calculate calendar. Return list of days in month.""" start_index = day_of_week(1, month, year) end_index = num_of_day(month, year) padding_day = [0 for i in range(0, start_index)] days = [i for i in range(1, end_index + 1)] return padding_da...
code_fim
hard
{ "lang": "python", "repo": "motmaytinh/pocket-calendar", "path": "/CalendarUtils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: motmaytinh/pocket-calendar path: /CalendarUtils.py """Calendar utility""" MONTH_NAME = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] DAY_NAME = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] _31_DAYS_MO...
code_fim
hard
{ "lang": "python", "repo": "motmaytinh/pocket-calendar", "path": "/CalendarUtils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MFernandez96/cars-python-cleaning path: /Country cleaning/Peru.py [\s-]{0,1}\w+)[-,\s]")[0] peru["MARCA2"] = peru["MODELO/VERSION"].str.extract(r"M\s?:\s?(\w+[\s-]{0,1}\w+)[,\s-]")[0] # peru["MODELO1"] = peru["MODELO/VERSION"].str.extract(r"MODELO\s?:\s?(.+?)[\s,]")[0] # ORIGINAL BIEN PERO PR...
code_fim
hard
{ "lang": "python", "repo": "MFernandez96/cars-python-cleaning", "path": "/Country cleaning/Peru.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MFernandez96/cars-python-cleaning path: /Country cleaning/Peru.py 1":"MODELO/VERSION", # "AÑO DE IMPORTACION":"FECHA DE IMPORTACION", # "AÑO DE FABRICACION": "AÑO"}) # # %% # peru = pd.concat([peru04, peru08, peru12, peru16], ignore_index...
code_fim
hard
{ "lang": "python", "repo": "MFernandez96/cars-python-cleaning", "path": "/Country cleaning/Peru.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # %% condicion = peru["MARCA"].isna() condicion2 = peru["MODELO"].notna() valores(peru[condicion & condicion2], "DESCRIPCION COMERCIAL 1") # %% peru.to_csv(r"D:\Basededatos\Limpioparaunir\peruoriginal.csv", index=False) #peru.to_csv(r"D:\Basededatos\Limpioparaunir\peru.csv", index=False) # %% valores...
code_fim
hard
{ "lang": "python", "repo": "MFernandez96/cars-python-cleaning", "path": "/Country cleaning/Peru.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> layers = list( _flatten_layers( [ self.unbuildPaint(childPaint) for childPaint in self.layers[ source["FirstLayerIndex"] : source["FirstLayerIndex"] + source["NumLayers"] ...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/fonttools/fontTools/colorLib/unbuilder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _unbuildPaintColrLayers(self, source): assert source["Format"] == ot.PaintFormat.PaintColrLayers layers = list( _flatten_layers( [ self.unbuildPaint(childPaint) for childPaint in self.layers[ ...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/fonttools/fontTools/colorLib/unbuilder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/fonttools/fontTools/colorLib/unbuilder.py from fontTools.ttLib.tables import otTables as ot from .table_builder import TableUnbuilder def unbuildColrV1(layerList, baseGlyphList): layers = [] if layerList: layers = layerList.Paint unbui...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/fonttools/fontTools/colorLib/unbuilder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def teardown(self): self.log.info('Main FINISHED')<|fim_prefix|># repo: NSO-developer/nso-docker path: /test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py # -*- mode: python; python-indent: 4 -*- import ncs from ncs.dp import Action from testpkg_python_b import main as tpb import...
code_fim
medium
{ "lang": "python", "repo": "NSO-developer/nso-docker", "path": "/test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSO-developer/nso-docker path: /test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py # -*- mode: python; python-indent: 4 -*- import ncs from ncs.dp import Action from testpkg_python_b import main as tpb import foo <|fim_suffix|> self.log.info('Main RUNNING') self.regi...
code_fim
hard
{ "lang": "python", "repo": "NSO-developer/nso-docker", "path": "/test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def teardown(self): self.log.info('Main FINISHED')<|fim_prefix|># repo: NSO-developer/nso-docker path: /test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py # -*- mode: python; python-indent: 4 -*- import ncs from ncs.dp import Action from testpkg_python_b import main as tpb impor...
code_fim
medium
{ "lang": "python", "repo": "NSO-developer/nso-docker", "path": "/test/packages/testpkg-pyvenv-a/python/testpkg_python_a/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.parsed_file_count += 1 # Accounts for fsevent files that get flushed to disk # at the same time. Usually the result of a shutdown # or unmount if not self.is_carved_gzip and self.use_file_mod_dates: prev_mod_date = sel...
code_fim
hard
{ "lang": "python", "repo": "Schramp/FSEventsParser", "path": "/FSEParser_V4.0.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Schramp/FSEventsParser path: /FSEParser_V4.0.py self.all_records_count)) print('[FINISHED] {} UTC Parsing files.\n'.format(strftime("%m/%d/%Y %H:%M:%S", gmtime()))) print('[STARTED] {} UTC Sorting fsevents table in Database.'.format(strftime("%m/%d/%Y %H:%M:%S", ...
code_fim
hard
{ "lang": "python", "repo": "Schramp/FSEventsParser", "path": "/FSEParser_V4.0.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Schramp/FSEventsParser path: /FSEParser_V4.0.py rivate/var/log/powermanagement/[\x30-\x39]{4}[.][\x30-\x39]{2}[.]" + "[\x30-\x39]{2}[.]asl") regex_7 = ("private/var/log/asl/AUX[.][\x30-\x39]{4}[.][\x30-\x39]{2}[.]" + "[\x30-\x39]{2}/[0-9]{9}") ...
code_fim
hard
{ "lang": "python", "repo": "Schramp/FSEventsParser", "path": "/FSEParser_V4.0.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yh-luo/prosdk-addons-python path: /tobii_research_addons/vectormath.py ''' Copyright 2018 Tobii AB 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/l...
code_fim
hard
{ "lang": "python", "repo": "yh-luo/prosdk-addons-python", "path": "/tobii_research_addons/vectormath.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __sub__(self, rhs): if isinstance(rhs, Point3): return Vector3(self.x - rhs.x, self.y - rhs.y, self.z - rhs.z) elif type(rhs) in [float, int]: return Vector3(self.x - float(rhs), self.y - float(rhs), self.z - float(rhs)) else: raise TypeE...
code_fim
hard
{ "lang": "python", "repo": "yh-luo/prosdk-addons-python", "path": "/tobii_research_addons/vectormath.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Geostatistic/dask-geomodeling path: /dask_geomodeling/raster/reduction.py """ Module containing reduction raster blocks. """ import numpy as np from dask_geomodeling.utils import get_index, parse_percentile_statistic from functools import partial STATISTICS = { "first": None, "last": No...
code_fim
hard
{ "lang": "python", "repo": "Geostatistic/dask-geomodeling", "path": "/dask_geomodeling/raster/reduction.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # sum, count and nans output do not contain no data: fill zeroes right away if statistic in {"sum", "count", "nans"}: fill_value = 0 else: fill_value = no_data_value # create the output array out = np.full(shape, fill_value, dtype) if statistic == "last": ...
code_fim
hard
{ "lang": "python", "repo": "Geostatistic/dask-geomodeling", "path": "/dask_geomodeling/raster/reduction.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns: dict with "values" and "no_data_value" """ if statistic not in STATISTICS: percentile = parse_percentile_statistic(statistic) if percentile is None: raise KeyError('Unknown statistic "{}"'.format(statistic)) else: statistic = "perc...
code_fim
hard
{ "lang": "python", "repo": "Geostatistic/dask-geomodeling", "path": "/dask_geomodeling/raster/reduction.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/horizon path: /openstack_dashboard/utils/futurist_utils.py # 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/L...
code_fim
medium
{ "lang": "python", "repo": "openstack/horizon", "path": "/openstack_dashboard/utils/futurist_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def call_functions_parallel(*worker_defs): """Call specified functions in parallel. :param *worker_defs: Each positional argument can be either of a function to be called or a tuple which consists of a function, a list of positional arguments) and keyword arguments (optional). ...
code_fim
medium
{ "lang": "python", "repo": "openstack/horizon", "path": "/openstack_dashboard/utils/futurist_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if getattr(sys, 'frozen', False): # frozen BASE_DIR = os.path.dirname(sys.executable) else: # unfrozen BASE_DIR = os.path.dirname(os.path.realpath(__file__)) dirpath = BASE_DIR + '/igp-resolve/' filename = 'igp_resolve.json' path = os.path.join (dirpath,filename) # Create directory if d...
code_fim
hard
{ "lang": "python", "repo": "3fr61n/netflow-correlator", "path": "/network-rib/data/igp_resolver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 3fr61n/netflow-correlator path: /network-rib/data/igp_resolver.py import json import requests from requests.auth import HTTPBasicAuth from priodict import priorityDictionary import socket import threading import pprint from collections import defaultdict import pytricia import sys import os op...
code_fim
hard
{ "lang": "python", "repo": "3fr61n/netflow-correlator", "path": "/network-rib/data/igp_resolver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dirpath = BASE_DIR + '/igp-resolve/' filename = 'igp_resolve.json' path = os.path.join (dirpath,filename) # Create directory if does not exist if not os.path.exists (dirpath): os.makedirs (dirpath,mode=0777) result = AutoVivification() graph = get_link_state_graph() print graph nodes = grap...
code_fim
hard
{ "lang": "python", "repo": "3fr61n/netflow-correlator", "path": "/network-rib/data/igp_resolver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kikyoiii/Data_Assimilation path: /src/VarDACAE/VarDA/batch_DA.py import torch import time from VarDACAE import ML_utils, SplitData, fluidity from VarDACAE.VarDA import DAPipeline from VarDACAE.VarDA import SVD, VDAInit from VarDACAE.utils.expdir import init_expdir from VarDACAE.settings import h...
code_fim
hard
{ "lang": "python", "repo": "kikyoiii/Data_Assimilation", "path": "/src/VarDACAE/VarDA/batch_DA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k, v in result.items(): totals[k] += v return totals @staticmethod def __print_totals(totals, num_states, print_small): if not print_small: for k, v in totals.items(): print(k, "{:.2f}".format(v / num_states)) print()...
code_fim
hard
{ "lang": "python", "repo": "kikyoiii/Data_Assimilation", "path": "/src/VarDACAE/VarDA/batch_DA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dht11_pin = 23 ctrl = Controller(ROOT_DIR + '/config.json') ctrl.connect() ctrl.skill('humiture').plug(dht11_pin) ctrl.wait_messages() if __name__ == "__main__": main()<|fim_prefix|># repo: satori-com/satori-raspberry path: /examples/humiture_dht11.py import os from satori_raspb...
code_fim
medium
{ "lang": "python", "repo": "satori-com/satori-raspberry", "path": "/examples/humiture_dht11.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: satori-com/satori-raspberry path: /examples/humiture_dht11.py import os from satori_raspberry.controller import Controller ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) <|fim_suffix|>if __name__ == "__main__": main()<|fim_middle|>def main(): dht11_pin = 23 ctrl = Controller...
code_fim
medium
{ "lang": "python", "repo": "satori-com/satori-raspberry", "path": "/examples/humiture_dht11.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: loco-3d/sot-talos-balance path: /src/dynamic_graph/sot_talos_balance/meta_task_pose.py from dynamic_graph import plug from dynamic_graph.sot.core import GainAdaptive, Task from dynamic_graph.sot.core.feature_pose import FeaturePose class MetaTaskPose(object): def opPointExist(self, opPoint)...
code_fim
hard
{ "lang": "python", "repo": "loco-3d/sot-talos-balance", "path": "/src/dynamic_graph/sot_talos_balance/meta_task_pose.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.opPoint = opPoint if self.opPointExist(opPoint): return self.dyn.createOpPoint(opPoint, opPointRef) def createFeature(self): self.feature = FeaturePose("feature" + self.name) self.feature.selec.value = "111111" def createTask(self): ...
code_fim
medium
{ "lang": "python", "repo": "loco-3d/sot-talos-balance", "path": "/src/dynamic_graph/sot_talos_balance/meta_task_pose.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, name, dyn, opPoint, opPointRef="right-wrist"): self.name = name self.defineDynEntities(dyn) self.createOpPoint(opPoint, opPointRef) self.createFeature() self.createTask() self.createGain() self.plugEverything() @property ...
code_fim
hard
{ "lang": "python", "repo": "loco-3d/sot-talos-balance", "path": "/src/dynamic_graph/sot_talos_balance/meta_task_pose.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.frame_q.full(): self.frame_q.get() if self.atari: frame = Environment._preprocess(frame) self.frame_q.put(frame) def get_num_actions(self): return self.game.env.action_space.n def reset(self): self.total_reward = 0 s...
code_fim
hard
{ "lang": "python", "repo": "machine-intelligence/rl-teacher-atari", "path": "/agents/ga3c/ga3c/Environment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: machine-intelligence/rl-teacher-atari path: /agents/ga3c/ga3c/Environment.py # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * R...
code_fim
hard
{ "lang": "python", "repo": "machine-intelligence/rl-teacher-atari", "path": "/agents/ga3c/ga3c/Environment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not self.frame_q.full(): return None # frame queue is not full yet. x_ = np.array(self.frame_q.queue) x_ = np.transpose(x_, [1, 2, 0]) # move channels return x_ def _update_frame_q(self, frame): if self.frame_q.full(): self.frame_q....
code_fim
hard
{ "lang": "python", "repo": "machine-intelligence/rl-teacher-atari", "path": "/agents/ga3c/ga3c/Environment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if set(data.keys()) - set(self.__dict__.keys()): warnings.warn("Unknown config keys: %s" % (set(data.keys()) - set(self.__dict__.keys()))) for k, v in data.items(): if k in self.__dict__: self.set_field(k, v) def write_ini(self): import ...
code_fim
hard
{ "lang": "python", "repo": "thebjorn/pydeps", "path": "/pydeps/configs.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: thebjorn/pydeps path: /pydeps/configs.py from io import StringIO import json import warnings import logging log = logging.getLogger(__name__) # from devtools import debug HAVE_TOML = False try: import tomllib as toml HAVE_TOML = True except ImportError: try: import to...
code_fim
hard
{ "lang": "python", "repo": "thebjorn/pydeps", "path": "/pydeps/configs.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: c-yan/atcoder path: /abc/abc259/abc259d.py from sys import setrecursionlimit, stdin def find(parent, i): t = parent[i] if t < 0: return i t = find(parent, t) parent[i] = t return t def unite(parent, i, j): i = find(parent, i) j = find(parent, j) if i ==...
code_fim
hard
{ "lang": "python", "repo": "c-yan/atcoder", "path": "/abc/abc259/abc259d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>N = int(readline()) sx, sy, tx, ty = map(int, readline().split()) xyr = [list(map(int, readline().split())) for _ in range(N)] parent = [-1] * (N + 1) for i in range(N - 1): for j in range(i + 1, N): if intersect(xyr[i], xyr[j]): unite(parent, i, j) for i in range(N): if on_...
code_fim
medium
{ "lang": "python", "repo": "c-yan/atcoder", "path": "/abc/abc259/abc259d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Elvislee123/HandwritingRecognitionPrinter path: /code/SimpleHTR-master/src/Googlesearch2.py #activated when Button is pressed from time import sleep from gpiozero import LED #Controlling the lights for feedback led1 = LED(3) led2 = LED(4) #pre-Recognition light sequence for i in range(5): led1.o...
code_fim
hard
{ "lang": "python", "repo": "Elvislee123/HandwritingRecognitionPrinter", "path": "/code/SimpleHTR-master/src/Googlesearch2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#LED sequence for the end of phase 2 for i in range(1): led2.on() sleep(3) led2.off() #LED sequence for beginning of phase 3, printing for i in range(5): led1.on() led2.on() sleep(0.2) led1.off() led2.off() servo = 25 GPIO.setmode(GPIO.BCM) GPIO.setup(s...
code_fim
hard
{ "lang": "python", "repo": "Elvislee123/HandwritingRecognitionPrinter", "path": "/code/SimpleHTR-master/src/Googlesearch2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nodeInfo = configuration.getNode("rack1-master1", flatDeviceHierarchy=True) assert nodeInfo.state == States.RUNNING for deviceInfo in nodeInfo.devices.values(): log.info("Device: %s, State: %s", deviceInfo.type, deviceInfo.state) if deviceInfo.type == "c4.devices.Unknown": ...
code_fim
hard
{ "lang": "python", "repo": "Brewgarten/c4-system-manager", "path": "/tests/test_system.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Brewgarten/c4-system-manager path: /tests/test_system.py import logging import time from c4.system.backend import Backend from c4.system.configuration import States log = logging.getLogger(__name__) def test_system(system): logging.root.setLevel(logging.INFO) logging.getLogger("c4.me...
code_fim
hard
{ "lang": "python", "repo": "Brewgarten/c4-system-manager", "path": "/tests/test_system.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> annotations = session.query( genepanel_annotation.c.annotation_transcript, genepanel_annotation.c.annotation_symbol, genepanel_annotation.c.annotation_hgvsc, ).all() al = session.query(allele.Allele).filter(allele.Allele.id == allele_id).one() logger.echo("Ready to...
code_fim
hard
{ "lang": "python", "repo": "dabble-of-devops-consulting/ella", "path": "/src/cli/commands/delete/delete.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@delete.command("alleleinterpretation") @click.argument("allele_id", type=int) @click.option( "--delete-all", is_flag=True, help="Delete all allele interpretations, not just since last finalize", ) @session @cli_logger(prompt_reason=True) def cmd_alleleinterpretation_delete(logger, session, al...
code_fim
hard
{ "lang": "python", "repo": "dabble-of-devops-consulting/ella", "path": "/src/cli/commands/delete/delete.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dabble-of-devops-consulting/ella path: /src/cli/commands/delete/delete.py import click from vardb.datamodel import sample, workflow, allele from datalayer.queries import annotation_transcripts_genepanel from api.schemas.alleleinterpretations import AlleleInterpretationOverviewSchema from cli.dec...
code_fim
hard
{ "lang": "python", "repo": "dabble-of-devops-consulting/ella", "path": "/src/cli/commands/delete/delete.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gokuldharan/cs224u-project path: /OP-GAN/box_generation/sample.py import os import argparse import logging import numpy as np import math import torch from torch.optim.lr_scheduler import StepLR import seq2seq from seq2seq.trainer import SupervisedTrainer from seq2seq.models import PreEncoderRNN...
code_fim
hard
{ "lang": "python", "repo": "gokuldharan/cs224u-project", "path": "/OP-GAN/box_generation/sample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cap_word2index = checkpoint.cap_word2index cap_index2word = checkpoint.cap_index2word label_word2index = checkpoint.label_word2index label_index2word = checkpoint.label_index2word if not os.path.isfile(opt.gaussian_dict_path): print('calculating means and stds of box positions...
code_fim
hard
{ "lang": "python", "repo": "gokuldharan/cs224u-project", "path": "/OP-GAN/box_generation/sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>elif not opt.is_training and opt.load_checkpoint is not None: opt.box_saving_folder = '%s_%s/'%(opt.box_saving_folder, opt.load_checkpoint) logging.info("loading checkpoint from {}".format( opt.load_checkpoint)) checkpoint_path = os.path.join(opt.load_checkpoint) checkpoint = Checkpoint.l...
code_fim
hard
{ "lang": "python", "repo": "gokuldharan/cs224u-project", "path": "/OP-GAN/box_generation/sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> [ [ -11.0, -3.0, -4.0 ], [ -8.0, -3.0, -7.0 ], [ 1.0, -2.0, 1.0 ], [ 0.0, 0.0, 0.5 ] ], [ [ -16.0, -4.0, 0.0 ], [ 4.0, -3.0, 14.0 ], [ 1.0, -3.0, 0.0 ], [ 0.0, 0.0, 0.5 ] ], [ [ -7.0, -8.0, 0.0 ], [ 5.0, -1.0, -14.0 ], [ 0.0, -3.0, 0.0 ], [ 0.0, ...
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/scaffoldmaker", "path": "/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahyar-osn/scaffoldmaker path: /src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py 0.0, 0.5 ] ], [ [ -59.1, -62.5, 170.8 ], [ 74.0, -20.1, 14.4 ], [ 0.0, 0.0, 5.0 ], [ 0.0, 0.0, 0.5 ] ], [ [ 23.5, -53.2, 179.7 ], [ 84.6, 47.0, 6.9 ], [ 0.0, ...
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/scaffoldmaker", "path": "/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>.0, 4.0, 9.0 ], [ 2.0, 2.0, 1.0 ], [ 0.0, 1.0, 2.0 ] ], [ [ -3.0, 2.0, 3.0 ], [ -4.0, -8.0, 0.0 ], [ 2.0, -1.0, 2.0 ], [ 1.0, 0.0, 2.0 ] ], [ [ -11.0, -3.0, -4.0 ], [ -8.0, -3.0, -7.0 ], [ 1.0, -2.0, 1.0 ], [ 0.0, 0.0, 0.5 ] ], [ [ -16.0, -4....
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/scaffoldmaker", "path": "/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mhmgad/ExCut path: /excut/experiments/datasets.py import os datasets={} experiment_name="expr10" # add baseline_data for ds in ['terroristAttack', 'imdb', 'uwcse', 'webkb', 'mutagenesis', 'hep']: dataset_folder = os.path.join('/scratch/GW/pool0/gadelrab/ExDEC/data/baseline_data/', ds) ...
code_fim
hard
{ "lang": "python", "repo": "mhmgad/ExCut", "path": "/excut/experiments/datasets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for ds in ['grad_ungrad_course']: dataset_folder = '/scratch/GW/pool0/gadelrab/ExDEC/data/uobm/' dataset_output_folder = os.path.join('/scratch/GW/pool0/gadelrab/ExDEC/%s/uobm/' % experiment_name, ds) datasets[ds] = {'dataset_folder': dataset_folder, 'dataset_output_folder'...
code_fim
hard
{ "lang": "python", "repo": "mhmgad/ExCut", "path": "/excut/experiments/datasets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> validated1 = ValidatedMetaboliteTable.create_from_csv_file(csv_file1) validated2 = ValidatedMetaboliteTable.create_from_csv_file(csv_file2) db.session.add_all([validated1, validated2]) db.session.commit() resp = client.post(url_for('csv.merge_csv_files'), json={...
code_fim
hard
{ "lang": "python", "repo": "girder/viime", "path": "/tests/test_csv_file_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: girder/viime path: /tests/test_csv_file_api.py from io import BytesIO from flask import url_for from viime.models import CSVFile, CSVFileSchema, db, ValidatedMetaboliteTable csv_data = """ id,col1,col2 row1,0.5,2.0 row2,1.5,0 """ def test_upload_csv_file(client): data = { 'file':...
code_fim
hard
{ "lang": "python", "repo": "girder/viime", "path": "/tests/test_csv_file_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> expected_column_types = [{ 'column_header': 'nan', 'column_index': 0, 'column_type': 'key', 'subtype': None, 'meta': None }, { 'column_header': 'g', 'column_index': 1, 'column_type': 'group', 'subtype': None, 'meta': N...
code_fim
hard
{ "lang": "python", "repo": "girder/viime", "path": "/tests/test_csv_file_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def testUnwrapMod4(self): data = [0, 1, 2, 0, -1, -2, -3, -4] unwrapped_4 = misc.Unwrap(data, 4) self.assertEqual([0, 1, 2, 0, -1, -2, -3, -4], unwrapped_4) def testDataShouldNotChangeAfterUnwrap(self): data = [0, 1, 2, 0, -1, -2, -3, -4] _ = misc.Unwrap(data, 4) self.assertE...
code_fim
hard
{ "lang": "python", "repo": "iridium-browser/iridium-browser", "path": "/third_party/webrtc/rtc_tools/py_event_log_analyzer/misc_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iridium-browser/iridium-browser path: /third_party/webrtc/rtc_tools/py_event_log_analyzer/misc_test.py #!/usr/bin/env python3 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE ...
code_fim
hard
{ "lang": "python", "repo": "iridium-browser/iridium-browser", "path": "/third_party/webrtc/rtc_tools/py_event_log_analyzer/misc_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for hp_key in hp.hyper_parameters[0]: if "filter" in hp_key and len(filter_list) < conv_layers: filter_list.append(hp.hyper_parameters[0][hp_key]) elif "pooling_type" in hp_key and len(pooling_type_list) < conv_layers: pooling_type_list.appen...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/AISY_Framework", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/AISY_Framework path: /app.py , f in os.walk(databases_root_folder): for file in f: if file.endswith(".sqlite"): db_files.append(file) all_tables = [] all_tables_names = [] for db_file in db_files: if os.path.exists(databases_root_f...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/AISY_Framework", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> all_plots = [] for ds in datasets_dict: in_file = h5py.File(datasets_root_folder + ds, "r") profiling_samples = np.array(in_file['Profiling_traces/traces'], dtype=np.float64) all_plots.append({ "title": ds, "layout_plotly": plotly.get_plotly_layout...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/AISY_Framework", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .widgets import ( DateInput, DateTimeInput, TimeInput, )<|fim_prefix|># repo: fredpalmer/patt3rns path: /patt3rns/forms/__init__.py # coding=utf-8 # flake8: noqa from __future__ import unicode_literals from .fields import ( CharField, DateField, DateTimeField, TimeField, ...
code_fim
easy
{ "lang": "python", "repo": "fredpalmer/patt3rns", "path": "/patt3rns/forms/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fredpalmer/patt3rns path: /patt3rns/forms/__init__.py # coding=utf-8 # flake8: noqa from __future__ import unicode_literals from .fields import ( CharField, DateField, DateTimeField, TimeField, ) <|fim_suffix|>from .widgets import ( DateInput, DateTimeInput, TimeInput...
code_fim
easy
{ "lang": "python", "repo": "fredpalmer/patt3rns", "path": "/patt3rns/forms/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Teknologforeningen/svaksvat path: /csvimport/addphuxes.py """Script to add members from a CSV-file to the database. """ # imports import csv import sys import os import sqlalchemy sys.path.append(os.path.dirname(os.getcwd())) # Add .. to path from backend.ldaplogin import (get_member_with_rea...
code_fim
hard
{ "lang": "python", "repo": "Teknologforeningen/svaksvat", "path": "/csvimport/addphuxes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> SessionMaker = connect.connect('members', 'members', 'localhost', 'members') session = SessionMaker() memberdictlist = csvimporter.parse_csv(sys.argv[1], ',', '"') for memberdict in memberdictlist: new_member = create_phux(session) csvimporter.update_contact_info(new_memb...
code_fim
hard
{ "lang": "python", "repo": "Teknologforeningen/svaksvat", "path": "/csvimport/addphuxes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nfo(res.raw[1].authors) # hews__ logger.info(res.raw[1].url) # https://twitter.com/hews__/status/1299728221005643776 logger.info(res.raw[1].detail) # 2570x4096 JPEG 1087.9KB<|fim_prefix|># repo: 123linux456/PicImageSearch path: /test/test3.py from loguru import logger from PicImageSearch import Ascii...
code_fim
hard
{ "lang": "python", "repo": "123linux456/PicImageSearch", "path": "/test/test3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 123linux456/PicImageSearch path: /test/test3.py from loguru import logger from PicImageSearch import Ascii2D ascii2d = Ascii2D() res = ascii2d.search('https://pixiv.cat/77702503-1.jpg') #res = ascii2d.search(r'C:/kitUIN/i<|fim_suffix|>witter'])> logger.info(res.raw[1].thumbnail) # https://asci...
code_fim
medium
{ "lang": "python", "repo": "123linux456/PicImageSearch", "path": "/test/test3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scsnake/morphsnakes path: /win32func.py import win32con, win32api, win32gui, ctypes, ctypes.wintypes import threading class COPYDATASTRUCT(ctypes.Structure): _fields_ = [ ('dwData', ctypes.wintypes.LPARAM), ('cbData', ctypes.wintypes.DWORD), ('lpData', ctypes.c_wchar...
code_fim
hard
{ "lang": "python", "repo": "scsnake/morphsnakes", "path": "/win32func.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __OnCopyData(self, hwnd, msg, wparam, lparam): pCDS = ctypes.cast(lparam, PCOPYDATASTRUCT) t = threading.Thread(target=self.OnCopyData if self.receiver is None else self.receiver, kwargs={'hwnd': hwnd, 'msg': msg, '...
code_fim
hard
{ "lang": "python", "repo": "scsnake/morphsnakes", "path": "/win32func.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: meejah/carml path: /carml/carml_copybin.py import sys import time import functools from zope.interface import implementer from twisted.python import usage, log from twisted.plugin import IPlugin from twisted.internet import defer from twisted.web.iweb import IAgentEndpointFactory from twisted.we...
code_fim
medium
{ "lang": "python", "repo": "meejah/carml", "path": "/carml/carml_copybin.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> auth = '%s %s' % (onion, cookie) if auth not in config.HidServAuth: config.HidServAuth.append(auth) await config.save() agent = tor.web_agent() url = 'http://{}'.format(onion).encode('ascii') print("retrieving: {}".format(url)) res = await agent.request(b'GET', url) ...
code_fim
hard
{ "lang": "python", "repo": "meejah/carml", "path": "/carml/carml_copybin.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> new_grid = copy.deepcopy(grid) for x_element in range(len(new_grid)): for y_element in range(len(new_grid[x_element])): if new_grid[x_element][y_element] == 0: answers = ExactCover(new_grid, x_element, y_element) for answer in answers: ...
code_fim
hard
{ "lang": "python", "repo": "HannesHolst1/pydoku", "path": "/backend/solve_puzzle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HannesHolst1/pydoku path: /backend/solve_puzzle.py import copy # can solve 3x3, 9x9, 16x16 block_size = 3 grid_numbers = range(1, 10) def ReturnBlockOfCoordinates(x, y): """ Returns the block in which the coordinates are located. """ block_x = int(x / block_size) block_y = ...
code_fim
hard
{ "lang": "python", "repo": "HannesHolst1/pydoku", "path": "/backend/solve_puzzle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Solves the given Sudoku grid using recursion. """ if is_grid_solved(grid): return grid new_grid = copy.deepcopy(grid) for x_element in range(len(new_grid)): for y_element in range(len(new_grid[x_element])): if new_grid[x_element][y_element] == 0: ...
code_fim
hard
{ "lang": "python", "repo": "HannesHolst1/pydoku", "path": "/backend/solve_puzzle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('shepherd', '0004_auto_20190910_0113'), ] operations = [ migrations.AlterField( model_name='serverhistory', name='activity_type', field=models.ForeignKey(help_text='Select the intended activity to be performed by the server...
code_fim
medium
{ "lang": "python", "repo": "chrismaddalena/Ghostwriter", "path": "/ghostwriter/shepherd/migrations/0005_auto_20191001_1352.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='serverhistory', name='activity_type', field=models.ForeignKey(help_text='Select the intended activity to be performed by the server', on_delete=django.db.models.deletion.PROTECT, to='shepherd.ActivityType'), ...
code_fim
medium
{ "lang": "python", "repo": "chrismaddalena/Ghostwriter", "path": "/ghostwriter/shepherd/migrations/0005_auto_20191001_1352.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }