text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: yyht/sinkhorn-loss path: /Sentiment/dataset/train_test_split.py import pandas as pd import logging from sklearn.model_selection import train_test_split import sklearn import torch f_names = ['loc_Clothing_Shoes_and_Jewelry.csv', 'loc_Toys_and_Games.csv', 'loc_Cell_Phone...
code_fim
hard
{ "lang": "python", "repo": "yyht/sinkhorn-loss", "path": "/Sentiment/dataset/train_test_split.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' save train-test split ''' train_test_split_dir = "../train_test_split" import pickle as pk pk.dump({ 'train_labels':train_labels, 'train_texts':train_texts, 'val_labels':val_labels, 'val_texts':val_texts, 'test_lab...
code_fim
hard
{ "lang": "python", "repo": "yyht/sinkhorn-loss", "path": "/Sentiment/dataset/train_test_split.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/feature/vt/api/impl/MatchSetImpl.pyi import ghidra.feature.vt.api.impl import ghidra.feature.vt.api.main import ghidra.program.model.address import java.lang import java.util class MatchSetImpl(object, ghidra.feature.vt.api.main.VTMatchSe...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/feature/vt/api/impl/MatchSetImpl.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def notifyAll(self) -> None: ... def removeMatch(self, __a0: ghidra.feature.vt.api.main.VTMatch) -> bool: ... def toString(self) -> unicode: ... @overload def wait(self) -> None: ... @overload def wait(self, __a0: long) -> None: ... @overload def wait(self, __a0: l...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/feature/vt/api/impl/MatchSetImpl.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahlusar1989/probablepeople path: /tests/test_tokenizing.py from probablepeople import tokenize import unittest class TestTokenizing(unittest.TestCase) : def test_split_on_punc(self) : <|fim_suffix|> assert tokenize('foo bar') == ['foo', 'bar'] assert tokenize('foo bar') == ...
code_fim
medium
{ "lang": "python", "repo": "ahlusar1989/probablepeople", "path": "/tests/test_tokenizing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert tokenize('robert (bob) belcher') == ['robert', '(bob)', 'belcher'] assert tokenize('robert(bob) belcher') == ['robert', '(bob)', 'belcher'] assert tokenize('robert (bob)belcher') == ['robert', '(bob)', 'belcher'] if __name__ == '__main__' : unittest.main()<|fim_prefix|...
code_fim
hard
{ "lang": "python", "repo": "ahlusar1989/probablepeople", "path": "/tests/test_tokenizing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert tokenize('mr & mrs') == ['mr', '&', 'mrs'] def test_paren(self) : assert tokenize('robert (bob) belcher') == ['robert', '(bob)', 'belcher'] assert tokenize('robert(bob) belcher') == ['robert', '(bob)', 'belcher'] assert tokenize('robert (bob)belcher') == ['rober...
code_fim
hard
{ "lang": "python", "repo": "ahlusar1989/probablepeople", "path": "/tests/test_tokenizing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: print(f"{WARNING}WARNING - file 'metric_explanation.txt' not found.{NORMAL}") return prs def pptx_ui_errors(slide, message: str): """PPTX UI Errors Log errors as they occur, print on slide itself Arguments: slide {pptx-slide} -- pptx-slide object, for logging...
code_fim
hard
{ "lang": "python", "repo": "nga-27/SecuritiesAnalysisTools", "path": "/libs/ui_generation/pptx_resources/slide_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nga-27/SecuritiesAnalysisTools path: /libs/ui_generation/pptx_resources/slide_utils.py """ slide utilities """ import os from datetime import datetime from pptx.util import Inches, Pt from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN # pylint: disable=no-name-in-module fr...
code_fim
hard
{ "lang": "python", "repo": "nga-27/SecuritiesAnalysisTools", "path": "/libs/ui_generation/pptx_resources/slide_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Pass the location data from fund_content_slides.json and generate an object """ # pylint: disable=too-few-public-methods left: Inches top: Inches height: Inches width: Inches def __init__(self): self.left = 0.0 self.top = 0.0 self.height = 0.0 ...
code_fim
hard
{ "lang": "python", "repo": "nga-27/SecuritiesAnalysisTools", "path": "/libs/ui_generation/pptx_resources/slide_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> alpha: float = 2.0, gamma: float = 4.0, reduction: str = 'mean', loss_weight: float = 1.0, pos_weight: float = 1.0, neg_weight: float = 1.0) -> None: super().__init__() self.alpha = alpha ...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/mmdet/models/losses/gaussian_focal_loss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> More details can be found in the `paper <https://arxiv.org/abs/1808.01244>`_ Code is modified from `kp_utils.py <https://github.com/princeton-vl/CornerNet/blob/master/models/py_utils/kp_utils.py#L152>`_ # noqa: E501 Please notice that the target in GaussianFocalLoss is a gaussian heat...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/mmdet/models/losses/gaussian_focal_loss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/mmdetection/mmdet/models/losses/gaussian_focal_loss.py # Copyright (c) OpenMMLab. All rights reserved. from typing import Optional, Union import torch.nn as nn from torch import Tensor from mmdet.registry import MODELS from .utils import weight_reduce_loss, weigh...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/mmdet/models/losses/gaussian_focal_loss.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def loadAuth(self): with open(self.AUTH_LOC, "r") as auth_file: auth_string = json.load(auth_file)["token"] return auth_string def loadPackage(self): with open(self.PACKAGE_LOC, "r") as package_file: package = json.load(package_file) return package def loadGuilds(self): try: with...
code_fim
hard
{ "lang": "python", "repo": "PikaBlue107/steve-content-warning", "path": "/steveIO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def loadGuilds(self): try: with open(self.GUILDS_LOC, "rb") as guilds_file: #will close guilds_file if json throws an error guilds = pickle.load(guilds_file) except FileNotFoundError: #catches FileNotFoundError so that we can create a fresh guilds file print("No guilds file found. Creating ...
code_fim
medium
{ "lang": "python", "repo": "PikaBlue107/steve-content-warning", "path": "/steveIO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PikaBlue107/steve-content-warning path: /steveIO.py import json import pickle import sys from history import History class SteveIO: AUTH_LOC_DEFAULT = "auth.json" PACKAGE_LOC_DEFAULT = "package.json" GUILDS_LOC_DEFAULT = "guilds.pickle" def __init__(self, auth_loc=AUTH_LOC_DEFAULT, packa...
code_fim
hard
{ "lang": "python", "repo": "PikaBlue107/steve-content-warning", "path": "/steveIO.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pivoted_values_column_type = query.metadata_manager.retrieve_query_metadata_column_type_by_name( step.value_column ) query.metadata_manager.remove_query_metadata_columns( query.metadata_manager.retrieve_query_metadata_columns_as_list(columns_filter=step.index) ) query.m...
code_fim
hard
{ "lang": "python", "repo": "davinov/weaverbird", "path": "/server/weaverbird/backends/sql_translator/steps/pivot.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: davinov/weaverbird path: /server/weaverbird/backends/sql_translator/steps/pivot.py from distutils import log from weaverbird.backends.sql_translator.steps.utils.query_transformation import ( build_selection_query, sanitize_column_name, ) from weaverbird.backends.sql_translator.types impo...
code_fim
hard
{ "lang": "python", "repo": "davinov/weaverbird", "path": "/server/weaverbird/backends/sql_translator/steps/pivot.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rlfscin/bioinspirada path: /flappyBird/parent_selection.py import setup as st import recombination as rec from random import randint from copy import deepcopy from individual import Individual # ============================================================================= # =====================...
code_fim
hard
{ "lang": "python", "repo": "rlfscin/bioinspirada", "path": "/flappyBird/parent_selection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rand1 = randint(0, len(population)-1) rand2 = rand1 while rand2 == rand1: rand2 = randint(0, len(population)-1) return p1, p2 def global_uniform_selection(population): objvar_lists = _choose_lists_from_pop(population, (lambda x: x.objvars)) sigma_lists = _choose_lists_fro...
code_fim
hard
{ "lang": "python", "repo": "rlfscin/bioinspirada", "path": "/flappyBird/parent_selection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def approx_greater_equal_zero(value, rel_tol=0.0, abs_tol=1e-10): return value >= 0 or math.isclose(value, 0, rel_tol=rel_tol, abs_tol=abs_tol) def approx_eq(v1, v2, rel_tol=0.0, abs_tol=1e-10): return math.isclose(v1, v2, rel_tol=rel_tol, abs_tol=abs_tol) def assert_log(condition, message="", _...
code_fim
hard
{ "lang": "python", "repo": "systems-explained/geb-simulations", "path": "/models/system_model_v3/model/parts/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return value >= 0 or math.isclose(value, 0, rel_tol=rel_tol, abs_tol=abs_tol) def approx_eq(v1, v2, rel_tol=0.0, abs_tol=1e-10): return math.isclose(v1, v2, rel_tol=rel_tol, abs_tol=abs_tol) def assert_log(condition, message="", _raise=True): try: assert condition, message except...
code_fim
hard
{ "lang": "python", "repo": "systems-explained/geb-simulations", "path": "/models/system_model_v3/model/parts/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: systems-explained/geb-simulations path: /models/system_model_v3/model/parts/utils.py from decimal import Decimal import numpy as np import pandas as pd import math import logging import time from functools import wraps import models.system_model_v3.model.parts.failure_modes as failure def apy_t...
code_fim
hard
{ "lang": "python", "repo": "systems-explained/geb-simulations", "path": "/models/system_model_v3/model/parts/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Raises ------ Exception - given series is not a numpy array. Returns ------- Result : statsmodels.tsa.seasonal.DecomposeResult object Object containing the decomposition results. """ assert isinstance(series, np.ndarray), "Series is no...
code_fim
hard
{ "lang": "python", "repo": "AnaTomomi/tscfat", "path": "/build/lib/Analysis/decompose_timeseries.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fig1.tight_layout(pad=2) return fig1 def STL_decomposition(series, title, test = False, savepath = False, savename = False, ylabel = "Battery Level (%)", ...
code_fim
hard
{ "lang": "python", "repo": "AnaTomomi/tscfat", "path": "/build/lib/Analysis/decompose_timeseries.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnaTomomi/tscfat path: /build/lib/Analysis/decompose_timeseries.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 1 14:40:46 2020 @author: arsi Calculate STL decomposition for given time series and plot the components. The decomposition is based on statsmodels ST...
code_fim
hard
{ "lang": "python", "repo": "AnaTomomi/tscfat", "path": "/build/lib/Analysis/decompose_timeseries.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fayazazam/acovrp path: /tsplibparser.py #!python2 import math import re class TSPLIBParser(object): @staticmethod def d_euc2d(i, j): xd = i[0] - j[0] yd = i[1] - j[1] return int(round(math.sqrt(xd*xd + yd*yd))) KEYS_SPEC = ['NAME', 'TYPE', 'COMMENT', 'DIMENSION', 'CAPACI...
code_fim
hard
{ "lang": "python", "repo": "fayazazam/acovrp", "path": "/tsplibparser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(self.filename, 'r') as file: for line in file: if any(value for key, value in sections.iteritems()): if sections['node_coords']: try: counter += 1 m = re.match(r'\s*(\d+)\s+(\-?\d+(\.\d+)?)\s+(\-?\d+(\.\d+)?)(\s+(\-?\d+(\.\d+)?))?\s*\n', line) if '...
code_fim
hard
{ "lang": "python", "repo": "fayazazam/acovrp", "path": "/tsplibparser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: soodraghav/Data-Structures path: /Data Structures/1_ArraysAndLists/2_LinkedListExercises/4_reverse_ll_same_LL.py # Helper Code #Return Same LinkedList class Node: def __init__(self, value): self.value = value self.next = None class LinkedList: def __init__(self): ...
code_fim
medium
{ "lang": "python", "repo": "soodraghav/Data-Structures", "path": "/Data Structures/1_ArraysAndLists/2_LinkedListExercises/4_reverse_ll_same_LL.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return str([v for v in self]) def reverse(linked_list): """ Reverse the inputted linked list Args: linked_list(obj): Linked List to be reversed Returns: obj: Reveresed Linked List """ prev = None current_node = linked_list.h...
code_fim
hard
{ "lang": "python", "repo": "soodraghav/Data-Structures", "path": "/Data Structures/1_ArraysAndLists/2_LinkedListExercises/4_reverse_ll_same_LL.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> while current_node != None: next = current_node.next current_node.next = prev prev = current_node current_node = next # print(prev.value) linked_list.head = prev return linked_list # Tests llist = LinkedList...
code_fim
hard
{ "lang": "python", "repo": "soodraghav/Data-Structures", "path": "/Data Structures/1_ArraysAndLists/2_LinkedListExercises/4_reverse_ll_same_LL.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuyyy111/BCAN path: /data.py from queue import Queue from threading import Thread import h5py import nltk import torch import torch.utils.data as data import os import numpy as np import json from torch.utils.data import DataLoader from prefetch_generator import BackgroundGenerator ...
code_fim
hard
{ "lang": "python", "repo": "liuyyy111/BCAN", "path": "/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> images, captions, ids, img_ids = zip(*data) # Merge images (convert tuple of 3D tensor to 4D tensor) images = torch.stack(images, 0) # Merget captions (convert tuple of 1D tensor to 2D tensor) lengths = torch.LongTensor([len(cap) for cap in captions]) targets = torch.zeros...
code_fim
hard
{ "lang": "python", "repo": "liuyyy111/BCAN", "path": "/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if text==palindrom_text: print("Palindrome") else: print("Not Palindrome")<|fim_prefix|># repo: Shobhits7/Programming-Basics path: /Python/palindrome.py # First we take an input which is assigned to the variable "text" # Then we use the python string slice method to reverse the string # When both...
code_fim
medium
{ "lang": "python", "repo": "Shobhits7/Programming-Basics", "path": "/Python/palindrome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shobhits7/Programming-Basics path: /Python/palindrome.py # First we take an input which is assigned to the variable "text" # Then we use the python string slice method to reverse the string # When both the strings are compared and an appropriate output is made <|fim_suffix|>if text==palindrom_te...
code_fim
medium
{ "lang": "python", "repo": "Shobhits7/Programming-Basics", "path": "/Python/palindrome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bl = fake.create_blacklist(owner_reddit_name='AuthorName', blocked_reddit_name='MemberName') blacklist_user.return_value = (bl, True) app, reply, message, match = fake.create_all() Blacklist(app).run(reply, message, match) blacklist_user.assert_called_once_with('AuthorName', 'Member...
code_fim
hard
{ "lang": "python", "repo": "c17r/TagTrain", "path": "/tests/tagtrain/test_blacklist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c17r/TagTrain path: /tests/tagtrain/test_blacklist.py from unittest.mock import MagicMock, patch from tagtrain import data from . import fake from tagtrain.tagtrain.tt_blacklist import Blacklist @patch('tagtrain.data.by_owner.blacklist_user') def test_unknown_group(blacklist_user): blackli...
code_fim
hard
{ "lang": "python", "repo": "c17r/TagTrain", "path": "/tests/tagtrain/test_blacklist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeyDi/Mispelling path: /code/words_perturbation/perturbation.py import os import re import math import random import sys import json import itertools from random import randint from string import ascii_letters from os import path, listdir from configparser import ConfigParser pathname = o...
code_fim
hard
{ "lang": "python", "repo": "JeyDi/Mispelling", "path": "/code/words_perturbation/perturbation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result_path = config["config"]["perturbed_tweets_folder"] #result_path = "..\\..\\tweets\\perturbed" Only for test purposes result_path = path.join(result_path,filename + ".txt") with open(result_path, "w") as text_file: for index, i in enumerate(result): if index ...
code_fim
hard
{ "lang": "python", "repo": "JeyDi/Mispelling", "path": "/code/words_perturbation/perturbation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nat-n/copier path: /tests/test_migrations.py import json import platform from pathlib import Path from shutil import copytree import pytest import yaml from plumbum import local from plumbum.cmd import git from copier import run_copy, run_update from copier.errors import UserMessageError from ...
code_fim
hard
{ "lang": "python", "repo": "nat-n/copier", "path": "/tests/test_migrations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Build template in v1 with local.cwd(src): git("init") build_file_tree( { "[[ _copier_conf.answers_file ]].jinja": "[[_copier_answers|to_nice_yaml]]", "copier.yml": ( f"""\ _envops: {BRACKET_ENVOPS...
code_fim
hard
{ "lang": "python", "repo": "nat-n/copier", "path": "/tests/test_migrations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Plot data plt.plot_date(formatted_dates, karma_totals, marker="", linestyle="-", lw=constants.width, color=constants.color) # Configure settings ax.grid(constants.show_grid) plt.xticks() locator = mpd.AutoDateLocator(interval_multiples=False) ...
code_fim
hard
{ "lang": "python", "repo": "paramt/trackarma", "path": "/src/generate_chart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: if max(karma_totals) > 1000000: karma_totals = [int(x) / 1000000 for x in karma_totals] ylabel = "(millions)" elif max(karma_totals) > 1000: karma_totals = [int(x) / 1000 for x in karma_totals] ylabel = "(thousands)" except (Inde...
code_fim
medium
{ "lang": "python", "repo": "paramt/trackarma", "path": "/src/generate_chart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paramt/trackarma path: /src/generate_chart.py import datetime import matplotlib.pyplot as plt import matplotlib.dates as mpd import src.constants as constants def main(): plt.switch_backend('Agg') plt.rcParams["figure.figsize"] = (10, 6) # Open dates.txt with open("data/dates.t...
code_fim
medium
{ "lang": "python", "repo": "paramt/trackarma", "path": "/src/generate_chart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saroad2/briefcase path: /tests/integrations/linuxdeploy/test_LinuxDeployBase__upgrade.py import pytest from briefcase.exceptions import MissingToolError, NetworkFailure from briefcase.integrations.linuxdeploy import LinuxDeployBase from tests.integrations.linuxdeploy.utils import side_effect_cre...
code_fim
hard
{ "lang": "python", "repo": "saroad2/briefcase", "path": "/tests/integrations/linuxdeploy/test_LinuxDeployBase__upgrade.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Mock a successful download mock_tools.download.file.side_effect = side_effect_create_mock_appimage( appimage_path ) # Create a linuxdeploy wrapper, then upgrade it linuxdeploy.upgrade() # The mock file should exist as the upgraded version assert appimage_path.exists...
code_fim
hard
{ "lang": "python", "repo": "saroad2/briefcase", "path": "/tests/integrations/linuxdeploy/test_LinuxDeployBase__upgrade.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>',name) else: print('Псевдоним введен не верно!') input ('Нажмите Enter для выхода')<|fim_prefix|># repo: Gerashenko/pythontask path: /zadanie_3.py # Геращенко Мария Yur`evich # Variant 5 print('Герой нашей сегодняшней программы - Чарльз Лютвидж Доджсон.\nПод каким же именем мы знаем этого человек...
code_fim
medium
{ "lang": "python", "repo": "Gerashenko/pythontask", "path": "/zadanie_3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gerashenko/pythontask path: /zadanie_3.py # Геращенко Мария Yur`evich # Variant 5 print('Герой нашей сегодняшней программы -<|fim_suffix|>'Ваш ответ: ') if name=='Льюис Кэрролл': print ('Все верно: Чарльз Лютвидж Доджсон -',name) else: print('Псевдоним введен не верно!') input ('Нажмите ...
code_fim
medium
{ "lang": "python", "repo": "Gerashenko/pythontask", "path": "/zadanie_3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpsonntag/snippets path: /python/odml/test_scripts/datacite_ns_collapse_test.py import os import odmltools.importers.import_datacite as dimp <|fim_suffix|># test fail dimp.handle_document(extra_file, out_dir) # test ns escape extra_nspace = ["http://datacite.org/schema/kernel-2"] dimp.handle_d...
code_fim
hard
{ "lang": "python", "repo": "mpsonntag/snippets", "path": "/python/odml/test_scripts/datacite_ns_collapse_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># test fail dimp.handle_document(extra_file, out_dir) # test ns escape extra_nspace = ["http://datacite.org/schema/kernel-2"] dimp.handle_document(extra_file, out_dir, extra_ns=extra_nspace)<|fim_prefix|># repo: mpsonntag/snippets path: /python/odml/test_scripts/datacite_ns_collapse_test.py import os i...
code_fim
hard
{ "lang": "python", "repo": "mpsonntag/snippets", "path": "/python/odml/test_scripts/datacite_ns_collapse_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MRYLH/MASS-Multi-task-Anthropomorphic-Speech-Synthesis-Framework path: /code/WaveRNN-master/extract_sp+f0/process_sp+f0.py import librosa import numpy as np import os, sys os.environ["CUDA_VISIBLE_DEVICES"] = "3" import argparse # import pyworld from multiprocessing import cpu_count from concurr...
code_fim
hard
{ "lang": "python", "repo": "MRYLH/MASS-Multi-task-Anthropomorphic-Speech-Synthesis-Framework", "path": "/code/WaveRNN-master/extract_sp+f0/process_sp+f0.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def split_data(paths): indices = np.arange(len(paths)) test_size = 0.005 train_indices, test_indices = train_test_split(indices, test_size=test_size, random_state=1234) train_paths = list(np.array(paths)[train_indices]) test_paths = list(np.array(paths)[test_indices]) return train...
code_fim
hard
{ "lang": "python", "repo": "MRYLH/MASS-Multi-task-Anthropomorphic-Speech-Synthesis-Framework", "path": "/code/WaveRNN-master/extract_sp+f0/process_sp+f0.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huseyinozdemir/pythontr_api path: /recipe/serializers/serializer_message.py from rest_framework import serializers from core.models import Message class MessageSerializer(serializers.ModelSerializer): <|fim_suffix|> model = Message fields = ('id', 'create_at', 'sender', 'user',...
code_fim
easy
{ "lang": "python", "repo": "huseyinozdemir/pythontr_api", "path": "/recipe/serializers/serializer_message.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Message fields = ('id', 'create_at', 'sender', 'user', 'subject', 'content', 'ip', 'is_read', 'is_delete',) read_only_fields = ('id',)<|fim_prefix|># repo: huseyinozdemir/pythontr_api path: /recipe/serializers/serializer_message.py from r...
code_fim
easy
{ "lang": "python", "repo": "huseyinozdemir/pythontr_api", "path": "/recipe/serializers/serializer_message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>uction! It will wipe the database.") else: unittest.main()<|fim_prefix|># repo: SuperTux88/MediaCrush path: /tests.py from mediacrush.tests import * from mediacrush.config import config import unittest if __name__ == '__main__': if config.get('meta', <|fim_middle|>'environment') != 'dev'...
code_fim
medium
{ "lang": "python", "repo": "SuperTux88/MediaCrush", "path": "/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuperTux88/MediaCrush path: /tests.py from mediacrush.tests import * from mediacrush.config import config import unittest if __name__ == '__main__': if config.get('meta', <|fim_suffix|>uction! It will wipe the database.") else: unittest.main()<|fim_middle|>'environment') != 'dev'...
code_fim
medium
{ "lang": "python", "repo": "SuperTux88/MediaCrush", "path": "/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>'environment') != 'dev': print("Do NOT run unit tests in production! It will wipe the database.") else: unittest.main()<|fim_prefix|># repo: SuperTux88/MediaCrush path: /tests.py from mediacrush.tests import * from mediacrush.config import config i<|fim_middle|>mport unittest if __na...
code_fim
medium
{ "lang": "python", "repo": "SuperTux88/MediaCrush", "path": "/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='sharekitmetadataharvest', name='is_extracted', field=models.BooleanField(default=False), ), ]<|fim_prefix|># repo: surfedushare/search-portal path: /harvester/sharekit/migrations/0003_is_extracted....
code_fim
medium
{ "lang": "python", "repo": "surfedushare/search-portal", "path": "/harvester/sharekit/migrations/0003_is_extracted.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: surfedushare/search-portal path: /harvester/sharekit/migrations/0003_is_extracted.py # Generated by Django 3.2.12 on 2022-04-19 11:37 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AddField( model_name='sharekitmetadataharvest', ...
code_fim
medium
{ "lang": "python", "repo": "surfedushare/search-portal", "path": "/harvester/sharekit/migrations/0003_is_extracted.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MattesR/search path: /hoover/site/wsgi.py import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hoover.site.settings") from django.core.wsgi import get_wsgi_application <|fim_suffix|>from whitenoise.django import DjangoWhiteNoise application = DjangoWhiteNoise(application) from . import e...
code_fim
easy
{ "lang": "python", "repo": "MattesR/search", "path": "/hoover/site/wsgi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from whitenoise.django import DjangoWhiteNoise application = DjangoWhiteNoise(application) from . import events<|fim_prefix|># repo: MattesR/search path: /hoover/site/wsgi.py import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hoover.site.settings") <|fim_middle|>from django.core.wsgi import get...
code_fim
medium
{ "lang": "python", "repo": "MattesR/search", "path": "/hoover/site/wsgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tag = datacatalog.Tag() prepare.BaseTagFactory._set_bool_field(tag, 'bool', None) self.assertNotIn('bool', tag.fields) def test_set_bool_field_should_set_given_value(self): tag = datacatalog.Tag() prepare.BaseTagFactory._set_bool_field(tag, 'bool', False) ...
code_fim
hard
{ "lang": "python", "repo": "codingnuub/datacatalog-connectors", "path": "/google-datacatalog-connectors-commons/tests/google/datacatalog_connectors/commons/prepare/base_tag_factory_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(1996, len(tag.fields['string'].string_value)) self.assertEqual(u'{}{}...'.format('a' * 1990, str_value), tag.fields['string'].string_value) self.assertEqual( 1999, len(tag.fields['string'].string_value.encode('UTF-8'))) def...
code_fim
hard
{ "lang": "python", "repo": "codingnuub/datacatalog-connectors", "path": "/google-datacatalog-connectors-commons/tests/google/datacatalog_connectors/commons/prepare/base_tag_factory_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: codingnuub/datacatalog-connectors path: /google-datacatalog-connectors-commons/tests/google/datacatalog_connectors/commons/prepare/base_tag_factory_test.py #!/usr/bin/python # coding=utf-8 # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may ...
code_fim
hard
{ "lang": "python", "repo": "codingnuub/datacatalog-connectors", "path": "/google-datacatalog-connectors-commons/tests/google/datacatalog_connectors/commons/prepare/base_tag_factory_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>## Using the database to store task state and results. result_backend = 'db+sqlite:///results.db' task_default_delivery_mode = "transient" task_annotations = {'tasks.add': {'rate_limit': '10/s'}}<|fim_prefix|># repo: Patola/desafiocit path: /celeryconfig.py ## Broker settings. broker_url = 'amqp://gues...
code_fim
medium
{ "lang": "python", "repo": "Patola/desafiocit", "path": "/celeryconfig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Patola/desafiocit path: /celeryconfig.py ## Broker settings. broker_url = 'amqp://guest:guest@127.0.0.1:5672//' # serializer celery_task_serializer = 'pickle' #CELERY_TASK_SERIALIZER = 'pickle' <|fim_suffix|>broker_heartbeat=0 ## Using the database to store task state and results. result_backe...
code_fim
medium
{ "lang": "python", "repo": "Patola/desafiocit", "path": "/celeryconfig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Tests for get_website_user().""" def test_get_website_user_returns_user(self): """Test if something is returned.""" user = get_website_user() self.assertTrue(user) def test_get_website_user_returns_same_user(self): """Test if the same user is returned over ...
code_fim
medium
{ "lang": "python", "repo": "thecut/thecut-authorship", "path": "/thecut/authorship/tests/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_website_user_returns_same_user(self): """Test if the same user is returned over multiple calls.""" user = get_website_user() self.assertEqual(get_website_user(), user)<|fim_prefix|># repo: thecut/thecut-authorship path: /thecut/authorship/tests/test_utils.py # -*-...
code_fim
medium
{ "lang": "python", "repo": "thecut/thecut-authorship", "path": "/thecut/authorship/tests/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thecut/thecut-authorship path: /thecut/authorship/tests/test_utils.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from ..utils import get_website_user from django.test import TestCase <|fim_suffix|> def test_get_website_user_returns_user(self): ""...
code_fim
medium
{ "lang": "python", "repo": "thecut/thecut-authorship", "path": "/thecut/authorship/tests/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wcsjtu/tordj path: /tordj/global_settings.py # -*- coding: utf-8 -*- from __future__ import unicode_literals """default settings. all attribute here can be overridden""" DATABASES = { 'session': { 'ENGINE': 'redis', 'OPTIONS':{ 'host': 'localhost', 'p...
code_fim
hard
{ "lang": "python", "repo": "wcsjtu/tordj", "path": "/tordj/global_settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>GRPC_SERVICES = {} # with format like this {'service module': {'env': 'environment module'}, } # eg. { # "tordj.grpcio.dbservice": { # "context": "path to context dict", # if has not special context, just let empty ...
code_fim
medium
{ "lang": "python", "repo": "wcsjtu/tordj", "path": "/tordj/global_settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_rsvp = { "meetupId": len(self.db) + 1, "topic": topic, "status": status } self.db.append(new_rsvp) return new_rsvp<|fim_prefix|># repo: SolomonMacharia/Questioner path: /app/api/v1/models/rsvp_models.py all_rsvps = [] class RsvpMo...
code_fim
medium
{ "lang": "python", "repo": "SolomonMacharia/Questioner", "path": "/app/api/v1/models/rsvp_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SolomonMacharia/Questioner path: /app/api/v1/models/rsvp_models.py all_rsvps = [] class RsvpModel: <|fim_suffix|> self.db = all_rsvps def create_rsvp(self, topic, status): new_rsvp = { "meetupId": len(self.db) + 1, "topic": topic, "status"...
code_fim
easy
{ "lang": "python", "repo": "SolomonMacharia/Questioner", "path": "/app/api/v1/models/rsvp_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _read_one_field(iprot, ftype): if ftype == TType.BOOL: return iprot.readBool() elif ftype == TType.BYTE: return iprot.readByte() elif ftype == TType.I08: return iprot.readI08() elif ftype == TType.I16: return iprot.readI16() elif ftype == TType.I32: return iprot.readI32()...
code_fim
hard
{ "lang": "python", "repo": "sarvex/commons", "path": "/src/python/twitter/thrift/util/generic_struct_parser.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarvex/commons path: /src/python/twitter/thrift/util/generic_struct_parser.py # Copyright 2011 Twitter Inc. All rights reserved __author__ = 'ugo' # Ugo Di Girolamo import traceback from thrift.Thrift import TType def _type_name(ftype): return TType._VALUES_TO_NAMES[ftype] def read(iprot):...
code_fim
hard
{ "lang": "python", "repo": "sarvex/commons", "path": "/src/python/twitter/thrift/util/generic_struct_parser.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: boconlonton/python-deep-dive path: /part-3/1-dictionaries/exercise-1.py """ Write a function that will create and return a dictionary from another dictionary but sorted by value """ <|fim_suffix|>d1 = {'a': 2, 'b': 1, 'c': 4} d2 = dictionary_constructor1(d1) print(d2) d3 = dictionary_constructo...
code_fim
hard
{ "lang": "python", "repo": "boconlonton/python-deep-dive", "path": "/part-3/1-dictionaries/exercise-1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d1 = {'a': 2, 'b': 1, 'c': 4} d2 = dictionary_constructor1(d1) print(d2) d3 = dictionary_constructor2(d1) print(d3)<|fim_prefix|># repo: boconlonton/python-deep-dive path: /part-3/1-dictionaries/exercise-1.py """ Write a function that will create and return a dictionary from another dictionary but sorted...
code_fim
medium
{ "lang": "python", "repo": "boconlonton/python-deep-dive", "path": "/part-3/1-dictionaries/exercise-1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ The plugin for L{twisted.lore.lmath} can be discovered by querying for L{IProcessor} plugins. """ plugins = getPlugins(IProcessor) lmath = [p for p in plugins if p.name == "mlore"] self.assertEqual(len(lmath), 1, "Did not find math lore plu...
code_fim
medium
{ "lang": "python", "repo": "baojunli/FastCAE", "path": "/VTK/vtk_7.1.1_x64_Debug/lib/python2.7/site-packages/twisted/lore/test/test_lmath.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: baojunli/FastCAE path: /VTK/vtk_7.1.1_x64_Debug/lib/python2.7/site-packages/twisted/lore/test/test_lmath.py # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.lore.lmath}. """ from xml.dom.minidom import Element, Text from twisted.trial.uni...
code_fim
hard
{ "lang": "python", "repo": "baojunli/FastCAE", "path": "/VTK/vtk_7.1.1_x64_Debug/lib/python2.7/site-packages/twisted/lore/test/test_lmath.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result = '' for number, roman in symbols: result += roman * (n // number) # 符號出現次數 n %= number # 剩餘位數 return result<|fim_prefix|># repo: RevansChen/online-judge path: /Codewars/4kyu/roman-numerals-encoder/Python/solutions2.py # Python - 2.7.6 # 列出所有可能的進位值 ...
code_fim
easy
{ "lang": "python", "repo": "RevansChen/online-judge", "path": "/Codewars/4kyu/roman-numerals-encoder/Python/solutions2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RevansChen/online-judge path: /Codewars/4kyu/roman-numerals-encoder/Python/solutions2.py # Python - 2.7.6 # 列出所有可能的進位值 symbols = [ (1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, '...
code_fim
easy
{ "lang": "python", "repo": "RevansChen/online-judge", "path": "/Codewars/4kyu/roman-numerals-encoder/Python/solutions2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_loss(output_dict, gt_labels, **kwargs): return nn.CrossEntropyLoss()(output_dict['logits'], gt_labels.long()) + \ nn.CrossEntropyLoss()(output_dict['logit_b'], gt_labels.long())<|fim_prefix|># repo: clovaai/wsolevaluation path: /wsol/method/acol.py """ Original repository: https://...
code_fim
hard
{ "lang": "python", "repo": "clovaai/wsolevaluation", "path": "/wsol/method/acol.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: clovaai/wsolevaluation path: /wsol/method/acol.py """ Original repository: https://github.com/xiaomengyc/ACoL """ import torch import torch.nn as nn from .util import get_attention __all__ = ['AcolBase'] class AcolBase(nn.Module): def _acol_logits(self, feature, labels, drop_threshold): ...
code_fim
hard
{ "lang": "python", "repo": "clovaai/wsolevaluation", "path": "/wsol/method/acol.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_loss(output_dict, gt_labels, **kwargs): return nn.CrossEntropyLoss()(output_dict['logits'], gt_labels.long()) + \ nn.CrossEntropyLoss()(output_dict['logit_b'], gt_labels.long())<|fim_prefix|># repo: clovaai/wsolevaluation path: /wsol/method/acol.py """ Original repository: https:/...
code_fim
hard
{ "lang": "python", "repo": "clovaai/wsolevaluation", "path": "/wsol/method/acol.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /Trigger/TriggerCommon/TriggerMenu/python/calibcosmicmon/generateBeamspotChainDefs.py # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration ########################################################################################## #######################...
code_fim
medium
{ "lang": "python", "repo": "strigazi/athena", "path": "/Trigger/TriggerCommon/TriggerMenu/python/calibcosmicmon/generateBeamspotChainDefs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(listOfChainDefs)>1: theChainDef = mergeChainDefs(listOfChainDefs) else: theChainDef = listOfChainDefs[0] return theChainDef<|fim_prefix|># repo: strigazi/athena path: /Trigger/TriggerCommon/TriggerMenu/python/calibcosmicmon/generateBeamspotChainDefs.py # Copyright (C) ...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/Trigger/TriggerCommon/TriggerMenu/python/calibcosmicmon/generateBeamspotChainDefs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonebeabout/nwhcc path: /scripts/update-commons.py from bs4 import BeautifulSoup with open('../public_html/commons/head.html','r') as f: head_src = BeautifulSoup(f,'html.parser') head = head_src.find('meta').prettify('utf-8') with open('../public_html/commons/footer.html','r') as f: footer...
code_fim
hard
{ "lang": "python", "repo": "jonebeabout/nwhcc", "path": "/scripts/update-commons.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open('../public_html/events.html', 'r+') as f: events = BeautifulSoup(f,'html.parser') events.head.string = head events.footer.string = footer t = events.find(id='fh5co-counter') t.string = times f.seek(0) str = events.prettify('utf-8').replace('&lt;','<') str = str.replace('&gt;','>'...
code_fim
hard
{ "lang": "python", "repo": "jonebeabout/nwhcc", "path": "/scripts/update-commons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open('../public_html/beliefs.html', 'r+') as f: beliefs = BeautifulSoup(f,'html.parser') beliefs.head.string = head beliefs.footer.string = footer t = beliefs.find(id='fh5co-counter') t.string = times f.seek(0) str = beliefs.prettify('utf-8').replace('&lt;','<') str = str.replace('&gt...
code_fim
hard
{ "lang": "python", "repo": "jonebeabout/nwhcc", "path": "/scripts/update-commons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: densikat/PyRobotSim path: /Direction.py class Direction: directions = { 1: "NORTH", 2: "EAST", 3: "SOUTH", 4: "WEST" } def __init__(self): pass <|fim_suffix|> return Direction.directions[directionindex] @staticmethod def getdi...
code_fim
hard
{ "lang": "python", "repo": "densikat/PyRobotSim", "path": "/Direction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for index, direction in Direction.directions.items(): if direction == directionname: return index<|fim_prefix|># repo: densikat/PyRobotSim path: /Direction.py class Direction: directions = { 1: "NORTH", 2: "EAST", 3: "SOUTH", 4: "WE...
code_fim
hard
{ "lang": "python", "repo": "densikat/PyRobotSim", "path": "/Direction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>summary = defaultdict(list) for i,line in enumerate(gzip.open('mOTU.nr.padded.motu.linkage.map.gz', 'r')): if i == 0: continue tokens = line.rstrip('\n').split('\t') if tokens[0] in percog: summary[tokens[10]].append(percog[tokens[0]]) write("\t") write("\t".join(headers)) wr...
code_fim
hard
{ "lang": "python", "repo": "montoias/ngless", "path": "/Modules/motus.ngm/motus-summary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: montoias/ngless path: /Modules/motus.ngm/motus-summary.py from collections import defaultdict import gzip import sys input_counts = sys.argv[1] write = sys.stdout.write # This could probably be done faster & simpler with a few numpy + pandas # functions, but we prefer to not depend on those pa...
code_fim
hard
{ "lang": "python", "repo": "montoias/ngless", "path": "/Modules/motus.ngm/motus-summary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> percog = {} for i,line in enumerate(open(input_counts)): tokens = line.rstrip().split('\t') if i == 0: headers = tokens[1:] else: counts = [float(v) for v in tokens[1:]] percog[tokens[0]] = counts summary = defaultdict(list) for i,line in enumerate(gzip.open('mOTU.nr...
code_fim
hard
{ "lang": "python", "repo": "montoias/ngless", "path": "/Modules/motus.ngm/motus-summary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>hash_functions = { "md5": md5, "sha1": sha1, "sha224": sha224, "sha256": sha256, "sha384": sha384, "sha512": sha512, "blake2b": blake2b, "blake2s": blake2s, "sha3_224": sha3_224, "sha3_256": sha3_256, "sha3_384": sha3_384, "sha3_512": sha3_512, "adler32"...
code_fim
hard
{ "lang": "python", "repo": "mlkra/various-algorithms", "path": "/mincount/hashfunctions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlkra/various-algorithms path: /mincount/hashfunctions.py from typing import Callable import hashlib import zlib def __common(n: int, h: Callable, digest_size: int, b=0) -> float: assert b <= digest_size if b == 0: return int.from_bytes(h(n.to_bytes(8, "big")).digest(), 'big') /...
code_fim
hard
{ "lang": "python", "repo": "mlkra/various-algorithms", "path": "/mincount/hashfunctions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return __common(n, hashlib.sha3_512, 512, b) def adler32(n: int, b=0) -> float: if b == 0: return zlib.adler32(n.to_bytes(8, "big")) / 2**32 else: return (zlib.adler32(n.to_bytes(8, "big")) >> (32 - b)) / 2**b def adler322(n: int) -> int: return zlib.adler32(n.to_bytes(...
code_fim
hard
{ "lang": "python", "repo": "mlkra/various-algorithms", "path": "/mincount/hashfunctions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: unfoldingWord-dev/door43-acceptance-tests path: /app_code/cli/bible-test.py from __future__ import unicode_literals, print_function import argparse import json import urllib import sys from urllib2 import HTTPError from bs4 import BeautifulSoup from general_tools.print_utils import print_error, p...
code_fim
hard
{ "lang": "python", "repo": "unfoldingWord-dev/door43-acceptance-tests", "path": "/app_code/cli/bible-test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args(sys.argv[1:]) test_errors = [] test_warnings = [] print_ok('STARTING: ', 'Acceptance test for {0}\n'.format(args.gitrepo)) with BibleTest(test_errors, test_warnings) as test: success = test.run(args.gitrepo) if test_errors: print_notice('...
code_fim
hard
{ "lang": "python", "repo": "unfoldingWord-dev/door43-acceptance-tests", "path": "/app_code/cli/bible-test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/spark path: /python/pyspark/pandas/tests/series/test_stat.py h MultiIndex some of index is NaN. pser.index = pd.MultiIndex.from_tuples( [("x", "a"), None, ("y", "c"), ("x", "a"), ("y", "c"), ("x", "a")] ) psser = ps.from_pandas(pser) self.assert...
code_fim
hard
{ "lang": "python", "repo": "apache/spark", "path": "/python/pyspark/pandas/tests/series/test_stat.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }