text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def get(self, key): key = self.add_prefix(key) if self._cache: value = self._cache.get(key) if value is None: self.autofill() value = self._cache.get(key) else: value = None if value is None: ...
code_fim
hard
{ "lang": "python", "repo": "bulldoges/MemberMatters", "path": "/memberportal/membermatters/constance_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bulldoges/MemberMatters path: /memberportal/membermatters/constance_backend.py from constance.backends.database import DatabaseBackend as BaseDatabaseBackend class DatabaseBackend(BaseDatabaseBackend): <|fim_suffix|> key = self.add_prefix(key) if self._cache: value = ...
code_fim
hard
{ "lang": "python", "repo": "bulldoges/MemberMatters", "path": "/memberportal/membermatters/constance_backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deepmd-production/lca-code path: /scripts/pre_process.py """Pre-process DICOMs and create an HDF5 file.""" import argparse <|fim_suffix|> main(parser.parse_args())<|fim_middle|>def main(args): raise NotImplementedError('Pre-process not implemented.') if __name__ == '__main__': pars...
code_fim
medium
{ "lang": "python", "repo": "deepmd-production/lca-code", "path": "/scripts/pre_process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError('Pre-process not implemented.') if __name__ == '__main__': parser = argparse.ArgumentParser(description='Pre-process DICOMs') main(parser.parse_args())<|fim_prefix|># repo: deepmd-production/lca-code path: /scripts/pre_process.py """Pre-process DICOMs and create a...
code_fim
easy
{ "lang": "python", "repo": "deepmd-production/lca-code", "path": "/scripts/pre_process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output = [] def inorder(node: TreeNode) -> None: if node: inorder(node.left) output.append(node.val) inorder(node.right) inorder(root) return output<|fim_prefix|># repo: czs108/LeetCode-Solutions path: /Easy/94....
code_fim
hard
{ "lang": "python", "repo": "czs108/LeetCode-Solutions", "path": "/Easy/94. Binary Tree Inorder Traversal/solution (2).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: czs108/LeetCode-Solutions path: /Easy/94. Binary Tree Inorder Traversal/solution (2).py # 94. Binary Tree Inorder Traversal # Runtime: 50 ms, faster than 10.24% of Python3 online submissions for Binary Tree Inorder Traversal. # Memory Usage: 14.1 MB, less than 91.45% of Python3 online submissio...
code_fim
hard
{ "lang": "python", "repo": "czs108/LeetCode-Solutions", "path": "/Easy/94. Binary Tree Inorder Traversal/solution (2).py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Recursion def inorderTraversal(self, root: TreeNode) -> list[int]: output = [] def inorder(node: TreeNode) -> None: if node: inorder(node.left) output.append(node.val) inorder(node.right) inorder(root) ...
code_fim
hard
{ "lang": "python", "repo": "czs108/LeetCode-Solutions", "path": "/Easy/94. Binary Tree Inorder Traversal/solution (2).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> CHS=ProbabilityInterval(lower_bound=0.5, upper_bound=1.0), CLM=ProbabilityInterval(lower_bound=0.5, upper_bound=1.0), ESN=ProbabilityInterval(lower_bound=0.5, upper_bound=1.0), FIN=ProbabilityInterval(lower_bound=0.5, upper_b...
code_fim
hard
{ "lang": "python", "repo": "akotlar/bystro", "path": "/python/python/bystro/ancestry/dummy_ancestry_response.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: akotlar/bystro path: /python/python/bystro/ancestry/dummy_ancestry_response.py """Provide dummy ancestry response for integration testing.""" from bystro.ancestry.ancestry_types import ( AncestryResponse, AncestryResult, PopulationVector, ProbabilityInterval, SuperpopVector, ...
code_fim
hard
{ "lang": "python", "repo": "akotlar/bystro", "path": "/python/python/bystro/ancestry/dummy_ancestry_response.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: miguelmalvarez/kaggle_digits path: /run_nn.py import tensorflow as tf import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from tensorflow.keras.preprocessing.image import ImageDataGenerator def main(): train_data = pd.read_csv('data/train.csv', header=...
code_fim
hard
{ "lang": "python", "repo": "miguelmalvarez/kaggle_digits", "path": "/run_nn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True) model.compile(optimizer='adam', loss=loss_fn, metrics=['accuracy']) model.fit(x_train, y_train, epochs=epochs, batch_size=batch_size, validation_data=(x_val, y_val)) predictions =...
code_fim
hard
{ "lang": "python", "repo": "miguelmalvarez/kaggle_digits", "path": "/run_nn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fberanizo/sin5006 path: /tests/cvrp/grid_search.py # -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.abspath('..')) import numpy, itertools, operator, pandas class GridSearch(object): def __init__(self, genetic_algorithm, params, repeat=2): self.genetic_algorithm = ...
code_fim
hard
{ "lang": "python", "repo": "fberanizo/sin5006", "path": "/tests/cvrp/grid_search.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_best_parametrization(self): """Returns a list of tuples that have the attributes: params: the parameters used by the GA best_fitness: the mean of best fitnesses of each iteration """ return max(self.grid_scores, key=lambda x: x[1])<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "fberanizo/sin5006", "path": "/tests/cvrp/grid_search.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> parameterId = parameter.getId() if parameterId == 1: from watchFaceParser.models.elements.date.monthAndDayElement import MonthAndDayElement self._monthAndDay = MonthAndDayElement(parameter = parameter, parent = self, name = 'MonthAndDay') return self._mo...
code_fim
hard
{ "lang": "python", "repo": "abhishekhbhootwala/py_amazfit_tools", "path": "/watchFaceParser/models/elements/dateElement.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekhbhootwala/py_amazfit_tools path: /watchFaceParser/models/elements/dateElement.py import logging from watchFaceParser.models.elements.basic.containerElement import ContainerElement class DateElement(ContainerElement): def __init__(self, parameter, parent = None, name = None): ...
code_fim
hard
{ "lang": "python", "repo": "abhishekhbhootwala/py_amazfit_tools", "path": "/watchFaceParser/models/elements/dateElement.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def aossapi_implementation(provider, play_context): provider['transport'] = 'aossapi' if provider.get('host') is None: provider['host'] = play_context.remote_addr if provider.get('port') is None: if provider.get('use_ssl'): ...
code_fim
hard
{ "lang": "python", "repo": "fallenfuzz/aruba-ansible-modules", "path": "/aruba_module_installer/library/plugins/action/arubaoss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if provider.get('port') is None: if provider.get('use_ssl'): provider['port'] = 443 else: provider['port'] = 80 if provider.get('timeout') is None: provider['timeout'] = C.PERSISTENT_COMMAND_TIMEOUT if provider.g...
code_fim
hard
{ "lang": "python", "repo": "fallenfuzz/aruba-ansible-modules", "path": "/aruba_module_installer/library/plugins/action/arubaoss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fallenfuzz/aruba-ansible-modules path: /aruba_module_installer/library/plugins/action/arubaoss.py # (c) 2018 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # t...
code_fim
hard
{ "lang": "python", "repo": "fallenfuzz/aruba-ansible-modules", "path": "/aruba_module_installer/library/plugins/action/arubaoss.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: obiwan314/k9os path: /scripts/center.py [246,-384], [246,-384], [246,-384], [246,-384], [246,-384], [246,-384], [246,-384], [246,-384], [245,-386], [245,-386], [245,-386], [245,-386], [247,-384], [247,-384], [247,-384], [247,-384], ...
code_fim
hard
{ "lang": "python", "repo": "obiwan314/k9os", "path": "/scripts/center.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: obiwan314/k9os path: /scripts/center.py [-144,-190], [-144,-190], [-144,-190], [-144,-190], [-158,-202], [-158,-202], [-158,-202], [-158,-202], [-163,-212], [-163,-212], [-163,-212], [-163,-212], [-167,-218], [-167,-218], [-167,-218], ...
code_fim
hard
{ "lang": "python", "repo": "obiwan314/k9os", "path": "/scripts/center.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> [-147,-618], [-147,-618], [-147,-618], [-143,-621], [-143,-621], [-143,-621], [-143,-621], [-140,-623], [-140,-623], [-140,-623], [-137,-621], [-137,-621], [-137,-621], [-137,-621], [-141,-625], [-141,-625], [-141,-625], [-141,-625], ...
code_fim
hard
{ "lang": "python", "repo": "obiwan314/k9os", "path": "/scripts/center.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> doubles = [] for x in singles: x = int(x) res.append(asc[x-1]) for x in doubles: x = int(x) res.append(asc[x-1]) res = ''.join(res) return res<|fim_prefix|># repo: erjan/coding_exercis...
code_fim
hard
{ "lang": "python", "repo": "erjan/coding_exercises", "path": "/decrypt_string_from_alphabet_to_integer_mapping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for x in singles: x = int(x) res.append(asc[x-1]) for x in doubles: x = int(x) res.append(asc[x-1]) res = ''.join(res) return res<|fim_prefix|># repo: erjan/coding_exercises path: /decrypt_string_from...
code_fim
hard
{ "lang": "python", "repo": "erjan/coding_exercises", "path": "/decrypt_string_from_alphabet_to_integer_mapping.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: erjan/coding_exercises path: /decrypt_string_from_alphabet_to_integer_mapping.py ''' Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z')...
code_fim
hard
{ "lang": "python", "repo": "erjan/coding_exercises", "path": "/decrypt_string_from_alphabet_to_integer_mapping.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Caso 4 ----------- # tiene una entrada de usuario staff # si debe verificar # Caso 5 --------- # tiene una entrada de usuario superuser # si debe verificar # Caso 6 ------------- # tiene un usuario con muchas entradas # tiene dos usuarios con entradas que coinciden a las del otro us...
code_fim
hard
{ "lang": "python", "repo": "RedCiudadana/crowdata", "path": "/crowdataapp/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RedCiudadana/crowdata path: /crowdataapp/tests.py from django.test import TestCase from crowdataapp.models import Document class DocumentTest(TestCase): fixtures = ['prod.json'] def setUp(self): <|fim_suffix|> # VERIFICACIONES ############################# # Caso 1 ------- # tres usu...
code_fim
medium
{ "lang": "python", "repo": "RedCiudadana/crowdata", "path": "/crowdataapp/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: renxinqiang/NLTK_EMOTION path: /comment7.py ','道路','走出','属于',\ '金立','口碑','来讲','评价','手机','有着','品牌','相当','它们','国内','对于',\ '八款','金立','囊括','入手','一款','一口气','各个','打算','手机','这次','发布',\ '手机','金立','热度','多久','难得','销量','第一次','保持','过去',\ '手机','金立','实体店','玩玩','换个','过年','时尚','商务','路线','时间',\ '金立','安全','主打','芯片...
code_fim
hard
{ "lang": "python", "repo": "renxinqiang/NLTK_EMOTION", "path": "/comment7.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '安全','重要',\ '金立','信息安全','续航','独特','手机','有着','品牌','优势','行业','方面','作为',\ '从金立','金立','范的','向着','时尚','进军','商务','注重','看出','年轻','同时',\ '金立','续航','主打','貌似','隐私','超级','安全','以及',\ '金立','十几年','手机','毕竟','品牌','个人','认为',\ '金立','手机','品牌','道路','走出','属于',\ '金立','口碑','来讲','评价','手机','有着','品牌','相当','它们','国内','对于',\ '八款','金...
code_fim
hard
{ "lang": "python", "repo": "renxinqiang/NLTK_EMOTION", "path": "/comment7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>耀',\ '双摄','荣耀','最早','国内',\ '屏得','凑活','音质','不至于',\ '摄像头','屏幕','或许',\ '我敢','扯淡','笔记本','配置','所有',\ '双摄','荣耀','最早','国内',\ '联发科','高通','好不好',\ '想要','性能',\ '柔性','误解','相当',\ '国服','毁号','王碎','宝宝',\ '听筒','摄像头','前置','放在',\ '颜值','超好','最赞','拍照','跟风','游戏','配置','大部分','系统',\ '不怎么样','性能','样子',\ '笔记本','区别','配置',\ '中芯','芯片',...
code_fim
hard
{ "lang": "python", "repo": "renxinqiang/NLTK_EMOTION", "path": "/comment7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mynameismon/12thPracticals path: /question_15/question_15.py # Write a Python program to copy the contents of above file “Medicine.csv” into “Temp.csv”, but with a differe<|fim_suffix|>er(f, delimiter=',') with open('question_15/Temp.csv', 'w') as f1: writer = csv.writ...
code_fim
medium
{ "lang": "python", "repo": "mynameismon/12thPracticals", "path": "/question_15/question_15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>er='\t') for row in reader: writer.writerow(row) if __name__ == '__main__': copy_csv()<|fim_prefix|># repo: mynameismon/12thPracticals path: /question_15/question_15.py # Write a Python program to copy the contents of above file “Medicine.csv” into “Temp.csv”, but ...
code_fim
hard
{ "lang": "python", "repo": "mynameismon/12thPracticals", "path": "/question_15/question_15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>er(f, delimiter=',') with open('question_15/Temp.csv', 'w') as f1: writer = csv.writer(f1, delimiter='\t') for row in reader: writer.writerow(row) if __name__ == '__main__': copy_csv()<|fim_prefix|># repo: mynameismon/12thPracticals path: /question_15/q...
code_fim
medium
{ "lang": "python", "repo": "mynameismon/12thPracticals", "path": "/question_15/question_15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SasView/sasmodels path: /sasmodels/models/correlation_length.py #correlation length model # Note: model title and parameter table are inserted automatically r""" Definition ---------- The scattering intensity I(q) is calculated as .. math:: I(Q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi)^m} + \t...
code_fim
hard
{ "lang": "python", "repo": "SasView/sasmodels", "path": "/sasmodels/models/correlation_length.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def Iq(q, lorentz_scale, porod_scale, cor_length, porod_exp, lorentz_exp): """ 1D calculation of the Correlation length model """ with errstate(divide='ignore'): porod = porod_scale / q**porod_exp lorentz = lorentz_scale / (1.0 + (q * cor_length)**lorentz_exp) inten = p...
code_fim
hard
{ "lang": "python", "repo": "SasView/sasmodels", "path": "/sasmodels/models/correlation_length.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> options = { "num_subpolicies": 2, "fn_choose_subpolicy": fn_choose_subpolicy, "hierarchical_fcnet_hiddens": [[32, 32]] * 2 } config["model"].update({"custom_options": options}) flow_env_name = "TwoLoopsMergePOEnv" exp_tag = "merge_two_level_policy_example" ...
code_fim
medium
{ "lang": "python", "repo": "lijunsun/flow", "path": "/examples/rllib/merge_two_level_policy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lijunsun/flow path: /examples/rllib/merge_two_level_policy.py """ (description) """ import os import ray import ray.rllib.ppo as ppo from ray.tune.registry import get_registry, register_env as register_rllib_env from .cooperative_merge import flow_params, HORIZON, make_create_env # Inner ring ...
code_fim
hard
{ "lang": "python", "repo": "lijunsun/flow", "path": "/examples/rllib/merge_two_level_policy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> flow_env_name = "TwoLoopsMergePOEnv" exp_tag = "merge_two_level_policy_example" this_file = os.path.basename(__file__)[:-3] # filename without '.py' flow_params["flowenv"] = flow_env_name flow_params["exp_tag"] = exp_tag flow_params["module"] = os.path.basename(__file__)[:-3] ...
code_fim
hard
{ "lang": "python", "repo": "lijunsun/flow", "path": "/examples/rllib/merge_two_level_policy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nerevu/riko path: /riko/modules/udf.py # -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.modules.udf ~~~~~~~~~~~~~~~~ Provides functions for performing an arbitrary (user-defined) function on stream items. Examples: basic usage:: >>> from riko.modules.udf import pipe ...
code_fim
hard
{ "lang": "python", "repo": "nerevu/riko", "path": "/riko/modules/udf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parser(stream, objconf, tuples, **kwargs): """Parses the pipe content Args: stream (Iter[dict]): The source. Note: this shares the `tuples` iterator, so consuming it will consume `tuples` as well. objconf (obj): the item independent configuration (an Objectify ...
code_fim
hard
{ "lang": "python", "repo": "nerevu/riko", "path": "/riko/modules/udf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for note in noten: template = Template(mail_template, trim_blocks=True) email_path = os.path.join(email_dir, f"{note['Studierender'].lower().replace(' ', '-')}.txt") with open(email_path, "w") as f: f.write(template.render(note))<|fim_prefix|># repo: hdigital/teaching path: /3-py-tool...
code_fim
hard
{ "lang": "python", "repo": "hdigital/teaching", "path": "/3-py-tools/mail-grades.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hdigital/teaching path: /3-py-tools/mail-grades.py import os, shutil import numpy as np import pandas as pd from jinja2 import Template email_dir = 'z-Mail-Note' if os.path.exists(email_dir): shutil.rmtree(email_dir) os.makedirs(email_dir) with open('mail-grades-template.txt') as f: ...
code_fim
medium
{ "lang": "python", "repo": "hdigital/teaching", "path": "/3-py-tools/mail-grades.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>noten = (pd.read_excel("0-Studierende-Leistungen.xlsx") .replace({np.nan: None}) .dropna(subset = ["Studierender"]) .to_dict(orient = "records") ) for note in noten: template = Template(mail_template, trim_blocks=True) email_path = os.path.join(email_di...
code_fim
medium
{ "lang": "python", "repo": "hdigital/teaching", "path": "/3-py-tools/mail-grades.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Camiloasc1/AstronomyUNAL path: /CelestialMechanics/Scripts/Homework2.py import matplotlib.pyplot as plt from scipy.optimize import brentq import numpy as np DELTA = 0.01 <|fim_suffix|>f = lambda x: x - (1 - m2) * (x + m2) / (abs(x + m2) ** 3) - m2 * (x - 1 + m2) / (abs(x - 1 + m2) ** 3) segmen...
code_fim
medium
{ "lang": "python", "repo": "Camiloasc1/AstronomyUNAL", "path": "/CelestialMechanics/Scripts/Homework2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>f = lambda x: x - (1 - m2) * (x + m2) / (abs(x + m2) ** 3) - m2 * (x - 1 + m2) / (abs(x - 1 + m2) ** 3) segments = [[-2, -m2 - DELTA], [-m2 + DELTA, 1 - m2 - DELTA], [1 - m2 + DELTA, 2]] roots = [brentq(f, segments[i][0], segments[i][1]) for i in range(len(segments))] x = [np.li...
code_fim
medium
{ "lang": "python", "repo": "Camiloasc1/AstronomyUNAL", "path": "/CelestialMechanics/Scripts/Homework2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Merge a list of samples to form a mini-batch. Args: samples (List[int]): sample indices to collate Returns: dict: a mini-batch suitable for forwarding with a Model """ batch = self.base_dataset.collater(samples) # In case of an e...
code_fim
medium
{ "lang": "python", "repo": "archomt/FBK-fairseq-ST", "path": "/examples/speech_recognition/data/multitask_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def size(self, index): """Return an example's size as a float or tuple. This value is used when filtering a dataset with ``--max-positions``.""" return self.base_dataset.size(index) def ordered_indices(self): """Return an ordered list of indices. Batches will be co...
code_fim
hard
{ "lang": "python", "repo": "archomt/FBK-fairseq-ST", "path": "/examples/speech_recognition/data/multitask_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: archomt/FBK-fairseq-ST path: /examples/speech_recognition/data/multitask_dataset.py import torch from fairseq.data import FairseqDataset class MultiTaskDataset(FairseqDataset): def __init__(self, base_dataset, auxiliary_targets): super().__init__() self.base_dataset = base_...
code_fim
hard
{ "lang": "python", "repo": "archomt/FBK-fairseq-ST", "path": "/examples/speech_recognition/data/multitask_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: show0925/magnet-dht path: /magnet_dht/run.py #! usr/bin/python # encoding=utf-8 from threading import Thread from magnet_dht.crawler import * from magnet_dht.magnet_to_torrent_aria2c import * # 服务 host SERVER_HOST = "0.0.0.0" # 服务端口 SERVER_PORT = 9090 # 是否使用全部进程 MAX_PROCESSES = 2 // 2 or cpu_...
code_fim
medium
{ "lang": "python", "repo": "show0925/magnet-dht", "path": "/magnet_dht/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 启动线程 :param offset: 端口偏移值 """ dht = DHTServer(SERVER_HOST, SERVER_PORT + offset, offset) threads = [ Thread(target=dht.send_find_node_forever), Thread(target=dht.receive_response_forever), Thread(target=dht.bs_timer), ] if parse: threads...
code_fim
medium
{ "lang": "python", "repo": "show0925/magnet-dht", "path": "/magnet_dht/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mitsei/dlkit path: /dlkit/authz_adapter/repository/sessions.py query.match_repository_id(repository_id, match=False) return self._query_session.get_assets_by_query(query) def get_repository_id(self): return self._provider_session.get_repository_id() repository_...
code_fim
hard
{ "lang": "python", "repo": "mitsei/dlkit", "path": "/dlkit/authz_adapter/repository/sessions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> composition_search_order = property(fget=get_composition_search_order) @raise_null_argument def get_compositions_by_search(self, composition_query, composition_search): """Pass through to provider CompositionSearchSession.get_compositions_by_search""" # Implemented from azosid...
code_fim
hard
{ "lang": "python", "repo": "mitsei/dlkit", "path": "/dlkit/authz_adapter/repository/sessions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mitsei/dlkit path: /dlkit/authz_adapter/repository/sessions.py _changed_resources if not self._can('register'): raise PermissionDenied() self._provider_session.register_for_changed_compositions() @raise_null_argument def register_for_changed_composition(self, ...
code_fim
hard
{ "lang": "python", "repo": "mitsei/dlkit", "path": "/dlkit/authz_adapter/repository/sessions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for row in reader: record = dict([(k, v) for k, v in row.iteritems() if k in fields]) # Cast strings that are integers to int record = convert(record) # Build an insert statement that we can use a dictionary with query = 'INSERT INTO %s (%s) ' % (cfname, ', '.j...
code_fim
hard
{ "lang": "python", "repo": "polyvore/splunk-cassandra", "path": "/bin/dbcql-insert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: polyvore/splunk-cassandra path: /bin/dbcql-insert.py #!/usr/bin/env python # # Copyright 2011 Splunk, 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 at # # http:...
code_fim
hard
{ "lang": "python", "repo": "polyvore/splunk-cassandra", "path": "/bin/dbcql-insert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> This is necessary because python csv module does not intepret type, so our integers/floats on sys.stdin become strings. """ for k,v in row.iteritems(): if isinstance(v, str): if v.isdigit(): row[k] = int(v) elif re.match(r'^\d+[,\.]\d+$', v)...
code_fim
hard
{ "lang": "python", "repo": "polyvore/splunk-cassandra", "path": "/bin/dbcql-insert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: crunchable/python-rtmbot path: /braceexpand.py import re BRACES_RE = re.compile("\{(.*?)\}", re.DOTALL) def expand_braces(text): <|fim_suffix|> brace = braces[0] options = brace.split('|') for option in options: replaced = BRACES_RE.sub(option, text, count=1) for sub_o...
code_fim
medium
{ "lang": "python", "repo": "crunchable/python-rtmbot", "path": "/braceexpand.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> brace = braces[0] options = brace.split('|') for option in options: replaced = BRACES_RE.sub(option, text, count=1) for sub_opt in expand_braces(replaced): yield sub_opt<|fim_prefix|># repo: crunchable/python-rtmbot path: /braceexpand.py import re BRACES_RE = re.c...
code_fim
medium
{ "lang": "python", "repo": "crunchable/python-rtmbot", "path": "/braceexpand.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pandinosaurus/ensae_teaching_cs path: /_unittests/ut_documentation/test_LONG_rst2html_latex.py """ @brief test log(time=93s) """ import sys import os import unittest import warnings from pyquickhelper.loghelper.flog import fLOG from pyquickhelper.pycode import get_temp_folder from pyquickhe...
code_fim
hard
{ "lang": "python", "repo": "Pandinosaurus/ensae_teaching_cs", "path": "/_unittests/ut_documentation/test_LONG_rst2html_latex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> preamble = """ \\newcommand{\\acc}[1]{\\left\\{#1\\right\\}} \\newcommand{\\abs}[1]{\\left\\{#1\\right\\}} \\newcommand{\\cro}[1]{\\left[#1\\right]} \\newcommand{\\pa}[1]{\\left(#1\\right)} \\newcom...
code_fim
hard
{ "lang": "python", "repo": "Pandinosaurus/ensae_teaching_cs", "path": "/_unittests/ut_documentation/test_LONG_rst2html_latex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nviel/tracker2backlog path: /issue.py from dataclasses import dataclass @dataclass class Issue: numero: int = 0 resume: str = "" statut: str = None version_ciblee: str = None # date_creation: str = None categorie_MOA: str = None valeur_metier: int = None charge: in...
code_fim
hard
{ "lang": "python", "repo": "nviel/tracker2backlog", "path": "/issue.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._numero @numero.setter def numero(self, value): print(value) self._numero = int(value) """<|fim_prefix|># repo: nviel/tracker2backlog path: /issue.py from dataclasses import dataclass @dataclass class Issue: numero: int = 0 resume: str = "" statut...
code_fim
hard
{ "lang": "python", "repo": "nviel/tracker2backlog", "path": "/issue.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CermakM/fabric8-analytics-common path: /dashboard/src/smoke_tests.py """Module with class that handle smoke test results.""" import csv class SmokeTests: """Class that handle smoke test results.""" INPUT_FILES = { "production": { "logs": "smoketests_prod.log", ...
code_fim
hard
{ "lang": "python", "repo": "CermakM/fabric8-analytics-common", "path": "/dashboard/src/smoke_tests.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def logs(self): """Getter for the 'logs' attribute.""" if not self._logs: self.read_logs() return self._logs if __name__ == "__main__": # execute only if run as a script smoke_tests = SmokeTests() print("Results:") print(smoke_tests.r...
code_fim
medium
{ "lang": "python", "repo": "CermakM/fabric8-analytics-common", "path": "/dashboard/src/smoke_tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def results(self): """Getter for the 'results' attribute.""" if not self._results: self.read_results() return self._results @property def logs(self): """Getter for the 'logs' attribute.""" if not self._logs: self.re...
code_fim
hard
{ "lang": "python", "repo": "CermakM/fabric8-analytics-common", "path": "/dashboard/src/smoke_tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>me='SourceType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255, unique=True)), ('notes', models.TextField(blank=True)), ], ...
code_fim
hard
{ "lang": "python", "repo": "Princeton-CDH/derrida-django", "path": "/derrida/footnotes/migrations/0001_initial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Princeton-CDH/derrida-django path: /derrida/footnotes/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-06 21:00 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations...
code_fim
hard
{ "lang": "python", "repo": "Princeton-CDH/derrida-django", "path": "/derrida/footnotes/migrations/0001_initial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amywinecoff/t-recs path: /trecs/tests/test_recommender.py import numpy as np from trecs.models import BaseRecommender from trecs.components import Creators import test_helpers class DummyRecommender(BaseRecommender): def __init__( self, users_hat, items_hat, users, items, num_users,...
code_fim
hard
{ "lang": "python", "repo": "amywinecoff/t-recs", "path": "/trecs/tests/test_recommender.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 10 users and 50 items users = np.random.randint(10, size=(10, 5)) items = np.random.randint(10, size=(5, 50)) users_hat = np.copy(users) items_hat = np.copy(items) def test_generate_recommendations(self): dummy = DummyRecommender(self.users_hat, self.items_hat, self.user...
code_fim
hard
{ "lang": "python", "repo": "amywinecoff/t-recs", "path": "/trecs/tests/test_recommender.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.note_field is None: return self.note_address.is_prefix_of(other.note_address) if self.note_field == 'list': # This branch is here to deal with descending into chords' list field. The hackyness of it arises # from the fact that the fact that the ...
code_fim
hard
{ "lang": "python", "repo": "expressionsofchange/nerf1", "path": "/dsn/s_expr/note_address.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: expressionsofchange/nerf1 path: /dsn/s_expr/note_address.py # ## Classes for note-addresses from utils import pmts class NoteAddress(object): """(Global) address of a Note, the path of that note in a with respect to some global root score.""" def __init__(self, address=()): pm...
code_fim
hard
{ "lang": "python", "repo": "expressionsofchange/nerf1", "path": "/dsn/s_expr/note_address.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.over and mousePressed or self.locked: self.press = True self.locked = True else: self.press = False def releaseEvent(self): self.locked = False def display(self): line(self.x, self.y, self.x + self.stretch, self.y) ...
code_fim
hard
{ "lang": "python", "repo": "jdf/processing.py", "path": "/mode/examples/Topics/GUI/Handles/handle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def releaseEvent(self): self.locked = False def display(self): line(self.x, self.y, self.x + self.stretch, self.y) fill(255) stroke(0) rect(self.boxX, self.boxY, self.size, self.size) if self.over or self.press: line(self.boxX, self.boxY...
code_fim
hard
{ "lang": "python", "repo": "jdf/processing.py", "path": "/mode/examples/Topics/GUI/Handles/handle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdf/processing.py path: /mode/examples/Topics/GUI/Handles/handle.py class Handle(object): def __init__(self, x, y, stretch, size, others): self.x = x self.y = y self.stretch = stretch self.size = size self.boxX = self.x + self.stretch - self.size / 2 ...
code_fim
hard
{ "lang": "python", "repo": "jdf/processing.py", "path": "/mode/examples/Topics/GUI/Handles/handle.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_folder(self, path): for root, dirs, files in os.walk("{}{}".format(self.location, path)): for f in files: self.get_file("{}/{}".format(root.replace(self.location, ""), f)) return "Donwloaded" def get_size(self, folder): size = 0 ...
code_fim
hard
{ "lang": "python", "repo": "nmrkic/AssetsStore", "path": "/assetsstore/assets/local/local_files.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmrkic/AssetsStore path: /assetsstore/assets/local/local_files.py from assetsstore.assets import FileAssets from shutil import copyfile import pathlib import logging import os logger = logging.getLogger(__name__) class LocalFiles(FileAssets): def __init__(self): self.location = os...
code_fim
hard
{ "lang": "python", "repo": "nmrkic/AssetsStore", "path": "/assetsstore/assets/local/local_files.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>zs2 = np.array([[91.852,726.34], [93, 727], [96, 727], [97, 726], [100, 726], [103, 724], [108, 726], [112, 726], [117, 726], [121, 726], [125, 725], [130, 725], [136, 726], [142, 727], [148, 726], [154, 726], [159, 726], [167, 727], [174, 726], [180, 727], [187, 725], [196, 726], [202, 726], [210, 727], ...
code_fim
hard
{ "lang": "python", "repo": "SaraR12/Master_Thesis", "path": "/filterpy-master/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaraR12/Master_Thesis path: /filterpy-master/test.py [117, 726], [121, 726], [125, 725], [130, 725], [136, 726], [142, 727], [148, 726], [154, 726], [159, 726], [167, 727], [174, 726], [180, 727], [187, 725], [196, 726], [202, 726], [210, 727], ...
code_fim
hard
{ "lang": "python", "repo": "SaraR12/Master_Thesis", "path": "/filterpy-master/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mampfes/hacs_waste_collection_schedule path: /custom_components/waste_collection_schedule/waste_collection_schedule/source/east_northamptonshire_gov_uk.py from datetime import datetime, timedelta import requests from waste_collection_schedule import Collection # type: ignore[attr-defined] TIT...
code_fim
medium
{ "lang": "python", "repo": "mampfes/hacs_waste_collection_schedule", "path": "/custom_components/waste_collection_schedule/waste_collection_schedule/source/east_northamptonshire_gov_uk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = r.json() process_day = datetime.now() while process_day.weekday() != DAYS.get(data["day"]): process_day = process_day + timedelta(days=1) reference_date = datetime(2022, 6, 20) entries = [] for _ in range(10): weeks_diff: in...
code_fim
hard
{ "lang": "python", "repo": "mampfes/hacs_waste_collection_schedule", "path": "/custom_components/waste_collection_schedule/waste_collection_schedule/source/east_northamptonshire_gov_uk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in range(10): weeks_diff: int = int((process_day - reference_date).days / 7) if weeks_diff % 2 == 0: bin_type = "general" if data["schedule"] == "B" else "recycling" else: bin_type = "recycling" if data["schedule"] == "B" el...
code_fim
hard
{ "lang": "python", "repo": "mampfes/hacs_waste_collection_schedule", "path": "/custom_components/waste_collection_schedule/waste_collection_schedule/source/east_northamptonshire_gov_uk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: toastdriven/eliteracing path: /pages/views.py from django.shortcuts import get_object_or_404, render from .models import Page <|fim_suffix|> page = get_object_or_404(Page, slug=slug) return render(request, 'pages/page.html', {'page': page})<|fim_middle|>def show_page(request, slug):
code_fim
easy
{ "lang": "python", "repo": "toastdriven/eliteracing", "path": "/pages/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> page = get_object_or_404(Page, slug=slug) return render(request, 'pages/page.html', {'page': page})<|fim_prefix|># repo: toastdriven/eliteracing path: /pages/views.py from django.shortcuts import get_object_or_404, render from .models import Page <|fim_middle|> def show_page(request, slug):
code_fim
easy
{ "lang": "python", "repo": "toastdriven/eliteracing", "path": "/pages/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mottaquikarim/pydev-psets path: /pset_basic_data_types/shopping_list/tests/test_p1.py import io import pytest from unittest import TestCase from unittest.mock import patch @pytest.mark.describe('Shopping List Calculator I - Outputs') class TestPrint(TestCase): @pytest.mark.it('Print statem...
code_fim
hard
{ "lang": "python", "repo": "mottaquikarim/pydev-psets", "path": "/pset_basic_data_types/shopping_list/tests/test_p1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from p1 import ( item_price_1, item_price_2, item_price_3, item_price_4, item_price_5, ) assert isinstance(item_price_1, float) assert isinstance(item_price_2, float) assert isinstance(item_price_3, float)...
code_fim
hard
{ "lang": "python", "repo": "mottaquikarim/pydev-psets", "path": "/pset_basic_data_types/shopping_list/tests/test_p1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asteriation/acnh-eventflow-compiler path: /bfevfl/array.py from __future__ import annotations from typing import Generic, Optional, Sequence, TypeVar from bitstring import BitStream, pack from .str_ import String from .block import Block, DataBlock, ContainerBlock T = TypeVar('T', bound='Bloc...
code_fim
hard
{ "lang": "python", "repo": "asteriation/acnh-eventflow-compiler", "path": "/bfevfl/array.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def alignment(self) -> int: return 8 def __init__(self, items: Sequence[str]) -> None: super().__init__([StringArray._String(item) for item in items]) self.n = len(items) def alignment(self) -> int: return 8<|fim_prefix|># repo: asteriation/acnh-eventf...
code_fim
hard
{ "lang": "python", "repo": "asteriation/acnh-eventflow-compiler", "path": "/bfevfl/array.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class BoolArray(DataBlock): # todo: verify true def __init__(self, items: Sequence[bool]) -> None: super().__init__(4 * len(items)) self.n = len(items) for i, item in enumerate(items): self.buffer.overwrite(pack('uintle:32', 0x80000001 if item else 0x00000000))...
code_fim
hard
{ "lang": "python", "repo": "asteriation/acnh-eventflow-compiler", "path": "/bfevfl/array.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: QAlexBall/Python_Module path: /PatternDesign/Proxy/proxy2.py """ 通过付款用例展示代理模式的显示应用场景 """ from abc import ABCMeta, abstractmethod class Payment(metaclass=ABCMeta): @abstractmethod def do_pay(self): pass class Bank(Payment): def __init__(self): self.card = None ...
code_fim
hard
{ "lang": "python", "repo": "QAlexBall/Python_Module", "path": "/PatternDesign/Proxy/proxy2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.__has_funds(): print("Bank:: Paying the merchant") return True else: print("Bank:: Sorry, not enough funds!") return False class DebitCard(Payment): def __init__(self): self.bank = Bank() def do_pay(self): ...
code_fim
hard
{ "lang": "python", "repo": "QAlexBall/Python_Module", "path": "/PatternDesign/Proxy/proxy2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("You:: Lets buy the Denim shirt") self.debit_card = DebitCard() self.is_purchased = None def make_payment(self): self.is_purchased = self.debit_card.do_pay() def __del__(self): if self.is_purchased: print("You: Wow! Denim shirt is Mi...
code_fim
hard
{ "lang": "python", "repo": "QAlexBall/Python_Module", "path": "/PatternDesign/Proxy/proxy2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skudi/python-cas-client path: /cas_client/cas_client.py def delete_session(self, ticket): ''' Delete a session record associated with a service ticket. ''' assert isinstance(self.session_storage_adapter, CASSessionAdapter) logging.debug('[CAS] Deleting sess...
code_fim
hard
{ "lang": "python", "repo": "skudi/python-cas-client", "path": "/cas_client/cas_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skudi/python-cas-client path: /cas_client/cas_client.py Create a session record from a service ticket. ''' assert isinstance(self.session_storage_adapter, CASSessionAdapter) logging.debug('[CAS] Creating session for ticket {}'.format(ticket)) self.session_sto...
code_fim
hard
{ "lang": "python", "repo": "skudi/python-cas-client", "path": "/cas_client/cas_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' The CAS client's default service URL. This can typically be overriden in any method call. ''' return self._service_url @property def session_storage_adapter(self): ''' The CAS client's session storage adapter for maintaining session sta...
code_fim
hard
{ "lang": "python", "repo": "skudi/python-cas-client", "path": "/cas_client/cas_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('pacientes', '0001_initial'), ('profesionales', '0005_auto_20190928_2338'), ('centros_de_salud', '0004_especialidad_servicio'), ] operations = [ migrations.CreateModel( name='Turno', fields=[ ('id', mode...
code_fim
hard
{ "lang": "python", "repo": "cluster311/ggg", "path": "/calendario/migrations/0001_initial.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cluster311/ggg path: /calendario/migrations/0001_initial.py # Generated by Django 2.2.4 on 2019-09-30 22:43 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> initial = True dependencies = [ ('pacientes', '0001_initial'), ('profesi...
code_fim
hard
{ "lang": "python", "repo": "cluster311/ggg", "path": "/calendario/migrations/0001_initial.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> initial = True dependencies = [ ('pacientes', '0001_initial'), ('profesionales', '0005_auto_20190928_2338'), ('centros_de_salud', '0004_especialidad_servicio'), ] operations = [ migrations.CreateModel( name='Turno', fields=[ ...
code_fim
hard
{ "lang": "python", "repo": "cluster311/ggg", "path": "/calendario/migrations/0001_initial.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for p in range (1,6): peso = float(input("Digite o peso da {}ª pessoa:".format(p))) if p == 1: pesomaior = peso pesomenor = peso else: if peso > pesomaior: pesomaior = peso if peso < pesomenor: pesomenor = peso print(...
code_fim
medium
{ "lang": "python", "repo": "Osmair-riamso/AulasPython", "path": "/Aulas python downloads/ex055.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Osmair-riamso/AulasPython path: /Aulas python downloads/ex055.py '''Faça um programa que leia o peso de cinco pessoas. No final, mostre qual foi o maior e o menor peso lidos. ''' <|fim_suffix|>for p in range (1,6): peso = float(input("Digite o peso da {}ª pessoa:".format(p))) if p == 1:...
code_fim
medium
{ "lang": "python", "repo": "Osmair-riamso/AulasPython", "path": "/Aulas python downloads/ex055.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> request = self.factory.get('/') response = self.view(request) assert response.status_code == status.HTTP_200_OK assert response.data == { 'page_size': 25, 'page_count': 4, 'results': list(range(1, 26)), 'previous': None, ...
code_fim
hard
{ "lang": "python", "repo": "mozilla/addons-server", "path": "/src/olympia/api/tests/test_pagination.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # page size and page should be ignored. request = self.factory.get('/', {'page_size': 10, 'page': 2}) response = self.view(request) assert response.data == { 'page_size': 1, 'page_count': 1, 'results': list(range(1, 2)), 'prev...
code_fim
hard
{ "lang": "python", "repo": "mozilla/addons-server", "path": "/src/olympia/api/tests/test_pagination.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }