text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: yalinli2/Bioindustrial-Park path: /BioSTEAM 1.x.x/build/lib/biorefineries/lipidcane/species/pretreatment.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 10 16:26:31 2018 All species for the oil and sugar separation (pretreatment) section of the lipid cane baseline bioref...
code_fim
medium
{ "lang": "python", "repo": "yalinli2/Bioindustrial-Park", "path": "/BioSTEAM 1.x.x/build/lib/biorefineries/lipidcane/species/pretreatment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _get_credentials(): _check_path_exists()<|fim_prefix|># repo: yjkweon24/cmapBQ path: /cmapBQ/auth.py import os def _check_path_exists(): <|fim_middle|> PATH = os.path.expanduser('~/.cmapBQ') if os.path.exists(PATH): pass else: os.mkdir(PATH) return PATH
code_fim
medium
{ "lang": "python", "repo": "yjkweon24/cmapBQ", "path": "/cmapBQ/auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yjkweon24/cmapBQ path: /cmapBQ/auth.py import os def _check_path_exists(): <|fim_suffix|> _check_path_exists()<|fim_middle|> PATH = os.path.expanduser('~/.cmapBQ') if os.path.exists(PATH): pass else: os.mkdir(PATH) return PATH def _get_credentials():
code_fim
medium
{ "lang": "python", "repo": "yjkweon24/cmapBQ", "path": "/cmapBQ/auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return _main_logger.bind(location=location) def debug(msg): frame = inspect.stack()[1] module = inspect.getmodule(frame[0]) get_logger(module.__name__).debug(msg, debug=True, lineno=frame.lineno)<|fim_prefix|># repo: marc-x-andre/PathViz path: /utils/logger.py import inspect import st...
code_fim
hard
{ "lang": "python", "repo": "marc-x-andre/PathViz", "path": "/utils/logger.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Logger(structlog.BoundLogger): def debug(self, msg, *args, **kwargs): pass def info(self, msg, *args, **kwargs): pass def warning(self, msg, *args, **kwargs): pass def error(self, msg, *args, **kwargs): pass def exception(self, msg, *args, **...
code_fim
medium
{ "lang": "python", "repo": "marc-x-andre/PathViz", "path": "/utils/logger.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marc-x-andre/PathViz path: /utils/logger.py import inspect import structlog structlog.configure( processors=[ structlog.processors.StackInfoRenderer(), structlog.dev.set_exc_info, structlog.stdlib.add_log_level, structlog.processors.format_exc_info, s...
code_fim
hard
{ "lang": "python", "repo": "marc-x-andre/PathViz", "path": "/utils/logger.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Animadversio/FloodFillNetwork-Notes path: /connect_with_knossos.py """ Create KNOSSOS dataset from the image data and segmentation files for proofreading and post processing """ import knossos_utils from ffn.inference.storage import subvolume_path import numpy as np #%% kns_dataset = knossos_ut...
code_fim
hard
{ "lang": "python", "repo": "Animadversio/FloodFillNetwork-Notes", "path": "/connect_with_knossos.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#%% Fetch segmentation file from npz corner = (0, 1000, 1500) seg_dir = "/home/morganlab/Documents/ixP11LGN/p11_5_exp1_rev_full" data_path = subvolume_path(seg_dir, corner, 'npz') seg = np.load(data_path) seg=seg['segmentation'] #%% Export the cube dataset into KNOSSOS kzip_path = "/home/morganlab/Documen...
code_fim
hard
{ "lang": "python", "repo": "Animadversio/FloodFillNetwork-Notes", "path": "/connect_with_knossos.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agladyshev/FSND-brewlocker path: /app/main/forms.py from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileRequired, FileAllowed from wtforms import StringField, TextAreaField, SubmitField from wtforms.validators import Required, Length, URL from wtforms import ValidationError ...
code_fim
medium
{ "lang": "python", "repo": "agladyshev/FSND-brewlocker", "path": "/app/main/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> header = StringField("Your pitch here", validators=[Required()]) body = TextAreaField("Tell me everything", validators=[Required()]) img = FileField('Upload photos', validators=[ FileAllowed(images, 'Images only!')]) phone = StringField('Phone', validators=[Required(), ...
code_fim
medium
{ "lang": "python", "repo": "agladyshev/FSND-brewlocker", "path": "/app/main/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sharan21/vae-exps-3 path: /load_data.py # _*_ coding: utf-8 _*_ import os import sys import torch from torch.nn import functional as F import numpy as np from torchtext.legacy import data from torchtext.legacy import datasets from torchtext.vocab import Vectors, GloVe def load_dataset(test_sen=...
code_fim
hard
{ "lang": "python", "repo": "sharan21/vae-exps-3", "path": "/load_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> word_embeddings = TEXT.vocab.vectors print ("Length of Text Vocabulary: " + str(len(TEXT.vocab))) print ("Vector size of Text Vocabulary: ", TEXT.vocab.vectors.size()) print ("Label Length: " + str(len(LABEL.vocab))) train_data, valid_data = train_data.split() # Further splitting of t...
code_fim
hard
{ "lang": "python", "repo": "sharan21/vae-exps-3", "path": "/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Alternatively we can also use the default configurations''' # train_iter, test_iter = datasets.IMDB.iters(batch_size=32) vocab_size = len(TEXT.vocab) # print(TEXT.vocab.stoi["<eos>"]) # print(TEXT.vocab.stoi["<sos>"]) # exit(0) return TEXT, vocab_size, word_embeddings, tra...
code_fim
hard
{ "lang": "python", "repo": "sharan21/vae-exps-3", "path": "/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if method == "imageinfo": return wmcommons.imageinfo(args)<|fim_prefix|># repo: hay/chantek path: /commands/wmcommons/command.py from . import wmcommons CACHEABLE = True arguments = { "q" : { "required" : True, "type" : str }, "height" : 300, "width" : 300 } m...
code_fim
easy
{ "lang": "python", "repo": "hay/chantek", "path": "/commands/wmcommons/command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hay/chantek path: /commands/wmcommons/command.py from . import wmcommons CACHEABLE = True arguments = { "q" : { "required" : True, "type" : str }, "height" : 300, "width" : 300 } methods = ("imageinfo") <|fim_suffix|> if method == "imageinfo": return w...
code_fim
easy
{ "lang": "python", "repo": "hay/chantek", "path": "/commands/wmcommons/command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if a == 0: if b == 0: if c == 0: print("phuong trinh vo so nghiem") else: print("phuong trinh vo nghiem") else: if c == 0: print("Phuong trinh co 1 nghiem x = 0") else: print("Phuong trinh co 1 nghiem x = ", ...
code_fim
medium
{ "lang": "python", "repo": "thephong45/student-practices", "path": "/5_Pham_Ngo_Tien_Dung/1.10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thephong45/student-practices path: /5_Pham_Ngo_Tien_Dung/1.10.py # "Tạo một chương trình bằng Python, giải phương trình bậc hai # A.x2 + B.x1 + C = 0 # Trong đó A, B, C là số thực (có thể âm), hãy tìm X. " <|fim_suffix|>a = float(input("Nhap a: ")) b = float(input("Nhap b: ")) c = float(in...
code_fim
medium
{ "lang": "python", "repo": "thephong45/student-practices", "path": "/5_Pham_Ngo_Tien_Dung/1.10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a = float(input("Nhap a: ")) b = float(input("Nhap b: ")) c = float(input("Nhcp c: ")) if a == 0: if b == 0: if c == 0: print("phuong trinh vo so nghiem") else: print("phuong trinh vo nghiem") else: if c == 0: print("Phuong t...
code_fim
medium
{ "lang": "python", "repo": "thephong45/student-practices", "path": "/5_Pham_Ngo_Tien_Dung/1.10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MonwarAdeeb/HackerRank-Solutions path: /Python/itertools.permutations() - Alternate Solution.py # Enter your code here. Read input from STDIN. Print output to STDOUT from itertools import permutations <|fim_suffix|>for i in permutations: print("".join(i))<|fim_middle|>word, num = input().spl...
code_fim
medium
{ "lang": "python", "repo": "MonwarAdeeb/HackerRank-Solutions", "path": "/Python/itertools.permutations() - Alternate Solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in permutations: print("".join(i))<|fim_prefix|># repo: MonwarAdeeb/HackerRank-Solutions path: /Python/itertools.permutations() - Alternate Solution.py # Enter your code here. Read input from STDIN. Print output to STDOUT from itertools import permutations <|fim_middle|>word, num = input().spl...
code_fim
medium
{ "lang": "python", "repo": "MonwarAdeeb/HackerRank-Solutions", "path": "/Python/itertools.permutations() - Alternate Solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod async def punish( self, ctx: commands.Context, member: discord.Member, punishment: Punishment ) -> None: """ The manager's punish function. :param ctx: The context of the punishments. :type ctx: commands.Context :param member: Th...
code_fim
hard
{ "lang": "python", "repo": "popop098/discord-super-utils", "path": "/discordSuperUtils/punishments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: popop098/discord-super-utils path: /discordSuperUtils/punishments.py from __future__ import annotations from abc import ABC, abstractmethod from datetime import timedelta from typing import Optional, List, TYPE_CHECKING if TYPE_CHECKING: import discord from discord.ext import commands ...
code_fim
hard
{ "lang": "python", "repo": "popop098/discord-super-utils", "path": "/discordSuperUtils/punishments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Time fitting VQC to data.""" self.vqc.fit(self.X, self.y_one_hot) if __name__ == "__main__": for dataset, backend, optimizer, loss_function in product(*VqcFitBenchmarks.params): bench = VqcFitBenchmarks() try: bench.setup(dataset, backend, optimizer, l...
code_fim
hard
{ "lang": "python", "repo": "ikkoham/qiskit-app-benchmarks", "path": "/machine_learning/benchmarks/vqc_fit_benchmark.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikkoham/qiskit-app-benchmarks path: /machine_learning/benchmarks/vqc_fit_benchmark.py # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory #...
code_fim
hard
{ "lang": "python", "repo": "ikkoham/qiskit-app-benchmarks", "path": "/machine_learning/benchmarks/vqc_fit_benchmark.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.vqc.fit(self.X, self.y_one_hot) if __name__ == "__main__": for dataset, backend, optimizer, loss_function in product(*VqcFitBenchmarks.params): bench = VqcFitBenchmarks() try: bench.setup(dataset, backend, optimizer, loss_function) except NotImplement...
code_fim
hard
{ "lang": "python", "repo": "ikkoham/qiskit-app-benchmarks", "path": "/machine_learning/benchmarks/vqc_fit_benchmark.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Use first max if it is close if np.abs(tau[zz] - tauFirstNext) < tauDistance: tau[zz+1] = tauFirstNext zeta[zz+1] = wpFirstMaxima[zz+1,1] # if it's too far, try the second max elif np.abs(tau[zz] - tauSecondNext) < tauDistance: tau[zz+1] = tauSecondNext zeta[zz+1] = wpSecondMaxim...
code_fim
hard
{ "lang": "python", "repo": "dwille/bbtools", "path": "/c-tools/fourier-reconstruction/1-dim-part/plt/avg-plot-spacetime-wp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dwille/bbtools path: /c-tools/fourier-reconstruction/1-dim-part/plt/avg-plot-spacetime-wp.py #!/usr/bin/env python2 from setup import * os.system('clear') from matplotlib.ticker import MultipleLocator from scipy.signal import argrelextrema print "" print " ---- Fourier Reconstruction Plotting U...
code_fim
hard
{ "lang": "python", "repo": "dwille/bbtools", "path": "/c-tools/fourier-reconstruction/1-dim-part/plt/avg-plot-spacetime-wp.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def generate_options_for_resource_class(control_value=None, **kwargs): if control_value is None: return ['DynamoDB', 'EBS', 'EFS', 'RDS', 'Storage Gateway'] region = control_value.split(',')[2] return [(region + ',' + 'DynamoDB', 'DynamoDB'), (region + ',' + 'EBS', 'EBS'), (region + ',...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/blueprints/aws_backup_selection/create.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if control_value is None: return ['DynamoDB', 'EBS', 'EFS', 'RDS', 'Storage Gateway'] region = control_value.split(',')[2] return [(region + ',' + 'DynamoDB', 'DynamoDB'), (region + ',' + 'EBS', 'EBS'), (region + ',' + 'EFS', 'EFS'), (region + ',' + 'RDS', 'RDS'), (region +...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/blueprints/aws_backup_selection/create.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CloudBoltSoftware/cloudbolt-forge path: /blueprints/aws_backup_selection/create.py """ Build service item action for AWS security group. """ from django.contrib.admin.utils import flatten import boto3 from botocore.exceptions import ClientError from common.methods import set_progress from infrast...
code_fim
hard
{ "lang": "python", "repo": "CloudBoltSoftware/cloudbolt-forge", "path": "/blueprints/aws_backup_selection/create.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aldopareja/instacart_kaggle path: /src/data/decompress.py import argparse, glob, os import warnings as wr import zipfile as zp def main(inputDir,outputDir): inputFiles = glob.glob(os.path.join(inputDir,'*.zip')) if not os.path.exists(outputDir): os.makedirs(outputDir) else: ...
code_fim
hard
{ "lang": "python", "repo": "aldopareja/instacart_kaggle", "path": "/src/data/decompress.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args() inputDir = args.input_directory outputDir = args.output_directory main(inputDir,outputDir)<|fim_prefix|># repo: aldopareja/instacart_kaggle path: /src/data/decompress.py import argparse, glob, os import warnings as wr import zipfile as zp def main(inputDir,o...
code_fim
medium
{ "lang": "python", "repo": "aldopareja/instacart_kaggle", "path": "/src/data/decompress.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """get triggered, when Plugin get uninstall""" pass def TerminalClientStart(self): """get triggered, when user terminal start""" pass def TerminalClientStop(self, exitCode=200): """get triggered, when user terminal stop""" pass def Interfac...
code_fim
medium
{ "lang": "python", "repo": "Mexlab/Doc", "path": "/Listener.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mexlab/Doc path: /Listener.py class Listener(): def __init__(self): pass def UserInput(self, username, userinput): """get triggered, when a plugin want a Input from a User""" pass def Print(self, text): """get triggered, when a text print out""" ...
code_fim
hard
{ "lang": "python", "repo": "Mexlab/Doc", "path": "/Listener.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JefflinKingston/greyatom-python-for-data-science path: /Make-Sense-of-Census/code.py # -------------- # Importing header files import numpy as np import warnings warnings.filterwarnings('ignore') #New record new_record=[[50, 9, 4, 1, 0, 0, 40, 0]] <|fim_suffix|>race_0=np.array(c...
code_fim
hard
{ "lang": "python", "repo": "JefflinKingston/greyatom-python-for-data-science", "path": "/Make-Sense-of-Census/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>len_0=race_0.size len_1=race_1.size len_2=race_2.size len_3=race_3.size len_4=race_4.size l=np.array([len_0,len_1,len_2,len_3,len_4]) m=l.min() minority_race=list(l).index(m) print(minority_race) senior_citizens=np.array(census[census[:,0]>60]) working_hours_sum=senior_citizens[:,6].sum() s...
code_fim
hard
{ "lang": "python", "repo": "JefflinKingston/greyatom-python-for-data-science", "path": "/Make-Sense-of-Census/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>senior_citizens=np.array(census[census[:,0]>60]) working_hours_sum=senior_citizens[:,6].sum() senior_citizens_len=senior_citizens.shape avg_working_hours=round(working_hours_sum/senior_citizens_len[0],2) print(working_hours_sum) print(avg_working_hours) high=np.array(census[census[:,1]>10]) low=n...
code_fim
hard
{ "lang": "python", "repo": "JefflinKingston/greyatom-python-for-data-science", "path": "/Make-Sense-of-Census/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DevLemp/OMS path: /OMS/movie/urls.py from django.urls import path, include from rest_framework.routers import DefaultRouter <|fim_suffix|> router = DefaultRouter() router.register('titles', views.MovieViewSet) router.register('titles/rent', views.RentViewSet) router.register('rental/return', vi...
code_fim
easy
{ "lang": "python", "repo": "DevLemp/OMS", "path": "/OMS/movie/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> router = DefaultRouter() router.register('titles', views.MovieViewSet) router.register('titles/rent', views.RentViewSet) router.register('rental/return', views.ReturnViewSet) router.register('rental/price', views.PriceViewSet) app_name = 'movie' urlpatterns = [ path('', include(router.urls)) ]<|fi...
code_fim
easy
{ "lang": "python", "repo": "DevLemp/OMS", "path": "/OMS/movie/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IML-DKFZ/fd-shifts path: /fd_shifts/tests/analysis/test_metrics.py ["all_nan_correct"]["all_confid"], np.nan), (stats_caches["all_nan_correct"]["some_confid"], np.nan), (stats_caches["all_nan_correct"]["some_confid_inv"], np.nan), (stats_caches["all_nan_correct"]["med_conf...
code_fim
hard
{ "lang": "python", "repo": "IML-DKFZ/fd-shifts", "path": "/fd_shifts/tests/analysis/test_metrics.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize( ("stats_cache", "expected"), [ (stats_caches["all_correct"]["all_confid"], 0), (stats_caches["all_correct"]["some_confid"], 8.059047775479163), (stats_caches["all_correct"]["some_confid_inv"], 8.059047775479163), (stats_caches["all_correct...
code_fim
hard
{ "lang": "python", "repo": "IML-DKFZ/fd-shifts", "path": "/fd_shifts/tests/analysis/test_metrics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IML-DKFZ/fd-shifts path: /fd_shifts/tests/analysis/test_metrics.py _correct"]["all_nan_confid"], np.nan), (stats_caches["none_correct"]["some_nan_confid"], np.nan), (stats_caches["all_nan_correct"]["all_confid"], np.nan), (stats_caches["all_nan_correct"]["some_confid"], np...
code_fim
hard
{ "lang": "python", "repo": "IML-DKFZ/fd-shifts", "path": "/fd_shifts/tests/analysis/test_metrics.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: spyysalo/multiling-cnn path: /testmlcnn.py #!/usr/bin/env python3 # Predict with multilingual text classifier. import sys import os import json import numpy as np from logging import warning, error from keras.models import load_model from keras.preprocessing.sequence import pad_sequences fro...
code_fim
hard
{ "lang": "python", "repo": "spyysalo/multiling-cnn", "path": "/testmlcnn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pred_Y = model.predict(test_X, verbose=0) acc = (np.argmax(pred_Y, axis=1) == np.argmax(test_Y, axis=1)).mean() print('accuracy:\t{:.4f}'.format(acc)) aucs = [] for c in range(num_classes): try: auc = roc_auc_score(test_Y[:, c], pred_Y[:, c]) except: ...
code_fim
hard
{ "lang": "python", "repo": "spyysalo/multiling-cnn", "path": "/testmlcnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lukew3/pythonlogbook path: /pythonlogbook/logbookenv/lib/python3.6/site-packages/mdutils/fileutils/fileutils.py # Python # # This module implements a main class that allows to create markdown files, write in them or read. # # This file is part of mdutils. https://github.com/didix21/mdutils #...
code_fim
hard
{ "lang": "python", "repo": "lukew3/pythonlogbook", "path": "/pythonlogbook/logbookenv/lib/python3.6/site-packages/mdutils/fileutils/fileutils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Read a Markdown file using a file name. It is not necessary to add *.md extension. :param file_name: Markdown file's name. :type file_name: str :return: return all file's data. :rtype: str""" if file_name.find('.md') == -1: file_name...
code_fim
hard
{ "lang": "python", "repo": "lukew3/pythonlogbook", "path": "/pythonlogbook/logbookenv/lib/python3.6/site-packages/mdutils/fileutils/fileutils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if file_name.find('.md') == -1: file_name += '.md' with open(file_name, 'r', encoding='utf-8') as file: file_data = file.read() return file_data if __name__ == '__main__': new_file = MarkDownFile('Example') new_file.rewrite_all_file(da...
code_fim
hard
{ "lang": "python", "repo": "lukew3/pythonlogbook", "path": "/pythonlogbook/logbookenv/lib/python3.6/site-packages/mdutils/fileutils/fileutils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SamiaAitAyadGoncalves/codewars-1 path: /Python/5kyu/Beeramid.py # https://www.codewars.com/kata/51e04f6b544cf3f6550000c1 # # Let's pretend your company just hired your friend from college and paid you a # referral bonus. Awesome! To celebrate, you're taking your team out to the terrible # dive ba...
code_fim
medium
{ "lang": "python", "repo": "SamiaAitAyadGoncalves/codewars-1", "path": "/Python/5kyu/Beeramid.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> cans = bonus//price i = 0 can_count = 0 while can_count <= cans: i += 1 can_count += i*i return max(i-1, 0)<|fim_prefix|># repo: SamiaAitAyadGoncalves/codewars-1 path: /Python/5kyu/Beeramid.py # https://www.codewars.com/kata/51e04f6b544cf3f6550000c1 # # Let's pretend...
code_fim
medium
{ "lang": "python", "repo": "SamiaAitAyadGoncalves/codewars-1", "path": "/Python/5kyu/Beeramid.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Britefury/batchup path: /batchup/tests/test_dataset.py import pytest import os import numpy as np from . import test_config def _get_data_dir(): return os.path.abspath('some_data_dir') def _patch_config_datadir(monkeypatch): from batchup import config monkeypatch.setattr(config, ...
code_fim
hard
{ "lang": "python", "repo": "Britefury/batchup", "path": "/batchup/tests/test_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # clean up f1.clean_up() assert not os.path.exists(dest) test_config._teardown_batchup_temp(tdir) def test_CopySourceFile_acquire_arg(monkeypatch): from batchup.datasets import dataset import hashlib tdir = test_config._setup_batchup_temp(monkeypatch) source_path = os....
code_fim
hard
{ "lang": "python", "repo": "Britefury/batchup", "path": "/batchup/tests/test_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: botpress/node-crfsuite-pos path: /py/__init__.py TAGS_MAP = { '-LRB-': 'PUNCT', '-RRB-': 'PUNCT', ',': 'PUNCT', ':': 'PUNCT', '.': 'PUNCT', "''": 'PUNCT', '""': 'PUNCT', '``': 'PUNCT', '#': 'SYM', '$': 'SYM', 'ADD': 'X', 'AFX': 'ADJ', 'BES': 'VE...
code_fim
hard
{ "lang": "python", "repo": "botpress/node-crfsuite-pos", "path": "/py/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>CE', 'SYM': 'SYM', 'TO': 'PART', 'UH': 'INTJ', 'VB': 'VERB', 'VBD': 'VERB', 'VBG': 'VERB', 'VBN': 'VERB', 'VBP': 'VERB', 'VBZ': 'VERB', 'WDT': 'ADJ', 'WP': 'NOUN', 'WP$': 'ADJ', 'WRB': 'ADV', 'XX': 'X' }<|fim_prefix|># repo: botpress/node-crfsuite-po...
code_fim
hard
{ "lang": "python", "repo": "botpress/node-crfsuite-pos", "path": "/py/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ts=["scripts/s3_media_upload"], install_requires=[ "boto3>=1.9.23<2.0", "botocore>=1.12.23<2.0", "humanize>=0.5.1<0.6", "psycopg2>=2.7.5<3.0", "PyYAML>=3.13<4.0", "tqdm>=4.26.0<5.0", "Twisted", ], )<|fim_prefix|># repo: rkfg/synapse-s3-storag...
code_fim
medium
{ "lang": "python", "repo": "rkfg/synapse-s3-storage-provider", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ize>=0.5.1<0.6", "psycopg2>=2.7.5<3.0", "PyYAML>=3.13<4.0", "tqdm>=4.26.0<5.0", "Twisted", ], )<|fim_prefix|># repo: rkfg/synapse-s3-storage-provider path: /setup.py from setuptools import setup __version__ = "1.0" setup( name="synapse-s3-storage-provider", v...
code_fim
medium
{ "lang": "python", "repo": "rkfg/synapse-s3-storage-provider", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rkfg/synapse-s3-storage-provider path: /setup.py from setuptools import setup __version__ = "1.0" setup( name="synapse-s3-storage-provider", version=__version__, zip<|fim_suffix|>ize>=0.5.1<0.6", "psycopg2>=2.7.5<3.0", "PyYAML>=3.13<4.0", "tqdm>=4.26.0<5.0", ...
code_fim
hard
{ "lang": "python", "repo": "rkfg/synapse-s3-storage-provider", "path": "/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>len(str2) % i == 0): if str1[:i] * (len(str1) // i) == str1 and \ str1[:i] * (len(str2) // i) == str2: return str1[:i] return ''<|fim_prefix|># repo: MDGSF/JustCoding path: /python-leetcode/1071.py class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: ...
code_fim
medium
{ "lang": "python", "repo": "MDGSF/JustCoding", "path": "/python-leetcode/1071.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> str1[:i] * (len(str2) // i) == str2: return str1[:i] return ''<|fim_prefix|># repo: MDGSF/JustCoding path: /python-leetcode/1071.py class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: for i<|fim_middle|> in range(min(len(str1), len(str2)), 0, -1): if (len(st...
code_fim
medium
{ "lang": "python", "repo": "MDGSF/JustCoding", "path": "/python-leetcode/1071.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MDGSF/JustCoding path: /python-leetcode/1071.py class Solution: def gcdOfStrings(self, str1: str, str2: str) -> str: for i<|fim_suffix|>len(str2) % i == 0): if str1[:i] * (len(str1) // i) == str1 and \ str1[:i] * (len(str2) // i) == str2: return str1[:i] retu...
code_fim
medium
{ "lang": "python", "repo": "MDGSF/JustCoding", "path": "/python-leetcode/1071.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProzorroUKR/openprocurement.api path: /src/openprocurement/tender/cfaselectionua/tests/tender.py # -*- coding: utf-8 -*- import unittest from copy import deepcopy from openprocurement.api.tests.base import snitch from openprocurement.tender.core.tests.base import ( test_exclusion_criteria, ...
code_fim
hard
{ "lang": "python", "repo": "ProzorroUKR/openprocurement.api", "path": "/src/openprocurement/tender/cfaselectionua/tests/tender.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class TenderProcessTest(BaseTenderWebTest): docservice = True initial_data = test_tender_cfaselectionua_data primary_tender_status = "draft" initial_auth = ("Basic", ("broker", "")) docservice = True test_invalid_tender_conditions = snitch(invalid_tender_conditions) test_one_v...
code_fim
hard
{ "lang": "python", "repo": "ProzorroUKR/openprocurement.api", "path": "/src/openprocurement/tender/cfaselectionua/tests/tender.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/neutron-tempest-plugin path: /neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py # Copyright (c) 2019 AT&T # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the Lice...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-tempest-plugin", "path": "/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @decorators.idempotent_id('fcb15ca3-ef61-11e9-9792-f45c89c47e11') @testtools.skipUnless(CONF.neutron_plugin_options.advanced_image_ref, 'Cloud image not found.') @decorators.attr(type='slow') @utils.services('compute', 'network') def test_taas_forwarded_traffi...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-tempest-plugin", "path": "/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brunorijsman/euler-problems-python path: /euler/problem265.py def recurse(n, ring, remaining, pos): if pos == (2**n) - 2: add_ring(n, ring) else: candidate = (ring[pos] & (2**(n-1) - 1)) << 1 consider(n, ring, remaining, pos, candidate) consider(n, ring, re...
code_fim
medium
{ "lang": "python", "repo": "brunorijsman/euler-problems-python", "path": "/euler/problem265.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def solve(n): global sum sum = 0 ring = {} ring[0] = 0 ring[1] = 1 remaining = list(range(2, 2**n)) ring[2**n - 1] = 2**(n-1) remaining.remove(2**(n-1)) recurse(n, ring, remaining, 1) print sum solve(5)<|fim_prefix|># repo: brunorijsman/euler-problems-python path:...
code_fim
hard
{ "lang": "python", "repo": "brunorijsman/euler-problems-python", "path": "/euler/problem265.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 'icecaps.data_io', 'icecaps.util', 'icecaps.decoding', 'icecaps.estimators' ] )<|fim_prefix|># repo: eabalo/Icecaps_Container_Build path: /icecaps/setup.py from setuptools import setup setup ( name='icecap<|fim_middle|>s', version='0.2.0', packages=['icecaps', ...
code_fim
easy
{ "lang": "python", "repo": "eabalo/Icecaps_Container_Build", "path": "/icecaps/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eabalo/Icecaps_Container_Build path: /icecaps/setup.py from setuptools import setup setup ( name='icecap<|fim_suffix|>icecaps.decoding', 'icecaps.estimators' ] )<|fim_middle|>s', version='0.2.0', packages=['icecaps', 'icecaps.data_io', 'icecaps.util', ...
code_fim
medium
{ "lang": "python", "repo": "eabalo/Icecaps_Container_Build", "path": "/icecaps/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>icecaps.decoding', 'icecaps.estimators' ] )<|fim_prefix|># repo: eabalo/Icecaps_Container_Build path: /icecaps/setup.py from setuptools import setup setup ( name='icecap<|fim_middle|>s', version='0.2.0', packages=['icecaps', 'icecaps.data_io', 'icecaps.util', ...
code_fim
medium
{ "lang": "python", "repo": "eabalo/Icecaps_Container_Build", "path": "/icecaps/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Software-Architecture-with-Python path: /Chapter03/fakelogger.py # Code Listing #2 import logging class FakeLogger(object): """ A class that fakes the interface of the logging.Logger object in a minimalistic fashion """ def __init__(self): self.lvl = logging...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Software-Architecture-with-Python", "path": "/Chapter03/fakelogger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Log at error level """ if self.lvl<=logging.ERROR: return self._log(msg, *args) def critical(self, msg, *args): """ Log at critical level """ if self.lvl<=logging.CRITICAL: return self._log(msg, *args)<|fim_prefix|># repo: PacktPublishing/Software-Architecture-...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Software-Architecture-with-Python", "path": "/Chapter03/fakelogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise<|fim_prefix|># repo: tjansse2/hep-monte-carlo path: /src/hepmc/core/a_nice_mc/logger.py import logging import sys import os import numpy as np import pandas as pd import errno...
code_fim
hard
{ "lang": "python", "repo": "tjansse2/hep-monte-carlo", "path": "/src/hepmc/core/a_nice_mc/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tjansse2/hep-monte-carlo path: /src/hepmc/core/a_nice_mc/logger.py import logging import sys import os import numpy as np import pandas as pd import errno def create_logger(module_name, level=logging.INFO): logger = logging.getLogger(module_name) logger.setLevel(level) handler = log...
code_fim
medium
{ "lang": "python", "repo": "tjansse2/hep-monte-carlo", "path": "/src/hepmc/core/a_nice_mc/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def ensure_directory(path): try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise<|fim_prefix|># repo: tjansse2/hep-monte-carlo path: /src/hepmc/core/a_nice_mc/logger.py import logging import sys import os import numpy as np imp...
code_fim
hard
{ "lang": "python", "repo": "tjansse2/hep-monte-carlo", "path": "/src/hepmc/core/a_nice_mc/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # number of allowed heuristic trials per embedding HEUR_TIMEOUT = 5 # allowed number of seconds for heuristic algorithm<|fim_prefix|># repo: retallickj/qca-embedding path: /gui/src/core/core_settings.py #!/usr/bin/env python # ----------------------------------- # Name: core_settings.py # Desc...
code_fim
hard
{ "lang": "python", "repo": "retallickj/qca-embedding", "path": "/gui/src/core/core_settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: retallickj/qca-embedding path: /gui/src/core/core_settings.py #!/usr/bin/env python # ----------------------------------- # Name: core_settings.py # Desc: Core settings for embedder<|fim_suffix|>-------------------------- DENSE_TRIALS = 10 # number of allowed dense placement trials per ...
code_fim
medium
{ "lang": "python", "repo": "retallickj/qca-embedding", "path": "/gui/src/core/core_settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vitrine-app/server path: /games_catcher.py from ctypes import * games_catcher = cdll.LoadLibrary('./lib/games_catcher.so') <|fim_suffix|>games_catcher.GetGame.argtypes = [c_int] games_catcher.GetGame.restype = c_char_p games_catcher.GetFirstGame.argtypes = [GoString] games_catcher.GetFirstGam...
code_fim
medium
{ "lang": "python", "repo": "vitrine-app/server", "path": "/games_catcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>games_catcher.ResearchGames.argtypes = [GoString, c_int] games_catcher.ResearchGames.restype = c_char_p<|fim_prefix|># repo: vitrine-app/server path: /games_catcher.py from ctypes import * games_catcher = cdll.LoadLibrary('./lib/games_catcher.so') class GoString(Structure): _fields_ = [('p', c_cha...
code_fim
medium
{ "lang": "python", "repo": "vitrine-app/server", "path": "/games_catcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if group_key is not None: if group_key not in nodes_df: raise Exception('Could not find column {}'.format(group_key)) groupings = nodes_df.groupby(group_key) n_colors = nodes_df[group_key].nunique() color_norm = colors.Normalize(vmin=0, vmax=(n_colors-1)) ...
code_fim
hard
{ "lang": "python", "repo": "NeoNeuron/bmtk", "path": "/bmtk/analyzer/visualization/spikes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeoNeuron/bmtk path: /bmtk/analyzer/visualization/spikes.py O: Need to be able to handle gid or node_id nodes_df = pd.DataFrame({'node_id': nodes_grp['node_id'], 'node_type_id': nodes_grp['node_type_id']}) #nodes_df = pd.DataFrame({'node_id': nodes_h5['/nodes/node_gid'], 'node_type_id': n...
code_fim
hard
{ "lang": "python", "repo": "NeoNeuron/bmtk", "path": "/bmtk/analyzer/visualization/spikes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeoNeuron/bmtk path: /bmtk/analyzer/visualization/spikes.py ot as plt import matplotlib.cm as cmx import matplotlib.colors as colors import matplotlib.gridspec as gridspec import bmtk.simulator.utils.config as config from bmtk.utils.reports.spike_trains.plotting import plot_raster, plot_rates # ...
code_fim
hard
{ "lang": "python", "repo": "NeoNeuron/bmtk", "path": "/bmtk/analyzer/visualization/spikes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: todrzywolek/word-learner path: /harness.py from logic import Logic import hints from gui import open_file class Harness: FILE_OPEN_OPTIONS = dict(defaultextension='.txt', filetypes=[('text files', '*.txt')], title='Wybierz plik z li...
code_fim
hard
{ "lang": "python", "repo": "todrzywolek/word-learner", "path": "/harness.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._logic = Logic() self._language = '[GER]' def start(self): print('Program do slowek.\nWybierz plik') f = open_file() self._logic.load_file(f) while not self._logic.empty(): word = self._logic.rand_word() answer = word.get_t...
code_fim
hard
{ "lang": "python", "repo": "todrzywolek/word-learner", "path": "/harness.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Program do slowek.\nWybierz plik') f = open_file() self._logic.load_file(f) while not self._logic.empty(): word = self._logic.rand_word() answer = word.get_translation() user_input = input('Your Answer: ') if user_inpu...
code_fim
hard
{ "lang": "python", "repo": "todrzywolek/word-learner", "path": "/harness.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Start Appium server and attach client self.appium_service = AppiumService() self.appium_service.start(args=['--address', '127.0.0.1', '-p', str(port)]) self.driver = webdriver.Remote("http://127.0.0.1:{0}/wd/hub".format(port), capabilities) def stop(self): if...
code_fim
hard
{ "lang": "python", "repo": "nmladenov/pragmatic-mobile-testing", "path": "/appium/appium-python-demos/utils/appium_session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def free_port(): """ Determines a free port using sockets. """ free_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) free_socket.bind(('0.0.0.0', 0)) free_socket.listen(5) port = free_socket.getsockname()[1] fr...
code_fim
hard
{ "lang": "python", "repo": "nmladenov/pragmatic-mobile-testing", "path": "/appium/appium-python-demos/utils/appium_session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmladenov/pragmatic-mobile-testing path: /appium/appium-python-demos/utils/appium_session.py import socket import sys from appium import webdriver from appium.webdriver.appium_service import AppiumService from webdriver_manager.chrome import ChromeDriverManager class AppiumSession(object): ...
code_fim
hard
{ "lang": "python", "repo": "nmladenov/pragmatic-mobile-testing", "path": "/appium/appium-python-demos/utils/appium_session.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> img_o = np.asarray(Image.open(IMG_SELECT)) img_moy_3_3 = average_filter_auto(img_o, (3,3)) img_moy_5_5 = average_filter_auto(img_o, (5,5)) filtre = np.asarray([[1, 2, 1], [2, 4, 2], [1, 2, 1]])/16 img_moy_3_3_cent = average_filter(img_o, filtre) img_bruit_gauss, bruit_gauss = gauss...
code_fim
medium
{ "lang": "python", "repo": "Guitheg/iprocessing_training", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> moon = np.asarray(Image.open(MOON)) moon_lapla = simple_laplacian(moon, 4) moon_rehau_lapla = simple_laplacian(moon, 0) moon_rehau_lapla_diag = simple_laplacian(moon, 5) u.view_img(moon, "[{}] Moon originale".format(os.path.basename(IMG_SELECT)), 9) u.view_img(moon_lapla, "[{}] Mo...
code_fim
hard
{ "lang": "python", "repo": "Guitheg/iprocessing_training", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Guitheg/iprocessing_training path: /main.py import sys, os from os.path import join import numpy as np import utils as u from PIL import Image from filtre import average_filter, average_filter_auto, gaussian_noise, simple_laplacian MAIN = os.path.abspath(os.path.dirname(__file__)) DATA = join...
code_fim
hard
{ "lang": "python", "repo": "Guitheg/iprocessing_training", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: svohara/svo_util path: /src/svo_util/text_ui.py ''' Created on Dec 10, 2012 @author: Stephen O'Hara Utility functions for various text-mode user interface functions. Typically things like showing a dotted progress bar during the iterations of some batch process, etc. ''' import sys <|fim_suffix...
code_fim
medium
{ "lang": "python", "repo": "svohara/svo_util", "path": "/src/svo_util/text_ui.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> ''' This function can be called in a processing loop to print out a progress indicator represented by up to 10 lines of dots, where each line represents completion of 10% of the total iterations. @param cur: The current value (integer) of the iteration/count. @param total: The...
code_fim
medium
{ "lang": "python", "repo": "svohara/svo_util", "path": "/src/svo_util/text_ui.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>from functools import reduce print(reduce(lambda a, y: a+y, [sin(x**i) for i in range(1, n+1)]))<|fim_prefix|># repo: mamaaravi/Python_Uni path: /1_loops.py #sum=sin(x)+sin(x^2)+xin(x^3)+...+sin(x^n) from math import sin sum=0 <|fim_middle|>n=int(input("Enter n: ")) x=int(input("Enter x: ")) for i in ...
code_fim
medium
{ "lang": "python", "repo": "mamaaravi/Python_Uni", "path": "/1_loops.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mamaaravi/Python_Uni path: /1_loops.py #sum=sin(x)+sin(x^2)+xin(x^3)+...+sin(x^n) from math import sin sum=0 n=int(input("Enter n: ")) x=int(input("Enter x: ")) for i in range(1,n+1): sum+=sin(x**i) <|fim_suffix|>from functools import reduce print(reduce(lambda a, y: a+y, [sin(x**i) for i...
code_fim
easy
{ "lang": "python", "repo": "mamaaravi/Python_Uni", "path": "/1_loops.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pretalx/pretalx path: /src/pretalx/event/migrations/0018_auto_20190223_1543.py # Generated by Django 2.1.5 on 2019-02-23 15:43 from django.db import migrations, models <|fim_suffix|> dependencies = [ ("submission", "0031_auto_20190223_0730"), ("event", "0017_auto_20180922_051...
code_fim
medium
{ "lang": "python", "repo": "pretalx/pretalx", "path": "/src/pretalx/event/migrations/0018_auto_20190223_1543.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name="team", name="limit_tracks", field=models.ManyToManyField(blank=True, to="submission.Track"), ), migrations.AlterField( model_name="event", name="timezone", fi...
code_fim
medium
{ "lang": "python", "repo": "pretalx/pretalx", "path": "/src/pretalx/event/migrations/0018_auto_20190223_1543.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> calib(event) # make a copy of the calibrated event for the camera frame case # later we clean and paramretrize the 2 events in the same way # but in 2 different frames to check they return compatible results event_camera_frame = deepcopy(event) telescope_po...
code_fim
hard
{ "lang": "python", "repo": "mireianievas/ctapipe", "path": "/ctapipe/reco/tests/test_HillasReconstructor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mireianievas/ctapipe path: /ctapipe/reco/tests/test_HillasReconstructor.py from copy import deepcopy import numpy as np from astropy import units as u import pytest from ctapipe.containers import ImageParametersContainer, HillasParametersContainer from ctapipe.instrument import SubarrayDescripti...
code_fim
hard
{ "lang": "python", "repo": "mireianievas/ctapipe", "path": "/ctapipe/reco/tests/test_HillasReconstructor.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if (moments_camera_frame.width.value > 0) and (moments_telescope_frame.width.value > 0): event_camera_frame.dl1.tel[ tel_id ].parameters.hillas = moments_camera_frame dl1.parameters.hillas = moments_telesco...
code_fim
hard
{ "lang": "python", "repo": "mireianievas/ctapipe", "path": "/ctapipe/reco/tests/test_HillasReconstructor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: neil-n-zhang/ABRS path: /ABRS_behavior_analysis.py #ABRS_behavior_analysis import numpy as np import scipy from scipy import ndimage from scipy import misc import pickle import pandas as pd import time import matplotlib.pyplot as plt import cv2 import os from ABRS_modules import discrete_radon...
code_fim
hard
{ "lang": "python", "repo": "neil-n-zhang/ABRS", "path": "/ABRS_behavior_analysis.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> idxNew = np.zeros((1,shIdx[1])) idxNew[0,0:shIdx[1]] = idx[0,0:shIdx[1]] idxS = idx minDurWalk=5; minDurSilence=5; minDurAPW=10; minDurAPA=30; durRecAP = get_durations (idxAP) shDurRecAP = np.shape(durRecAP) for d in range(1,shDurRecAP[1]-1): i...
code_fim
hard
{ "lang": "python", "repo": "neil-n-zhang/ABRS", "path": "/ABRS_behavior_analysis.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }