text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> @staticmethod def save_es_query_history(): """ 记录es查询历史装饰器 """ def _wrap(func): @wraps(func) def _deco(self, request, *args, **kwargs): param = request.data record = DatalabEsQueryHistory() rec...
code_fim
hard
{ "lang": "python", "repo": "Tencent/bk-base", "path": "/src/api/datalab/es_query/result_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lixiccccc/Population-Health-Trends path: /Optimization2.py import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import scipy as sci import sklearn from sklearn.linear_model import LinearRegression '#create Obesity array by interpolation. ...
code_fim
hard
{ "lang": "python", "repo": "lixiccccc/Population-Health-Trends", "path": "/Optimization2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>trainerr_oneterm,testerr_oneterm,index_oneterm,coef_oneterm,intercept_oneterm,prediction_oneterm,index_mintest,index_mintrain\ = singleoptimal(HFCS,percentobese,lag) '#Visualizing Single Term Regression' plt.figure() plt.xlabel('Index of Lagged Array') plt.ylabel('Mean Square Error') plt.title('Test/...
code_fim
hard
{ "lang": "python", "repo": "lixiccccc/Population-Health-Trends", "path": "/Optimization2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> trainerr_threeterm = [] testerr_threeterm = [] index1_threeterm = [] index2_threeterm = [] index3_threeterm = [] coef_threeterm = [] intercept_threeterm = [] prediction_threeterm = [] for index1 in lag: for index2 in lag: for index3 in lag: ...
code_fim
hard
{ "lang": "python", "repo": "lixiccccc/Population-Health-Trends", "path": "/Optimization2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: soleHats/Supreme-1 path: /supreme.py #!/usr/bin/python import os, sys, json, time, requests, urllib, random, threading, ConfigParser from datetime import datetime from functionCreate import copy_func from colorCodes import * from tokenContainer import * global mobileStockJson rootDirectory = os....
code_fim
hard
{ "lang": "python", "repo": "soleHats/Supreme-1", "path": "/supreme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': stopPoll = 0 checkedOut = 0 mobileStockJson = None user_config = Config() assert len(c.options('productName')) == len(c.options('productSize')) == len(c.options('productColor')) == len(c.options('productQty')),'Assertion Error: Product section lengths unmatch...
code_fim
hard
{ "lang": "python", "repo": "soleHats/Supreme-1", "path": "/supreme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BlakeMcc/healthFairDocRecs path: /health_fair/urls.py from django.conf.urls import url, include from django.contrib import admin from django.contrib.auth import views as auth_views from django.contrib.auth.decorators import login_required from django.views.generic import TemplateView from screene...
code_fim
hard
{ "lang": "python", "repo": "BlakeMcc/healthFairDocRecs", "path": "/health_fair/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>key = Fernet.generate_key() key = key.decode() with open(KEY_PATH, 'w') as f: f.write(f"export FERNET_KEY={key}") print(f"Fernet key created and stored in {KEY_PATH}")<|fim_prefix|># repo: CSCfi/docker-airflow path: /fernet-key-generator/create_fernet_key.py from cryptography.fernet import Fernet...
code_fim
hard
{ "lang": "python", "repo": "CSCfi/docker-airflow", "path": "/fernet-key-generator/create_fernet_key.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CSCfi/docker-airflow path: /fernet-key-generator/create_fernet_key.py from cryptography.fernet import Fernet import os <|fim_suffix|>KEY_PATH = '/tmp/fernet_key/fernet_key.env' if os.path.exists(KEY_PATH): print(f"File {KEY_PATH} exists already. Exiting without creating a new key") exit...
code_fim
easy
{ "lang": "python", "repo": "CSCfi/docker-airflow", "path": "/fernet-key-generator/create_fernet_key.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># loading actives actives_file = Path(args.actives_file) actives_props = [] if len(actives_file.parts) > 2: # path/to/target/actives_final.smi target = actives_file.parts[-2] else: # target.smi target = actives_file.stem if actives_file.suffix == '.gz': f = gzip.open(actives_file, 'r'...
code_fim
hard
{ "lang": "python", "repo": "hnlab/can-ai-do", "path": "/dude/generate_decoys/genDecoys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hnlab/can-ai-do path: /dude/generate_decoys/genDecoys.py """Generating decoys from database based on active smiles. """ import json import gzip import random import argparse import numpy as np from pathlib import Path from datetime import datetime as dt from rdkit import Chem from rdkit import D...
code_fim
hard
{ "lang": "python", "repo": "hnlab/can-ai-do", "path": "/dude/generate_decoys/genDecoys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: socialsoftware/mono2micro path: /backend/src/main/resources/evaluation/9_static_vs_dynamic_bestDecompositions.py import json import numpy as np import pandas as pd from py4j.java_gateway import JavaGateway DISTR_SRC_FILE_PATH = '../../java/pt/ist/socialsoftware/mono2micro/utils/mojoCalculator/sr...
code_fim
hard
{ "lang": "python", "repo": "socialsoftware/mono2micro", "path": "/backend/src/main/resources/evaluation/9_static_vs_dynamic_bestDecompositions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for file in files: print(file) data = pd.read_csv("./data/" + file) minComplexityClusters = [] for n in range(3, 11): minWeights = [] minComplexity = float("inf") minComplexityWeights = [] # a, w, r, s for entry in data.values: if entry[0] !=...
code_fim
hard
{ "lang": "python", "repo": "socialsoftware/mono2micro", "path": "/backend/src/main/resources/evaluation/9_static_vs_dynamic_bestDecompositions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WebPowerLabs/django-trainings path: /dtf/tags/models.py from django.db import models from django_extensions.db.fields import AutoSlugField <|fim_suffix|> def __init__(self, *args, **kwargs): super(Tag, self).__init__(*args, **kwargs) def __unicode__(self): return self.name<|fim_middle|> cl...
code_fim
hard
{ "lang": "python", "repo": "WebPowerLabs/django-trainings", "path": "/dtf/tags/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, **kwargs): super(Tag, self).__init__(*args, **kwargs) def __unicode__(self): return self.name<|fim_prefix|># repo: WebPowerLabs/django-trainings path: /dtf/tags/models.py from django.db import models from django_extensions.db.fields import AutoSlugField <|fim_middle|> cl...
code_fim
hard
{ "lang": "python", "repo": "WebPowerLabs/django-trainings", "path": "/dtf/tags/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for item in items(kwargs): print(f'Starting {item["id"]}') old_item = item.copy() new_item = transform_item(item) if old_item == new_item: print(f'Skipping {item["id"]}') continue print(f'Processing {item["id"]}') table.put_item(I...
code_fim
hard
{ "lang": "python", "repo": "support-kaaylabs/platform", "path": "/migrate_dynamodb_items.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: support-kaaylabs/platform path: /migrate_dynamodb_items.py #!/usr/bin/env python # -*- encoding: utf-8 -*- import json import re import sys import boto3 dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('SierraData_items') def items(kwargs=None): """Generate all items from a ...
code_fim
hard
{ "lang": "python", "repo": "support-kaaylabs/platform", "path": "/migrate_dynamodb_items.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> item['data'] = json.dumps(data, separators=(',', ':')) return item def main(): try: kwargs = {'ExclusiveStartKey': {'id': sys.argv[1]}} except IndexError: kwargs = {} for item in items(kwargs): print(f'Starting {item["id"]}') old_item = item.copy() ...
code_fim
hard
{ "lang": "python", "repo": "support-kaaylabs/platform", "path": "/migrate_dynamodb_items.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># don't assume the user has install dragonfly sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'dragonfly')) import translations MIN_PYTHON = (3, 0) if sys.version_info < MIN_PYTHON: sys.exit("Python {}.{} or later is required.\n".format(*MIN_PYTHON)) parser = argparse.ArgumentPars...
code_fim
hard
{ "lang": "python", "repo": "theAfricanQuant/dragonfly", "path": "/scripts/export.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theAfricanQuant/dragonfly path: /scripts/export.py #!/usr/bin/env python3 # Copyright 2017-2019, The Johns Hopkins University Applied Physics Laboratory LLC # All rights reserved. # Distributed under the terms of the Apache 2.0 License. # # Export a translation dictionary # # usage: export.py l...
code_fim
hard
{ "lang": "python", "repo": "theAfricanQuant/dragonfly", "path": "/scripts/export.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>USE_TZ = True # django-storages DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY") AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE...
code_fim
hard
{ "lang": "python", "repo": "gurleen/mercantile-api", "path": "/mercantile/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gurleen/mercantile-api path: /mercantile/settings.py """ Django settings for mercantile project. Generated by 'django-admin startproject' using Django 3.1.1. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their va...
code_fim
hard
{ "lang": "python", "repo": "gurleen/mercantile-api", "path": "/mercantile/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>LANGUAGE_CODE = "en-us" TIME_ZONE = "US/Eastern" USE_I18N = True USE_L10N = True USE_TZ = True # django-storages DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID") AWS_SECRET...
code_fim
hard
{ "lang": "python", "repo": "gurleen/mercantile-api", "path": "/mercantile/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thesofakillers/SlowFast path: /tools/sandbox_net.py from slowfast.datasets import loader import slowfast.utils.logging as logging import slowfast.utils.distributed as du import slowfast.utils.misc as misc import slowfast.utils.checkpoint as cu <|fim_suffix|> # Setup logging format. loggi...
code_fim
medium
{ "lang": "python", "repo": "thesofakillers/SlowFast", "path": "/tools/sandbox_net.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # load weights if cfg.INFERENCE.WEIGHTS_FILE_PATH != "": cu.load_checkpoint(cfg.INFERENCE.WEIGHTS_FILE_PATH, model, cfg.NUM_GPUS > 1, None, inflation=False, convert_from_caffe2=cfg.INFERENCE.WEIGHTS_TYPE == "caffe2") else: raise FileNotFoundError("Mod...
code_fim
hard
{ "lang": "python", "repo": "thesofakillers/SlowFast", "path": "/tools/sandbox_net.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Setup logging format. logging.setup_logging() # Print config. logger.info("Infer with config:") logger.info(cfg) # Build the SlowFast model and print its statistics model = build_model(cfg) if du.is_master_proc(): misc.log_model_info(model, cfg, is_train=False)...
code_fim
medium
{ "lang": "python", "repo": "thesofakillers/SlowFast", "path": "/tools/sandbox_net.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>subprocess.run(["cargo", "build", "--release"], check=True, cwd=str(ROOT)) if platform.system() == "Windows": SRC_NAME = "rocksdb3.dll" DEST_NAME = "rocksdb3.pyd" elif platform.system() == "Darwin": SRC_NAME = "librocksdb3.dylib" DEST_NAME = "rocksdb3.so" else: # Assume everything els...
code_fim
medium
{ "lang": "python", "repo": "bobosui/rocksdb3", "path": "/tests/build.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if platform.system() == "Windows": SRC_NAME = "rocksdb3.dll" DEST_NAME = "rocksdb3.pyd" elif platform.system() == "Darwin": SRC_NAME = "librocksdb3.dylib" DEST_NAME = "rocksdb3.so" else: # Assume everything else behaves like Linux. SRC_NAME = "librocksdb3.so" DEST_NAME = "rocks...
code_fim
medium
{ "lang": "python", "repo": "bobosui/rocksdb3", "path": "/tests/build.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bobosui/rocksdb3 path: /tests/build.py #! /usr/bin/env python3 # Build the shared library, and then copy it into this directory, so that # test_rocksdb.py can see it. We use the filename that Python requires on the # curent platform: rocksdb3.so on Linux and macOS, and rocksdb3.pyd on Windows. ...
code_fim
medium
{ "lang": "python", "repo": "bobosui/rocksdb3", "path": "/tests/build.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DoctorChe/Python_DataBase_PyQT path: /server/server_app.py import select import threading from typing import Tuple from socket import socket, AF_INET, SOCK_STREAM # from utils.config_jim import TO from server.utils.config_server import WORKERS, MSG_SIZE from server.utils.metaclasses import Serve...
code_fim
hard
{ "lang": "python", "repo": "DoctorChe/Python_DataBase_PyQT", "path": "/server/server_app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Метод отправки сообщений :param sock: сокет :param message: словарь сообщения :return: None """ try: # self.process_message(message, send_data_lst) # TODO: сделать проверку: зарегистрирован ли клиент на сервере ...
code_fim
hard
{ "lang": "python", "repo": "DoctorChe/Python_DataBase_PyQT", "path": "/server/server_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> db = DataBook() db.compile() db.link() if __name__ == "__main__": log.info("Databook generator") raise SystemExit(main())<|fim_prefix|># repo: normanlorrain/DataBookBinder path: /src/dbb/__main__.py """ Main application entry point. python -m DataBookBinder ... <|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "normanlorrain/DataBookBinder", "path": "/src/dbb/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: normanlorrain/DataBookBinder path: /src/dbb/__main__.py """ Main application entry point. python -m DataBookBinder ... """ <|fim_suffix|>if __name__ == "__main__": log.info("Databook generator") raise SystemExit(main())<|fim_middle|>from .util import config from .util import log f...
code_fim
medium
{ "lang": "python", "repo": "normanlorrain/DataBookBinder", "path": "/src/dbb/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def write_predictions_conv_ema(name, mode, input_fn, fwords, ftags, generator_fn, estimator): Path('results/score').mkdir(parents=True, exist_ok=True) with Path('results/score/{}.{}.preds.txt'.format(name, mode)).open('wb') as f: test_inpf = functools.partial(input_fn, fwords(n...
code_fim
hard
{ "lang": "python", "repo": "MANASLU8/tf_ner", "path": "/predictions_writer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def write_predictions_ema(name, mode, input_fn, fwords, ftags, generator_fn, estimator): Path('results/score').mkdir(parents=True, exist_ok=True) with Path('results/score/{}.{}.preds.txt'.format(name, mode)).open('wb') as f: test_inpf = functools.partial(input_fn, fwords(name),...
code_fim
hard
{ "lang": "python", "repo": "MANASLU8/tf_ner", "path": "/predictions_writer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MANASLU8/tf_ner path: /predictions_writer.py from pathlib import Path import functools def write_predictions(name, input_fn, fwords, ftags, generator_fn, estimator): Path('results/score').mkdir(parents=True, exist_ok=True) with Path('results/score/{}.preds.txt'.format(name)).open('wb') a...
code_fim
hard
{ "lang": "python", "repo": "MANASLU8/tf_ner", "path": "/predictions_writer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: saberkia/MLand path: /dc_supervised/sk_knn.py from sklearn.neighbors import KNeighborsClassifier import pandas as pd from sklearn import datasets from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt digits = datasets.load_digits() print(digits.keys()) <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "saberkia/MLand", "path": "/dc_supervised/sk_knn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Create a k-NN classifier with 7 neighbors: knn knn = KNeighborsClassifier(n_neighbors=7) # Fit the classifier to the training data knn.fit(X_train, y_train) # Print the accuracy print(knn.score(X_test, y_test))<|fim_prefix|># repo: saberkia/MLand path: /dc_supervised/sk_knn.py from sklearn.neighbors ...
code_fim
medium
{ "lang": "python", "repo": "saberkia/MLand", "path": "/dc_supervised/sk_knn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Split into training and test set X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=42, stratify=y) # Create a k-NN classifier with 7 neighbors: knn knn = KNeighborsClassifier(n_neighbors=7) # Fit the classifier to the training data knn.fit(X_train, y_train) # Pri...
code_fim
hard
{ "lang": "python", "repo": "saberkia/MLand", "path": "/dc_supervised/sk_knn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ft = (2 * frequency - 1) * epoch lr = cosine_decay(ft, lr_min, lr_max, n_epoch) lr *= gamma ** epoch return lr<|fim_prefix|># repo: aiorhiroki/farmer path: /farmer/ncc/schedulers/functional.py import numpy as np def step_lr(epoch, base_lr, step_size, gamma): reduce_num = epoch // st...
code_fim
hard
{ "lang": "python", "repo": "aiorhiroki/farmer", "path": "/farmer/ncc/schedulers/functional.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiorhiroki/farmer path: /farmer/ncc/schedulers/functional.py import numpy as np def step_lr(epoch, base_lr, step_size, gamma): reduce_num = epoch // step_size lr = base_lr * (gamma ** reduce_num) return lr def multi_step_lr(epoch, base_lr, milestones, milestone_num, gamma): fo...
code_fim
hard
{ "lang": "python", "repo": "aiorhiroki/farmer", "path": "/farmer/ncc/schedulers/functional.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def t0_switch_config_helper(test_obj: 'T0TestBase'): """ Make t0 switch configurations base on the configuration in the test plan. Set the configuration in test directly. Set the following test_obj attributes: int: switch_id """ configer = SwitchConfiger(test_obj) te...
code_fim
medium
{ "lang": "python", "repo": "lihuay/SAI", "path": "/test/sai_test/config/switch_configer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: switch_init_wait: switch init wait time (sec) route_mac: route mac (switch mac) Returns: Vlan: vlan object """ switch_id = sai_thrift_create_switch( self.test_obj.client, init_switch=True, src_mac_address=route_mac) ...
code_fim
hard
{ "lang": "python", "repo": "lihuay/SAI", "path": "/test/sai_test/config/switch_configer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lihuay/SAI path: /test/sai_test/config/switch_configer.py # Copyright (c) 2021 Microsoft Open Technologies, 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 # a copy of the License a...
code_fim
hard
{ "lang": "python", "repo": "lihuay/SAI", "path": "/test/sai_test/config/switch_configer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: danvalencia/deeppointcloud-benchmarks path: /models/pointnet2/nn.py import torch from torch import nn import torch.nn.functional as F from torch.nn import functional as FPModule from models.base_model import MLP, FPModule, UnetBasedModel from .modules import SAModule <|fim_suffix|> def forwar...
code_fim
hard
{ "lang": "python", "repo": "danvalencia/deeppointcloud-benchmarks", "path": "/models/pointnet2/nn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, opt, num_classes): self.down_conv_cls = SAModule self.up_conv_cls = FPModule self._name = 'POINTNET++_MODEL' super(SegmentationModel, self).__init__(opt, num_classes) #self.mlp_cls = MLP(opt.mlp_cls + [num_classes], p_dropout=0.1) self...
code_fim
medium
{ "lang": "python", "repo": "danvalencia/deeppointcloud-benchmarks", "path": "/models/pointnet2/nn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = F.relu(self.lin1(x)) x = F.dropout(x, p=0.5, training=self.training) x = self.lin2(x) x = F.dropout(x, p=0.5, training=self.training) x = self.lin3(x) return F.log_softmax(x, dim=-1) #return F.log_softmax(self.mlp_cls(x), dim=-1)<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "danvalencia/deeppointcloud-benchmarks", "path": "/models/pointnet2/nn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dimagi/commcare-hq path: /corehq/apps/hqwebapp/utils/translation.py from django.utils.functional import lazy from django<|fim_suffix|>_safe, str) format_html_lazy = lazy(format_html, str)<|fim_middle|>.utils.safestring import mark_safe from django.utils.html import format_html mark_safe_lazy = l...
code_fim
medium
{ "lang": "python", "repo": "dimagi/commcare-hq", "path": "/corehq/apps/hqwebapp/utils/translation.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>_safe, str) format_html_lazy = lazy(format_html, str)<|fim_prefix|># repo: dimagi/commcare-hq path: /corehq/apps/hqwebapp/utils/translation.py from django.utils.functional import lazy from django.utils.safestring import mark_safe from django.utils<|fim_middle|>.html import format_html mark_safe_lazy = l...
code_fim
easy
{ "lang": "python", "repo": "dimagi/commcare-hq", "path": "/corehq/apps/hqwebapp/utils/translation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>iseDataRegistration, ntSecureRouter1002E=ntSecureRouter1002E, ntSecureRouterNE05=ntSecureRouterNE05, ntEthernetRoutingSwitch=ntEthernetRoutingSwitch, ntSecureRouterNE08=ntSecureRouterNE08, ntSecureRouter1001S=ntSecureRouter1001S, ntSecureRouter4000Series=ntSecureRouter4000Series, ntEnterpriseData=ntEnterp...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/NT-ENTERPRISE-DATA-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/NT-ENTERPRISE-DATA-MIB.py # # PySNMP MIB module NT-ENTERPRISE-DATA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NT-ENTERPRISE-DATA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:24:49 2019 # On host D...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/NT-ENTERPRISE-DATA-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: awabcodes/rms path: /rms/project/utils.py from __future__ import unicode_literals import frappe @frappe.whitelist() def query_task(doctype, txt, searchfield, start, page_len, filters): from frappe.desk.reportview import build_match_conditions <|fim_suffix|> return frappe.db.sql("""select name...
code_fim
medium
{ "lang": "python", "repo": "awabcodes/rms", "path": "/rms/project/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> search_string = "%%%s%%" % txt order_by_string = "%s%%" % txt match_conditions = build_match_conditions("Task") match_conditions = ("and" + match_conditions) if match_conditions else "" return frappe.db.sql("""select name, subject from `tabTask` where (`%s` like %s or `subject` like %s) %s order...
code_fim
medium
{ "lang": "python", "repo": "awabcodes/rms", "path": "/rms/project/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>polynominal1, m1 = interpolation(1, data) polynominal2, m2 = interpolation(2, data) polynominal3, m3 = interpolation(3, data) polynominal4, m4 = interpolation(4, data) polynominal5, m5 = interpolation(5, data) polynominal6, m6 = interpolation(6, data) z=detectPolynominal(m1, m2, m3, m4, m5, m6 ) wrtieE...
code_fim
hard
{ "lang": "python", "repo": "nyucel/blm2010", "path": "/final/170401035.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: nyucel/blm2010 path: /final/170401035.py #Hasan Avcı 170401035 from sympy import Symbol,pprint file = open("veriler.txt", "r") data = file.readlines() for i in range(len(data)): data[i] = int(data[i]) def detectPolynominal(m1, m2, m3, m4, m5, m6): if m1 > m6 and m1 > m5 and m1 > m4 and...
code_fim
hard
{ "lang": "python", "repo": "nyucel/blm2010", "path": "/final/170401035.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> z=detectPolynominal(m1, m2, m3, m4, m5, m6 ) wrtieEquationAndIntegral(polynominal1, polynominal2, polynominal3, polynominal4, polynominal5, polynominal6,z) polinomsuzIntegral() dosya = open('170401035_yorum.txt', 'w') dosya.write("""Sonuçların farklı çıkmasının sebebi deltax'e verilen değerlerden kay...
code_fim
hard
{ "lang": "python", "repo": "nyucel/blm2010", "path": "/final/170401035.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wiselab2/findPhasiRNAs path: /findPhasiRNAs.py owtie_index==None: cmd="lib/bowtie/bowtie-build" cmd+=" --threads "+options.CPU+" " cmd+=options.genome+" " cmd+=options.output_directory+"/bowtie1_index" os.system(cmd) bowtie1_index=options.output_dir...
code_fim
hard
{ "lang": "python", "repo": "Wiselab2/findPhasiRNAs", "path": "/findPhasiRNAs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wiselab2/findPhasiRNAs path: /findPhasiRNAs.py argparse.ArgumentParser(prog="findPhasiRNAs.py",description="findPhasiRNAs can be used to find genomic locations where phasing occurs. ") optional_arg = parser.add_argument_group("Optional Arguments") required_arg = parser.add_argument_group...
code_fim
hard
{ "lang": "python", "repo": "Wiselab2/findPhasiRNAs", "path": "/findPhasiRNAs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> num_all_reads=0 for i in range(begin,finish+1): try: num_all_reads+=whole_mapped_data[chromosome][i] except KeyError: pass if num_all_reads<min_reads_in_a_window: ...
code_fim
hard
{ "lang": "python", "repo": "Wiselab2/findPhasiRNAs", "path": "/findPhasiRNAs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def plot_hyperplane(clf, min_x, max_x, linestyle, label): # get the separating hyperplane w = clf.coef_[0] a = -w[0] / w[1] xx = np.linspace(min_x, max_x) yy = a * xx - (clf.intercept_[0]) / w[1] pl.plot(xx, yy, linestyle, label=label) X, Y = make_multilabel_classification(n_cla...
code_fim
hard
{ "lang": "python", "repo": "forkloop/scikit-learn", "path": "/examples/plot_multilabel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: forkloop/scikit-learn path: /examples/plot_multilabel.py """ ========================= Multilabel classification ========================= This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process: - pick the numbe...
code_fim
medium
{ "lang": "python", "repo": "forkloop/scikit-learn", "path": "/examples/plot_multilabel.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>zero_class = np.where([0 in y for y in Y]) one_class = np.where([1 in y for y in Y]) pl.scatter(X[:, 0], X[:, 1], s=40, c='gray') pl.scatter(X[zero_class, 0], X[zero_class, 1], s=160, edgecolors='b', facecolors='none', linewidths=2, label='Class 1') pl.scatter(X[one_class, 0], X[one_class, 1], ...
code_fim
hard
{ "lang": "python", "repo": "forkloop/scikit-learn", "path": "/examples/plot_multilabel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: thoughteer/edera path: /tests/integration/monitoring/test_monitoring_agent.py import logging import threading from edera.monitoring.agent import LogCapturingTaskWrapper from edera.task import Task def test_log_capturing_task_wrapper_ignores_messages_from_other_threads(mocker): class T(Tas...
code_fim
medium
{ "lang": "python", "repo": "thoughteer/edera", "path": "/tests/integration/monitoring/test_monitoring_agent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def interfere(): interferer = threading.Thread(target=log) interferer.daemon = True interferer.start() interferer.join() sink = logging.getLogger("edera.monitoring.sink") sink.setLevel(logging.DEBUG) agent = mocker.Mock() wrapper = LogCapturingTaskWrapp...
code_fim
medium
{ "lang": "python", "repo": "thoughteer/edera", "path": "/tests/integration/monitoring/test_monitoring_agent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: banare/simplegauges path: /datastores/datastore.py # coding: utf-8 class GaugeDatastore(object): def save_data(self, gauge_name, date_key, data): """Saves specified data to date_key in specified gauge. date_key: str """ pass def get_gauge_data(self, gaug...
code_fim
medium
{ "lang": "python", "repo": "banare/simplegauges", "path": "/datastores/datastore.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Return format: [ {"key": date_key, "data": data}, ... ] For missing data, data field will be returned as None. """ pass def get_data(self, gauge_name, date_key): """Retrieves gauge data for a specific date key (e.g. day) date_key: str Return f...
code_fim
medium
{ "lang": "python", "repo": "banare/simplegauges", "path": "/datastores/datastore.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> If min_date_key (str) is specified, returns records after specified date key (incl. min_date_key). If max_date_key (str) is specified, returns records before specified date key (excl. max_date_key). Return format: [ {"key": date_key, "data": data}, ... ] F...
code_fim
medium
{ "lang": "python", "repo": "banare/simplegauges", "path": "/datastores/datastore.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yilin-wu98/gym path: /gym/envs/mujoco/assets/test.py # import random # from mujoco_py import load_model_from_path, MjSim, MjViewer # import os # # model = load_model_from_path("cloth_v0.xml") # sim = MjSim(model) # viewer = MjViewer(sim) # sim_state = sim.get_state() # # while True: # sim.set...
code_fim
hard
{ "lang": "python", "repo": "yilin-wu98/gym", "path": "/gym/envs/mujoco/assets/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.6 1" texcoord="true" inflate="0.005" subgrid="2"/> <geom type="capsule" size="0.015 0.01" rgba=".8 .2 .1 1"/> </composite> </body> </worldbody> </mujoco> """ physics = mujoco.Physics.from_xml_string(xml_string) # Render the default camera view as a numpy array of pixels. pixels = physics.r...
code_fim
hard
{ "lang": "python", "repo": "yilin-wu98/gym", "path": "/gym/envs/mujoco/assets/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xbnr/future_makers path: /python_samples/translate_server.py # Translation API - https://azure.microsoft.com/en-gb/services/cognitive-services/translator-text-api/ # Example Request - http://localhost:3001/?lang=fr&text=hello import http.server import socketserver import urllib.parse import urll...
code_fim
hard
{ "lang": "python", "repo": "xbnr/future_makers", "path": "/python_samples/translate_server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> queryStarts = self.path.find("?") + 1 if self.__data == "": self.__data = self.rfile.read(int(self.headers['Content-Length'])).decode("utf-8") from urllib.parse import parse_qs parsed = parse_qs(self.path[queryStarts:]) parsed = parse_qs(self.__data) ...
code_fim
hard
{ "lang": "python", "repo": "xbnr/future_makers", "path": "/python_samples/translate_server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # This helper function formats parts of our response properly def write(self,text): self.wfile.write(str.encode(text)) def set_headers(self): self.send_response(200) # 200 means everything is OK self.send_header('Content-type', 'text/html') #Our response contains text ...
code_fim
hard
{ "lang": "python", "repo": "xbnr/future_makers", "path": "/python_samples/translate_server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: calvinti12/impulse path: /impulse/alert/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-11-08 03:07 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> initial = True dependencies = [ ] operations...
code_fim
hard
{ "lang": "python", "repo": "calvinti12/impulse", "path": "/impulse/alert/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Qiskit/qiskit-ibmq-provider path: /test/utils.py # This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www...
code_fim
hard
{ "lang": "python", "repo": "Qiskit/qiskit-ibmq-provider", "path": "/test/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Cancel a job. Args: job: Job to cancel. verify: Verify job status. Returns: Whether job has been cancelled. """ cancelled = False for _ in range(2): # Try twice in case job is not in a cancellable state try: cancelled = job.c...
code_fim
hard
{ "lang": "python", "repo": "Qiskit/qiskit-ibmq-provider", "path": "/test/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Robpol86/FlashAirMusic path: /flash_air_music/upload/run.py """Main functions/coroutines that fire directory walking, song uploads, file/dir deletion, and retry logic.""" import asyncio import logging import time from flash_air_music.configuration import GLOBAL_MUTABLE_CONFIG from flash_air_mus...
code_fim
hard
{ "lang": "python", "repo": "Robpol86/FlashAirMusic", "path": "/flash_air_music/upload/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param str ip_addr: IP address of FlashAir to connect to. :return: If sync was successful. :rtype: bool """ log = logging.getLogger(__name__) log.debug('Waiting for semaphore...') sleep_for = 2 success = False changed = False with (yield from SEMAPHORE): lo...
code_fim
hard
{ "lang": "python", "repo": "Robpol86/FlashAirMusic", "path": "/flash_air_music/upload/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> myHelper.__init__(self) self.nameRe = re.compile(ur"\A( *)" + self.getReX11colors() + "( *)\Z", re.UNICODE|re.IGNORECASE) def name(self, value): value = value.strip() for k, v in self.x11colorValues.iteritems(): if k.lower() == value.lower(): ...
code_fim
medium
{ "lang": "python", "repo": "s0ap/tex", "path": "/page_designer/template_designer/code/colors/myname.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: s0ap/tex path: /page_designer/template_designer/code/colors/myname.py #!/usr/bin/env python # -*- coding: utf-8 -*- import re from myhelper import myHelper from x11colorvalues import x11colorValues class myName(myHelper): """ This class defines contains all methods, that convert from x11 ...
code_fim
medium
{ "lang": "python", "repo": "s0ap/tex", "path": "/page_designer/template_designer/code/colors/myname.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PavelBlend/blender-xray path: /io_scene_xray/formats/bones/exp.py # addon modules from .. import obj from ... import utils from ... import log from ... import rw @log.with_context(name='bones-partitions') def _export_partitions(context, bpy_obj): log.update(object=bpy_obj.name) packed_w...
code_fim
hard
{ "lang": "python", "repo": "PavelBlend/blender-xray", "path": "/io_scene_xray/formats/bones/exp.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> packed_writer = rw.write.PackedWriter() packed_writer.putf('<f', xray.mass.value) packed_writer.putv3f(cmass) chunked_writer.put(chunks.MASS_PARAMS, packed_writer) return chunked_writer @log.with_context(name='export-bones') @utils.stats.timer def export_file(context): utils.sta...
code_fim
hard
{ "lang": "python", "repo": "PavelBlend/blender-xray", "path": "/io_scene_xray/formats/bones/exp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@log.with_context(name='export-bones') @utils.stats.timer def export_file(context): utils.stats.status('Export File', context.filepath) arm_obj = context.bpy_arm_obj log.update(object=arm_obj.name) chunked_writer = rw.write.ChunkedWriter() # get armature scale root_obj = utils.ob...
code_fim
hard
{ "lang": "python", "repo": "PavelBlend/blender-xray", "path": "/io_scene_xray/formats/bones/exp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Creates and returns the L9C script """ return RpycHost(c_instance)<|fim_prefix|># repo: enteleform-forks/AbletonAPI path: /python-api-materials/code/RpycHost/__init__.py #**************************************************************************************** # File: __init__.py # # Copy...
code_fim
medium
{ "lang": "python", "repo": "enteleform-forks/AbletonAPI", "path": "/python-api-materials/code/RpycHost/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: enteleform-forks/AbletonAPI path: /python-api-materials/code/RpycHost/__init__.py #**************************************************************************************** # File: __init__.py # # Copyright: 2011 Ableton AG, Berlin. All Rights reserved #***************************************...
code_fim
easy
{ "lang": "python", "repo": "enteleform-forks/AbletonAPI", "path": "/python-api-materials/code/RpycHost/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kirenguyen/unity-game-controllers path: /TapGameController/tests/test_fsm.py # -*- coding: utf-8 -*- from ..TapGameFSM import TapGameFSM import unittest class FSMTestSuite(unittest.TestCase): <|fim_suffix|> def test_FSM(self): return True # def send_command(cmd, *args): ...
code_fim
medium
{ "lang": "python", "repo": "kirenguyen/unity-game-controllers", "path": "/TapGameController/tests/test_fsm.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return True # def send_command(cmd, *args): # print(cmd) # # my_FSM = TapGameFSM() # my_FSM.max_rounds = 2 # my_FSM.send_game_cmd = send_command # # self.assertEqual(my_FSM.state, 'GAME_START') # # my_FSM.init_firs...
code_fim
medium
{ "lang": "python", "repo": "kirenguyen/unity-game-controllers", "path": "/TapGameController/tests/test_fsm.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def clearRelevancy(): cypher.execute(GRAPHDB, "MATCH ()-[r:RELEVANCY]->() DELETE r") def calculateRelevancy(): # clear old transformer clearRelevancy() # calculate transformer if WHICH_RELEVANCY_ALGORITHM == "random": randomRelevancyEdges() elif WHICH_RELEVANCY_ALGORITH...
code_fim
medium
{ "lang": "python", "repo": "R4chel/RecommendationGraph", "path": "/recgraph/transformer/calculateRelevancy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # calculate transformer if WHICH_RELEVANCY_ALGORITHM == "random": randomRelevancyEdges() elif WHICH_RELEVANCY_ALGORITHM == "simple": simpleRelevancyEdges() else: print "+EE+: Unknown Relevancy Algorithm" # output graph to json file in static directory if WH...
code_fim
medium
{ "lang": "python", "repo": "R4chel/RecommendationGraph", "path": "/recgraph/transformer/calculateRelevancy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: R4chel/RecommendationGraph path: /recgraph/transformer/calculateRelevancy.py import os from py2neo import cypher from recgraph.transformer.randomRelevancy import randomRelevancyEdges from recgraph.transformer.simpleRelevancy import simpleRelevancyEdges from recgraph.transformer.convertToJson im...
code_fim
medium
{ "lang": "python", "repo": "R4chel/RecommendationGraph", "path": "/recgraph/transformer/calculateRelevancy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_recurrence(self): recurrence = RecurringTransaction.objects.create( title='some recurrence', amount=25, date=date.today(), src=self.personal, dst=self.foreign, interval=RecurringTransaction.MONTHLY, tr...
code_fim
hard
{ "lang": "python", "repo": "agstrike/silverstrike", "path": "/silverstrike/tests/models/test_splits.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agstrike/silverstrike path: /silverstrike/tests/models/test_splits.py from datetime import date from django.test import TestCase from django.urls import reverse from silverstrike.models import (Account, AccountType, Category, RecurringTransaction, Split, Transac...
code_fim
hard
{ "lang": "python", "repo": "agstrike/silverstrike", "path": "/silverstrike/tests/models/test_splits.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # all center frequencies of the filters f = (N / fs) * invmelscale( melscale(fl * fs) + (np.arange(M + 2) * (melscale(fh * fs) - melscale(fl * fs)) / (M + 1)) ) # Construct the triangular filter bank H = np.zeros((M, N // 2 + 1)) k = np.arange(N // 2 + 1) for m...
code_fim
hard
{ "lang": "python", "repo": "LCAV/pyroomacoustics", "path": "/pyroomacoustics/acoustics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LCAV/pyroomacoustics path: /pyroomacoustics/acoustics.py port constants from .transform import stft def binning(S, bands): """ This function computes the sum of all columns of S in the subbands enumerated in bands """ B = np.zeros((S.shape[0], len(bands)), dtype=S.dtype) ...
code_fim
hard
{ "lang": "python", "repo": "LCAV/pyroomacoustics", "path": "/pyroomacoustics/acoustics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # perform STFT, X contains frames in rows X = stft.analysis(x, L, hop, transform=np.fft.rfft) # get and apply the mel filter bank # and compute log energy H = melfilterbank(M, L, fs=fs, fl=fl, fh=fh) S = np.log(np.dot(H, np.abs(X.T) ** 2)) # Now take DCT of the result C =...
code_fim
hard
{ "lang": "python", "repo": "LCAV/pyroomacoustics", "path": "/pyroomacoustics/acoustics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_equal(self.nodes[0].createrawscriptaddress("6ac1"), "3HnzbJ4TR9") assert_equal(self.nodes[0].validateaddress("3HnzbJ4TR9")["isvalid"], True) assert_equal(self.nodes[0].validateaddress("3HnzbJ4TR9")["scriptPubKey"], "6ac1") self.nodes[0].staking(False) self.n...
code_fim
medium
{ "lang": "python", "repo": "David4860/navcoin-core", "path": "/qa/rpc-tests/createrawscriptaddress.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: David4860/navcoin-core path: /qa/rpc-tests/createrawscriptaddress.py #!/usr/bin/env python3 # Copyright (c) 2019 The Navcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framewor...
code_fim
hard
{ "lang": "python", "repo": "David4860/navcoin-core", "path": "/qa/rpc-tests/createrawscriptaddress.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakobkogler/CodeforcesAssistant path: /parse_testcases.py #!/usr/bin/env python3 from bs4 import BeautifulSoup, NavigableString from urllib.request import urlopen import argparse import os import re def format_testcase(test): return '\n'.join(e for e in test.pre.contents if isinstance(e, Na...
code_fim
hard
{ "lang": "python", "repo": "jakobkogler/CodeforcesAssistant", "path": "/parse_testcases.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> for idx, test_case in enumerate(parse_testcases(contest, problem), start=1): for text_type, text in zip(("input", "output"), test_case): file_path = os.path.join(dir_path, '{}{}'.format(text_type, idx)) with open(file_path, 'w') as f: ...
code_fim
hard
{ "lang": "python", "repo": "jakobkogler/CodeforcesAssistant", "path": "/parse_testcases.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>image # Written by Tianrui Hui # --------------------------------------------------------<|fim_prefix|># repo: VitoChien/py-mask-rcnn path: /lib/crop_seg/__init__.py # ------------------------------------------<|fim_middle|>-------------- # Crop the segmentation label
code_fim
easy
{ "lang": "python", "repo": "VitoChien/py-mask-rcnn", "path": "/lib/crop_seg/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>---------------------------------------------<|fim_prefix|># repo: VitoChien/py-mask-rcnn path: /lib/crop_seg/__init__.py # -------------------------------------------------------- # Crop the segmentation label <|fim_middle|>image # Written by Tianrui Hui # -----------
code_fim
easy
{ "lang": "python", "repo": "VitoChien/py-mask-rcnn", "path": "/lib/crop_seg/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }