text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>class TemplateSyntaxError(Exception): """ This exception is raised when a template syntax error is encountered. """ pass<|fim_prefix|># repo: django-compressor/django-compressor path: /compressor/exceptions.py class CompressorError(Exception): """ A general error of the compresso...
code_fim
hard
{ "lang": "python", "repo": "django-compressor/django-compressor", "path": "/compressor/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> outFina = outFileTemplate.format(x, y) overwrite = False if not os.path.exists(outFina) or overwrite: GetTile(x, y, 12, outFina) #time.sleep(1) #Combine column into tar if tarCol: print ("Tarring column") t = tarfile.open(tarFina, mode='w') for y in range(tileTR[1], tileB...
code_fim
hard
{ "lang": "python", "repo": "TimSC/osm-to-gps-map", "path": "/download.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TimSC/osm-to-gps-map path: /download.py from __future__ import print_function import math, os, bz2, urlutil, tiles, time, pycurl, gzip, sys, tarfile from pyo5m import OsmData from io import BytesIO def GetTile(x, y, zoom, outFina): topLeft = tiles.num2deg(x, y, zoom) bottomRight = tiles.num2...
code_fim
hard
{ "lang": "python", "repo": "TimSC/osm-to-gps-map", "path": "/download.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: asfixia/DinamicaXYZ path: /colorize.py ''' Script to generate a png from a raster file. It can be used from the command line or from an other python script ''' from os.path import exists from osgeo import gdal from osgeo.gdalconst import GA_ReadOnly from struct import unpack from PIL import Image...
code_fim
hard
{ "lang": "python", "repo": "asfixia/DinamicaXYZ", "path": "/colorize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> base_draw.point((x, y), (int(r), int(g), int(b))) alpha_draw.point((x, y), int(a)) break del dataset del band # Adding transparency and saving the output image color_layer = Image.new('RGBA', base.size, (255, 255, 255, 0)) base =...
code_fim
hard
{ "lang": "python", "repo": "asfixia/DinamicaXYZ", "path": "/colorize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' Usage explanation ''' def Usage(): print "Not enough arguments." print "Usage:" print argv[0] + ' [-exact_color_entry|-nearest_color_entry] [-band=1] data_file color_file output_file' exit() # ''' # Program Mainline # ''' # if __name__ == "__main__": # # file_name =...
code_fim
hard
{ "lang": "python", "repo": "asfixia/DinamicaXYZ", "path": "/colorize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PandaDrunkard/proex path: /u-tokyo/2018-summer/1.py import sys import dataset as ds def main(): <|fim_suffix|>if __name__ == '__main__': main() # import cProfile # cProfile.run('main()')<|fim_middle|> img1 = ds.test() print(len(img1)) # 960000
code_fim
easy
{ "lang": "python", "repo": "PandaDrunkard/proex", "path": "/u-tokyo/2018-summer/1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: databill86/HyperFoods path: /venv/lib/python3.6/site-packages/jupyterlab/tests/test_build_api.py """Test the kernels service API.""" from tempfile import TemporaryDirectory import threading import pytest from jupyterlab.labapp import LabApp from jupyterlab_server.tests.utils import APITester, L...
code_fim
hard
{ "lang": "python", "repo": "databill86/HyperFoods", "path": "/venv/lib/python3.6/site-packages/jupyterlab/tests/test_build_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Test the build web service API""" Application = LabApp def tempdir(self): td = TemporaryDirectory() self.tempdirs.append(td) return td.name def setUp(self): # Any TemporaryDirectory objects appended to this list will be cleaned # up at the end o...
code_fim
medium
{ "lang": "python", "repo": "databill86/HyperFoods", "path": "/venv/lib/python3.6/site-packages/jupyterlab/tests/test_build_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.planet = create_planet() start = self.planet.vertexes[(0, -1)] target = self.planet.vertexes[(2, 2)] sp = ShortestPath(self.planet, start, target) sp.run() pass def set_sp(self, sp): expected = [ self.planet.edges[(((0, -1), 0)...
code_fim
hard
{ "lang": "python", "repo": "cornzz/robolab-tud-spring18", "path": "/__tests__/planet_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cornzz/robolab-tud-spring18 path: /__tests__/planet_test.py #!/usr/bin/env python3 import unittest from src.events.EventNames import EventNames from src.events.EventRegistry import EventRegistry from src.planet.Planet import Planet from src.planet.Direction import Direction from src.planet.Verte...
code_fim
hard
{ "lang": "python", "repo": "cornzz/robolab-tud-spring18", "path": "/__tests__/planet_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> planet.add_path(planet.vertexes[(-2, 2)], Direction.SOUTH) planet.add_path(planet.vertexes[(-2, 2)], Direction.EAST) planet.add_path(planet.vertexes[(-2, 1)], Direction.NORTH) planet.add_path(planet.vertexes[(-2, 1)], Direction.WEST) planet.add_path(planet.vertexes[(-2, 1)], Direction...
code_fim
hard
{ "lang": "python", "repo": "cornzz/robolab-tud-spring18", "path": "/__tests__/planet_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>### def main(): print('Initializing camera') sleep(1) # camera warm-up time print('Initializing websockets server on port %d' % WS_PORT) WebSocketWSGIHandler.http_version = '1.1' websocket_server = make_server( '', WS_PORT, server_class=WSGIServer, handler_class=WebSocketWSGIRequestHandler, ...
code_fim
hard
{ "lang": "python", "repo": "Rafarrale/Camara-TFG", "path": "/server.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rafarrale/Camara-TFG path: /server.py #!/usr/bin/env python import sys import io import os import shutil import base64 import json import cv2 import paho.mqtt.client as mqtt import picamera from picamera.array import PiRGBArray from picamera import PiCamera from mail import sendEmail from subpr...
code_fim
hard
{ "lang": "python", "repo": "Rafarrale/Camara-TFG", "path": "/server.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> model.compile(optimizer=AdamAccumulate(lr=1e-4, accum_iters=4), loss=bce_ln_jaccard_loss, metrics=['binary_crossentropy', weighted_iou_score, edge_iou_score, mask_iou_score, 'accuracy']) model.summary() model.load_weights('cfm_weights_patched_no_sce_224_e08_iou0.5221.h5') print('-'*30) print('Fitti...
code_fim
hard
{ "lang": "python", "repo": "daniel-cheng/CALFIN", "path": "/training/train_cfm_v8_224_deeplabv3-xception_patched-256-16.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('-'*30) print('Creating and compiling model...') print('-'*30) img_shape = (img_size, img_size, 3) inputs = Input(shape=img_shape) model = Deeplabv3(input_shape=(img_size, img_size,3), classes=16, OS=16, backbone='xception', weights=None) model.compile(optimizer=AdamAccumulate(lr=1e-4, accu...
code_fim
hard
{ "lang": "python", "repo": "daniel-cheng/CALFIN", "path": "/training/train_cfm_v8_224_deeplabv3-xception_patched-256-16.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daniel-cheng/CALFIN path: /training/train_cfm_v8_224_deeplabv3-xception_patched-256-16.py import numpy as np import matplotlib.pyplot as plt from keras.models import Model, Input from keras.layers import Concatenate, Conv2D, MaxPooling2D, Conv2DTranspose, Dropout, UpSampling2D, BatchNormalization...
code_fim
hard
{ "lang": "python", "repo": "daniel-cheng/CALFIN", "path": "/training/train_cfm_v8_224_deeplabv3-xception_patched-256-16.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO(crbug.com/806361): Support generic typed lists and dicts. _value_type = basestring<|fim_prefix|># repo: xinghun61/infra path: /appengine/findit/dto/dict_of_basestring.py # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license th...
code_fim
easy
{ "lang": "python", "repo": "xinghun61/infra", "path": "/appengine/findit/dto/dict_of_basestring.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xinghun61/infra path: /appengine/findit/dto/dict_of_basestring.py # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from libs.structured_object import TypedDict <|fim_suffix|> # TODO...
code_fim
easy
{ "lang": "python", "repo": "xinghun61/infra", "path": "/appengine/findit/dto/dict_of_basestring.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nic30/hwt path: /hwt/serializer/hwt/value.py from copy import copy from typing import Union from hdlConvertorAst.hdlAst._defs import HdlIdDef from hdlConvertorAst.hdlAst._expr import HdlValueInt, HdlOp, HdlOpType, \ HdlValueId from hdlConvertorAst.translate.verilog_to_basic_hdl_sim_model.uti...
code_fim
hard
{ "lang": "python", "repo": "Nic30/hwt", "path": "/hwt/serializer/hwt/value.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t = self.as_hdl_HdlType_bits(val._dtype, declaration=False) c = hdl_getattr(t, "from_py") args = [HdlValueInt(val.val, None, 16), ] if not isFullVld: args.append(HdlValueInt(val.vld_mask, None, 16)) return hdl_call(c, args) def as_hdl_SignalItem(se...
code_fim
hard
{ "lang": "python", "repo": "Nic30/hwt", "path": "/hwt/serializer/hwt/value.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/neutron-lib path: /neutron_lib/exceptions/qos.py # Copyright 2011 VMware, Inc # All Rights Reserved. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-lib", "path": "/neutron_lib/exceptions/qos.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> message = _("Failed to remove provided policy %(policy_id)s " "because you are not authorized.") class TcLibQdiscTypeError(e.NeutronException): message = _("TC Qdisc type %(qdisc_type)s is not supported; supported " "types: %(supported_qdisc_types)s.") class TcL...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-lib", "path": "/neutron_lib/exceptions/qos.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: locked/4stability path: /liblcd_test.py #!/usr/bin/python import liblcd import time def main(): lcd = liblcd.LCD() # Initialise display lcd.init() # Send some centred test lcd.setline(1) lcd.string("--------------------",2) lcd.setline(2) lcd.string("Rasbperry Pi",2) <|fim_suffix|> #...
code_fim
medium
{ "lang": "python", "repo": "locked/4stability", "path": "/liblcd_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> time.sleep(20) # 20 second delay # Blank display lcd.setline(1) lcd.string("",3) lcd.setline(2) lcd.string("",3) if __name__ == '__main__': main()<|fim_prefix|># repo: locked/4stability path: /liblcd_test.py #!/usr/bin/python import liblcd import time def main(): lcd = liblcd.LCD() # Initi...
code_fim
medium
{ "lang": "python", "repo": "locked/4stability", "path": "/liblcd_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ir5/onnx-chainer path: /examples/sample_export.py #!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import chainer import numpy as np import chainercv.links as C import onnx_chainer parser = argparse.ArgumentParser() parser.add_argument('--gpu', type=int, default=-1) args = parser....
code_fim
medium
{ "lang": "python", "repo": "ir5/onnx-chainer", "path": "/examples/sample_export.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Pseudo input x = model.xp.zeros((1, 3, 224, 224), dtype=np.float32) onnx_chainer.export(model, x, filename='vgg16.onnx')<|fim_prefix|># repo: ir5/onnx-chainer path: /examples/sample_export.py #!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import chainer import numpy as np import chain...
code_fim
medium
{ "lang": "python", "repo": "ir5/onnx-chainer", "path": "/examples/sample_export.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DemocracyClub/UK-Polling-Stations path: /cdk/app.py #!/usr/bin/env python3 import os from aws_cdk import core as cdk from aws_cdk.core import Tags from stacks.command_runner_stack import WDIVOncePerTagCommandRunner from stacks.wdiv_s3_trigger_stack import WDIVS3TriggerStack from stacks.wdiv_sta...
code_fim
hard
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/cdk/app.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>env = cdk.Environment(account=os.getenv("CDK_DEFAULT_ACCOUNT"), region="eu-west-2") # Set the DC Environment early on. This is important to be able to conditionally # change the stack configurations dc_environment = app.node.try_get_context("dc-environment") or None assert ( dc_environment in valid_e...
code_fim
hard
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/cdk/app.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>app_wide_context = {} if dc_env := os.environ.get("DC_ENVIRONMENT"): app_wide_context["dc-environment"] = dc_env app = cdk.App(context=app_wide_context) env = cdk.Environment(account=os.getenv("CDK_DEFAULT_ACCOUNT"), region="eu-west-2") # Set the DC Environment early on. This is important to be abl...
code_fim
medium
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/cdk/app.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hultenvp/solis-sensor path: /test/soliscloud_test.py import hashlib from hashlib import sha1 import hmac import base64 from datetime import datetime from datetime import timezone import requests import json # Provided by Solis Support KeyId = "xxxxx" secretKey = b'xxxxx' VERB="POST" now = datet...
code_fim
hard
{ "lang": "python", "repo": "hultenvp/solis-sensor", "path": "/test/soliscloud_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>h = hmac.new(secretKey, msg=encryptStr.encode('utf-8'), digestmod=hashlib.sha1) Sign = base64.b64encode(h.digest()) Authorization = "API " + KeyId + ":" + Sign.decode('utf-8') requestStr = (VERB + " " + CanonicalizedResource + "\n" + "Content-MD5: " + Content_MD5 + "\n" + "Content-Type: " + Con...
code_fim
hard
{ "lang": "python", "repo": "hultenvp/solis-sensor", "path": "/test/soliscloud_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agoose77/hivesystem path: /tutorial/layers/layer16/maindrone.py from __future__ import print_function import bee import libcontext from libcontext.socketclasses import * from libcontext.pluginclasses import * class maindrone(bee.drone): <|fim_suffix|> def set_action1(self, action1): ...
code_fim
hard
{ "lang": "python", "repo": "agoose77/hivesystem", "path": "/tutorial/layers/layer16/maindrone.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if key == "W": i = "walk" self.action1.animplay(i) self.action1.soundplay(i) elif key == "TAB": i = "jump" self.action1.animplay(i) self.action1.soundplay(i) elif key == "R": self.action2.actionplay...
code_fim
medium
{ "lang": "python", "repo": "agoose77/hivesystem", "path": "/tutorial/layers/layer16/maindrone.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.action1 = action1 def set_action2(self, action2): self.action2 = action2 def set_action3(self, action3): self.action3 = action3 def place(self): s = socket_single_required(self.set_action1) libcontext.socket("action1", s) s = socket_singl...
code_fim
hard
{ "lang": "python", "repo": "agoose77/hivesystem", "path": "/tutorial/layers/layer16/maindrone.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> orient = -1 # the orientation of the image try: exif = dict((ExifTags.TAGS[k], v) for k, v in im._getexif( ).items() if k in ExifTags.TAGS) orient = exif["Orientation"] # get the orientation of the image except: pass # now ...
code_fim
hard
{ "lang": "python", "repo": "txstc55/ImageMosaicBVH", "path": "/PrepImage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: txstc55/ImageMosaicBVH path: /PrepImage.py import numpy as np from PIL import Image from PIL import ImageFilter from PIL import ImageCms import math import PIL.ExifTags as ExifTags import io def DebugPrint(debug, message): if debug: print(message) def convert_to_srgb(img): '''...
code_fim
hard
{ "lang": "python", "repo": "txstc55/ImageMosaicBVH", "path": "/PrepImage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # crop the image if width > height: im = im.crop(((width-height)/2, 0, width - (width-height)/2, height)) width = height elif height > width: im = im.crop((0, (height-width)/2, width, height - (...
code_fim
hard
{ "lang": "python", "repo": "txstc55/ImageMosaicBVH", "path": "/PrepImage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': arg_parser = ArgumentParser('Pig Chase 6.0 experiment') arg_parser.add_argument('-t', '--type', type=str, default='astar', choices=['astar', 'random'], help='The type of baseline to run.') arg_parser.add_argume...
code_fim
hard
{ "lang": "python", "repo": "alexlimh/malmochallenge", "path": "/HiDDeN/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexlimh/malmochallenge path: /HiDDeN/train.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun May 14 07:27:00 2017 @author: alex """ #============================================================================== # This is the algorithm described in the documentation # You can...
code_fim
hard
{ "lang": "python", "repo": "alexlimh/malmochallenge", "path": "/HiDDeN/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mononobi/pyrin path: /src/pyrin/caching/decorators.py coding: utf-8 -*- """ caching decorators module. """ from functools import update_wrapper from werkzeug.utils import cached_property as cached_property_base import pyrin.caching.services as caching_services import pyrin.utils.function as fu...
code_fim
hard
{ "lang": "python", "repo": "mononobi/pyrin", "path": "/src/pyrin/caching/decorators.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mononobi/pyrin path: /src/pyrin/caching/decorators.py -8 -*- """ caching decorators module. """ from functools import update_wrapper from werkzeug.utils import cached_property as cached_property_base import pyrin.caching.services as caching_services import pyrin.utils.function as function_util...
code_fim
hard
{ "lang": "python", "repo": "mononobi/pyrin", "path": "/src/pyrin/caching/decorators.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result = caching_services.try_get('complex', method, args, kwargs, **options) if result is not None: return result result = method(*args, **kwargs) caching_services.try_set('complex', result, met...
code_fim
hard
{ "lang": "python", "repo": "mononobi/pyrin", "path": "/src/pyrin/caching/decorators.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xorinox/chia-blockchain path: /tests/wallet/test_nft_store.py from pathlib import Path import aiosqlite import pytest from chia.types.blockchain_format.coin import Coin from chia.types.blockchain_format.program import Program from chia.types.blockchain_format.sized_bytes import bytes32 from chi...
code_fim
hard
{ "lang": "python", "repo": "xorinox/chia-blockchain", "path": "/tests/wallet/test_nft_store.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if db_filename.exists(): db_filename.unlink() con = await aiosqlite.connect(db_filename) wrapper = DBWrapper(con) db = await WalletNftStore.create(wrapper) try: a_bytes32 = bytes32.fromhex("09287c75377c63fd6a3a4d6658abed03e9a521e0436b1f83cdf...
code_fim
hard
{ "lang": "python", "repo": "xorinox/chia-blockchain", "path": "/tests/wallet/test_nft_store.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: biothings/biothings_schema.py path: /biothings_schema/dataload.py url elif file_path.startswith("http"): with requests.get(file_path) as url: # check if http requests returns a success status code if url.status_code != 200: raise ValueError(f"I...
code_fim
hard
{ "lang": "python", "repo": "biothings/biothings_schema.py", "path": "/biothings_schema/dataload.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return G def load_schema_class_into_networkx(schema, preload_schemaorg=False): """Constuct networkx DiGraph based on Schema provided""" # preload all schema from schemaorg latest version if preload_schemaorg: G = load_schema_class_into_networkx(preload_schemaorg, preload_schemaor...
code_fim
hard
{ "lang": "python", "repo": "biothings/biothings_schema.py", "path": "/biothings_schema/dataload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Load base schema, schema contains base classes for sub-classing in user schemas. base_schema can be: None - load default BASE_SCHEMA [] - empty list, do not load any base schemas ["schema.org, "bioschemas"] - load specified base schemas """ if base_schema == ...
code_fim
hard
{ "lang": "python", "repo": "biothings/biothings_schema.py", "path": "/biothings_schema/dataload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: G-Node/python-odml path: /doc/rdf/sparql_example_queries.py from rdflib import Graph, RDF from rdflib.plugins.sparql import prepareQuery from odml.tools.rdf_converter import ODML_NS rdf_namespace = {"odml": ODML_NS, "rdf": RDF} resource = "./odml_RDF_example_A.ttl" g = Graph() g.parse(resourc...
code_fim
hard
{ "lang": "python", "repo": "G-Node/python-odml", "path": "/doc/rdf/sparql_example_queries.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>print("q2") for row in g.query(q2): print("Doc: {0}, Sec: {1}, \n" "Prop: {2}, Bag: {3}".format(row.d, row.s, row.p, row.v)) print("Doc: {0}, Sec: {1}, \n" "Prop: {2}, Bag: {3}".format(row.d, row.s1, row.p1, row.v1)) print("q3") for row in g.query(q3): print("Doc: {0}, Sec...
code_fim
hard
{ "lang": "python", "repo": "G-Node/python-odml", "path": "/doc/rdf/sparql_example_queries.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # loop until termianted while(True): # randomly choose the next word index = random.randrange(0, len(letters)) word += letters[index] if (letters[index] == ""): break # get the new words lists letters =...
code_fim
hard
{ "lang": "python", "repo": "aes421/MarkovChain", "path": "/WordGenerator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aes421/MarkovChain path: /WordGenerator.py import random import sys def learn(): filename = sys.argv[1] if (len(sys.argv) == 3): markovOrder = int(sys.argv[2]) else: markovOrder = 1 startLetters = [] f = open(filename) # opens file for reading mc = dict()...
code_fim
hard
{ "lang": "python", "repo": "aes421/MarkovChain", "path": "/WordGenerator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i = 0 while i < times: # choose a random start word start = random.randrange(0, len(startLetters)) word = startLetters[start] # first word letters = mc[startLetters[start]] # loop until termianted while(True): # randomly choose the next ...
code_fim
hard
{ "lang": "python", "repo": "aes421/MarkovChain", "path": "/WordGenerator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_checkbox(capsys): with stylist.checkbox(content="Faking ...", content_after="Faked"): out, _ = capsys.readouterr() assert out == " {}Faking ...".format(NOT_CHECKED) out, _ = capsys.readouterr() assert out == "\r {}Faked \n".format(CHECKED) def test_activate(ca...
code_fim
hard
{ "lang": "python", "repo": "peopledoc/septentrion", "path": "/tests/unit/test_style.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with stylist.activate("title") as echo: echo("foo") out, _ = capsys.readouterr() assert out == "\x1b[36m\x1b[1mfoo\n"<|fim_prefix|># repo: peopledoc/septentrion path: /tests/unit/test_style.py import pytest from septentrion.style import noop_stylist, stylist CHECKED = "\x1b[...
code_fim
hard
{ "lang": "python", "repo": "peopledoc/septentrion", "path": "/tests/unit/test_style.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: peopledoc/septentrion path: /tests/unit/test_style.py import pytest from septentrion.style import noop_stylist, stylist CHECKED = "\x1b[32m[X] \x1b[0m" NOT_CHECKED = "\x1b[31m[ ] \x1b[0m" @pytest.mark.parametrize("expected,newline", [("foo\n", True), ("foo", False)]) def test_stylist_echo(cap...
code_fim
hard
{ "lang": "python", "repo": "peopledoc/septentrion", "path": "/tests/unit/test_style.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for attr in unknown_attrs: if attr in renamed_attrs: yield Issue( "renamed_field_attribute", f'Field attribute "{attr}" ' f'was renamed to "{renamed_attrs[attr]}"', addon.manifest_path, ...
code_fim
hard
{ "lang": "python", "repo": "srekal/odd", "path": "/odd/check/field_attrs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if attr in deprecated_attrs: yield Issue( "deprecated_field_attribute", f'Deprecated field attribute "{attr}" ' f'for field type "{field.class_name}"', addon.manifest_path, [Loca...
code_fim
hard
{ "lang": "python", "repo": "srekal/odd", "path": "/odd/check/field_attrs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: srekal/odd path: /odd/check/field_attrs.py from odd.check import Check from odd.check.python_emitter import FIELD_TYPE_VERSION_MAP from odd.const import SUPPORTED_VERSIONS from odd.issue import Issue, Location from odd.parso_utils import column_index_1 from odd.utils import expand_version_list C...
code_fim
hard
{ "lang": "python", "repo": "srekal/odd", "path": "/odd/check/field_attrs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anirban314/coursework path: /Google IT Automation with Python/Course 2/final_log-analysis.py # Coursera, Google IT Automation with Python # Course 2, Using Python to Interact with the Operating System # FINAL ASSIGNMENT # Log Analysis Using Regular Expressions import re import csv import operato...
code_fim
medium
{ "lang": "python", "repo": "anirban314/coursework", "path": "/Google IT Automation with Python/Course 2/final_log-analysis.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>with open("files/error_message.csv", 'w+') as file: writer = csv.writer(file, delimiter=',') writer.writerow(["Error", "Count"]) writer.writerows([error[0], error[1]] for error in error_dict.items())<|fim_prefix|># repo: anirban314/coursework path: /Google IT Automation with Python/Course 2/final_log-...
code_fim
hard
{ "lang": "python", "repo": "anirban314/coursework", "path": "/Google IT Automation with Python/Course 2/final_log-analysis.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def EulerProblem0028_01(): delta = [(0,1), (1,0), (0,-1), (-1,0)] number = 1001 array = [[0 for x in range(number)] for y in range(number)] done = 0 start = [int(number / 2), int(number / 2)] index = 0 dx, dy = delta[index] seed = 1 #print(start) #print(dx, dy...
code_fim
hard
{ "lang": "python", "repo": "zhaphod/ProjectEuler", "path": "/Python/proj_euler_problem_0028.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhaphod/ProjectEuler path: /Python/proj_euler_problem_0028.py ''' Problem 28 Number spiral diagonals Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: !21 22 23 24 !25 20 !7 8 !9 10 19 6 !1 2 11 18 !5 4 !3 12 !17 16 15 14...
code_fim
hard
{ "lang": "python", "repo": "zhaphod/ProjectEuler", "path": "/Python/proj_euler_problem_0028.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yandex-cloud/python-sdk path: /yandex/cloud/ai/vision/v1/face_detection_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: yandex/cloud/ai/vision/v1/face_detection.proto """Generated protocol buffer code.""" from google.protobuf import descriptor a...
code_fim
hard
{ "lang": "python", "repo": "yandex-cloud/python-sdk", "path": "/yandex/cloud/ai/vision/v1/face_detection_pb2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'yandex.cloud.ai.vision.v1.face_detection_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n...
code_fim
hard
{ "lang": "python", "repo": "yandex-cloud/python-sdk", "path": "/yandex/cloud/ai/vision/v1/face_detection_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n.yandex/cloud/ai/vision/v1/face_detection.proto\x12\x19yandex.cloud.ai.vision.v1\x1a*yandex/cloud/ai/vision/v1/primitives.proto\"@\n\x0e\x46\x61\x63\x65\x41nnotation\x12.\n\x05\x66\x61\x63\x65s\x18\x01 \x03(\x0b\x32\x1f.yandex.cloud.ai.vision.v...
code_fim
medium
{ "lang": "python", "repo": "yandex-cloud/python-sdk", "path": "/yandex/cloud/ai/vision/v1/face_detection_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Codeforces/Codeforces Round #696 (Div. 2)/A.py from collections import defaultdict T = int(raw_input()) <|fim_suffix|> ''' ^^^TEST^^^ 5 1 0 3 011 3 110 6 111000 6 001011 ---- 1 110 100 101101 101110 $$$TEST$$$ '''<|fim_middle|>for case_ in xrange(T): n = int(raw_inpu...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Codeforces/Codeforces Round #696 (Div. 2)/A.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>''' ^^^TEST^^^ 5 1 0 3 011 3 110 6 111000 6 001011 ---- 1 110 100 101101 101110 $$$TEST$$$ '''<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Codeforces/Codeforces Round #696 (Div. 2)/A.py from collections import defaultdict T = int(raw_input()) <|fim_middle|>for case_ in xrange(T): n = int(raw_input...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Codeforces/Codeforces Round #696 (Div. 2)/A.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> ''' ^^^TEST^^^ 5 1 0 3 011 3 110 6 111000 6 001011 ---- 1 110 100 101101 101110 $$$TEST$$$ '''<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /Codeforces/Codeforces Round #696 (Div. 2)/A.py from collections import defaultdict T = int(raw_input()) <|fim_middle|>for case_ in xrange(T): n = int(raw_inpu...
code_fim
hard
{ "lang": "python", "repo": "Wizmann/ACM-ICPC", "path": "/Codeforces/Codeforces Round #696 (Div. 2)/A.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: yafraorg-archive/yafra-archive path: /yafra-python/server/app/rest/controller.py # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See th...
code_fim
medium
{ "lang": "python", "repo": "yafraorg-archive/yafra-archive", "path": "/yafra-python/server/app/rest/controller.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>restBp = Blueprint('rest', __name__) @restBp.route('/db') def DbPage(): current_app.logger.info('start db list get') myDb = Database() #indexContent = myDb.certlist("/data/pki/yapki/index.txt") indexContent = myDb.certlist("/work/repos/git/yapki/backend/tests/index.txt") current_app.l...
code_fim
medium
{ "lang": "python", "repo": "yafraorg-archive/yafra-archive", "path": "/yafra-python/server/app/rest/controller.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(context=None): if not context: config = Config() connection = Connection(credentials=config.credentials) if config.base_url: connection.api_url = config.base_url context = PyutrackContext(connection, config) try: repeat = context.watch a...
code_fim
hard
{ "lang": "python", "repo": "janakaud/pyutrack", "path": "/pyutrack/cli/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: janakaud/pyutrack path: /pyutrack/cli/__init__.py import logging import click import time import sys from requests import RequestException from pyutrack import Credentials, Connection from pyutrack.cli.util import PyutrackContext from pyutrack.config import Config from pyutrack.errors import A...
code_fim
hard
{ "lang": "python", "repo": "janakaud/pyutrack", "path": "/pyutrack/cli/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not context: config = Config() connection = Connection(credentials=config.credentials) if config.base_url: connection.api_url = config.base_url context = PyutrackContext(connection, config) try: repeat = context.watch and context.watch > 0 ...
code_fim
medium
{ "lang": "python", "repo": "janakaud/pyutrack", "path": "/pyutrack/cli/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: google/CommonLoopUtils path: /clu/preprocess_spec_test.py # Copyright 2023 The CLU Authors. # # 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.or...
code_fim
hard
{ "lang": "python", "repo": "google/CommonLoopUtils", "path": "/clu/preprocess_spec_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_positional_argument(self): op = preprocess_spec._parse_single_preprocess_op("rescale(2)", dict(all_ops())) logging.info("op: %r", op) self.assertEqual(str(op), "Rescale(scale=2)") def test_keyword_argument(self): op = prepr...
code_fim
hard
{ "lang": "python", "repo": "google/CommonLoopUtils", "path": "/clu/preprocess_spec_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if record.addressline6.replace(" ", " ") in [ # split "EX5 1LN", # wrong "EX8 2FQ", ]: return None return super().address_record_to_dict(record)<|fim_prefix|># repo: DemocracyClub/UK-Polling-Stations path: /polling_stati...
code_fim
medium
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/polling_stations/apps/data_importers/management/commands/import_east_devon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> council_id = "EDE" addresses_name = ( "2023-05-04/2023-03-15T16:02:12.044482/Democracy_Club__04May2023.tsv" ) stations_name = ( "2023-05-04/2023-03-15T16:02:12.044482/Democracy_Club__04May2023.tsv" ) elections = ["2023-05-04"] csv_encoding = "windows-1252" c...
code_fim
medium
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/polling_stations/apps/data_importers/management/commands/import_east_devon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmmeijers/shrink path: /kdtree.py import operator import logging import unittest import math from util import distance2, compute_envelope, format_line class KdNode(object): """ A node in the KdTree Attributes: items: the items (vertices) stored in this node active: l...
code_fim
hard
{ "lang": "python", "repo": "bmmeijers/shrink", "path": "/kdtree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def visit_k_nearest(node, pt, k, result): """ Visit node to see if there are close points to point pt in this node Only k close points are kept in the result list """ # rather brute force but because cut off and k expected to be rather small # not further optimized # (result c...
code_fim
hard
{ "lang": "python", "repo": "bmmeijers/shrink", "path": "/kdtree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def k_nearest(node, pt, k, result): """ Recursive nearest neighbours implementation Adds candidate points to the result argument (initially an empty list) Returns: count of nodes visited during the search """ if node.items: visit_k_nearest(node, pt, k, result) retu...
code_fim
hard
{ "lang": "python", "repo": "bmmeijers/shrink", "path": "/kdtree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self, database): while True: next_url = self.extract_one(database) if self.current_url == next_url: break self.current_url= next_url def extract_one(self, database): page = requests.get(self.current_url) tree = ht...
code_fim
hard
{ "lang": "python", "repo": "roSievers/comic-orga", "path": "/src/scrapper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: roSievers/comic-orga path: /src/scrapper.py # -*- coding: utf-8 -*- """ Created on Mon Oct 9 08:21:45 2017 @author: Adeptus Alricus """ from lxml import html import requests import urllib.request import urllib.parse #href = tree.xpath('//a[@rel="next"]')[0].attrib["href"] #with urllib.reques...
code_fim
hard
{ "lang": "python", "repo": "roSievers/comic-orga", "path": "/src/scrapper.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not ("alt" in comic.attrib and "title" in comic.attrib): return { "href_next" : tree.xpath('//a[@rel="next"]')[0].attrib["href"] } return { "title" : comic.attrib["alt"] , "alt" : comic.attrib["title"] , "img" : comi...
code_fim
hard
{ "lang": "python", "repo": "roSievers/comic-orga", "path": "/src/scrapper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeMaCS-UNICAL/EmbASP-Python path: /embasp/base/input_program.py class InputProgram(object): """Represents a generic option.""" def __init__(self): """Creates new programs setting space as default separator.""" self._programs = "" # Where programs data is stored s...
code_fim
hard
{ "lang": "python", "repo": "DeMaCS-UNICAL/EmbASP-Python", "path": "/embasp/base/input_program.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Sets _programs value to the given one. The parameter programs represents a new value. """ self._programs = programs def set_separator(self, separator): """Set programs separator to the given one. The parameter separator is used as new separator. ...
code_fim
hard
{ "lang": "python", "repo": "DeMaCS-UNICAL/EmbASP-Python", "path": "/embasp/base/input_program.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_string_of_files_paths(self): """Returns string concatenating files paths.""" to_return = "" for paths in self.__files_paths: if len(paths) != 0: to_return += paths + " " return to_return def set_programs(self, programs): ...
code_fim
hard
{ "lang": "python", "repo": "DeMaCS-UNICAL/EmbASP-Python", "path": "/embasp/base/input_program.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(seba_version=''): version = [ seba_version, ] instance = GetCodeFromHttp() instance.version = version instance.start() def new_option_parser(): result = OptionParser() result.add_option( "--seba-version", default='94e9b1d6ba1466d288a12e3afaa1e...
code_fim
hard
{ "lang": "python", "repo": "amusecode/amuse", "path": "/src/amuse/community/seba/download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def main(seba_version=''): version = [ seba_version, ] instance = GetCodeFromHttp() instance.version = version instance.start() def new_option_parser(): result = OptionParser() result.add_option( "--seba-version", default='94e9b1d6ba1466d288a12e3afaa1...
code_fim
hard
{ "lang": "python", "repo": "amusecode/amuse", "path": "/src/amuse/community/seba/download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amusecode/amuse path: /src/amuse/community/seba/download.py #!/usr/bin/env python import subprocess import os import urllib.request import urllib.parse import urllib.error from shutil import which from optparse import OptionParser class GetCodeFromHttp: filename_template = "{version}.tar.g...
code_fim
hard
{ "lang": "python", "repo": "amusecode/amuse", "path": "/src/amuse/community/seba/download.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: samuelmaudo/yepes path: /yepes/middleware/login_required.py # -*- coding:utf-8 -*- from __future__ import unicode_literals from django import VERSION as DJANGO_VERSION from django.contrib.auth.views import redirect_to_login from django.utils.six.moves.urllib.parse import urlparse if DJANGO_VERS...
code_fim
medium
{ "lang": "python", "repo": "samuelmaudo/yepes", "path": "/yepes/middleware/login_required.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ def process_request(self, request): if request.user.is_anonymous(): url = request.get_full_path() if urlparse(url).path != settings.LOGIN_URL: return redirect_to_login(url)<|fim_prefix|># repo: samuelmaudo/yepes path: /yepes/middleware/login_req...
code_fim
hard
{ "lang": "python", "repo": "samuelmaudo/yepes", "path": "/yepes/middleware/login_required.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Probably useful for sites that are on deploy or on testing. """ def process_request(self, request): if request.user.is_anonymous(): url = request.get_full_path() if urlparse(url).path != settings.LOGIN_URL: return redirect_to_login(url)<|fim_pre...
code_fim
medium
{ "lang": "python", "repo": "samuelmaudo/yepes", "path": "/yepes/middleware/login_required.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibis-project/ibis path: /ibis/formats/tests/test_numpy.py from __future__ import annotations import hypothesis as h import hypothesis.extra.numpy as npst import hypothesis.strategies as st import numpy as np import pytest from packaging.version import parse as vparse import ibis.expr.datatypes ...
code_fim
hard
{ "lang": "python", "repo": "ibis-project/ibis", "path": "/ibis/formats/tests/test_numpy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( ("numpy_dtype", "ibis_dtype"), [ (np.bool_, dt.boolean), (np.int8, dt.int8), (np.int16, dt.int16), (np.int32, dt.int32), (np.int64, dt.int64), (np.uint8, dt.uint8), (np.uint16, dt.uint16), (np.uint32, dt.uint...
code_fim
hard
{ "lang": "python", "repo": "ibis-project/ibis", "path": "/ibis/formats/tests/test_numpy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>5) c = ((n-1)//15) sum = (((3 * a * (a+1))//2) + ((5 * b * (b+1))//2) - ((15 * c * (c+1))//2)) print(int(sum))<|fim_prefix|># repo: nidhim12/ProjectEuler_Solutions path: /Python_Code/num_01_Nidhi.py t = int(input().strip()) for a0 in range(t): n = int(inpu<|fim_middle|>t().strip()) ...
code_fim
medium
{ "lang": "python", "repo": "nidhim12/ProjectEuler_Solutions", "path": "/Python_Code/num_01_Nidhi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nidhim12/ProjectEuler_Solutions path: /Python_Code/num_01_Nidhi.py t = int(input().strip()) for a0 in range(t): n = int(inpu<|fim_suffix|> * b * (b+1))//2) - ((15 * c * (c+1))//2)) print(int(sum))<|fim_middle|>t().strip()) sum =0 a = ((n-1)//3) b = ((n-1)//5) c = ((n...
code_fim
medium
{ "lang": "python", "repo": "nidhim12/ProjectEuler_Solutions", "path": "/Python_Code/num_01_Nidhi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getitem__(self, item): return self.X[item], self.y[item]<|fim_prefix|># repo: InzamamRahaman/CostSensitiveLR path: /dataset.py import torch.utils.data as data_utils class PairedDataset(data_utils.Dataset): <|fim_middle|> def __init__(self, X, y): super().__init__() ...
code_fim
medium
{ "lang": "python", "repo": "InzamamRahaman/CostSensitiveLR", "path": "/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: InzamamRahaman/CostSensitiveLR path: /dataset.py import torch.utils.data as data_utils class PairedDataset(data_utils.Dataset): <|fim_suffix|> return self.n def __getitem__(self, item): return self.X[item], self.y[item]<|fim_middle|> def __init__(self, X, y): supe...
code_fim
medium
{ "lang": "python", "repo": "InzamamRahaman/CostSensitiveLR", "path": "/dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lkwilson/Honors-Thesis path: /doc/paper/scripts/AnalyzeR3BodyProb.py import os import pickle import itertools from echonn.sys import RestrictedCircular3Body from echonn.ml import ESNExperiment <|fim_suffix|>fn_y0s = os.path.join('.', 'rc3_body_y0s.p') print('Testing Restricted Circular 3 Body Mo...
code_fim
medium
{ "lang": "python", "repo": "lkwilson/Honors-Thesis", "path": "/doc/paper/scripts/AnalyzeR3BodyProb.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }