text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: LegendBC/PET path: /operator_ae/ansor/generate_task.py import re with open('task.txt') as f: for l in f.readlines(): pattern = <|fim_suffix|>KW, strides, padding, dilation = 1, 14, 14, 512, 512, 3, 3, ( # 1, 1), (3, 3), 3<|fim_middle|>re.compile(r'\[.*?\]') # 查找数字 result...
code_fim
medium
{ "lang": "python", "repo": "LegendBC/PET", "path": "/operator_ae/ansor/generate_task.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bpbpublications/Advance-Core-Python-Programming path: /Chapter 12/Pre_order_traversal.py class Node(object): def __init__(self, data_value): self.data_value = data_value self.left = None self.right = None def insert_left(self, child): if s...
code_fim
hard
{ "lang": "python", "repo": "bpbpublications/Advance-Core-Python-Programming", "path": "/Chapter 12/Pre_order_traversal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Tree_Right print("Create Tree_Right") tree_right = Node("Tree_Right") root.insert_right(tree_right) #TreeLL print("Create TreeLL") treell = Node("TreeLL") tree_left.insert_left(treell) print("*****Preorder Traversal*****") print(root.preorder(root))<|fim_prefix|># repo: bpbpubl...
code_fim
hard
{ "lang": "python", "repo": "bpbpublications/Advance-Core-Python-Programming", "path": "/Chapter 12/Pre_order_traversal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>root.insert_right(tree_right) #TreeLL print("Create TreeLL") treell = Node("TreeLL") tree_left.insert_left(treell) print("*****Preorder Traversal*****") print(root.preorder(root))<|fim_prefix|># repo: bpbpublications/Advance-Core-Python-Programming path: /Chapter 12/Pre_order_traversal....
code_fim
hard
{ "lang": "python", "repo": "bpbpublications/Advance-Core-Python-Programming", "path": "/Chapter 12/Pre_order_traversal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PeterZhouSZ/neural_surface_maps path: /utils/config.py from datetime import datetime from omegaconf import OmegaConf import os ### Compose folders name from exp parameters def compose_config_folders(config): <|fim_suffix|> ### Copy configuration to experiment folder def copy_config_to_experime...
code_fim
hard
{ "lang": "python", "repo": "PeterZhouSZ/neural_surface_maps", "path": "/utils/config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out_path = os.path.join(folder, 'config.yaml') OmegaConf.save(config, out_path, resolve=True)<|fim_prefix|># repo: PeterZhouSZ/neural_surface_maps path: /utils/config.py from datetime import datetime from omegaconf import OmegaConf import os ### Compose folders name from exp parameters def com...
code_fim
hard
{ "lang": "python", "repo": "PeterZhouSZ/neural_surface_maps", "path": "/utils/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result = local('ffmpeg -i %s -vf subtitles=%s -strict -2 -vcodec libx264 -b 512K -threads 4 -preset superfast -crf 23 %s' % (vid,srt,out),capture=True) return out except Exception, e: print e return False if __name__ == '__main__': merge()<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "level09/cc", "path": "/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: level09/cc path: /tasks.py from celery import Celery from celery.task import periodic_task, task from datetime import timedelta from settings import Config from fabric.api import local from uuid import uuid4 import os celery = Celery('tasks',broker='redis://localhost:6379/2') CFG = Config() ...
code_fim
medium
{ "lang": "python", "repo": "level09/cc", "path": "/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarineLasbleis/GrowYourIC path: /thisisatest.py import numpy as np import matplotlib.pyplot as plt #for figures from mpl_toolkits.basemap import Basemap #to render maps import math from GrowYourIC import positions, geodyn, geodyn_trg, geodyn_static, plot_data, data #plt.rcParams['figure.figsize...
code_fim
hard
{ "lang": "python", "repo": "MarineLasbleis/GrowYourIC", "path": "/thisisatest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> npoints = 60 #number of points in the x direction for the data set. data_set = data.PerfectSamplingEquator(npoints, rICB = 1.) data_set.method = "bt_point" Radial = geodyn_static.Radial_sym() proxy = geodyn.evaluate_proxy(data_set, Radial, proxy_type="radius", verbose = False) data_set.plot_c_vec(R...
code_fim
hard
{ "lang": "python", "repo": "MarineLasbleis/GrowYourIC", "path": "/thisisatest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :rtype : object """ release_tag = latest_github_tag() distro = check_distro() agent_tar_path = "/root/nova-agent/nova-agent-Linux-x86_64-%s.tar.gz" % release_tag nova_file = "nova-agent-Linux-x86_64-%s.tar.gz" % release_tag installer_path = "/root/nova-agent/" nov...
code_fim
hard
{ "lang": "python", "repo": "bdelliott/openstack-guest-agents-unix", "path": "/tools/install_agent.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bdelliott/openstack-guest-agents-unix path: /tools/install_agent.py __author__ = 'Admin' import os import subprocess import shutil import time import platform import json import urllib2 def latest_github_tag(): """ Returns latest Release Tag at GitHub. """ release_tags_github_url = "ht...
code_fim
hard
{ "lang": "python", "repo": "bdelliott/openstack-guest-agents-unix", "path": "/tools/install_agent.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if os.path.exists(nova_agent__process_path): subprocess.call(["%s" % nova_agent__process_path, "stop"]) if os.path.exists(nova_agent_path): #shutil.move(nova_agent_path, "/tmp") subprocess.call(["rm", "-rf", "%s" % nova_agent_path]) if os.path.exists(nova_agent_bin_pa...
code_fim
hard
{ "lang": "python", "repo": "bdelliott/openstack-guest-agents-unix", "path": "/tools/install_agent.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>spam = "Four score and seven years is eighty seven years." # 3. If you assign spam = "Four score and seven years is eighty seven years.", # what would each of the following lines print? print(spam[5]) print(spam[-3]) print(spam[0:4] + spam[5]) print(spam[-3:-1]) print(spam[:10]) print(spam[-5:]) print(...
code_fim
medium
{ "lang": "python", "repo": "leihuagh/python-tutorials", "path": "/books/CrackingCodesWithPython/Chapter03/PracticeQuestions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leihuagh/python-tutorials path: /books/CrackingCodesWithPython/Chapter03/PracticeQuestions.py # Chapter 3 Practice Questions spam = "Cats" # 1. If you assign spam = "Cats", what do the following lines print? print(spam + spam + spam) print(spam * 3) <|fim_suffix|>spam = "Four score and seven ye...
code_fim
medium
{ "lang": "python", "repo": "leihuagh/python-tutorials", "path": "/books/CrackingCodesWithPython/Chapter03/PracticeQuestions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> returner = [] for injector in injectors: result_futures = [ requester.check(test_payload.format(working=working)) for (test_payload, expected) in injector.test_payloads ] results = await asyncio.gather(*result_futures) for idx, (test_p...
code_fim
hard
{ "lang": "python", "repo": "Tobey123/xcat", "path": "/xcat/payloads.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tobey123/xcat path: /xcat/payloads.py import asyncio from collections import namedtuple from typing import List from xpath import E from .requester import Requester Injection = namedtuple('Injection', 'name example test_payloads payload_generator') def makeformat(str): return lambda work...
code_fim
hard
{ "lang": "python", "repo": "Tobey123/xcat", "path": "/xcat/payloads.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scifi6546/n-tree path: /tree.py def insert(root,data): if(root.type=="l0"): if(root.dat<|fim_suffix|>insert(root,data[1:]) else: root = L1(root,None)<|fim_middle|>a is None): root.data=data[0] if(len(data)==1): return ...
code_fim
hard
{ "lang": "python", "repo": "scifi6546/n-tree", "path": "/tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>insert(root,data[1:]) else: root = L1(root,None)<|fim_prefix|># repo: scifi6546/n-tree path: /tree.py def insert(root,data): if(root.type=="l0"): if(root.data is None): root.data=data[0] if(len(data)==<|fim_middle|>1): return ...
code_fim
hard
{ "lang": "python", "repo": "scifi6546/n-tree", "path": "/tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>1): return else: return insert(root,data[1:]) else: root = L1(root,None)<|fim_prefix|># repo: scifi6546/n-tree path: /tree.py def insert(root,data): if(root.type=="l0"): if(root.dat<|fim_middle|>a is None): root.data=...
code_fim
hard
{ "lang": "python", "repo": "scifi6546/n-tree", "path": "/tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sousoul/PARIMA path: /Preprocess/FrameProjector/StitchedCentroidConverter.py import argparse import vrProjector import numpy as np import cv2 as cv import os def main(): <|fim_suffix|> out = vrProjector.CubemapProjection() out.initImages(int(args.cubeMapDim), int(args.cubeMapDim)) source = ...
code_fim
hard
{ "lang": "python", "repo": "sousoul/PARIMA", "path": "/Preprocess/FrameProjector/StitchedCentroidConverter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> out = vrProjector.CubemapProjection() out.initImages(int(args.cubeMapDim), int(args.cubeMapDim)) source = vrProjector.EquirectangularProjection() source.loadImage(args.dirPath + "/frame0.jpg") out.reprojectToEquirectangular(args.source, source, int(args.cubeMapDim), int(args.cubeMapDim), args.output...
code_fim
hard
{ "lang": "python", "repo": "sousoul/PARIMA", "path": "/Preprocess/FrameProjector/StitchedCentroidConverter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zerothi/aotus path: /fortran_language.py # Checks for supported Fortran language features # # Results are stored in the context environment with a fortsupp_ prefix. # def options(opt): flopts = opt.add_option_group('Fortran Language specific settings') flopts.add_option('--quad_kind', ac...
code_fim
hard
{ "lang": "python", "repo": "zerothi/aotus", "path": "/fortran_language.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if conf.is_defined('quadruple'): fcenv['fortsupp_quad_kind'] = int( conf.get_define('quadruple') .replace('"', '').strip() ) else: fcenv['fortsupp_quad_kind'] = -1 conf.env = fcenv if conf.env['fortsupp_quad_kind'] > 0: conf.end_m...
code_fim
hard
{ "lang": "python", "repo": "zerothi/aotus", "path": "/fortran_language.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def supports_f2008_gamma(conf, mandatory=True): ''' Check for F2008 gamma function support. ''' fcenv = conf.env.derive() fcenv.detach() conf.check_fc(fragment = ''' program check_gamma implicit none real :: a_real real :: res read(*,*) a_real res = gamma(a_real) end program che...
code_fim
hard
{ "lang": "python", "repo": "zerothi/aotus", "path": "/fortran_language.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def mockreturn(): return 'foo' monkeypatch.setattr("neo.libs.ncurses.setup_form", mockreturn) x = ncurses.setup_form() assert x == 'foo' def test_curses_exec_form(self, monkeypatch): def mockreturn(): return 'foo' monkeypatch.set...
code_fim
hard
{ "lang": "python", "repo": "isnuryusuf/neo-cli", "path": "/tests/test_ncurses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: isnuryusuf/neo-cli path: /tests/test_ncurses.py import pytest from neo.libs import ncurses class TestCurses: def test_curses_get_stack(self, monkeypatch): def mockreturn(): return 'foo' monkeypatch.setattr("neo.libs.ncurses.get_stack", mockreturn) x = ncu...
code_fim
medium
{ "lang": "python", "repo": "isnuryusuf/neo-cli", "path": "/tests/test_ncurses.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoyRin/opendp path: /.github/assert_version.py import configparser import toml # all version numbers should be: version = open("../VERSION", 'r').read() assert version != "0.0.0-development", "Please update the repository with the current version." print("Checking if all version numbers are sync...
code_fim
hard
{ "lang": "python", "repo": "RoyRin/opendp", "path": "/.github/assert_version.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># check that opendp crate version is set properly opendp_toml = toml.load('../rust/opendp/Cargo.toml') assert opendp_toml['package']['version'] == version, \ "rust/opendp/Cargo.toml crate version is incorrect" # check that opendp-ffi crate version is set properly opendp_ffi_toml = toml.load('../rust/...
code_fim
hard
{ "lang": "python", "repo": "RoyRin/opendp", "path": "/.github/assert_version.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': total = 15 coins = [3,4,6,7,9] total_sol = number_of_solutions(total, coins) total_sol_space = number_of_solutions_space_efficient(total, coins) print(str(total_sol) + " " + str(total_sol_space)) actual_solution(total, coins)<|fim_prefix|># repo: shree199...
code_fim
hard
{ "lang": "python", "repo": "shree1999/interview", "path": "/python/dynamic/coinchangetotalsolution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shree1999/interview path: /python/dynamic/coinchangetotalsolution.py # coin changing number of solutions possible # java code https://github.com/mission-peace/interview/blob/master/src/com/interview/dynamic/CoinChanging.java # It counts number of ways total can be formed with given coins # given...
code_fim
hard
{ "lang": "python", "repo": "shree1999/interview", "path": "/python/dynamic/coinchangetotalsolution.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def actual_soltion_util(total, coins, result): if total == 0: print(result) return for index, coin in enumerate(coins): if total >= coin: result.append(coin) actual_soltion_util(total - coin, coins[index:], result) del result[len(result)-...
code_fim
medium
{ "lang": "python", "repo": "shree1999/interview", "path": "/python/dynamic/coinchangetotalsolution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cookiehacker29/callofdutyapi path: /GetAPI.py from Database import Database from requests import * import sys import random import json import urllib import os """ ================= GetAPI class ================= Class allowing to get the data of API of call of duty Example of use : myAP...
code_fim
hard
{ "lang": "python", "repo": "cookiehacker29/callofdutyapi", "path": "/GetAPI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Fonction to get any data and save it on the database """ def run(self) -> None: self.mysql.connect() api_data = self.accessToStats() if api_data.status_code == 200: print("\033[1;32m[OK]\033[0m API connexion success....") data_js...
code_fim
hard
{ "lang": "python", "repo": "cookiehacker29/callofdutyapi", "path": "/GetAPI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> access_token = json.loads(device.text)["data"]["authHeader"] headers_login = { "Authorization": f"Bearer "+access_token, "x_cod_device_id": self.device_id } login = post(url=self.url_login, json=mydata_login, headers=headers...
code_fim
hard
{ "lang": "python", "repo": "cookiehacker29/callofdutyapi", "path": "/GetAPI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wang-Haining/writeprints-zh path: /tests/test_base.py from writeprints_static.base import WriteprintsStatic import pytest def test_transform(): texts = ["This is a text.", "This is another text."] vec = WriteprintsStatic() X = vec.transform(texts) assert X is not None assert...
code_fim
hard
{ "lang": "python", "repo": "Wang-Haining/writeprints-zh", "path": "/tests/test_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> texts = ["This is a text.", "This is another text."] vec = WriteprintsStatic() X = vec.fit_transform(texts) feature_names = vec.get_feature_names() assert feature_names is not None assert len(feature_names) == 552 assert feature_names[2] == "short_words" assert feature_name...
code_fim
hard
{ "lang": "python", "repo": "Wang-Haining/writeprints-zh", "path": "/tests/test_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Convert all sizes in bytes to bytes, MB, GB, etc. for path, size in file_sizes.items(): file_sizes[path] = convert(size) return file_sizes def graph_dir( directory: str, filename: str = '', orientation: str = 'LR', data: bool = False, ...
code_fim
hard
{ "lang": "python", "repo": "mjstamper/Directory-Grapher", "path": "/dir.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjstamper/Directory-Grapher path: /dir.py """ Alex Eidt Creates an acyclic directed graph representing the structure any directory that is in the same directory as this script. """ import os import argparse import requests from graphviz import Digraph from typing import Union # Change PATH se...
code_fim
hard
{ "lang": "python", "repo": "mjstamper/Directory-Grapher", "path": "/dir.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): parser = argparse.ArgumentParser(description='Visualizes directory structure with graphs.') parser.add_argument('dir', help='Directory Name.') parser.add_argument('-o', required=False, help='Output file name.') parser.add_argument('-d', required=False, help='Visualization Depth...
code_fim
hard
{ "lang": "python", "repo": "mjstamper/Directory-Grapher", "path": "/dir.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># use with authentication # please insert correct OAuth token headers['Authorization'] = 'Bearer ' + 'your_oauth_token' r = http.urlopen('GET', url, headers=headers) print(r.status) print(r.data)<|fim_prefix|># repo: matteoporru/iot-starterkit path: /neo/code-snippets/python/hcp-iot-services/https/retr...
code_fim
hard
{ "lang": "python", "repo": "matteoporru/iot-starterkit", "path": "/neo/code-snippets/python/hcp-iot-services/https/retrieve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># interaction for a specific Device instance - replace 1 with your specific Device ID url = 'https://iotmms_on_your_trial_system.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/1' headers = urllib3.util.make_headers() # use with authentication # please insert correct OAuth token headers[...
code_fim
hard
{ "lang": "python", "repo": "matteoporru/iot-starterkit", "path": "/neo/code-snippets/python/hcp-iot-services/https/retrieve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matteoporru/iot-starterkit path: /neo/code-snippets/python/hcp-iot-services/https/retrieve.py import urllib3 import certifi # It is absolutely CRITICAL that you use certificate validation to ensure and guarantee that # 1. you are indeed sending the message to *.hanatrial.ondemand.com and # 2. th...
code_fim
hard
{ "lang": "python", "repo": "matteoporru/iot-starterkit", "path": "/neo/code-snippets/python/hcp-iot-services/https/retrieve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jiaxuuuuuu/VanillaML path: /vanilla_ml/util/metrics/rmse.py """ Root mean square error (RMSE) """ import numpy as np def mse_score(y_true, y_pred): return np.mean(np.square(y_true - y_pred)) <|fim_suffix|> return np.sqrt(mse_score(y_true, y_pred))<|fim_middle|>def rmse_score(y_true, y_...
code_fim
easy
{ "lang": "python", "repo": "Jiaxuuuuuu/VanillaML", "path": "/vanilla_ml/util/metrics/rmse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def rmse_score(y_true, y_pred): return np.sqrt(mse_score(y_true, y_pred))<|fim_prefix|># repo: Jiaxuuuuuu/VanillaML path: /vanilla_ml/util/metrics/rmse.py """ Root mean square error (RMSE) """ import numpy as np def mse_score(y_true, y_pred): <|fim_middle|> return np.mean(np.square(y_true - y_p...
code_fim
easy
{ "lang": "python", "repo": "Jiaxuuuuuu/VanillaML", "path": "/vanilla_ml/util/metrics/rmse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /_RESOURCES/awesome-git-user/ThinkComplexity2/code/listsum.py """This module contains code from Think Python by Allen B. Downey http://thinkpython.com Copyright 2012 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ import os import ...
code_fim
hard
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/_RESOURCES/awesome-git-user/ThinkComplexity2/code/listsum.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Plots data and a fitted curve. ns: sequence of n (problem size) ts: sequence of t (run time) label: string label for the data curve color: string color for the data curve exp: exponent (slope) for the fitted curve """ tfit = fit(ns, ts, exp) pyplot.plot(ns, tfit, co...
code_fim
hard
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/_RESOURCES/awesome-git-user/ThinkComplexity2/code/listsum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: project-lolquiz/the-backend path: /routes/game_route.py from flasgger import swag_from from flask import jsonify, Blueprint <|fim_suffix|> @game_config_rest.route('/games/configs/types') @swag_from('./docs/game/game_types.yml') def game_types(): return jsonify(get_all_types()), 200 @game_c...
code_fim
medium
{ "lang": "python", "repo": "project-lolquiz/the-backend", "path": "/routes/game_route.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return jsonify(get_all_types()), 200 @game_config_rest.route('/games/configs/modes') @swag_from('./docs/game/game_modes.yml') def game_modes(): return jsonify(get_all_modes()), 200<|fim_prefix|># repo: project-lolquiz/the-backend path: /routes/game_route.py from flasgger import swag_from from f...
code_fim
medium
{ "lang": "python", "repo": "project-lolquiz/the-backend", "path": "/routes/game_route.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lisaveta-K/lisaveta-k.github.io path: /_site/tomat/apps/checkout/managers.py # -*- coding: utf-8 -*- from satchless.process import ProcessManager from cart.models import Cart from checkout.steps.auth import AuthStep from checkout.steps.delivery import DeliveryStep from checkout.steps.address im...
code_fim
hard
{ "lang": "python", "repo": "Lisaveta-K/lisaveta-k.github.io", "path": "/_site/tomat/apps/checkout/managers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if request.user.is_anonymous() or request.user.status in (User.STATUS_CUSTOMER, User.STATUS_ADMIN): self.steps = ( AuthStep(self, request), PhoneStep(self, request), DeliveryStep(self, request), AddressStep(self, request),...
code_fim
hard
{ "lang": "python", "repo": "Lisaveta-K/lisaveta-k.github.io", "path": "/_site/tomat/apps/checkout/managers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrobichaud/django-awesome-presentations path: /testing_migrations/models.py from django.db import models class AwesomeModel(models.Model): name = models.CharField(max_length=100, unique=True) <|fim_suffix|> class KittenName(models.Model): kitten = models.ForeignKey(Kitten, on_delete=mo...
code_fim
medium
{ "lang": "python", "repo": "jrobichaud/django-awesome-presentations", "path": "/testing_migrations/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class KittenName(models.Model): kitten = models.ForeignKey(Kitten, on_delete=models.CASCADE) name = models.CharField(max_length=100)<|fim_prefix|># repo: jrobichaud/django-awesome-presentations path: /testing_migrations/models.py from django.db import models class AwesomeModel(models.Model): ...
code_fim
medium
{ "lang": "python", "repo": "jrobichaud/django-awesome-presentations", "path": "/testing_migrations/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dantefung/Python-Codebase path: /study_sample/ahp/ahp.py # coding:utf-8 import numpy as np class AHP: """ 相关信息的传入和准备 """ def __init__(self, array): ## 记录矩阵相关信息 self.array = array ## 记录矩阵大小 self.n = array.shape[0] # 初始化RI值,用于一致性检验 se...
code_fim
hard
{ "lang": "python", "repo": "dantefung/Python-Codebase", "path": "/study_sample/ahp/ahp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 几何平均法求权重 """ def cal_weight__by_geometric_method(self): # 求矩阵的每列的积 col_product = np.product(self.array, axis=0) # 将得到的积向量的每个分量进行开n次方 array_power = np.power(col_product, 1 / self.n) # 将列向量归一化 array_weight = array_power / np.sum(array_power...
code_fim
hard
{ "lang": "python", "repo": "dantefung/Python-Codebase", "path": "/study_sample/ahp/ahp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', ] )<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "bwalkowi/pytest-xvfb-recorder", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bwalkowi/pytest-xvfb-recorder path: /setup.py from setuptools import setup setup( name='pytest-xvfb-recorder', version='0.1.0', description='pytest plugin allowing starting and recording xvfb session using ffmpeg', long_description=open('README.rst').read(), author='bwalkowi...
code_fim
hard
{ "lang": "python", "repo": "bwalkowi/pytest-xvfb-recorder", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> classifiers=[ 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', 'Framework :: Pytest', 'Intended Audience :: Developers', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 2....
code_fim
hard
{ "lang": "python", "repo": "bwalkowi/pytest-xvfb-recorder", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> seq = spl[spl_end] assert not seq.isdigit(),"error: this .sequences file has an odd format" output.write(">%s\n%s\n" % (unitig_id,seq)) output.close()<|fim_prefix|># repo: ekimb/rust-mdbg path: /utils/sequences_file_to_fasta.py import sys if len(sys.argv) < 3 or ".fa" not in sys.argv[2] or "...
code_fim
medium
{ "lang": "python", "repo": "ekimb/rust-mdbg", "path": "/utils/sequences_file_to_fasta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ekimb/rust-mdbg path: /utils/sequences_file_to_fasta.py import sys if len(sys.argv) < 3 or ".fa" not in sys.argv[2] or ".sequences" not in sys.argv[1]: exit("input: [final.sequences] [final.fasta]\n will take the sequences column and put it in fasta format, that's all\n") output = open(sys.a...
code_fim
medium
{ "lang": "python", "repo": "ekimb/rust-mdbg", "path": "/utils/sequences_file_to_fasta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>inue spl = line.split() unitig_id = spl[0] spl_end = -5 minims = tuple(map(lambda x: int(x.strip('[').strip(']').replace(',','')),spl[1:spl_end])) seq = spl[spl_end] assert not seq.isdigit(),"error: this .sequences file has an odd format" output.write(">%s\n%s\n" % (unitig_id,...
code_fim
medium
{ "lang": "python", "repo": "ekimb/rust-mdbg", "path": "/utils/sequences_file_to_fasta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>64, FileManager, click, submit, display_gif<|fim_prefix|># repo: clasp-developers/cl-nglview path: /nglview/utils/__init__.py from __future__ import absolute_import from . import widget_utils, js_utils, py_uti<|fim_middle|>ls from .py_utils import get_colors_from_b
code_fim
easy
{ "lang": "python", "repo": "clasp-developers/cl-nglview", "path": "/nglview/utils/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: clasp-developers/cl-nglview path: /nglview/utils/__init__.py from __future__ import absolute_import fr<|fim_suffix|>64, FileManager, click, submit, display_gif<|fim_middle|>om . import widget_utils, js_utils, py_utils from .py_utils import get_colors_from_b
code_fim
medium
{ "lang": "python", "repo": "clasp-developers/cl-nglview", "path": "/nglview/utils/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if fbus.clear: nvacant.next = N ntenant.next = 0 else: v = int(nvacant) f = int(ntenant) if fbus.read_valid: v = v + 1 f = f - 1 if fbus.write: v = v -1 ...
code_fim
hard
{ "lang": "python", "repo": "Vikram9866/rhea", "path": "/rhea/cores/fifo/fifo_sync.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vikram9866/rhea path: /rhea/cores/fifo/fifo_sync.py # Copyright (c) 2014 Christopher L. Felton # from math import log, fmod, ceil from myhdl import Signal, intbv, modbv, always_comb, always_seq, block from rhea.system import FIFOBus from .fifo_mem import fifo_mem_generic @block def fifo_sync(...
code_fim
hard
{ "lang": "python", "repo": "Vikram9866/rhea", "path": "/rhea/cores/fifo/fifo_sync.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @always_comb def beh_assign(): fbus.read_valid.next = vld & fbus.read nvacant = Signal(intbv(N, min=-0, max=N+1)) # # empty slots ntenant = Signal(intbv(0, min=-0, max=N+1)) # # filled slots @always_seq(clock.posedge, reset=reset) def dbg_occupancy()...
code_fim
hard
{ "lang": "python", "repo": "Vikram9866/rhea", "path": "/rhea/cores/fifo/fifo_sync.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> recommendation_description = models.CharField(max_length=250)<|fim_prefix|># repo: ristovao/2017.2-Receituario-Medico path: /medical_prescription/recommendation/models/newrecommendation.py # Django from django.db import models # Local Django <|fim_middle|>class NewRecommendation(models.Model):
code_fim
easy
{ "lang": "python", "repo": "ristovao/2017.2-Receituario-Medico", "path": "/medical_prescription/recommendation/models/newrecommendation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ristovao/2017.2-Receituario-Medico path: /medical_prescription/recommendation/models/newrecommendation.py # Django from django.db import models <|fim_suffix|> recommendation_description = models.CharField(max_length=250)<|fim_middle|># Local Django class NewRecommendation(models.Model):
code_fim
easy
{ "lang": "python", "repo": "ristovao/2017.2-Receituario-Medico", "path": "/medical_prescription/recommendation/models/newrecommendation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: akira-okumura/ISEE_SiPM path: /old_script/measurement/Initialise.py import target_driver import target_io import time def Initialise(board): for asic in range(0, 4): board.WriteASICSetting("SSPinLE_Delay", asic, 0x2e) board.WriteASICSetting("SSPinTE_Delay",...
code_fim
hard
{ "lang": "python", "repo": "akira-okumura/ISEE_SiPM", "path": "/old_script/measurement/Initialise.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> board.WriteRegister(0x33, 0x00180000) board.WriteRegister(0x33, 0x80180000) board.WriteRegister(0x33, 0x00100000) board.WriteSetting("Start_TimeBase", 0x1) time.sleep(0.1) for asic in range(0, 4): board.WriteASICSetting("Vqbuff", asic, 0x426) board....
code_fim
hard
{ "lang": "python", "repo": "akira-okumura/ISEE_SiPM", "path": "/old_script/measurement/Initialise.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #for innerloop in range(outerloop, outerloop + rangelength): for innerloop in range(0, rangelength): # Build up average pixel intensities, casting each image as an array of floats im = imlist[outerloop + innerloop] complete += 1 filename = frames_in_dir + "\\" + im status = ...
code_fim
hard
{ "lang": "python", "repo": "wasoxygen/video_smoother", "path": "/smooth.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>for outerloop in range(0, len(imlist) - rangelength): #for outerloop in range(0, 4): # Create a numpy array of floats to store the average (assume RGB images) arr=numpy.zeros((h,w,3),numpy.float) #for innerloop in range(outerloop, outerloop + rangelength): for innerloop in range(0, rangelength...
code_fim
hard
{ "lang": "python", "repo": "wasoxygen/video_smoother", "path": "/smooth.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wasoxygen/video_smoother path: /smooth.py import os, numpy, PIL, time from PIL import Image #11:56 AM 9/12/2020 t1 = time.perf_counter() #scene00001.png to scene01616.png frames_in_dir = r"C:\Users\Steve\Videos\smooth\Shibuya_LlSPOnQw86A\frames_in" frames_out_dir = r"C:\Users\Steve\Videos\smo...
code_fim
medium
{ "lang": "python", "repo": "wasoxygen/video_smoother", "path": "/smooth.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> client.playlist_activate_previous() assert client.get_active_playlist() == 1 def test_foobar_properties(client): version = client.get_version() version_string = client.get_version_string() name = client.get_name() version_text = client.get_version_as_text() # Can't make any ...
code_fim
hard
{ "lang": "python", "repo": "PCManticore/foo_rpc", "path": "/tests/test_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PCManticore/foo_rpc path: /tests/test_api.py dex'] == 0 missing = client.playlist_get_item_handle( new_playlist_with_items.index, len(new_playlist_with_items.files) + 1) assert not missing def test_activeplaylist_get_item_handle(client, active_playlist_with_item): h...
code_fim
hard
{ "lang": "python", "repo": "PCManticore/foo_rpc", "path": "/tests/test_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PCManticore/foo_rpc path: /tests/test_api.py quest.addfinalizer(lambda: client.stop()) # Foobar needs time for getting the file and starting the actual playback. time.sleep(0.5) is_playing, now_playing = client.get_now_playing() assert is_playing now_playing_formatted = di...
code_fim
hard
{ "lang": "python", "repo": "PCManticore/foo_rpc", "path": "/tests/test_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TrendingTechnology/MLServer path: /runtimes/mlflow/mlserver_mlflow/encoding.py import numpy as np from typing import Dict, List, Union from mlserver.codecs import NumpyCodec from mlserver.types import ResponseOutput DefaultOutputName = "predict" TensorDict = Dict[str, np.ndarray] MLflowPayload...
code_fim
medium
{ "lang": "python", "repo": "TrendingTechnology/MLServer", "path": "/runtimes/mlflow/mlserver_mlflow/encoding.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> codec = NumpyCodec() if type(mlflow_payload) is np.ndarray: # Cast to dict of tensors mlflow_payload = {DefaultOutputName: mlflow_payload} # type: ignore return [ codec.encode(key, value) for key, value in mlflow_payload.items() # type: ignore ]<|fim_pre...
code_fim
medium
{ "lang": "python", "repo": "TrendingTechnology/MLServer", "path": "/runtimes/mlflow/mlserver_mlflow/encoding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: orestis46/Netconf-Restconf path: /Netconf/nornir_netconf_scrapli_netconf_cisco_devices.py # Nornir Modules from nornir import InitNornir from nornir_scrapli.tasks import netconf, netconf_get, netconf_get_config, netconf_edit_config, netconf_lock, netconf_unlock, netconf_commit from nornir_netconf...
code_fim
hard
{ "lang": "python", "repo": "orestis46/Netconf-Restconf", "path": "/Netconf/nornir_netconf_scrapli_netconf_cisco_devices.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> task.run(task=netconf_get_config, source="running", filter=("subtree", filtro)) print("="*40) print("\n") print(f"\n\n********** {task.host.hostname} **********\n\n") print("="*40) if __name__ == "__main__": main()<|fim_prefix|># repo: orestis46/Netconf-Restconf pat...
code_fim
hard
{ "lang": "python", "repo": "orestis46/Netconf-Restconf", "path": "/Netconf/nornir_netconf_scrapli_netconf_cisco_devices.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eigenomarksamy/audibot path: /audibot_control/scripts/twistlot_blue_audi.py #! /usr/bin/env python import rospy from std_msgs.msg import Float64 from geometry_msgs.msg import Twist max_speed = 3.6 #TODO: Find the actual maximum speed aucmd_topic = '/blue/cmd_vel' thrtl_topic = '/blue/throttle...
code_fim
hard
{ "lang": "python", "repo": "eigenomarksamy/audibot", "path": "/audibot_control/scripts/twistlot_blue_audi.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> rospy.init_node('twist_blue_audi', anonymous=True) rospy.Subscriber(aucmd_topic, Twist, twist_callback) thrtl_pub.publish(Float64(0.0)) brake_pub.publish(Float64(0.0)) rospy.spin() if __name__ == '__main__': try: twist_lot_control() except rospy.ROSInterruptException: pass<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "eigenomarksamy/audibot", "path": "/audibot_control/scripts/twistlot_blue_audi.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def execute(self, query: str, data: str = None): try: if data: self.cur.execute(query, data) else: self.cur.execute(query) self.conn.commit() except Exception as ex: print(ex) return self.cur.fetch...
code_fim
hard
{ "lang": "python", "repo": "mrubio-chavarria/fetchers-python", "path": "/src/adapters/sqlite.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrubio-chavarria/fetchers-python path: /src/adapters/sqlite.py import logging import sqlite3 import pandas as pd from datetime import datetime __all__ = ('SqliteHelper',) from utils.adapter_abstract import AbstractAdapter logger = logging.getLogger(__name__) sql_create_epidemiology_table = ""...
code_fim
hard
{ "lang": "python", "repo": "mrubio-chavarria/fetchers-python", "path": "/src/adapters/sqlite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> content_offset, block_text, state, state_machine): obj_name = arguments[0] obj = resolve_name(obj_name) rst = ViewList() rst.append(obj.__doc__, '<docstring>') print "CALLED", obj_name, obj, rst node = nodes.section() surrounding_title_styles = state.mem...
code_fim
medium
{ "lang": "python", "repo": "oyorooms/hue", "path": "/desktop/core/ext-py/nose-1.3.7/doc/docstring.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: oyorooms/hue path: /desktop/core/ext-py/nose-1.3.7/doc/docstring.py from docutils import nodes from docutils.statemachine import ViewList from nose.util import resolve_name <|fim_suffix|> content_offset, block_text, state, state_machine): obj_name = arguments[0] ob...
code_fim
medium
{ "lang": "python", "repo": "oyorooms/hue", "path": "/desktop/core/ext-py/nose-1.3.7/doc/docstring.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HuiSiqi/e2c-pytorch path: /e2c/tf_e2c/viz_results.py """ Quick-and-dirty visualization scripts for a variety of tasks. """ import sequential_e2c as e2c #import e2c_plane_z as e2c import matplotlib.pyplot as plt import tensorflow as tf import numpy as np from data.plane_data2 import PlaneDat...
code_fim
hard
{ "lang": "python", "repo": "HuiSiqi/e2c-pytorch", "path": "/e2c/tf_e2c/viz_results.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def show_recons_seq(sess, ckptfile): e2c.saver.restore(sess, ckptfile) # restore variable values dataset = PlaneData("data/plane1.npz", "data/env1.png") dataset.initialize() T = e2c.T print(T) (x_vals, u_vals) = dataset.sample_seq(e2c.batch_size, T) feed_dict = {} for t in...
code_fim
hard
{ "lang": "python", "repo": "HuiSiqi/e2c-pytorch", "path": "/e2c/tf_e2c/viz_results.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> d = 100 # interval for i in range(int(1e5) // d): f = "%s-%05d" % (cpktprefix, i * d) ckptfile = f + ".ckpt" print(ckptfile) fig = viz_z(sess, ckptfile) fig.suptitle('%d' % (i * d)) fig.savefig(f + ".png") # combine with convert -delay 10 -l...
code_fim
hard
{ "lang": "python", "repo": "HuiSiqi/e2c-pytorch", "path": "/e2c/tf_e2c/viz_results.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # empty call assert(pgbadger.get_pgbadger_reports(None,empty_app)) def test_get_pgbadger_report_last(): # empty call pgbadger.get_pgbadger_report_last(None,empty_app) def test_get_pgbadger_report_last_html(): # empty call pgbadger.get_pgbadger_report_last_html(None,empty_app) ...
code_fim
hard
{ "lang": "python", "repo": "daamien/temboard-agent-pgbadger", "path": "/tests/unit/test_class.py", "mode": "spm", "license": "PostgreSQL", "source": "the-stack-v2" }
<|fim_prefix|># repo: daamien/temboard-agent-pgbadger path: /tests/unit/test_class.py from temboardagent.errors import UserError from temboardagent.cli import Application from temboardagent.scheduler import taskmanager from temboardagent.scripts.agent import WorkerPoolService from temboardagent.scripts.agent import S...
code_fim
hard
{ "lang": "python", "repo": "daamien/temboard-agent-pgbadger", "path": "/tests/unit/test_class.py", "mode": "psm", "license": "PostgreSQL", "source": "the-stack-v2" }
<|fim_suffix|>ception, ex: return ex.args[0]<|fim_prefix|># repo: kykrueger/openbis path: /openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/server/CommonServerTestResources/sample_adaptor_test__container.py def validate(sample, isNew): try:<|fim_middle|> assertEntity(sample.container(), ...
code_fim
medium
{ "lang": "python", "repo": "kykrueger/openbis", "path": "/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/server/CommonServerTestResources/sample_adaptor_test__container.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kykrueger/openbis path: /openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/server/CommonServerTestResources/sample_adaptor_test__container.py def validate(sample, isNew): try: assertEntity(sample.container<|fim_suffix|>ception, ex: return ex.args[0]<|fim_middle|>(), ...
code_fim
easy
{ "lang": "python", "repo": "kykrueger/openbis", "path": "/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/server/CommonServerTestResources/sample_adaptor_test__container.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _create_version(self, global_step): return "inc-{:.>20}".format(global_step) class HashIncreaser(object): def increase(self, inc_version): execute(self.increase_op(inc_version)) def increase_op(self, inc_version): return xdl.ps_streaming_trigger_hash_op(_string_to...
code_fim
hard
{ "lang": "python", "repo": "laozhuang727/x-deeplearning", "path": "/xdl/xdl/python/training/increaser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: laozhuang727/x-deeplearning path: /xdl/xdl/python/training/increaser.py # Copyright 2018 Alibaba Group. 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 the Licens...
code_fim
hard
{ "lang": "python", "repo": "laozhuang727/x-deeplearning", "path": "/xdl/xdl/python/training/increaser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(0, dim[2]): Ble[:, :, i] = k1*A[:, :, i].astype(float) + k2*B[:, :, i].astype(float) #6 plt.figure plt.imshow(Ble)<|fim_prefix|># repo: Tjccs/DRPI path: /Tp's/tp_2.py # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from imageio import imr...
code_fim
hard
{ "lang": "python", "repo": "Tjccs/DRPI", "path": "/Tp's/tp_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tjccs/DRPI path: /Tp's/tp_2.py # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from imageio import imread, imwrite import matplotlib.pyplot as plt import numpy as np import scipy.ndimage Img = imread('Z:/DRPI/einstein01.tif') <|fim_suffix|># 2 S1 ...
code_fim
hard
{ "lang": "python", "repo": "Tjccs/DRPI", "path": "/Tp's/tp_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 4 Reg = imread('Z:/DRPI/ferramentas_bin.tif') Mult = Reg*S1[:, :, 0] # 5 A = imread('Z:/DRPI/einstein01.tif') B = imread('Z:/DRPI/marilyn01.tif') k1 = 0.5 k2 = 0.5 Ble = A dim = A.shape for i in range(0, dim[2]): Ble[:, :, i] = k1*A[:, :, i].astype(float) + k2*B[:, :, i].astype(float)...
code_fim
hard
{ "lang": "python", "repo": "Tjccs/DRPI", "path": "/Tp's/tp_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhruvsharma1999/data-structures-algorithms path: /trees/bstpy.py #implementing Binary search tree in python3 #Node class class Node: """Initiate the root node, with left and right child with value of None""" def __init__(self, value=None): self.value = value self.left_chi...
code_fim
medium
{ "lang": "python", "repo": "dhruvsharma1999/data-structures-algorithms", "path": "/trees/bstpy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """a private function which insert a new node in the BST if the root is not none""" if value < cur_node.value: if cur_node.left_child == None: cur_node.left_child = Node(value) else: self._insert(value, cur_node.left_child) e...
code_fim
medium
{ "lang": "python", "repo": "dhruvsharma1999/data-structures-algorithms", "path": "/trees/bstpy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }