text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> result = self.testClient.get('/api/swagger.json') self.assertEqual(result.status_code, 200) result = self.testClient.get('/apidocs/swagger.json') self.assertEqual(result.status_code, 200)<|fim_prefix|># repo: rmetcalf9/baseapp_for_restapi_backend_with_swagger path: /exampleProjects/restAP...
code_fim
hard
{ "lang": "python", "repo": "rmetcalf9/baseapp_for_restapi_backend_with_swagger", "path": "/exampleProjects/restAPIWithSwagger/test/test_serverInfoAPI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rmetcalf9/baseapp_for_restapi_backend_with_swagger path: /exampleProjects/restAPIWithSwagger/test/test_serverInfoAPI.py from TestHelperSuperClass import testHelperAPIClient, env import unittest import json class test_api(testHelperAPIClient): <|fim_suffix|> result = self.testClient.get('/api/...
code_fim
hard
{ "lang": "python", "repo": "rmetcalf9/baseapp_for_restapi_backend_with_swagger", "path": "/exampleProjects/restAPIWithSwagger/test/test_serverInfoAPI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danbar/fglib path: /examples/example_spa #!/usr/bin/env python """A simple example of the sum-product algorithm This is a simple example of the sum-product algorithm on a factor graph with Bernoulli random variables, which is taken from page 409 of the book C. M. Bishop, Pattern Recognition and...
code_fim
hard
{ "lang": "python", "repo": "danbar/fglib", "path": "/examples/example_spa", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dist_fb = [[0.3, 0.4], [0.3, 0.0]] fb = nodes.FNode("fb", rv.Discrete(dist_fb, x2, x3)) dist_fc = [[0.3, 0.4], [0.3, 0.0]] fc = nodes.FNode("fc", rv.Discrete(dist_fc, x2, x4)) # Add nodes to factor graph fg.set_nodes([x1, x2, x3, x4]) fg.set_nodes([fa, fb, fc]) # Add edges to fact...
code_fim
hard
{ "lang": "python", "repo": "danbar/fglib", "path": "/examples/example_spa", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError def parse_results(self): raise NotImplementedError<|fim_prefix|># repo: Hackthings/ava-slackbot path: /avabot/commands/__init__.py # -*- coding: utf-8 -*- import json class Command: def __init__(self, config, **kwargs): self.config = config ...
code_fim
hard
{ "lang": "python", "repo": "Hackthings/ava-slackbot", "path": "/avabot/commands/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hackthings/ava-slackbot path: /avabot/commands/__init__.py # -*- coding: utf-8 -*- import json class Command: def __init__(self, config, **kwargs): <|fim_suffix|> self.run() def run(self): # execute api call response = self.request() channel = self.kwarg...
code_fim
hard
{ "lang": "python", "repo": "Hackthings/ava-slackbot", "path": "/avabot/commands/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _copyRecursive( syn, entity, destinationId, mapping=None, skipCopyAnnotations=False, **kwargs ): """ Recursively copies synapse entites, but does not copy the wikis :param entity: A synapse entity ID :param destinationId: Synapse ID of a folder/project that th...
code_fim
hard
{ "lang": "python", "repo": "Sage-Bionetworks/synapsePythonClient", "path": "/synapseutils/copy_functions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sage-Bionetworks/synapsePythonClient path: /synapseutils/copy_functions.py ) return mapping def _copyRecursive( syn, entity, destinationId, mapping=None, skipCopyAnnotations=False, **kwargs ): """ Recursively copies synapse entites, but does not copy the wikis :param e...
code_fim
hard
{ "lang": "python", "repo": "Sage-Bionetworks/synapsePythonClient", "path": "/synapseutils/copy_functions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sage-Bionetworks/synapsePythonClient path: /synapseutils/copy_functions.py ils.changeFileMetaData(syn, file_entity, "my_new_name_file.txt") """ ent = syn.get(entity, downloadFile=False) fileResult = syn._getFileHandleDownload(ent.dataFileHandleId, ent.id) ent.contentType = ent.con...
code_fim
hard
{ "lang": "python", "repo": "Sage-Bionetworks/synapsePythonClient", "path": "/synapseutils/copy_functions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nHashOPHR from datasketch.b_bit_minhash import bBitMinHash from datasketch.lsh import MinHashLSH, WeightedMinHashLSH from datasketch.weighted_minhash import WeightedMinHash, WeightedMinHashGenerator from datasketch.minheap_minhash import MinHashMinHeap from datasketch.partition_minhash import PartitionMin...
code_fim
medium
{ "lang": "python", "repo": "demitrin/datasketch-fork", "path": "/datasketch/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>h, WeightedMinHashGenerator from datasketch.minheap_minhash import MinHashMinHeap from datasketch.partition_minhash import PartitionMinHash, BetterWeightedPartitionMinHash<|fim_prefix|># repo: demitrin/datasketch-fork path: /datasketch/__init__.py """ Data sketch module for Python =======================...
code_fim
medium
{ "lang": "python", "repo": "demitrin/datasketch-fork", "path": "/datasketch/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: demitrin/datasketch-fork path: /datasketch/__init__.py """ Data sketch module for Python ============================= datasketch is a Python module integrating various data sketch algorithms. It aims to provide efficient ap<|fim_suffix|>nHashOPHR from datasketch.b_bit_minhash import bBitMinHash...
code_fim
medium
{ "lang": "python", "repo": "demitrin/datasketch-fork", "path": "/datasketch/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> eps = EP.list() for ep in eps: if ep.deleted == False and ep.dn not in self.eps[ep.epg_dn]: ep.deleted = True ep.update() EP(ep.dn, ep.path_dn, ep.mac, ep.ip, 'deleted', now, deleted=True).create() self.ctr...
code_fim
hard
{ "lang": "python", "repo": "HyechurnJang/adun", "path": "/engine/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HyechurnJang/adun path: /engine/core.py # -*- coding: utf-8 -*- ''' Created on 2018. 3. 30. @author: HyechurnJang ''' import json import datetime from json import JSONEncoder from pygics import Lock from acidipy import Controller, Event from model import EPG, EP, MacIP class Track...
code_fim
hard
{ "lang": "python", "repo": "HyechurnJang/adun", "path": "/engine/core.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setMacIP(self, epg_dn, mac, ip, name=None): if epg_dn not in self.macips: macip = MacIP(epg_dn, mac, ip, name).create() self.macips[epg_dn] = {mac:macip} else: if mac not in self.macips[epg_dn]: macip = MacIP(epg_dn, mac, ip...
code_fim
hard
{ "lang": "python", "repo": "HyechurnJang/adun", "path": "/engine/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> addmm_weights = linear_op.params[linear_op.ParamName.WEIGHTS].data addmm_weights = addmm_weights.transpose(1,0) linear_op.set_param_from_data( linear_op.ParamName.WEIGHTS, addmm_weights) node.op = linear_op<|fim_prefix|># repo: Xilinx/Vitis-AI path: /sr...
code_fim
medium
{ "lang": "python", "repo": "Xilinx/Vitis-AI", "path": "/src/vai_quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/parse/parser_post_process.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> linear_op.set_config('out_features', weight_size[1]) linear_op.set_config('in_features', weight_size[0]) addmm_weights = linear_op.params[linear_op.ParamName.WEIGHTS].data addmm_weights = addmm_weights.transpose(1,0) linear_op.set_param_from_data( ...
code_fim
hard
{ "lang": "python", "repo": "Xilinx/Vitis-AI", "path": "/src/vai_quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/parse/parser_post_process.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xilinx/Vitis-AI path: /src/vai_quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/parse/parser_post_process.py # # Copyright 2019 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain ...
code_fim
hard
{ "lang": "python", "repo": "Xilinx/Vitis-AI", "path": "/src/vai_quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/parse/parser_post_process.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mohit-Pathak/pyecca path: /pyecca/estimators/attitude/algorithms/__init__.py import casadi as ca import os from . import mekf, mrp, quat, sim def eqs(**kwargs): <|fim_suffix|> def generate_code(eqs, dest_dir, **kwargs): p = { 'main': False, 'mex': False, 'with_heade...
code_fim
medium
{ "lang": "python", "repo": "Mohit-Pathak/pyecca", "path": "/pyecca/estimators/attitude/algorithms/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> os.makedirs(dest_dir, exist_ok=True) gen.generate(dest_dir + os.path.sep)<|fim_prefix|># repo: Mohit-Pathak/pyecca path: /pyecca/estimators/attitude/algorithms/__init__.py import casadi as ca import os from . import mekf, mrp, quat, sim def eqs(**kwargs): <|fim_middle|> return { ...
code_fim
hard
{ "lang": "python", "repo": "Mohit-Pathak/pyecca", "path": "/pyecca/estimators/attitude/algorithms/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ghrek/Hat path: /hat_bot.py from discord.ext import commands import os import discord import random token = 'token' bot = discord.Client() bot = commands.Bot(command_prefix='!') bot.remove_command('help') <|fim_suffix|>@bot.event async def on_ready(): await bot.change_presence...
code_fim
medium
{ "lang": "python", "repo": "Ghrek/Hat", "path": "/hat_bot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@bot.command() async def help(ctx): embed = discord.Embed(title="Help Commands", description="List of commands that you can access from this bot.") embed.add_field(name="!ping", value="sends a pong bitch message", inline=False) embed.add_field(name="!say", value="literally repeats whatever...
code_fim
medium
{ "lang": "python", "repo": "Ghrek/Hat", "path": "/hat_bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def output_urls(self): return {resource.url for resource in self._outputs} def sorted_inputs_string(self): sorted_inputs_urls = sorted([resource.url for resource in self.iter_inputs()]) return ",".join(sorted_inputs_urls) def depends_on_process(self, process): ...
code_fim
hard
{ "lang": "python", "repo": "lexman/tuttle", "path": "/tuttle/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lexman/tuttle path: /tuttle/process.py # -*- coding: utf8 -*- from time import time class Process: """ Class wrapping a process. A process has some input resources, some output resources, some code that produces outputs from inputs, a processor that handle the language specificities ...
code_fim
hard
{ "lang": "python", "repo": "lexman/tuttle", "path": "/tuttle/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Returns True if self deprends on a resource created by process""" for output_resource in process.iter_outputs(): if self.has_input(output_resource): return True return False def pick_an_output(self): if not self.has_outputs(): ...
code_fim
hard
{ "lang": "python", "repo": "lexman/tuttle", "path": "/tuttle/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Megha-Bose/Brick-Breaker-Game path: /bomb.py from headers import * from objects import * from utilities import * from os import * class Bomb(Object): # Inherits Object class def __init__(self, x, y): self.diry = +1 self.active = 0 self.__body = np.array([["*"]]) ...
code_fim
hard
{ "lang": "python", "repo": "Megha-Bose/Brick-Breaker-Game", "path": "/bomb.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check if bomb has gone below paddle def has_fallen(self, grid): y = self.gety() if y > HEIGHT - 4: self.clear(grid) return 1 return 0 # Check if bomb is on paddle def on_paddle(self, grid, paddle_xl, paddle_xr, bomb_x, bomb_y): ...
code_fim
hard
{ "lang": "python", "repo": "Megha-Bose/Brick-Breaker-Game", "path": "/bomb.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: palakbaphna/pyprac path: /Integer&FloatNumbers/12CarRoute.py #A car can cover distance of N kilometers per day. # How many days will it take to cover a route of length M kilometers? # The program gets two numbers: N and M. N = int (input("N = ?")) M = int(input("M = ?")) <|fim_suffix|> print("...
code_fim
easy
{ "lang": "python", "repo": "palakbaphna/pyprac", "path": "/Integer&FloatNumbers/12CarRoute.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("No. of days will it take to cover a route of length M kilometers is", ceil(M/N))<|fim_prefix|># repo: palakbaphna/pyprac path: /Integer&FloatNumbers/12CarRoute.py #A car can cover distance of N kilometers per day. # How many days will it take to cover a route of length M kilometers? # The program ...
code_fim
easy
{ "lang": "python", "repo": "palakbaphna/pyprac", "path": "/Integer&FloatNumbers/12CarRoute.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ipatrol/pineapple path: /plugins/base/Empty.py from util import Events class Plugin(object): def __init__(self, pm): self.pm = pm @staticmethod def register_events(): <|fim_suffix|> async def handle_command(self, message_object, command, args): """ Handle...
code_fim
medium
{ "lang": "python", "repo": "ipatrol/pineapple", "path": "/plugins/base/Empty.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def handle_command(self, message_object, command, args): """ Handle Events.Command events :param message_object: discord.Message object containing the message :param command: The name of the command (first word in the message, without prefix) :param args: ...
code_fim
medium
{ "lang": "python", "repo": "ipatrol/pineapple", "path": "/plugins/base/Empty.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check(self, arg): # Try to convert it to the binary. try: _ = Binary.convert(arg) return True except: # if transfered to exception we know its not binary. self.set_error(f"Expected String to be in Binary format, Got: {arg}") ...
code_fim
hard
{ "lang": "python", "repo": "tkech17/Validator", "path": "/validator/rules_src/binary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkech17/Validator path: /validator/rules_src/binary.py from validator.rules_src import Rule class Binary(Rule): """ The field under validation must be a binary number Examples: >>> from validator import validate >>> reqs = {"date" : "010101010010"} >>> rule = {"date" :...
code_fim
medium
{ "lang": "python", "repo": "tkech17/Validator", "path": "/validator/rules_src/binary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> aliases = ["bin", "binary"] def __init__(self): Rule.__init__(self) def check(self, arg): # Try to convert it to the binary. try: _ = Binary.convert(arg) return True except: # if transfered to exception we know its not binar...
code_fim
hard
{ "lang": "python", "repo": "tkech17/Validator", "path": "/validator/rules_src/binary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: angup143/roadtracer path: /lib/roadcnn/dataset.py import numpy import os import os.path import random import scipy.ndimage import scipy.misc import multiprocessing import time SIZE = 256 def load_tile(sat_fname, osm_fname): region = sat_fname.split('/')[-1].split('_sat')[0] sat = scipy.ndimag...
code_fim
hard
{ "lang": "python", "repo": "angup143/roadtracer", "path": "/lib/roadcnn/dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_regions = ['boston', 'new york', 'chicago', 'la', 'toronto', 'denver', 'kansas city', 'san diego', 'pittsburgh', 'montreal', 'vancouver', 'tokyo', 'saltlakecity', 'paris', 'amsterdam'] if traintest == 'train': files = [fname for fname in files if fname.split('/')[-1].split('_')[0] not in test_reg...
code_fim
medium
{ "lang": "python", "repo": "angup143/roadtracer", "path": "/lib/roadcnn/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Try the uninstall and verify that everything is removed. result2 = run_pip("uninstall", "INITools", "-y") assert_all_changes(result, result2, [env.venv/'build', 'cache']) def test_setup_py_with_dos_line_endings(): """ It doesn't choke on a setup.py file that uses DOS line endings (...
code_fim
hard
{ "lang": "python", "repo": "dgladkov/pip", "path": "/tests/test_compat.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_setup_py_with_dos_line_endings(): """ It doesn't choke on a setup.py file that uses DOS line endings (\\r\\n). Refs https://github.com/pypa/pip/issues/237 """ reset_env() to_install = os.path.abspath(os.path.join(here, 'packages', 'LineEndings')) run_pip('install', to...
code_fim
hard
{ "lang": "python", "repo": "dgladkov/pip", "path": "/tests/test_compat.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dgladkov/pip path: /tests/test_compat.py """ Tests for compatibility workarounds. """ import os from tests.test_pip import (here, reset_env, run_pip, pyversion, assert_all_changes) def test_debian_egg_name_workaround(): """ We can uninstall packages installe...
code_fim
hard
{ "lang": "python", "repo": "dgladkov/pip", "path": "/tests/test_compat.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ali-Parandeh/Data_Science_Playground path: /pyimagesearch gurus/Module 1/lesson_1_6/morphological.py import argparse import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument('-i', '--image', required=True, help='Path to the image') args = ...
code_fim
hard
{ "lang": "python", "repo": "Ali-Parandeh/Data_Science_Playground", "path": "/pyimagesearch gurus/Module 1/lesson_1_6/morphological.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># loop over the kernels and apply a morphological gradient operation to the image # NOTE: A morphological gradient is the difference between the dilation and erosion. # It is useful for determining the outline of a particular object of an image for kernel_size in kernel_sizes: kernel = cv2.getStructur...
code_fim
hard
{ "lang": "python", "repo": "Ali-Parandeh/Data_Science_Playground", "path": "/pyimagesearch gurus/Module 1/lesson_1_6/morphological.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagasudhirpulla/grafana_smscountry_webhook path: /tests/services/test_smsSender.py import unittest from src.services.smsSender import SmsApi from src.config.appConfig import loadAppConfig <|fim_suffix|> def test_run(self) -> None: """tests the function that sends sms """ ...
code_fim
medium
{ "lang": "python", "repo": "nagasudhirpulla/grafana_smscountry_webhook", "path": "/tests/services/test_smsSender.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """tests the function that sends sms """ appConf = loadAppConfig() smsApi = SmsApi(appConf["smsUsername"], appConf["smsPassword"], appConf["persons"], appConf["groups"]) resp: bool = smsApi.sendSmsToGroup( 'it', '[Alerting] CCTV u...
code_fim
medium
{ "lang": "python", "repo": "nagasudhirpulla/grafana_smscountry_webhook", "path": "/tests/services/test_smsSender.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeroenmaas/tzaar-python-ai path: /shared/simpleAI.py from shared.board import * import random def playMove(board, turnInfo: TurnInformation): moves = [] if turnInfo.turns >= 1: positions = getItemsOfType(board, turnInfo.player) all_options = [] for pos_info in pos...
code_fim
hard
{ "lang": "python", "repo": "jeroenmaas/tzaar-python-ai", "path": "/shared/simpleAI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lowest_player_count = stats_player.getLowestCount() lowest_opponent_count = stats_opponent.getLowestCount() diff = lowest_player_count - lowest_opponent_count if diff > 0: return 0.5 + (0.5 - 0.45/diff) elif diff < 0: return 0.45/abs(diff) else: return 0.5<|...
code_fim
hard
{ "lang": "python", "repo": "jeroenmaas/tzaar-python-ai", "path": "/shared/simpleAI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Columns are ``sample_index``, ``integrand``, ``location``, ``age_lower``, ``age_upper``, ``time_lower``, ``time_upper``, ``mean``, and any covariates. If you drop the sample index, and add standard deviation, this can serve as data values. """ avgint = read_...
code_fim
hard
{ "lang": "python", "repo": "adolgert/cascade", "path": "/src/cascade/model/object_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adolgert/cascade path: /src/cascade/model/object_wrapper.py turns a dataframe of locations, built from the node table. Input locations have ``location_id``, ``parent_id`` and optional ``name``. This output table also has a ``node_id``, which was the node used by Dismod-AT....
code_fim
hard
{ "lang": "python", "repo": "adolgert/cascade", "path": "/src/cascade/model/object_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adolgert/cascade path: /src/cascade/model/object_wrapper.py @property def avgint(self): """pd.DataFrame: The average integrands have the same shape as the data and can be set but not read.""" raise NotImplementedError("Reading avgints is not implemented.") @...
code_fim
hard
{ "lang": "python", "repo": "adolgert/cascade", "path": "/src/cascade/model/object_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ttt888ttt/OSINT-SAN path: /module/gui/geoLRun.py #!/usr/bin/python #by bafomet import os, sys import time import math import socket import urllib.request from urllib.request import urlopen from json import load from PIL import Image, ImageDraw import wx # use wx to build the UI. from geopy.dist...
code_fim
hard
{ "lang": "python", "repo": "ttt888ttt/OSINT-SAN", "path": "/module/gui/geoLRun.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Load the data center position.""" with open(gv.DC_POS_PATH, 'r') as fh: for line in fh: dcID, _, dcPos = line.rstrip().split(';') self.centerDict[dcID] = [float(i) for i in dcPos.split(',')] #-----------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "ttt888ttt/OSINT-SAN", "path": "/module/gui/geoLRun.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#--GeoMgr---------------------------------------------------------------------- def checkIPValid(self, ipAddr): """ Check whether a IP address is a valid one.""" try: socket.inet_aton(ipAddr) return True except socket.error: return False #--...
code_fim
hard
{ "lang": "python", "repo": "ttt888ttt/OSINT-SAN", "path": "/module/gui/geoLRun.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ader from .preprocess import csv_to_dataset<|fim_prefix|># repo: 1chimaruGin/EfficientDet path: /data/__init__.py from .dataset import CocoDetection, Custom<|fim_middle|>_Dataset from .transforms import * from .loader import create_loader, create_custom_lo
code_fim
medium
{ "lang": "python", "repo": "1chimaruGin/EfficientDet", "path": "/data/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1chimaruGin/EfficientDet path: /data/__init__.py from .dataset import CocoDetection, Custom<|fim_suffix|>ader from .preprocess import csv_to_dataset<|fim_middle|>_Dataset from .transforms import * from .loader import create_loader, create_custom_lo
code_fim
medium
{ "lang": "python", "repo": "1chimaruGin/EfficientDet", "path": "/data/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mailmahee/cassandra-dtest path: /counter_upgrade_test.py import time import os from dtest import Tester, debug from tools import * from assertions import * from ccmlib.cluster import Cluster from ccmlib import common as ccmcommon try: TO_BRANCH = os.environ['CASSANDRA_VERSION'] except KeyEr...
code_fim
hard
{ "lang": "python", "repo": "mailmahee/cassandra-dtest", "path": "/counter_upgrade_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Generally this fails before 10 rows have been added. for x in xrange(10000): debug(x) cursor.execute("UPDATE counters SET row = row+1 where key='a'")<|fim_prefix|># repo: mailmahee/cassandra-dtest path: /counter_upgrade_test.py import time import os from dtest i...
code_fim
hard
{ "lang": "python", "repo": "mailmahee/cassandra-dtest", "path": "/counter_upgrade_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ambarqadeer/ALOPqadeer path: /histing.py import glob from astropy.io import fits import numpy as np import matplotlib.pyplot as plt from astropy.nddata import CCDData import astropy.units as u import ccdproc as ccdp import os import pathlib from ccdproc import ImageFileCollection from astropy.vis...
code_fim
medium
{ "lang": "python", "repo": "ambarqadeer/ALOPqadeer", "path": "/histing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>med=sigma_clip(median,sigma=3,cenfunc='median',stdfunc=mad_std,masked=False) sig=sigma_clip(sigclip,sigma=3,cenfunc='median',stdfunc=mad_std,masked=False) plt.figure(figsize=(10,20)) fig, axs=plt.subplots(2,1) axs[0].hist(med,bins=20,label='median',histtype='stepfilled',log=False) axs[1].hist(sig,bins...
code_fim
medium
{ "lang": "python", "repo": "ambarqadeer/ALOPqadeer", "path": "/histing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #END get_insert_size_std_dev # At some point might do deeper type checking... if not isinstance(returnVal, float): raise ValueError('Method get_insert_size_std_dev return value ' + 'returnVal is not type float as required.') # retur...
code_fim
hard
{ "lang": "python", "repo": "jkbaumohl/ReadsAPI", "path": "/lib/ReadsAPI/ReadsAPIImpl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jkbaumohl/ReadsAPI path: /lib/ReadsAPI/ReadsAPIImpl.py ntents of config file in a hash or None if it couldn't # be found def __init__(self, config): #BEGIN_CONSTRUCTOR self.workspaceURL = config['workspace-url'] #END_CONSTRUCTOR pass def get_id(se...
code_fim
hard
{ "lang": "python", "repo": "jkbaumohl/ReadsAPI", "path": "/lib/ReadsAPI/ReadsAPIImpl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> returnVal = 'NA' #None try: objref = workspace_name + '/' + str(objid) readssetparams = {} readssetparams['workspace_name'] = workspace_name readssetparams['id'] = objid objtype = self.get_type(ctx, readssetparams) ...
code_fim
hard
{ "lang": "python", "repo": "jkbaumohl/ReadsAPI", "path": "/lib/ReadsAPI/ReadsAPIImpl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Godzil/splashbuilder path: /ws_splashbuilder/__init__.py #!/usr/bin/env python3 <|fim_suffix|>from . import splashbuilder from . import cel2wst from . import map2wsm from . import pal2wsp<|fim_middle|>try: from ._version import version as __version__ except ImportError: __version__ = "Un...
code_fim
medium
{ "lang": "python", "repo": "Godzil/splashbuilder", "path": "/ws_splashbuilder/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>from . import splashbuilder from . import cel2wst from . import map2wsm from . import pal2wsp<|fim_prefix|># repo: Godzil/splashbuilder path: /ws_splashbuilder/__init__.py #!/usr/bin/env python3 <|fim_middle|>try: from ._version import version as __version__ except ImportError: __version__ = "Un...
code_fim
medium
{ "lang": "python", "repo": "Godzil/splashbuilder", "path": "/ws_splashbuilder/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # compute (regularized) cross-entropy and update loss tmp_loss += regularized_cross_entropy(self.layers, regularization, tmp_output[label]) if np.argmax(tmp_output) == label: # update accuracy num_corr += 1 ...
code_fim
hard
{ "lang": "python", "repo": "ChengTsungPao/working", "path": "/python/Optimum_Design/project/cnn-from-scratch/src/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChengTsungPao/working path: /python/Optimum_Design/project/cnn-from-scratch/src/model.py from layer import Convolutional, Pooling, FullyConnected, Dense, regularized_cross_entropy, lr_schedule from inout import plot_sample, plot_learning_curve, plot_accuracy_curve, plot_histogram import numpy as ...
code_fim
hard
{ "lang": "python", "repo": "ChengTsungPao/working", "path": "/python/Optimum_Design/project/cnn-from-scratch/src/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if plot_weights: for layer in self.layers: if 'pool' not in layer.name: plot_histogram(layer.name, layer.get_weights()) def evaluate(self, X, y, regularization, plot_correct, plot_missclassified, plot_feature_maps, verbose): loss, num_co...
code_fim
hard
{ "lang": "python", "repo": "ChengTsungPao/working", "path": "/python/Optimum_Design/project/cnn-from-scratch/src/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n17s/batch_rl path: /main.py import tensorflow as tf from batch_rl.baselines.train import main import dopamine def print_gpus(): <|fim_suffix|>if __name__ == '__main__': main()<|fim_middle|> ld = tf.config.list_logical_devices() for ldi in ld: print(ldi)
code_fim
medium
{ "lang": "python", "repo": "n17s/batch_rl", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': main()<|fim_prefix|># repo: n17s/batch_rl path: /main.py import tensorflow as tf from batch_rl.baselines.train import main import dopamine <|fim_middle|> def print_gpus(): ld = tf.config.list_logical_devices() for ldi in ld: print(ldi)
code_fim
medium
{ "lang": "python", "repo": "n17s/batch_rl", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main()<|fim_prefix|># repo: n17s/batch_rl path: /main.py import tensorflow as tf from batch_rl.baselines.train import main import dopamine <|fim_middle|>def print_gpus(): ld = tf.config.list_logical_devices() for ldi in ld: print(ldi)
code_fim
medium
{ "lang": "python", "repo": "n17s/batch_rl", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: feima0011/py_parametric_modeling path: /src/matlabpipetest.py from matlabpipe import MatlabPipe def test_t_tide_demo(matlab): <|fim_suffix|>if __name__ == '__main__': matlab = MatlabPipe(matlab_version='2013a') matlab.open() test_t_tide_demo(matlab)<|fim_middle|> """Call Matlab a...
code_fim
hard
{ "lang": "python", "repo": "feima0011/py_parametric_modeling", "path": "/src/matlabpipetest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': matlab = MatlabPipe(matlab_version='2013a') matlab.open() test_t_tide_demo(matlab)<|fim_prefix|># repo: feima0011/py_parametric_modeling path: /src/matlabpipetest.py from matlabpipe import MatlabPipe def test_t_tide_demo(matlab): <|fim_middle|> """Call Matlab a...
code_fim
hard
{ "lang": "python", "repo": "feima0011/py_parametric_modeling", "path": "/src/matlabpipetest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if len(points) == 0: raise(ValueError("Unable to find valid points within the provided GPX file.")) # Generate DataFrame columns = ['latitude', 'longitude', 'elevation', 'northing', 'easting'] ...
code_fim
hard
{ "lang": "python", "repo": "naveenkratos/volpy", "path": "/volpy/survey.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naveenkratos/volpy path: /volpy/survey.py import pandas as pd import os from defusedxml.ElementTree import parse from .coordinates import CoordinateSystem from .coordinates import UtmCoordinate class Survey(): """ The survey class is the starting point of this library Its data sourc...
code_fim
hard
{ "lang": "python", "repo": "naveenkratos/volpy", "path": "/volpy/survey.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kalekundert/stepwise_mol_bio path: /stepwise_mol_bio/_utils.py #!/usr/bin/env python3 import sys import byoc import autoprop import tidyexc import freezerbox from freezerbox import ReagentConfig, BaseProductConfig, iter_combo_makers from byoc import Method, DocoptConfig from appdirs import AppD...
code_fim
hard
{ "lang": "python", "repo": "kalekundert/stepwise_mol_bio", "path": "/stepwise_mol_bio/_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def comma_list(x): return [x.strip() for x in x.split(',')] def comma_tuple(x): return tuple(comma_list(x)) def comma_set(x): return set(comma_list(x)) def int_or_expr(x): return type_or_expr(int, x) def float_or_expr(x): return type_or_expr(float, x) def type_or_expr(type, x): ...
code_fim
hard
{ "lang": "python", "repo": "kalekundert/stepwise_mol_bio", "path": "/stepwise_mol_bio/_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> input = [sentence_to_tensor(sentence_str, embedding, postags)] print(input) output = model(input) output = softmax(output, dim=1) # print(output) output = output.argmax(dim = 1, keepdim=True) print(output) return [ TAGS[i] for i in output] if __name__ == "__main__": ...
code_fim
hard
{ "lang": "python", "repo": "TuquiSierra/Ehealth", "path": "/extracting_entities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TuquiSierra/Ehealth path: /extracting_entities.py from LSTMnn import MyLSTM from utils import sentence_to_tensor from torch.nn.functional import softmax from scripts.anntools import Collection from pathlib import Path import torch import pickle import string <|fim_suffix|> if __name__ == "__main...
code_fim
hard
{ "lang": "python", "repo": "TuquiSierra/Ehealth", "path": "/extracting_entities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": c = Collection() model = MyLSTM(100, 100, len(TAGS), len(LETTERS), 100) d= torch.load(MODEL_PATH, map_location=torch.device('cpu')) model.load_state_dict(d) embedding = pickle.load(open(EMBEDDING_PATH, 'rb')) postags = pickle.load(open(POSTAG_PATH, 'rb'))...
code_fim
hard
{ "lang": "python", "repo": "TuquiSierra/Ehealth", "path": "/extracting_entities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikita-3108/CoC_PeRKS path: /emotion-recognition-using-speech-master/mytrain.py from deep_emotion_recognition import DeepEmotionRecognizer import pyaudio import os import wave from sys import byteorder from array import array from struct import pack from sklearn.ensemble import GradientBoostingCl...
code_fim
hard
{ "lang": "python", "repo": "nikita-3108/CoC_PeRKS", "path": "/emotion-recognition-using-speech-master/mytrain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if snd_started and num_silent > SILENCE: break sample_width = p.get_sample_size(FORMAT) stream.stop_stream() stream.close() p.terminate() r = normalize(r) r = trim(r) r = add_silence(r, 0.5) return sample_width, r if __name__ =="__main__": print("The...
code_fim
hard
{ "lang": "python", "repo": "nikita-3108/CoC_PeRKS", "path": "/emotion-recognition-using-speech-master/mytrain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sammacorpy/alpha_search_engine path: /searchpage/views.py from django.shortcuts import render,redirect from django.http import HttpResponse # from django.views.decorators.http import require_POST # from .models import * import time from django.conf import settings import os # from .forms import t...
code_fim
hard
{ "lang": "python", "repo": "sammacorpy/alpha_search_engine", "path": "/searchpage/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> finalres = [] for i in sorted(dic.keys(), reverse=True): if i > float(0): for j in dic[i]: # print(j) with open(j.replace("words_data", "scrap_data",).replace(".csv", ""), encoding="utf8") as final: ...
code_fim
hard
{ "lang": "python", "repo": "sammacorpy/alpha_search_engine", "path": "/searchpage/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunliwen/poco path: /poco/common/test_utils.py import json import copy from django.conf import settings from django.test import TestCase from apps.apis.search import es_search_functions from django.core.urlresolvers import reverse import site_manage_utils from common.mongo_client import getMongoC...
code_fim
hard
{ "lang": "python", "repo": "sunliwen/poco", "path": "/poco/common/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from apps.apis.search.tasks import rebuild_suggestion_cache rebuild_suggestion_cache.delay(self.TEST_SITE_ID) def postItems(self, test_data_module, item_ids, site_token=None): self.assertItemsCount(0) items = test_data_module.getItems(None) for item in items: ...
code_fim
hard
{ "lang": "python", "repo": "sunliwen/poco", "path": "/poco/common/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def rebuildSuggestionCache(self): from apps.apis.search.tasks import rebuild_suggestion_cache rebuild_suggestion_cache.delay(self.TEST_SITE_ID) def postItems(self, test_data_module, item_ids, site_token=None): self.assertItemsCount(0) items = test_data_module.getIt...
code_fim
hard
{ "lang": "python", "repo": "sunliwen/poco", "path": "/poco/common/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> del self.net['throat.seed'] del self.net.models['throat.seed'] self.net['pore.seed'] = np.random.rand(self.net.Np,) self.net.add_model(model=mods.from_neighbor_pores, propname='throat.seed', prop='pore.seed', ...
code_fim
hard
{ "lang": "python", "repo": "PMEAL/OpenPNM", "path": "/tests/unit/models/misc/MiscTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PMEAL/OpenPNM path: /tests/unit/models/misc/MiscTest.py import numpy as np import scipy.stats as spst from numpy.testing import assert_approx_equal, assert_array_almost_equal_nulp import openpnm as op import openpnm.models.misc as mods class MiscTest: def setup_class(self): self.n...
code_fim
hard
{ "lang": "python", "repo": "PMEAL/OpenPNM", "path": "/tests/unit/models/misc/MiscTest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmarqu/cocotb path: /tests/test_cases/test_toplevel_library/test_myentity.py # Copyright cocotb contributors # Licensed under the Revised BSD License, see LICENSE for details. # SPDX-License-Identifier: BSD-3-Clause <|fim_suffix|> @cocotb.test() async def test_myentity(dut): # if we got here...
code_fim
easy
{ "lang": "python", "repo": "cmarqu/cocotb", "path": "/tests/test_cases/test_toplevel_library/test_myentity.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@cocotb.test() async def test_myentity(dut): # if we got here, the test worked pass<|fim_prefix|># repo: cmarqu/cocotb path: /tests/test_cases/test_toplevel_library/test_myentity.py # Copyright cocotb contributors # Licensed under the Revised BSD License, see LICENSE for details. # SPDX-License-I...
code_fim
easy
{ "lang": "python", "repo": "cmarqu/cocotb", "path": "/tests/test_cases/test_toplevel_library/test_myentity.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nvitucci/pyke path: /pyke/condensedPrint.py # $Id: condensedPrint.py 081917d30609 2010-03-05 mtnyogi $ # coding=utf-8 # # Copyright © 2007-2008 Bruce Frederiksen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation file...
code_fim
hard
{ "lang": "python", "repo": "nvitucci/pyke", "path": "/pyke/condensedPrint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def printSeq(startChar, endChar, seq, maxdepth): """ >>> printSeq('(', ')', (1, 2, 3), 4) ['(', '1', '2', '3', ')'] >>> printSeq('(', ')', (), 4) ['(', ')'] """ if maxdepth < 1: return '&' maxdepth -= 1 return [startChar] + [cprint2(x, maxdepth) for x in...
code_fim
hard
{ "lang": "python", "repo": "nvitucci/pyke", "path": "/pyke/condensedPrint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/StockQuantity.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class StockQuantity(object): <|fim_suffix|> @date.setter def date(self, value): self._date = ...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/StockQuantity.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def to_alipay_dict(self): params = dict() if self.date: if hasattr(self.date, 'to_alipay_dict'): params['date'] = self.date.to_alipay_dict() else: params['date'] = self.date if self.quantity: if hasattr(self.qu...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/StockQuantity.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Write files to fileStore transcriptome_id = job.fileStore.writeGlobalFile(os.path.join(job.tempDir, 'rnaAligned.toTranscriptome.out.bam')) aligned_id = job.fileStore.writeGlobalFile(aligned_bam_path) if save_aligned_bam else None wiggle_path = os.path.join(job.tempDir, 'rnaSignal.UniqueM...
code_fim
hard
{ "lang": "python", "repo": "BD2KGenomics/toil-rnaseq", "path": "/src/toil_rnaseq/tools/aligners.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BD2KGenomics/toil-rnaseq path: /src/toil_rnaseq/tools/aligners.py import os import subprocess from toil.lib.docker import dockerCall from toil_rnaseq.tools import star_version from toil_rnaseq.utils.files import tarball_files from toil_rnaseq.utils.urls import download_url def run_star(job, r...
code_fim
hard
{ "lang": "python", "repo": "BD2KGenomics/toil-rnaseq", "path": "/src/toil_rnaseq/tools/aligners.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.bce_weight == 1: return self.bce_loss(outputs, targets) elif self.dice_weight == 1: return self.dice_loss(outputs, targets) else: bce = self.bce_loss(outputs, targets) * self.bce_weight dice = self.dice_loss(outputs, targets) ...
code_fim
hard
{ "lang": "python", "repo": "pandov/mmcs-diploma", "path": "/src/criterion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pandov/mmcs-diploma path: /src/criterion.py from torch import Tensor import torch from src.metric import dice, iou class ReducibleLoss(torch.nn.Module): def __init__(self, reduction: str = None): super().__init__() self.reduction = reduction <|fim_suffix|> def forward(s...
code_fim
medium
{ "lang": "python", "repo": "pandov/mmcs-diploma", "path": "/src/criterion.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def sequence(l, u): return [i for i in range(l, u+l)] def check(husband, wife): for i, m in enumerate(husband): if wife[m] == i: print('Match') else: print('Error!') def inverse_women(women, n): inv_women = [] for woman in women: inverse = ...
code_fim
hard
{ "lang": "python", "repo": "gustavo-moura/SCC5900-algorithm-design", "path": "/01-stable-marriage-problem/stable_marriage_problem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gustavo-moura/SCC5900-algorithm-design path: /01-stable-marriage-problem/stable_marriage_problem.py # -*- coding: utf-8 -*- """ # Stable Marriage Problem ## SCC5900 - Algorithm Design ### Lecture 1 #### v1.1 """ import sys data = sys.stdin.readlines() content = [line.rstrip() for line in data]...
code_fim
hard
{ "lang": "python", "repo": "gustavo-moura/SCC5900-algorithm-design", "path": "/01-stable-marriage-problem/stable_marriage_problem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> wife = nones(n) husband = nones(n) freeman = sequence(0, n) while len(freeman) != 0: # print(f'freeman={freeman}') m = freeman[0] man = men[m] # print(f'm={m}') # print(f'man={man}') for w in man: # print(f'w={w}') ...
code_fim
hard
{ "lang": "python", "repo": "gustavo-moura/SCC5900-algorithm-design", "path": "/01-stable-marriage-problem/stable_marriage_problem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": wsgi_app = GUnicornFlaskApplication(app) wsgi_app.run( worker_class="gunicorn.workers.ggevent.GeventWorker", bind="0.0.0.0:8000" )<|fim_prefix|># repo: shuangrain/binary-flask-sample-on-the-container path: /src/wsgi.py from abc import ABC from guni...
code_fim
hard
{ "lang": "python", "repo": "shuangrain/binary-flask-sample-on-the-container", "path": "/src/wsgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }