text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> if cv2.waitKey(30) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()<|fim_prefix|># repo: xmanatee/mipt.digger.project path: /nmakeenkov_dev.py import cv2 import rectangle_builder cap = cv2.VideoCapture(u'data/CH0P0389.MPG') r_b = rectangle_builder.RectangleBuilder() while(cap.isOp...
code_fim
hard
{ "lang": "python", "repo": "xmanatee/mipt.digger.project", "path": "/nmakeenkov_dev.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cv2.rectangle(frame, lb, rt, (0, 200, 0), 2) # for fr in q: # for ch in fr: # for c in ch[1]: # cv2.rectangle(frame, (c[0], ch[0]), (c[1], ch[0]+1), (0,200,0)) to_show = cv2.resize(edges, (720, 405)) to_show_ = cv2.resize(frame, (720, 405)) cv2.imshow('', to_show) cv2.imsh...
code_fim
medium
{ "lang": "python", "repo": "xmanatee/mipt.digger.project", "path": "/nmakeenkov_dev.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class BertAdapterTestBase(AdapterTestBase): config_class = BertConfig config = make_config( BertConfig, hidden_size=32, num_hidden_layers=4, num_attention_heads=4, intermediate_size=37, ) tokenizer_name = "bert-base-uncased" @require_torch class Be...
code_fim
medium
{ "lang": "python", "repo": "cambridgeltl/autopeft", "path": "/adapter-transformers-adapters3.1.0/tests_adapters/test_bert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cambridgeltl/autopeft path: /adapter-transformers-adapters3.1.0/tests_adapters/test_bert.py import unittest from tests.models.bert.test_modeling_bert import * from transformers import BertAdapterModel from transformers.testing_utils import require_torch from .methods import ( BottleneckAdap...
code_fim
hard
{ "lang": "python", "repo": "cambridgeltl/autopeft", "path": "/adapter-transformers-adapters3.1.0/tests_adapters/test_bert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name="hapaplacename", name="historic", field=models.BooleanField( default=False, help_text="Historischer Ort bedeutet es gibt diesen Ort heute nicht mehr", verbose_name...
code_fim
medium
{ "lang": "python", "repo": "acdh-oeaw/hapa", "path": "/archiv/migrations/0003_hapaplacename_historic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acdh-oeaw/hapa path: /archiv/migrations/0003_hapaplacename_historic.py # Generated by Django 3.1.6 on 2021-02-09 09:38 from django.db import migrations, models <|fim_suffix|> dependencies = [ ("archiv", "0002_auto_20210202_1709"), ] operations = [ migrations.AddFie...
code_fim
medium
{ "lang": "python", "repo": "acdh-oeaw/hapa", "path": "/archiv/migrations/0003_hapaplacename_historic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_socket(host): present = [ # "tcp://0.0.0.0:3000" "tcp://127.0.0.1:3000" ] for socket in present: s = host.socket(socket) assert s.is_listening<|fim_prefix|># repo: bolek2000/ansible-grafana path: /tests/test_default.py from testinfra.utils.ansible_runn...
code_fim
hard
{ "lang": "python", "repo": "bolek2000/ansible-grafana", "path": "/tests/test_default.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bolek2000/ansible-grafana path: /tests/test_default.py from testinfra.utils.ansible_runner import AnsibleRunner testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') def test_directories(host): present = [ "/etc/grafana", "/var/log/grafana", ...
code_fim
medium
{ "lang": "python", "repo": "bolek2000/ansible-grafana", "path": "/tests/test_default.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> present = [ # "tcp://0.0.0.0:3000" "tcp://127.0.0.1:3000" ] for socket in present: s = host.socket(socket) assert s.is_listening<|fim_prefix|># repo: bolek2000/ansible-grafana path: /tests/test_default.py from testinfra.utils.ansible_runner import AnsibleRunner...
code_fim
medium
{ "lang": "python", "repo": "bolek2000/ansible-grafana", "path": "/tests/test_default.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guzdy/tumblr_crawler path: /tumblr_crawler.py # !/usr/bin/env python3 # -×- coding: utf-8 -*- import sys import configparser import shlex from image_downloader import ImagesDownloader from video_downloader import VideoDownloader def main(blogname, timesleep=0, proxies=None): <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "guzdy/tumblr_crawler", "path": "/tumblr_crawler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # main 部分, 设置 config 和 命令行参数 if __name__ == "__main__": config_parser = configparser.ConfigParser() config_parser.read('config.ini') BLOGNAME = config_parser.get('USER', 'BLOGNAME') blognames = shlex.split(BLOGNAME) TIMEOUT = config_parser.getint('USER', 'TIMEOUT') TIMESLEEP = con...
code_fim
hard
{ "lang": "python", "repo": "guzdy/tumblr_crawler", "path": "/tumblr_crawler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ould", re.I | re.U): "which'd", re.compile("which shall|which will", re.I | re.U): "which'll", re.compile("which are", re.I | re.U): "which're", re.compile("which have", re.I | re.U): "which've", re.compile("who would|who had|who did", re.I | re.U): "who'd", re.compile("who would have"...
code_fim
hard
{ "lang": "python", "repo": "vatsalsaglani/nlp-text-contractions", "path": "/NLPContractions/contraction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vatsalsaglani/nlp-text-contractions path: /NLPContractions/contraction.py import re from collections import defaultdict expansionDict = { re.compile('alright', re.I | re.U): "a'ight", re.compile('am not|is not|has not|are not|have not|did not', re.I | re.U): "ain't", re.compile('am n...
code_fim
hard
{ "lang": "python", "repo": "vatsalsaglani/nlp-text-contractions", "path": "/NLPContractions/contraction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>): "that'll", re.compile("that has|that is", re.I | re.U): "that's", re.compile("that would|that had", re.I | re.U): "that'd", re.compile("there had|there would", re.I | re.U): "there'd", re.compile("there shall|there will", re.I | re.U): "there'll", re.compile("there are", re.I | re.U...
code_fim
hard
{ "lang": "python", "repo": "vatsalsaglani/nlp-text-contractions", "path": "/NLPContractions/contraction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuquant/dicom_download_manager path: /datacenter/blueprints/ajax.py # -*- coding: utf-8 -*- """ Author : Jason Github : https://github.com/yuquant Description : """ from flask import render_template, jsonify, Blueprint from flask_login import current_user from sqlalchemy import and_ from datacent...
code_fim
hard
{ "lang": "python", "repo": "yuquant/dicom_download_manager", "path": "/datacenter/blueprints/ajax.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user = User.query.filter_by(username=username).first_or_404() if not current_user.is_following(user): return jsonify(message='Not follow yet.'), 400 current_user.unfollow(user) return jsonify(message='Follow canceled.') @ajax_bp.route('/bar/', methods=['GET']) def bar(): """...
code_fim
hard
{ "lang": "python", "repo": "yuquant/dicom_download_manager", "path": "/datacenter/blueprints/ajax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@ajax_bp.route('/uncollect/<int:photo_id>', methods=['POST']) def uncollect(photo_id): if not current_user.is_authenticated: return jsonify(message='Login required.'), 403 photo = Photo.query.get_or_404(photo_id) if not current_user.is_collecting(photo): return jsonify(message...
code_fim
hard
{ "lang": "python", "repo": "yuquant/dicom_download_manager", "path": "/datacenter/blueprints/ajax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chrisdjscott/Atoman path: /atoman/gui/utils.py """ GUI utilities @author: Chris Scott """ from __future__ import absolute_import from __future__ import unicode_literals import logging from PySide2 import QtGui, QtCore, QtWidgets #############################################################...
code_fim
hard
{ "lang": "python", "repo": "chrisdjscott/Atoman", "path": "/atoman/gui/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Show (and return) a progress dialog """ progress = QtWidgets.QProgressDialog(parent=parent) progress.setWindowModality(QtCore.Qt.WindowModal) progress.setWindowTitle(title) progress.setLabelText(label) progress.setRange(0, 0) progress.setMinimumDuration(0) ...
code_fim
hard
{ "lang": "python", "repo": "chrisdjscott/Atoman", "path": "/atoman/gui/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nnuncert/nnuncert path: /nnuncert/utils/io.py import pickle def save_obj(obj, path: str): """Save some object via pickle. Parameters ---------- obj path : str """ with open(path, 'wb') as h: pickle.dump(obj, h) def load_obj(path: str): """Load object ...
code_fim
hard
{ "lang": "python", "repo": "nnuncert/nnuncert", "path": "/nnuncert/utils/io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- float Content of first line converted to float. """ return float(get_first_line(file)) def txt2str(file: str) -> str: """Load first line from .txt file as string. Parameters ---------- file : str Returns ------- str Conte...
code_fim
hard
{ "lang": "python", "repo": "nnuncert/nnuncert", "path": "/nnuncert/utils/io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return None def trace(self): """ Return a tuple or dict of the state of the indicator. It is used mainly for profiling of the signals. This method must be overrided. """ return tuple()<|fim_prefix|># repo: cal97g/siis path: /strategy/indicator...
code_fim
medium
{ "lang": "python", "repo": "cal97g/siis", "path": "/strategy/indicator/indicator.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: cal97g/siis path: /strategy/indicator/indicator.py # @date 2018-09-02 # @author Frederic SCHERMA # @license Copyright (c) 2018 Dream Overflow # Indicator base class class Indicator(object): """ Base class for an indicator. @todo https://www.centralcharts.com/fr/forums/12-analyse-tech...
code_fim
medium
{ "lang": "python", "repo": "cal97g/siis", "path": "/strategy/indicator/indicator.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def compute(self, timestamp): return None def trace(self): """ Return a tuple or dict of the state of the indicator. It is used mainly for profiling of the signals. This method must be overrided. """ return tuple()<|fim_prefix|># repo: cal9...
code_fim
hard
{ "lang": "python", "repo": "cal97g/siis", "path": "/strategy/indicator/indicator.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: developerdiniz/Python path: /01.Python - Orientação a Objetos/Exercicios Conta Bancaria/Exercicio_fixacao.py '''Exercicio de fixação: Crie um software degerenciamento bancario Esse software poderá ser capaz de criar clientes e con<|fim_suffix|> cliente, saldo, limite, saca, depositar e consultar ...
code_fim
medium
{ "lang": "python", "repo": "developerdiniz/Python", "path": "/01.Python - Orientação a Objetos/Exercicios Conta Bancaria/Exercicio_fixacao.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cliente, saldo, limite, saca, depositar e consultar saldo'''<|fim_prefix|># repo: developerdiniz/Python path: /01.Python - Orientação a Objetos/Exercicios Conta Bancaria/Exercicio_fixacao.py '''Exercicio de fixação: Crie um software degerenciamento bancario Esse software poderá ser capaz de criar client...
code_fim
medium
{ "lang": "python", "repo": "developerdiniz/Python", "path": "/01.Python - Orientação a Objetos/Exercicios Conta Bancaria/Exercicio_fixacao.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nciganovic/Blog path: /blogsite/blog/migrations/0010_blog_blog_slug.py # Generated by Django 2.2 on 2019-05-20 17:24 <|fim_suffix|> operations = [ migrations.AddField( model_name='blog', name='blog_slug', field=models.CharField(default='', max_lengt...
code_fim
medium
{ "lang": "python", "repo": "nciganovic/Blog", "path": "/blogsite/blog/migrations/0010_blog_blog_slug.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('blog', '0009_blog_img_name'), ] operations = [ migrations.AddField( model_name='blog', name='blog_slug', field=models.CharField(default='', max_length=200), preserve_default=False, ), ]<|fim_prefix|...
code_fim
easy
{ "lang": "python", "repo": "nciganovic/Blog", "path": "/blogsite/blog/migrations/0010_blog_blog_slug.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self,): _BUZZWORD.__init__(self) self.name = "BUZZWORDS" self.specie = 'nouns' self.basic = "buzzword" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_buzzwords.py from xai.brain.wordbase.nouns._buzzword import _BUZZWORD <|fim_middle|>#cal...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_buzzwords.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_buzzwords.py from xai.brain.wordbase.nouns._buzzword import _BUZZWORD <|fim_suffix|> def __init__(self,): _BUZZWORD.__init__(self) self.name = "BUZZWORDS" self.specie = 'nouns' self.basic = "buzzword" self.jsondata = {}<|fim_middle|>#cal...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_buzzwords.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_read_v5_document_aktiv(datadir): doc = DesignSpaceDocument.fromfile(datadir / "test_v5_aktiv.designspace") assert not doc.locationLabels assert_descriptors_equal( doc.axes, [ AxisDescriptor( tag="wght", name="Weight", ...
code_fim
hard
{ "lang": "python", "repo": "gregdavill/KiBuzzard", "path": "/KiBuzzard/deps/fonttools/Tests/designspaceLib/designspace_v5_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gregdavill/KiBuzzard path: /KiBuzzard/deps/fonttools/Tests/designspaceLib/designspace_v5_test.py dth", filename="Test_WghtWdth_different_from_name.ttf", axisSubsets=[ RangeAxisSubsetDescriptor(name="Weight"), RangeAxisSubsetD...
code_fim
hard
{ "lang": "python", "repo": "gregdavill/KiBuzzard", "path": "/KiBuzzard/deps/fonttools/Tests/designspaceLib/designspace_v5_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def chicalc(del_t,tau,ph,z,B_src,V_src,b,f_nuobs,f_err,flx_obs): # Input Parameter # #del_t :Duration of phase List #tau :Timescale of expansion List #ph :user input for phase integer #z :redshift of the source float #B_src :Magnetic Field Of Source float #V_src :Volume Of Source float #b :compressi...
code_fim
hard
{ "lang": "python", "repo": "diveshjain-phy/zombie_galaxies", "path": "/Abell1914/operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: diveshjain-phy/zombie_galaxies path: /Abell1914/operations.py from scipy.special import gamma #from scipy.stats import chisquare import numpy as np from astropy.cosmology import FlatLambdaCDM from scipy.integrate import quad from astropy.io import ascii import math import matplotlib.pyplot as plt...
code_fim
hard
{ "lang": "python", "repo": "diveshjain-phy/zombie_galaxies", "path": "/Abell1914/operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xusl/android-wilhelm path: /boot_images/core/hwengines/dmov/hal/build/SConscript #=============================================================================== # # HAL DMOV Libs # # GENERAL DESCRIPTION # HAL DMOV Libs build script # # Copyright (c) 2009-2011 by QUALCOMM, Incorporated. # All ...
code_fim
hard
{ "lang": "python", "repo": "xusl/android-wilhelm", "path": "/boot_images/core/hwengines/dmov/hal/build/SConscript", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> haldmov_qdsp6sw_obj = env.Object(HAL_DMOV_QDSP6SW_SOURCES) haldmov_qdsp6sw_lib = env.Library('${BUILDPATH}/HALdmov_qdsp6sw', haldmov_qdsp6sw_obj) haldmov_apps_obj = env.Object(HAL_DMOV_APPS_SOURCES) haldmov_apps_lib = env.Library('${BUILDPATH}/HALdmov_apps', haldmov_apps_obj) ...
code_fim
hard
{ "lang": "python", "repo": "xusl/android-wilhelm", "path": "/boot_images/core/hwengines/dmov/hal/build/SConscript", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env.AddLibsToImage(['MODEM_IMAGE', 'CBSP_MODEM_IMAGE','CBSP_QDSP6_SW_IMAGE','OSBL_BOOT_IMAGE', 'TZOS_IMAGE'], [haldmov_lib]) if env['HAL_PLATFORM'] in ['8660','8960']: env.AddLibsToImage(['NAND_TOOLS_IMAGE'],[haldmov_lib]) env.AddLibsToImage(['APPS_IMAGE', 'CBSP_APPS_IMAG...
code_fim
hard
{ "lang": "python", "repo": "xusl/android-wilhelm", "path": "/boot_images/core/hwengines/dmov/hal/build/SConscript", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> X1.append((mapping_c[choice(C)],mapping_cr[p],mapping_c[choice(C)])) Y1.append(0) except KeyError: pass distRt = defaultdict(int) for s,p,o,score in Tg: X2.append((mapping_t[s],mapping_tr[p],mapping_t[o])) Y2.append(float(s...
code_fim
hard
{ "lang": "python", "repo": "NIVA-Knowledge-Graph/NIVAUC", "path": "/models/model_LP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NIVA-Knowledge-Graph/NIVAUC path: /models/model_LP.py ### dense model from keras import Model from keras.layers import Dense, Dropout, BatchNormalization, Embedding, Multiply,Activation, Reshape, Concatenate, Lambda from keras.utils import plot_model import numpy as np from random import choic...
code_fim
hard
{ "lang": "python", "repo": "NIVA-Knowledge-Graph/NIVAUC", "path": "/models/model_LP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pbar.update(1) cvscores = np.asarray(cvscores) for i,n in enumerate(model.metrics_names): print(mode,n,"%.2f (+/- %.2f)" % (np.mean(cvscores[:,i]), np.std(cvscores[:,i]))) else: model = LinkPredict(input_dim=[N,M,Nr,M...
code_fim
hard
{ "lang": "python", "repo": "NIVA-Knowledge-Graph/NIVAUC", "path": "/models/model_LP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sno = [] data = pd.read_csv("only_tweets.csv") gs = goslate.Goslate() for i in data: text = gs.translate(i,"en") with open("Translated.csv", "w") as csv_file: writer = csv.writer(csv_file) writer.writerow([sno,text])<|fim_prefix|># repo: JagadishSivakumar/Sentiment-Analysis-Globe ...
code_fim
hard
{ "lang": "python", "repo": "JagadishSivakumar/Sentiment-Analysis-Globe", "path": "/ml-core/translator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sno = [] data = pd.read_csv("only_tweets.csv") gs = goslate.Goslate() for i in data: text = gs.translate(i,"en") with open("Translated.csv", "w") as csv_file: writer = csv.writer(csv_file) writer.writerow([sno,text])<|fim_prefix|># repo: JagadishSivakumar/Sentiment-Analysis-Globe ...
code_fim
hard
{ "lang": "python", "repo": "JagadishSivakumar/Sentiment-Analysis-Globe", "path": "/ml-core/translator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JagadishSivakumar/Sentiment-Analysis-Globe path: /ml-core/translator.py from googletrans import Translator import csv import pandas as pd data = pd.read_csv("only_tweets.csv") translator = Translator() '''text = for i in data[2]: translated = translator.traslate(i) print(translated) ...
code_fim
hard
{ "lang": "python", "repo": "JagadishSivakumar/Sentiment-Analysis-Globe", "path": "/ml-core/translator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oeg-upm/ttla path: /experiments/loader.py import sys import os proj_path = (os.path.join(os<|fim_suffix|>ir)) # print("detect init project path: "+str(proj_path)) sys.path.append(proj_path) import commons<|fim_middle|>.path.dirname(os.path.realpath(__file__)), os.pard
code_fim
easy
{ "lang": "python", "repo": "oeg-upm/ttla", "path": "/experiments/loader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>j_path)) sys.path.append(proj_path) import commons<|fim_prefix|># repo: oeg-upm/ttla path: /experiments/loader.py import sys import os proj_path = (os.path.join(os<|fim_middle|>.path.dirname(os.path.realpath(__file__)), os.pardir)) # print("detect init project path: "+str(pro
code_fim
medium
{ "lang": "python", "repo": "oeg-upm/ttla", "path": "/experiments/loader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: oeg-upm/ttla path: /experiments/loader.py import sys import os proj_path = (os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pard<|fim_suffix|>j_path)) sys.path.append(proj_path) import commons<|fim_middle|>ir)) # print("detect init project path: "+str(pro
code_fim
easy
{ "lang": "python", "repo": "oeg-upm/ttla", "path": "/experiments/loader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env = make(ENV_NAMES[name]) agent = AGENTS[name]() env.reset() state = env.unwrapped.state for i in range(3): action = agent.get_action(state) _, _, done, info = env.step(action) state = info["state"] env.render() if done: break<|fim...
code_fim
medium
{ "lang": "python", "repo": "frostburn/gym_puyopuyo", "path": "/tests/test_agent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frostburn/gym_puyopuyo path: /tests/test_agent.py import pytest from gym import make from gym_puyopuyo.agent import AGENTS from gym_puyopuyo.env import ENV_NAMES <|fim_suffix|> env = make(ENV_NAMES[name]) agent = AGENTS[name]() env.reset() state = env.unwrapped.state for i i...
code_fim
medium
{ "lang": "python", "repo": "frostburn/gym_puyopuyo", "path": "/tests/test_agent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if pattern is not None: filter_p = pattern + self.extension else: filter_p = '.*' + self.extension self.filter_p = filter_p gs.debug('Filter: {}'.format(filter_p), 1) self.files = self.__filter(filter_p) if self.files is []: ...
code_fim
hard
{ "lang": "python", "repo": "ibaris/gscpy", "path": "/gscpy/i_import/i_dr_import.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibaris/gscpy path: /gscpy/i_import/i_dr_import.py #!/usr/bin/env python ############################################################################ # # MODULE: i.dr.import # AUTHOR(S): Ismail Baris # PURPOSE: Import data into a mapset from a file with considering a certain pattern. #...
code_fim
hard
{ "lang": "python", "repo": "ibaris/gscpy", "path": "/gscpy/i_import/i_dr_import.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __import_file(self, filename, module, args): mapname = os.path.splitext(os.path.basename(filename))[0] gs.message(_('Processing <{}>...').format(mapname)) if module == 'r.import': args['resolution_value'] = self.__raster_resolution(filename) try: ...
code_fim
hard
{ "lang": "python", "repo": "ibaris/gscpy", "path": "/gscpy/i_import/i_dr_import.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blufzzz/pytorch-hebbian path: /pytorch_hebbian/nn/layers.py import torch from torch import nn class Flatten(nn.Module): def forward(self, x: torch.Tensor): <|fim_suffix|> def forward(self, x: torch.Tensor): return torch.relu(x) ** self.n<|fim_middle|> return x.view(x.size(...
code_fim
medium
{ "lang": "python", "repo": "blufzzz/pytorch-hebbian", "path": "/pytorch_hebbian/nn/layers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return torch.relu(x) ** self.n<|fim_prefix|># repo: blufzzz/pytorch-hebbian path: /pytorch_hebbian/nn/layers.py import torch from torch import nn class Flatten(nn.Module): def forward(self, x: torch.Tensor): return x.view(x.size(0), -1) class RePU(nn.ReLU): def __init__(self, ...
code_fim
medium
{ "lang": "python", "repo": "blufzzz/pytorch-hebbian", "path": "/pytorch_hebbian/nn/layers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cprint('\nlooking for updates ,please wait !',"yellow") github_url = 'https://github.com/hamzaubi/EgyBest-Downloader' r = requests.get(github_url) soup = BeautifulSoup(r.text, "html.parser") try: github_version = soup.select_one("#readme > div.Box-body > article > h1").text.spl...
code_fim
medium
{ "lang": "python", "repo": "hamzaubi/EgyBest-Downloader", "path": "/Core/UpdateChecker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hamzaubi/EgyBest-Downloader path: /Core/UpdateChecker.py import requests from bs4 import BeautifulSoup from termcolor import cprint <|fim_suffix|> cprint('\nlooking for updates ,please wait !',"yellow") github_url = 'https://github.com/hamzaubi/EgyBest-Downloader' r = requests.get(git...
code_fim
medium
{ "lang": "python", "repo": "hamzaubi/EgyBest-Downloader", "path": "/Core/UpdateChecker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gistable/gistable path: /all-gists/4004663/snippet.py def customized(default=None, template=None): def decorator(method): @functools.wraps(method) def wrapper(self, *args, **kargs): self.template = default if self.current_user: self.temp...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/all-gists/4004663/snippet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class MainHandler(tornado.web.RequestHandler): @customized(default='index.html', template='user.index.html') def get(self): self.render(self.template)<|fim_prefix|># repo: gistable/gistable path: /all-gists/4004663/snippet.py def customized(default=None, template=None): def decorator(...
code_fim
hard
{ "lang": "python", "repo": "gistable/gistable", "path": "/all-gists/4004663/snippet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomasavare/history-of-interpretation path: /saliency/integrated_gradients_test.py # Copyright 2019 Google Inc. All Rights Reserved. # # 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 th...
code_fim
medium
{ "lang": "python", "repo": "thomasavare/history-of-interpretation", "path": "/saliency/integrated_gradients_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ To run: "python -m saliency.integrated_gradients_test" from the PAIR-code/saliency directory. """ def testIntegratedGradientsGetMask(self): with tf.Graph().as_default() as graph: x = tf.placeholder(shape=[None, 3], dtype=tf.float32) y = 5 * x[:, 0] + x[:, 0] * x[:, 1] + tf...
code_fim
medium
{ "lang": "python", "repo": "thomasavare/history-of-interpretation", "path": "/saliency/integrated_gradients_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return short_url.process_url(url, request, userID)<|fim_prefix|># repo: Pravv/PrvHosting path: /controllers/short_url.py from flask import redirect, request from models import short_url <|fim_middle|> def handle_short_url(userID): url = request.args.get('url') if url is None: return ...
code_fim
medium
{ "lang": "python", "repo": "Pravv/PrvHosting", "path": "/controllers/short_url.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pravv/PrvHosting path: /controllers/short_url.py from flask import redirect, request from models import short_url <|fim_suffix|> url = request.args.get('url') if url is None: return redirect(request.host_url, code=302) return short_url.process_url(url, request, userID)<|fim_...
code_fim
easy
{ "lang": "python", "repo": "Pravv/PrvHosting", "path": "/controllers/short_url.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.context = context try: tempdir = context.tempdir if tempdir is None: raise Exception() except: raise Exception("Context does not contain info about tempdir") def __enter__(self): self.context.cwd = os.getcwd() ...
code_fim
hard
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/quantarhei/testing/behave.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def cleanup_temp_dir(context): """Cleans up temporary directory """ try: os.chdir(context.cwd) except: print("Current working file record does not exist") try: context.tempdir.cleanup() except: print("Temporary directory cannot be cleaned up - do...
code_fim
hard
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/quantarhei/testing/behave.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmancal74/quantarhei path: /quantarhei/testing/behave.py # -*- coding: utf-8 -*- """ Support module for tests using `behave` package """ # standard imports import os import tempfile import re from subprocess import check_output # non-standard imports import pkg_resources def quantarhei_...
code_fim
hard
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/quantarhei/testing/behave.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("done") if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--data_file', default = "training_set_rel3.tsv", help = "name of .tsv file containing essay data") parser.add_argument('--out_file', default = "training_set_rel3_x.tsv"...
code_fim
hard
{ "lang": "python", "repo": "16lemoing/automated-essay-scoring", "path": "/bin/compute_x_features.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f"saving to {out_file}") data.to_csv(out_file, sep = "\t") print("done") if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--data_file', default = "training_set_rel3.tsv", help = "name of .tsv file containing essay da...
code_fim
hard
{ "lang": "python", "repo": "16lemoing/automated-essay-scoring", "path": "/bin/compute_x_features.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 16lemoing/automated-essay-scoring path: /bin/compute_x_features.py # -*- coding: utf-8 -*- import sys sys.path.append("../src") import argparse from pathlib import Path import pandas as pd from spellchecker import SpellChecker from nltk.tokenize.treebank import TreebankWordDetokenizer from strin...
code_fim
hard
{ "lang": "python", "repo": "16lemoing/automated-essay-scoring", "path": "/bin/compute_x_features.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eslammohamed13/microblog path: /microblog-01-hello-world/src/models/Roles.py import testdata # Models declared <|fim_suffix|> ''' Roles ''' id = testdata.CountingFactory(10) name = testdata.FakeDataFactory('name') displayname = testdata.RandomLengthStringFactory() des...
code_fim
medium
{ "lang": "python", "repo": "eslammohamed13/microblog", "path": "/microblog-01-hello-world/src/models/Roles.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Roles ''' id = testdata.CountingFactory(10) name = testdata.FakeDataFactory('name') displayname = testdata.RandomLengthStringFactory() description = testdata.RandomLengthStringFactory()<|fim_prefix|># repo: eslammohamed13/microblog path: /microblog-01-hello-world/src/model...
code_fim
medium
{ "lang": "python", "repo": "eslammohamed13/microblog", "path": "/microblog-01-hello-world/src/models/Roles.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linsomniac/spawk path: /spawk/input.py #!/usr/bin/env python3 # vim: ts=4 sw=4 ai et class FileFollower: '''Iterator that follows the changes to a file "tail -F"-like. This iterator will produce all the lines in a file and then monitor for changes to the file and produce new lines a...
code_fim
hard
{ "lang": "python", "repo": "linsomniac/spawk", "path": "/spawk/input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param filename: Name of the file to follow. :param sleep_time: (float) Time to sleep between polls of the file. ''' def __init__(self, filename, sleep_time=1): self.filename = filename self.sleep_time = sleep_time def _follow(self): '''INTERNAL: Generator that...
code_fim
hard
{ "lang": "python", "repo": "linsomniac/spawk", "path": "/spawk/input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: learningequality/kolibri path: /kolibri/core/tasks/main.py import logging from django.utils.functional import SimpleLazyObject from kolibri.core.tasks.storage import Storage from kolibri.core.tasks.utils import db_connection from kolibri.core.tasks.worker import Worker from kolibri.utils import...
code_fim
hard
{ "lang": "python", "repo": "learningequality/kolibri", "path": "/kolibri/core/tasks/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def initialize_workers(): logger.info("Starting async task workers.") return Worker( connection=connection, regular_workers=conf.OPTIONS["Tasks"]["REGULAR_PRIORITY_WORKERS"], high_workers=conf.OPTIONS["Tasks"]["HIGH_PRIORITY_WORKERS"], )<|fim_prefix|># repo: learningequ...
code_fim
hard
{ "lang": "python", "repo": "learningequality/kolibri", "path": "/kolibri/core/tasks/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def __job_storage(): return Storage( connection=connection, ) # This storage instance should be used to access job_storage db. job_storage = SimpleLazyObject(__job_storage) """ :type: Storage """ def initialize_workers(): logger.info("Starting async task workers.") return Worke...
code_fim
medium
{ "lang": "python", "repo": "learningequality/kolibri", "path": "/kolibri/core/tasks/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> See Also -------- :py:class:`~autogluon.eda.visualization.dataset.DatasetStatistics` :py:class:`~autogluon.eda.visualization.missing.MissingValues` """ def can_handle(self, state: AnalysisState, args: AnalysisState) -> bool: return True def _fit(self, state: AnalysisS...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/autogluon", "path": "/eda/src/autogluon/eda/analysis/missing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/autogluon path: /eda/src/autogluon/eda/analysis/missing.py from typing import Any, Dict from .base import AbstractAnalysis, AnalysisState __all__ = ["MissingValuesAnalysis"] class MissingValuesAnalysis(AbstractAnalysis): """ Analyze dataset's missing value counts and freque...
code_fim
medium
{ "lang": "python", "repo": "stjordanis/autogluon", "path": "/eda/src/autogluon/eda/analysis/missing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: doomdagger/tweetmap2 path: /application.py #!/usr/bin/env python # The main file, start our application here <|fim_suffix|>__author__ = "He Li, Haoxiang Xu" logging.basicConfig(filename='tweetmap2.log', level=logging.DEBUG) if __name__ == '__main__': io.run(app, host='0.0.0.0', port=5000, d...
code_fim
easy
{ "lang": "python", "repo": "doomdagger/tweetmap2", "path": "/application.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from tweetmap import app, io __author__ = "He Li, Haoxiang Xu" logging.basicConfig(filename='tweetmap2.log', level=logging.DEBUG) if __name__ == '__main__': io.run(app, host='0.0.0.0', port=5000, debug=True)<|fim_prefix|># repo: doomdagger/tweetmap2 path: /application.py #!/usr/bin/env python # The...
code_fim
easy
{ "lang": "python", "repo": "doomdagger/tweetmap2", "path": "/application.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiogram/aiogram path: /aiogram/types/callback_query.py from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional from pydantic import Field from .base import TelegramObject if TYPE_CHECKING: from ..methods import AnswerCallbackQuery from .message import Messag...
code_fim
hard
{ "lang": "python", "repo": "aiogram/aiogram", "path": "/aiogram/types/callback_query.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def answer( self, text: Optional[str] = None, show_alert: Optional[bool] = None, url: Optional[str] = None, cache_time: Optional[int] = None, **kwargs: Any, ) -> AnswerCallbackQuery: """ Shortcut for method :class:`aiogram.methods.ans...
code_fim
hard
{ "lang": "python", "repo": "aiogram/aiogram", "path": "/aiogram/types/callback_query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Test rotations # Create more text objects AddOperator("Reflect") reflect = ReflectAttributes() reflect.reflections=(1, 1, 0, 0, 0, 0, 0, 0) SetOperatorOptions(reflect) text.text="Left" text.position=(-20, -5, 10) text.rotations=(0,0,90) text.heightMode = text.Relative DrawPlots() ResetView() Test("tex...
code_fim
hard
{ "lang": "python", "repo": "visit-dav/visit", "path": "/src/test/tests/rendering/text3d.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: visit-dav/visit path: /src/test/tests/rendering/text3d.py # ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: text3d.py # # Tests: mesh - 2D curvilinear, single domain # plots - Pseudocolor # ...
code_fim
hard
{ "lang": "python", "repo": "visit-dav/visit", "path": "/src/test/tests/rendering/text3d.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>extendedApplTable = MibTable((1, 3, 6, 1, 4, 1, 334, 3, 1, 1, 1), ) if mibBuilder.loadTexts: extendedApplTable.setStatus('mandatory') if mibBuilder.loadTexts: extendedApplTable.setDescription('The table holding information specific to an Application for which extended information is available.') extendedA...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/EXTENDED-MADMAN-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/EXTENDED-MADMAN-MIB.py dConnectFailureReason, mtaGroupIndex = mibBuilder.importSymbols("MTA-MIB", "mtaGroupInboundRejectionReason", "mtaGroupName", "mtaGroupOutboundConnectFailureReason", "mtaGroupIndex") applName, applOperStatus, applIndex,...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/EXTENDED-MADMAN-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/EXTENDED-MADMAN-MIB.py son", "mtaGroupName", "mtaGroupOutboundConnectFailureReason", "mtaGroupIndex") applName, applOperStatus, applIndex, applLastChange = mibBuilder.importSymbols("NETWORK-SERVICES-MIB", "applName", "applOperStatus", "applI...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/EXTENDED-MADMAN-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BA1RY/posture-aid path: /config.py class PostureAidConfig: __conf = { "PAD_X": 30, "PAD_Y": 30, "MODEL": 101, "CAM_ID": 0, "CORRECT_POS": (0,0,0,0), "SCALE_FACTOR": 0.7125, "ALARM_FILE": './data/audio/alarm_audio.wav' } __setters...
code_fim
medium
{ "lang": "python", "repo": "BA1RY/posture-aid", "path": "/config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def set(key, value): if key in PostureAidConfig.__setters: PostureAidConfig.__conf[key] = value else: raise KeyError("Key not accepted in set() method")<|fim_prefix|># repo: BA1RY/posture-aid path: /config.py class PostureAidConfig: __conf...
code_fim
medium
{ "lang": "python", "repo": "BA1RY/posture-aid", "path": "/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return PostureAidConfig.__conf[key] @staticmethod def set(key, value): if key in PostureAidConfig.__setters: PostureAidConfig.__conf[key] = value else: raise KeyError("Key not accepted in set() method")<|fim_prefix|># repo: BA1RY/posture-aid path: ...
code_fim
medium
{ "lang": "python", "repo": "BA1RY/posture-aid", "path": "/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-star18/atcoder path: /submissions/arc011/b.py import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) w = list(readline().rstrip().decode().split()) check = [('z', 'r'), ('b', 'c'), (...
code_fim
medium
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/arc011/b.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>', 'x'), ('p', 'm'), ('h', 'k'), ('n', 'g')] ans = [] for ww in w: ww = ww.lower() memo = '' for m in ww: for i, num in enumerate(check): if m in num: memo += str(i) break if memo != '': ans.append(memo) print(' '.join(ans))<|fim_...
code_fim
medium
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/arc011/b.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|># True/False file exists def file_exists(path): if os.path.isfile(os.path.abspath(path)): return True return False # True/False directory exists def dir_exists(path): if os.path.isdir(os.path.abspath(path)): return True return False # True/False directory and or file exists def dir_or_file_exist...
code_fim
hard
{ "lang": "python", "repo": "ZachisGit/ImageTranslation-MultidirectionalAutoencoders", "path": "/ai_lab/storagemanager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZachisGit/ImageTranslation-MultidirectionalAutoencoders path: /ai_lab/storagemanager.py import os # None if file doesnt exist # abspath(file) if it exists def check_file_path(path): if os.path.isfile(os.path.abspath(path)): return os.path.abspath(path) return None # None if directory doesnt...
code_fim
medium
{ "lang": "python", "repo": "ZachisGit/ImageTranslation-MultidirectionalAutoencoders", "path": "/ai_lab/storagemanager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if os.path.isfile(os.path.abspath(path)): return True return False # True/False directory exists def dir_exists(path): if os.path.isdir(os.path.abspath(path)): return True return False # True/False directory and or file exists def dir_or_file_exists(path): if os.path.isdir(os.path.abspath(path)...
code_fim
medium
{ "lang": "python", "repo": "ZachisGit/ImageTranslation-MultidirectionalAutoencoders", "path": "/ai_lab/storagemanager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/dataprotection/outputs.py duration_in_days: Optional[float] = None, state: Optional[str] = None): """ Soft delete related settings :param float retention_duration_in_days: Soft delete retenti...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/dataprotection/outputs.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(__self__, *, repeating_time_intervals: Sequence[str], time_zone: Optional[str] = None): """ Schedule for backup :param Sequence[str] repeating_time_intervals: ISO 8601 repeating time interval format :param str time_zone: Ti...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/dataprotection/outputs.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/dataprotection/outputs.py ts the type of secret store :param str uri: Uri to get to the resource :param str value: Gets or sets value stored in secret store resource """ pulumi.set(__self__, "secret_s...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/dataprotection/outputs.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # print('covered_branches', covered_branches) for branch_lineno in goal_branch: if not branch_lineno in covered_branches: break else: # print('Terminated: goal_branch is ' # + str(goal_branch) # + ', covered_branches are ' # + str(covered_branches)) # the branch is fully...
code_fim
hard
{ "lang": "python", "repo": "MisterAI/AutoTeSG", "path": "/DistanceCalculator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MisterAI/AutoTeSG path: /DistanceCalculator.py #!/usr/bin/python import sys import astor from CodeRunner import runCode from CustomExceptions import * class DistanceCalculator(): def normalise_branch_distance(self, branch_distance): try: return 1 - pow(1.001, -branch_distance) except Ov...
code_fim
hard
{ "lang": "python", "repo": "MisterAI/AutoTeSG", "path": "/DistanceCalculator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>img = np.zeros((source.shape[0]*data['dims'][0], source.shape[1]*data['dims'][1], 3), np.uint8) y = 0 for row in source: x = 0 for pix in row: # bgr pal_key = palette_oct.get((int(pix[2]/32), int(pix[1]/32), int(pix[0]/32))) if pal_key is None: pal_key = palette_quad....
code_fim
hard
{ "lang": "python", "repo": "Iapetus-11/photo-mosaic-generator", "path": "/compiler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#cv2.imshow('image', source) #cv2.waitKey(0) xi = data['dims'][1] yi = data['dims'][1] img = np.zeros((source.shape[0]*data['dims'][0], source.shape[1]*data['dims'][1], 3), np.uint8) y = 0 for row in source: x = 0 for pix in row: # bgr pal_key = palette_oct.get((int(pix[2]/32), int(pix[...
code_fim
hard
{ "lang": "python", "repo": "Iapetus-11/photo-mosaic-generator", "path": "/compiler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }