text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/1154. Day of the Year/1154.py class Solution: def dayOfYear(self, date: str) -> int: <|fim_suffix|> year = int(date[:4]) month = int(date[5:7]) day = int(date[8:]) days = [31, 29 if isLeapYear( year) else 28, 31, 30, 31, 30, 31, 31, 30, 3...
code_fim
medium
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/1154. Day of the Year/1154.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return sum(days[:month - 1]) + day<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/1154. Day of the Year/1154.py class Solution: def dayOfYear(self, date: str) -> int: <|fim_middle|> def isLeapYear(year: int) -> bool: return (year % 4 == 0 and year % 100 != 0) or year % 400 == 0 ...
code_fim
hard
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/1154. Day of the Year/1154.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmccloskey/SBaaS_MFA path: /template_scripts/template_analyzeFittedNetFluxDifferences.py import sys sys.path.append('C:/Users/dmccloskey-sbrg/Google Drive/SBaaS_base') from SBaaS_base.postgresql_settings import postgresql_settings from SBaaS_base.postgresql_orm import postgresql_orm # read in th...
code_fim
hard
{ "lang": "python", "repo": "dmccloskey/SBaaS_MFA", "path": "/template_scripts/template_analyzeFittedNetFluxDifferences.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>analysis_ids = [ 'ALEsKOs01_0_11_evo04tpiA', 'ALEsKOs01_150526_iDM2015_full05_OxicEvo04tpiAEcoli13CGlc_0', 'ALEsKOs01_150526_iDM2015_full05_OxicEvo04tpiAEvo01EPEcoli13CGlc_11', 'ALEsKOs01_150526_iDM2015_full05_OxicEvo04tpiAEvo02EPEcoli13CGlc_11', 'ALEsKOs01_150526_iDM2015_full05_OxicEv...
code_fim
hard
{ "lang": "python", "repo": "dmccloskey/SBaaS_MFA", "path": "/template_scripts/template_analyzeFittedNetFluxDifferences.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> theta = np.deg2rad(theta) direction = "/gps/direction {} 0 {}\n".format(np.sin(theta), -np.cos(theta)) radius = 0.15 position = "/gps/position {} 0. {} m\n".format(radius*np.sin(theta), radius*np.cos(theta)) number = "/run/beamOn {}\n".format(number) return particle+energy+direct...
code_fim
hard
{ "lang": "python", "repo": "Zelenyy/phd-code", "path": "/python/data_saving/satellite_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zelenyy/phd-code path: /python/data_saving/satellite_client.py import logging import numpy as np import matplotlib.pyplot as plt from phd.satellite.geant4_server import Geant4Server, DetectorMode <|fim_suffix|>def main(): logging.root.setLevel(logging.INFO) with Geant4Server(["./build/s...
code_fim
hard
{ "lang": "python", "repo": "Zelenyy/phd-code", "path": "/python/data_saving/satellite_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): logging.root.setLevel(logging.INFO) with Geant4Server(["./build/satellite/geant4-satellite.exe server"]) as server: server.start(DetectorMode.SUM) for energy in [30, 40, 50, 100]: text = get_request(energy, number=100) run = server.send(text) ...
code_fim
hard
{ "lang": "python", "repo": "Zelenyy/phd-code", "path": "/python/data_saving/satellite_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aruba/aoscx-ansible-collection path: /plugins/modules/aoscx_vlan_interface.py #!/usr/bin/python # -*- coding: utf-8 -*- # (C) Copyright 2019-2023 Hewlett Packard Enterprise Development LP. # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __futu...
code_fim
hard
{ "lang": "python", "repo": "aruba/aoscx-ansible-collection", "path": "/plugins/modules/aoscx_vlan_interface.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vlan_id = ansible_module.params["vlan_id"] admin_state = ansible_module.params["admin_state"] ipv4 = ansible_module.params["ipv4"] ipv6 = ansible_module.params["ipv6"] vrf = ansible_module.params["vrf"] description = ansible_module.params["description"] ip_helper_address = ansi...
code_fim
hard
{ "lang": "python", "repo": "aruba/aoscx-ansible-collection", "path": "/plugins/modules/aoscx_vlan_interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if active_gateway_ip and active_gateway_mac_v4: modified_op2 = vlan_interface.set_active_gateway( active_gateway_ip, active_gateway_mac_v4 ) modified_op = modified_op2 or modified_op if ip_helper_address: # Create DHCP_Relay ...
code_fim
hard
{ "lang": "python", "repo": "aruba/aoscx-ansible-collection", "path": "/plugins/modules/aoscx_vlan_interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> skip_if_url_is_not_available(TOPURL, regex='service provider outage') with chpwd(tmpdir): if create: with open("README.txt", 'w') as f: f.write(" ") pipe = [ crawl_url(TOPURL), [ assign({'dataset': dataset}), ...
code_fim
hard
{ "lang": "python", "repo": "datalad/datalad-crawler", "path": "/datalad_crawler/pipelines/tests/test_fcptable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with chpwd(tmpdir): if create: with open("README.txt", 'w') as f: f.write(" ") pipe = [ crawl_url(TOPURL), [ assign({'dataset': dataset}), skip_if({'dataset': 'Cleveland CCF|Durham_Madden|NewYork_Test...
code_fim
hard
{ "lang": "python", "repo": "datalad/datalad-crawler", "path": "/datalad_crawler/pipelines/tests/test_fcptable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datalad/datalad-crawler path: /datalad_crawler/pipelines/tests/test_fcptable.py # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING...
code_fim
hard
{ "lang": "python", "repo": "datalad/datalad-crawler", "path": "/datalad_crawler/pipelines/tests/test_fcptable.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EruDev/eru_manager path: /showdata/models.py from django.db import models <|fim_suffix|> verbose_name = 'CPU数据表' verbose_name_plural = verbose_name<|fim_middle|>class CPUData(models.Model): data = models.CharField(max_length=128, verbose_name='CPU数据') time = models.DateTi...
code_fim
medium
{ "lang": "python", "repo": "EruDev/eru_manager", "path": "/showdata/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> verbose_name = 'CPU数据表' verbose_name_plural = verbose_name<|fim_prefix|># repo: EruDev/eru_manager path: /showdata/models.py from django.db import models class CPUData(models.Model): data = models.CharField(max_length=128, verbose_name='CPU数据') time = models.DateTimeField(verbos...
code_fim
easy
{ "lang": "python", "repo": "EruDev/eru_manager", "path": "/showdata/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data = models.CharField(max_length=128, verbose_name='CPU数据') time = models.DateTimeField(verbose_name='监听时间') class Meta: verbose_name = 'CPU数据表' verbose_name_plural = verbose_name<|fim_prefix|># repo: EruDev/eru_manager path: /showdata/models.py from django.db import models...
code_fim
easy
{ "lang": "python", "repo": "EruDev/eru_manager", "path": "/showdata/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bunnyblanco/vendrest path: /vendrest/models/__init__.py from vendrest.models.transaction import ( Transaction, Resource <|fim_suffix|> Product, ProductCost )<|fim_middle|> ) from vendrest.models.product import (
code_fim
easy
{ "lang": "python", "repo": "bunnyblanco/vendrest", "path": "/vendrest/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Product, ProductCost )<|fim_prefix|># repo: bunnyblanco/vendrest path: /vendrest/models/__init__.py from vendrest.models.transaction import ( <|fim_middle|> Transaction, Resource ) from vendrest.models.product import (
code_fim
medium
{ "lang": "python", "repo": "bunnyblanco/vendrest", "path": "/vendrest/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danigfavero/ada path: /venv/lib/python3.7/site-packages/environs.py # -*- coding: utf-8 -*- import contextlib import inspect import functools import json as pyjson import os import re try: import urllib.parse as urlparse except ImportError: # Python 2 import urlparse try: from c...
code_fim
hard
{ "lang": "python", "repo": "danigfavero/ada", "path": "/venv/lib/python3.7/site-packages/environs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def decorator(func): self.add_parser(name, func) return func return decorator def add_parser_from_field(self, name, field_cls): """Register a new parser method with name ``name``, given a marshmallow ``Field``.""" self.__parser_map__[name] = _f...
code_fim
hard
{ "lang": "python", "repo": "danigfavero/ada", "path": "/venv/lib/python3.7/site-packages/environs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return decorator def add_parser_from_field(self, name, field_cls): """Register a new parser method with name ``name``, given a marshmallow ``Field``.""" self.__parser_map__[name] = _field2method(field_cls, method_name=name) def dump(self): """Dump parsed environme...
code_fim
hard
{ "lang": "python", "repo": "danigfavero/ada", "path": "/venv/lib/python3.7/site-packages/environs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: becauseIknowNothing/automate-the-boring-stuff-projects path: /Functions/The Collatz Sequence.py def collatz(number): if number%2==0: return number//2 return 3*number + 1 <|fim_suffix|>print("Input the number.") myNumber=userInput() while myNumber !=1: myNumber=collatz(myNumb...
code_fim
hard
{ "lang": "python", "repo": "becauseIknowNothing/automate-the-boring-stuff-projects", "path": "/Functions/The Collatz Sequence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("Input the number.") myNumber=userInput() while myNumber !=1: myNumber=collatz(myNumber) print(myNumber)<|fim_prefix|># repo: becauseIknowNothing/automate-the-boring-stuff-projects path: /Functions/The Collatz Sequence.py def collatz(number): if number%2==0: return number//2 ...
code_fim
hard
{ "lang": "python", "repo": "becauseIknowNothing/automate-the-boring-stuff-projects", "path": "/Functions/The Collatz Sequence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # bytes_buffer1 = bytes_buffer1 + data[j*8 + 0] # bytes_buffer1[j*2 + 1] = data[j*8 + 1] # bytes_buffer1[j*2 + 0] = data[j*8 + 2] # bytes_buffer1[j*2 + 1] = data[j*8 + 3] # bytes_buffer1[j*2 + 0] = data[j*8 + 4] # bytes_buffer1[j*2 + ...
code_fim
hard
{ "lang": "python", "repo": "JoeyYoung/sound_localization", "path": "/read_from_mic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoeyYoung/sound_localization path: /read_from_mic.py # Sound Source locate # # @Time : 2019-11-01 16:36 # @Author : xyzhao # @File : read_from_mic.py # @Description: record and split wav files from real microphones import pyaudio import wave import json import signal import sys import os...
code_fim
hard
{ "lang": "python", "repo": "JoeyYoung/sound_localization", "path": "/read_from_mic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> wave_file.close() def sigint_handler(signum, frame): stream.stop_stream() stream.close() p.terminate() close_files() print('catched interrupt signal!') sys.exit(0) if __name__ == "__main__": # Register ctrl-c interruption # signal.signal(signal.SIGINT, sigint_handle...
code_fim
hard
{ "lang": "python", "repo": "JoeyYoung/sound_localization", "path": "/read_from_mic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = self.pool1(F.relu(self.conv1(x))) x = nn.Dropout(p=0.3)(x) x = self.pool2(F.relu(self.conv2(x))) x = nn.Dropout(p=0.3)(x) x = self.pool3(F.relu(self.conv3(x))) x = nn.Dropout(p=0.3)(x) return x # will be used during inference def forwar...
code_fim
hard
{ "lang": "python", "repo": "alyildiz/facial_landmark", "path": "/modeling/src/models/basic_cnn/pl_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alyildiz/facial_landmark path: /modeling/src/models/basic_cnn/pl_model.py import pytorch_lightning as pl import torch from torch import nn from torch.nn import functional as F class BasicCNNModel(pl.LightningModule): def __init__(self, input_shape, learning_rate=0.001): super().__in...
code_fim
hard
{ "lang": "python", "repo": "alyildiz/facial_landmark", "path": "/modeling/src/models/basic_cnn/pl_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def __is_valid_time_symbol(time_symbol) -> bool: return isinstance(time_symbol, TimeSymbolType) or None<|fim_prefix|># repo: mysliwietzflorian/omr-demo-mt path: /src/model/attribute/time.py from typing import Optional from absl import logging from src.model.enum.time_symbo...
code_fim
hard
{ "lang": "python", "repo": "mysliwietzflorian/omr-demo-mt", "path": "/src/model/attribute/time.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.beats = beats self.beats_type = beats_type if Time.__is_valid_time_symbol(time_symbol): self.time_symbol = time_symbol else: logging.error("Time-Symbol value \"{}\" is not valid".format(time_symbol)) @staticmethod def __is_valid_time_s...
code_fim
medium
{ "lang": "python", "repo": "mysliwietzflorian/omr-demo-mt", "path": "/src/model/attribute/time.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mysliwietzflorian/omr-demo-mt path: /src/model/attribute/time.py from typing import Optional from absl import logging from src.model.enum.time_symbol_type import TimeSymbolType class Time(object): <|fim_suffix|> self.beats = beats self.beats_type = beats_type if Time._...
code_fim
medium
{ "lang": "python", "repo": "mysliwietzflorian/omr-demo-mt", "path": "/src/model/attribute/time.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nishaq503/CHESS path: /tests/test_manifold.py import random import unittest from tempfile import TemporaryFile import numpy as np from scipy.spatial.distance import cdist from chess import datasets, criterion from chess.manifold import Manifold, Cluster np.random.seed(42) random.seed(42) cla...
code_fim
hard
{ "lang": "python", "repo": "nishaq503/CHESS", "path": "/tests/test_manifold.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_build(self): m = Manifold(self.data, 'euclidean').build(criterion.MaxDepth(1)) self.assertEqual(2, len(m.graphs)) m.build(criterion.MaxDepth(2)) self.assertEqual(3, len(m.graphs)) m.build() self.assertEqual(len(self.data), len(m.graphs[-1])) ...
code_fim
hard
{ "lang": "python", "repo": "nishaq503/CHESS", "path": "/tests/test_manifold.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("core", "0042_alter_unitgroup_subject"), ] operations = [ migrations.AddField( model_name="unitgroup", name="artwork_thumb_md", field=models.ImageField( blank=True, help_text="Artwork for thi...
code_fim
hard
{ "lang": "python", "repo": "vEnhance/otis-web", "path": "/core/migrations/0043_unitgroup_artwork_thumb_md_and_more.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vEnhance/otis-web path: /core/migrations/0043_unitgroup_artwork_thumb_md_and_more.py # Generated by Django 4.1.4 on 2022-12-30 18:59 from django.db import migrations, models import core.models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField(...
code_fim
hard
{ "lang": "python", "repo": "vEnhance/otis-web", "path": "/core/migrations/0043_unitgroup_artwork_thumb_md_and_more.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name="unitgroup", name="artwork_thumb_md", field=models.ImageField( blank=True, help_text="Artwork for this unit", null=True, upload_to=core.models.artw...
code_fim
hard
{ "lang": "python", "repo": "vEnhance/otis-web", "path": "/core/migrations/0043_unitgroup_artwork_thumb_md_and_more.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plazaCenter = (radii[ring] + HALF_STREET_WIDTH, 0) plazaCenter = rotatePoint(radialRadians(radial), plazaCenter) angle /= 2.0 radialAngle = radialDegrees(radial) angle1 = radialAngle + angle angle2 = radialAngle - angle rings = xrange(toRing, ring + 1) if toRing < ring else xrange(ring + 1, toRin...
code_fim
hard
{ "lang": "python", "repo": "nightjuggler/brc", "path": "/gensvg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nightjuggler/brc path: /gensvg.py #!/usr/bin/python import math BLOCK_WIDTH = 200 HALF_STREET_WIDTH = 20 STREET_WIDTH = 2 * HALF_STREET_WIDTH MAN_TO_ESPLANADE = 2500 # Distance from the center of the Man to the center of Esplanade ESPLANADE_TO_A = 400 # Width of the block from Esplanade to A...
code_fim
hard
{ "lang": "python", "repo": "nightjuggler/brc", "path": "/gensvg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bglima/mlclass path: /04_Reinforcement/montecarlo.py ''' Created on 21 de mai de 2018 Objetivo: Provar a solução do problema de Monty Hall utilizando Monte Carlo @authors: Bruno Gabriel Lima João Paulo Clarindo Nilson Sales ''' import random as rand import matplotlib.pyplot...
code_fim
hard
{ "lang": "python", "repo": "bglima/mlclass", "path": "/04_Reinforcement/montecarlo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fig = plt.figure(figsize=(8, 6)) ax = plt.subplot(111) for policy in policies: (success, V_list) = evaluate_policy_dt(policy, n_doors, trials) print("Política: ", policy, "\nNúmero de tentativas:{}\nAcertos:{}\nPorcentagem:{}\n".format(trials, success, round(V_list[-1],3))) ...
code_fim
hard
{ "lang": "python", "repo": "bglima/mlclass", "path": "/04_Reinforcement/montecarlo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = np.load(data_file_path) data = abs(data) #taking the absolute value # The valid option implies that the convolution product is only given for # points where the kernel and the signals overlap completely data = np.apply_along_axis(np.convolve, 2, data, np.ones((nb_sampl...
code_fim
hard
{ "lang": "python", "repo": "palvalab/visual-perception", "path": "/baseline_correction_of_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: palvalab/visual-perception path: /baseline_correction_of_data.py # -*- coding: utf-8 -*- """Once all condition arrays are created via 'import_data_to_python.py', this script takes the absolute real value and performs baseline subtraction Created on Fri Jun 08 10:58:16 2018 @author: hamed ...
code_fim
medium
{ "lang": "python", "repo": "palvalab/visual-perception", "path": "/baseline_correction_of_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for condition in condition_arrays: data_file_path = data_dir + condition processed_file_path = data_dir + os.path.splitext(condition)[0] + '_w5_BLcorrected' #filename of processesed file data = np.load(data_file_path) data = abs(data) #taking the absolute value # ...
code_fim
hard
{ "lang": "python", "repo": "palvalab/visual-perception", "path": "/baseline_correction_of_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # this is stateful, even though it shouldn't be, # because the comparees are given as args to compare() and not as attributes to __init__()). self._metrics = [] @staticmethod def record_key_getter(metadata): return metadata['name'] def get_metadata_collector(...
code_fim
hard
{ "lang": "python", "repo": "yocheah/dac-man", "path": "/dacman/plugins/hdf5/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yocheah/dac-man path: /dacman/plugins/hdf5/__init__.py np try: import h5py as h5 except ImportError: from dacman.core.utils import dispatch_import_error dispatch_import_error(module_name='h5py', plugin_name='HDF5') from dacman.compare import base from . import metadata from .util ...
code_fim
hard
{ "lang": "python", "repo": "yocheah/dac-man", "path": "/dacman/plugins/hdf5/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # print(f'key_comp={key_comp}') obj_pair_metrics = self.get_comparison_metrics(key_comp, obj_md_a, obj_md_b) # print(f'obj_pair_a={obj_pair_metrics.a}') # print(f'obj_pair_b={obj_pair_metrics.b}') obj_pair_metrics.calculate() objs_met...
code_fim
hard
{ "lang": "python", "repo": "yocheah/dac-man", "path": "/dacman/plugins/hdf5/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: dir_path: string path to a directory. err_loc: the location to report if an error occurs. May be None (default) to report dir_path. Returns: string path to the local config file. Raises: ConfigError: if a config file could not be foun...
code_fim
hard
{ "lang": "python", "repo": "jonsim/tiny-install", "path": "/install", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonsim/tiny-install path: /install #!/usr/bin/env python # (c) Copyright 2017 Jonathan Simmonds # # Licensed under the MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in ...
code_fim
hard
{ "lang": "python", "repo": "jonsim/tiny-install", "path": "/install", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_config_from_local_dir(dir_path, err_loc=None): """Retrieves a path to the config file from a local directory. Args: dir_path: string path to a directory. err_loc: the location to report if an error occurs. May be None (default) to report dir_path. Ret...
code_fim
hard
{ "lang": "python", "repo": "jonsim/tiny-install", "path": "/install", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> productDetails = marketplace.describe_entity(EntityId=productId,Catalog='AWSMarketplace') logging.debug('describe_entity={}'.format(productDetails)) entityId = productDetails['EntityIdentifier'] revisionArns = finalizeresponse['Arn'] arnParts = finalizeresponse...
code_fim
hard
{ "lang": "python", "repo": "masinazarian/aws-data-exchange-publisher-coordinator", "path": "/source/FinalizeAndUpdateCatalogFunction/app.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|>def lambda_handler(event, context): try: global log_level log_level = str(os.environ.get('LOG_LEVEL')).upper() if log_level not in [ 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRIT...
code_fim
medium
{ "lang": "python", "repo": "masinazarian/aws-data-exchange-publisher-coordinator", "path": "/source/FinalizeAndUpdateCatalogFunction/app.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: masinazarian/aws-data-exchange-publisher-coordinator path: /source/FinalizeAndUpdateCatalogFunction/app.py #!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################## # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserve...
code_fim
hard
{ "lang": "python", "repo": "masinazarian/aws-data-exchange-publisher-coordinator", "path": "/source/FinalizeAndUpdateCatalogFunction/app.py", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> # Ask each model to make a prediction and then update it oof = {} for i, classifier in enumerate(self): oof[f'oof_{i}'] = classifier.predict_proba_one(x).get(True, 0.5) classifier.fit_one(x, y) # Optionally, add the base features if self.inc...
code_fim
hard
{ "lang": "python", "repo": "lffranca/creme", "path": "/creme/ensemble/stacking.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lffranca/creme path: /creme/ensemble/stacking.py import typing from creme import base __all__ = ['StackingBinaryClassifier'] class StackingBinaryClassifier(base.Ensemble, base.BinaryClassifier): """Stacking for binary classification. Parameters: classifiers meta_clas...
code_fim
hard
{ "lang": "python", "repo": "lffranca/creme", "path": "/creme/ensemble/stacking.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return self def predict_proba_one(self, x): oof = { f'oof_{i}': classifier.predict_proba_one(x).get(True, 0.5) for i, classifier in enumerate(self) } if self.include_features: oof.update(x) return self.meta_classifier.pred...
code_fim
hard
{ "lang": "python", "repo": "lffranca/creme", "path": "/creme/ensemble/stacking.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>Let's say that we know x is 1 or 0. How would we use it to set the ith bit to x, given that we used AND to clear the bit (set it to 0) but OR to set the bit (set it to 1)? Here is one approach for what to return (n & (~(1 << i))) | (x << i). What this does is force the ith bit to zero, then ORs it with 0...
code_fim
medium
{ "lang": "python", "repo": "heitorchang/learn-code", "path": "/battles/interview/bit_manipulation/insertBits.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heitorchang/learn-code path: /battles/interview/bit_manipulation/insertBits.py description = """ Given an integer n, replace its bits starting from the bit at position a to the bit at position b, inclusive, with the bits of integer k. Count from the least significant bit to the most significant b...
code_fim
medium
{ "lang": "python", "repo": "heitorchang/learn-code", "path": "/battles/interview/bit_manipulation/insertBits.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lenN = n.bit_length() lenK = k.bit_length() leftMask = ((1 << lenN) - 1) ^ ((1 << (b+1)) - 1) # print(bin(n)) # print(bin(leftMask)) rightSide = ((1 << a) - 1) & n # print(bin(rightSide)) kInPlace = k << a # print(bin(kInPlace)) return (n & leftMask) | kInPlace ...
code_fim
hard
{ "lang": "python", "repo": "heitorchang/learn-code", "path": "/battles/interview/bit_manipulation/insertBits.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FormantIO/formant path: /examples/python/grpc_api/protos/model/v1/file_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: protos/model/v1/file.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from go...
code_fim
hard
{ "lang": "python", "repo": "FormantIO/formant", "path": "/examples/python/grpc_api/protos/model/v1/file_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>_FILE.oneofs_by_name['data'].fields.append( _FILE.fields_by_name['url']) _FILE.fields_by_name['url'].containing_oneof = _FILE.oneofs_by_name['data'] _FILE.oneofs_by_name['data'].fields.append( _FILE.fields_by_name['raw']) _FILE.fields_by_name['raw'].containing_oneof = _FILE.oneofs_by_name['data'] DESC...
code_fim
hard
{ "lang": "python", "repo": "FormantIO/formant", "path": "/examples/python/grpc_api/protos/model/v1/file_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> db_table = "skiresorts" def __str__(self): return self.name<|fim_prefix|># repo: RitzAnthony/Ski_GeoDjango path: /geoweb/skiresorts/models.py from django.contrib.gis.db import models class Skiresort(models.Model): <|fim_middle|> name = models.CharField(max_length=200) geom =...
code_fim
medium
{ "lang": "python", "repo": "RitzAnthony/Ski_GeoDjango", "path": "/geoweb/skiresorts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RitzAnthony/Ski_GeoDjango path: /geoweb/skiresorts/models.py from django.contrib.gis.db import models class Skiresort(models.Model): <|fim_suffix|> db_table = "skiresorts" def __str__(self): return self.name<|fim_middle|> name = models.CharField(max_length=200) geom =...
code_fim
medium
{ "lang": "python", "repo": "RitzAnthony/Ski_GeoDjango", "path": "/geoweb/skiresorts/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.name<|fim_prefix|># repo: RitzAnthony/Ski_GeoDjango path: /geoweb/skiresorts/models.py from django.contrib.gis.db import models class Skiresort(models.Model): name = models.CharField(max_length=200) geom = models.MultiPolygonField(srid=21781, null=True...
code_fim
easy
{ "lang": "python", "repo": "RitzAnthony/Ski_GeoDjango", "path": "/geoweb/skiresorts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> source = '/users2/Datasets/PASCAL_VOC/VOCdevkit/VOC2012_Resize/source.txt' root_old = '/users2/Datasets/PASCAL_VOC/VOCdevkit/VOC2012' root_new = '/users2/Datasets/PASCAL_VOC/VOCdevkit/VOC2012_Resize' out_shape = 416 with open(source, 'r') as src: lines = src.readlines() print 'Processing...
code_fim
medium
{ "lang": "python", "repo": "opencv/opencv_contrib", "path": "/modules/dnn_objdetect/scripts/pascal_preprocess.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: opencv/opencv_contrib path: /modules/dnn_objdetect/scripts/pascal_preprocess.py from skimage import io, transform from multiprocessing.dummy import Pool as ThreadPool def rescale(root_new, root_old, img_path, ann_path, out_shape): try: img = io.imread(root_old+"/"+img_path) except Except...
code_fim
medium
{ "lang": "python", "repo": "opencv/opencv_contrib", "path": "/modules/dnn_objdetect/scripts/pascal_preprocess.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> public = True if access.lower()=='open' else False if access.lower()=='controlled' else None results = AuthorizedDataset.get_datasets(name=name, whitelist_id=id, public=public) datasets = [ { 'name': x.name, 'dataset_id': x.whitelist_id...
code_fim
hard
{ "lang": "python", "repo": "isb-cgc/ISB-CGC-API", "path": "/apiv4/program_views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isb-cgc/ISB-CGC-API path: /apiv4/program_views.py # # Copyright 2019, Institute for Systems Biology # # 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...
code_fim
hard
{ "lang": "python", "repo": "isb-cgc/ISB-CGC-API", "path": "/apiv4/program_views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def load_fixture(apps, schema_editor): objects = deserialize_fixture() for obj in objects: obj.save() def unload_fixture(apps, schema_editor): """Delete all EmailTemplate objects""" objects = deserialize_fixture() EmailTemplate = apps.get_model("helpdesk", "emailtemplate"...
code_fim
hard
{ "lang": "python", "repo": "django-helpdesk/django-helpdesk", "path": "/helpdesk/migrations/0003_initial_data_import.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: django-helpdesk/django-helpdesk path: /helpdesk/migrations/0003_initial_data_import.py # -*- coding: utf-8 -*- import os from sys import path from django.db import models, migrations from django.core import serializers fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fi...
code_fim
hard
{ "lang": "python", "repo": "django-helpdesk/django-helpdesk", "path": "/helpdesk/migrations/0003_initial_data_import.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def deserialize_fixture(): fixture_file = os.path.join(fixture_dir, fixture_filename) with open(fixture_file, 'rb') as fixture: return list(serializers.deserialize('json', fixture, ignorenonexistent=True)) def load_fixture(apps, schema_editor): objects = deserialize_fixture() f...
code_fim
medium
{ "lang": "python", "repo": "django-helpdesk/django-helpdesk", "path": "/helpdesk/migrations/0003_initial_data_import.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: HawkingLaugh/Data-Processing-Using-Python path: /Week4/31. statistics_analysis.py #%% from sklearn import datasets import pandas as pd import matplotlib.pyplot as plt # import scipy iris = datasets.load_iris() iris_df = pd.DataFrame(iris.data) iris_df.columns = iris.feature_names iris_df['target...
code_fim
medium
{ "lang": "python", "repo": "HawkingLaugh/Data-Processing-Using-Python", "path": "/Week4/31. statistics_analysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># extract the result of .quantile([0.25,0.75]) to calculate the interquartile range iris_df.iloc[:,0].quantile([0.75]).loc[0.75] - iris_df.iloc[:,0].quantile([0.25]).loc[0.25] # cal from .describe() iris_df.iloc[:,0].describe().loc['75%'] - iris_df.iloc[:,0].describe().loc['25%'] # %%<|fim_prefix|># r...
code_fim
hard
{ "lang": "python", "repo": "HawkingLaugh/Data-Processing-Using-Python", "path": "/Week4/31. statistics_analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: psfed0r0v/dl-osu-beat-generator path: /main.py import torch from torch import nn from torch.utils.data import DataLoader import wandb from config import get_params from dataset import DatasetNorm from utils.read_data import parse_data from utils import make_dataset from utils.utils impo...
code_fim
hard
{ "lang": "python", "repo": "psfed0r0v/dl-osu-beat-generator", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> iters = 0 loss = 0.0 cr_loss = nn.BCELoss() for i, data in enumerate(testloader, 0): tcnn.eval() mels, labels = data[0].to(device), data[1].to(device) pred = model(mels.unsqueeze(-1).permute(0, 3, 1, 2)).to('cpu').detach() res = accuracy(pred, labels)...
code_fim
hard
{ "lang": "python", "repo": "psfed0r0v/dl-osu-beat-generator", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: publicReposOrg/safir_monitor_dashboard path: /monitor_dashboard/api/monasca.py # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LIC...
code_fim
medium
{ "lang": "python", "repo": "publicReposOrg/safir_monitor_dashboard", "path": "/monitor_dashboard/api/monasca.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_measures(request, metric_name, dimensions, start=None, end=None): measures = monascaclient(request).metrics.list_measurements( name=metric_name, dimensions=dimensions, start_time=start, end_time=end) return measures<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "publicReposOrg/safir_monitor_dashboard", "path": "/monitor_dashboard/api/monasca.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_resources(request): resources = monascaclient(request).metrics.list_dimension_values( dimension_name='resource_id') return resources def get_measures(request, metric_name, dimensions, start=None, end=None): measures = monascaclient(request).metrics.list_measurements( ...
code_fim
hard
{ "lang": "python", "repo": "publicReposOrg/safir_monitor_dashboard", "path": "/monitor_dashboard/api/monasca.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: veneres/EyeCloud path: /server/app/__init__.py ''' flask app with mongo ''' import os import json import datetime from bson.objectid import ObjectId from flask import Flask from flask_pymongo import PyMongo class JSONEncoder(json.JSONEncoder): ''' extend json-encoder class''' def defau...
code_fim
medium
{ "lang": "python", "repo": "veneres/EyeCloud", "path": "/server/app/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># add mongo url to flask config, so that flask_pymongo can use it to make connection app.config['MONGO_URI'] = os.environ.get('DB') mongo = PyMongo(app) # use the modified encoder class to handle ObjectId & datetime object while jsonifying the response. app.json_encoder = JSONEncoder from app.controller...
code_fim
hard
{ "lang": "python", "repo": "veneres/EyeCloud", "path": "/server/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># use the modified encoder class to handle ObjectId & datetime object while jsonifying the response. app.json_encoder = JSONEncoder from app.controllers import *<|fim_prefix|># repo: veneres/EyeCloud path: /server/app/__init__.py ''' flask app with mongo ''' import os import json import datetime from bs...
code_fim
hard
{ "lang": "python", "repo": "veneres/EyeCloud", "path": "/server/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def mpupload(f, bucketName, keyName, conn=None, verbose=False, acl='public-read', logger=None): n1 = dt.datetime.now() bkt = findBucket(conn, bucketName) if not bkt: raise("No such bucket %s" % bucketName) mp = bkt.initiate_multipart_upload(keyName) if verbose: print mp...
code_fim
hard
{ "lang": "python", "repo": "pmnyc/Data_Engineering_Collections", "path": "/preparing_data_sets_and_delivery_tools/python/dig/pymod/botoutil.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmnyc/Data_Engineering_Collections path: /preparing_data_sets_and_delivery_tools/python/dig/pymod/botoutil.py #!/usr/bin/python # Filename: botoutil.py ''' botoutil @author: Andrew Philpot @version 0.2 collection of boto utils Usage: python botoutil.py Options: \t-h, --help:\tprint help to STDO...
code_fim
hard
{ "lang": "python", "repo": "pmnyc/Data_Engineering_Collections", "path": "/preparing_data_sets_and_delivery_tools/python/dig/pymod/botoutil.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: device_dicts: dictionaries from system_profiler to convert to a generic form. converted_dicts: converted dictionaries will be stored here. port_mapping: mapping from USB device number (str) to Cambrionix port number (int). parent_device_dict: dictionary of p...
code_fim
hard
{ "lang": "python", "repo": "isabella232/gazoo-device", "path": "/gazoo_device/utility/usb_info_mac.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/gazoo-device path: /gazoo_device/utility/usb_info_mac.py # Copyright 2021 Google LLC # # 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.apa...
code_fim
hard
{ "lang": "python", "repo": "isabella232/gazoo-device", "path": "/gazoo_device/utility/usb_info_mac.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: str: Cambrionix port number in port_map dict format. Examples: Device: Location ID: Cambrionix = 0x146 <--- length = 5 Child Cambrionix Hub = 0x1464 <--- length = 6 ^--- location_id[5]...
code_fim
hard
{ "lang": "python", "repo": "isabella232/gazoo-device", "path": "/gazoo_device/utility/usb_info_mac.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class SingleView(TemplateView): """ Display a single post """ template_name = 'single.html' def get_context_data(self, slug): context = super(SingleView, self).get_context_data() context['object'] = get_object_or_404(Post, slug=slug) return context @csrf_e...
code_fim
hard
{ "lang": "python", "repo": "codasus/django-blogages", "path": "/blogages/apps/blogages_core/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_queryset(self): """ Filter comments from specific post """ post_pk = self.get_post().pk queryset = super(CommentListView, self).get_queryset() return queryset.filter(object_pk=post_pk) def _get_create_url(self): kwargs = {'post_pk':...
code_fim
hard
{ "lang": "python", "repo": "codasus/django-blogages", "path": "/blogages/apps/blogages_core/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codasus/django-blogages path: /blogages/apps/blogages_core/views.py from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, render_to_response from django.utils.functional import memoize from django.views.decorators.csrf import csrf_exempt from django.views.ge...
code_fim
hard
{ "lang": "python", "repo": "codasus/django-blogages", "path": "/blogages/apps/blogages_core/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 18191171661/AutoEncoder-tensorflow1.01 path: /Autoencoder/Main.py from CLASS.AGN_Autoencoder import * from CLASS.MNA_Autoencoder import * from CLASS.VAE_Autoencoder import * def main(name = None): <|fim_suffix|>if __name__ == '__main__': main('AGN') #main('MNA') #main('VAE')<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "18191171661/AutoEncoder-tensorflow1.01", "path": "/Autoencoder/Main.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main('AGN') #main('MNA') #main('VAE')<|fim_prefix|># repo: 18191171661/AutoEncoder-tensorflow1.01 path: /Autoencoder/Main.py from CLASS.AGN_Autoencoder import * from CLASS.MNA_Autoencoder import * from CLASS.VAE_Autoencoder import * <|fim_middle|>def main(name = No...
code_fim
hard
{ "lang": "python", "repo": "18191171661/AutoEncoder-tensorflow1.01", "path": "/Autoencoder/Main.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: staffanm/protokollen path: /modules/ooxml.py #coding=utf-8 """This module includes tools for handling and extracting text from Office Open XML and modern Mocrosoft Word (.docx) files. """ <|fim_suffix|> """Returns all text content from the document as plain text. """ docu...
code_fim
hard
{ "lang": "python", "repo": "staffanm/protokollen", "path": "/modules/ooxml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns all text content from the document as plain text. """ document = opendocx(self.path) paratextlist = getdocumenttext(document) self.text = "\n".join(paratextlist) return self.text if __name__ == "__main__": print "This module is only intended to be ...
code_fim
hard
{ "lang": "python", "repo": "staffanm/protokollen", "path": "/modules/ooxml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from docx import opendocx, getdocumenttext #good for text, bad for metadata import openxmllib #good for metadata, bad for text from modules.metadata import Metadata class DocxExtractor(ExtractorBase): """Class for getting plain text from a Office Open XML file. """ def get_metadata(self): ...
code_fim
medium
{ "lang": "python", "repo": "staffanm/protokollen", "path": "/modules/ooxml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Lists the commands available in the given plugin. If no plugin is given, lists the public plugins available. If --private is given, lists the private plugins. """ private = False for (option, argument) in optlist: if option == 'private': ...
code_fim
hard
{ "lang": "python", "repo": "kblin/supybot-gsoc", "path": "/plugins/Misc/plugin.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kblin/supybot-gsoc path: /plugins/Misc/plugin.py , OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIAB...
code_fim
hard
{ "lang": "python", "repo": "kblin/supybot-gsoc", "path": "/plugins/Misc/plugin.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kblin/supybot-gsoc path: /plugins/Misc/plugin.py claimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions, and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the...
code_fim
hard
{ "lang": "python", "repo": "kblin/supybot-gsoc", "path": "/plugins/Misc/plugin.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NullspaceSF/DSSGAN path: /Input/Input.py ad_num: Number of thread :param max_threads: Total number of threads ''' print("Started input thread") input_frames = input_ph[0].get_shape().as_list()[1] output_frames = input_ph[1].get_shape().as_list()[1] padding = (input_frame...
code_fim
hard
{ "lang": "python", "repo": "NullspaceSF/DSSGAN", "path": "/Input/Input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if duration is not None: num_frames = int(duration * float(audio_sr)) pad_frames = int(padding_duration * float(audio_sr)) pad_front_frames = 0 pad_back_frames = 0 if offset is None: # In this case, select random section of audio file asser...
code_fim
hard
{ "lang": "python", "repo": "NullspaceSF/DSSGAN", "path": "/Input/Input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NullspaceSF/DSSGAN path: /Input/Input.py rums, float): drum_mag = np.zeros(mix_mag.shape, np.float32) else: drum_mag, _ = audioFileToSpectrogram(drums.path, fftWindowSize=model_config["num_fft"], \ hopSize=model_config["num_h...
code_fim
hard
{ "lang": "python", "repo": "NullspaceSF/DSSGAN", "path": "/Input/Input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def dictify(rows, keys): ''' given a list of rows from the db, return a list of dicts in the same order representing the same information keyed by the key names found in the tuple <keys> ''' dicts = [] for i in range(len(rows)): d = {} for j in range(len(keys)): d[keys[j]] = ro...
code_fim
hard
{ "lang": "python", "repo": "mhidas/AutoQC", "path": "/util/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }