text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>from .python.pyWeight_problem import WeightProblem from .python.pyWeight_problem import FuelCase from .python.FluidProperties import FluidProperties from .python.ICAOAtmosphere import ICAOAtmosphere from .python.pyEngine_problem import EngineProblem from .python.pyFieldPerformance_problem import FieldPe...
code_fim
hard
{ "lang": "python", "repo": "nbons/baseclasses", "path": "/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from .python.FluidProperties import FluidProperties from .python.ICAOAtmosphere import ICAOAtmosphere from .python.pyEngine_problem import EngineProblem from .python.pyFieldPerformance_problem import FieldPerformanceProblem from .python.pyLG_problem import LGProblem from .python.py3Util import getPy3Sa...
code_fim
medium
{ "lang": "python", "repo": "nbons/baseclasses", "path": "/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nbons/baseclasses path: /__init__.py from .python.pyAero_problem import AeroProblem from .python.pyTransi_problem import TransiProblem from .python.pyStruct_problem import StructProblem from .python.pyAeroStruct_problem import AeroStructProblem from .python.pyAero_solver import AeroSolver from ....
code_fim
hard
{ "lang": "python", "repo": "nbons/baseclasses", "path": "/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbussy/nbgrader path: /nbgrader/converters/__init__.py from .base import BaseConverter, NbGraderException from .assig<|fim_suffix|>derException", "Assign", "Autograde", "Feedback" ]<|fim_middle|>n import Assign from .autograde import Autograde from .feedback import Feedback __all__ =...
code_fim
medium
{ "lang": "python", "repo": "jbussy/nbgrader", "path": "/nbgrader/converters/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>derException", "Assign", "Autograde", "Feedback" ]<|fim_prefix|># repo: jbussy/nbgrader path: /nbgrader/converters/__init__.py from .base import BaseConverter, NbGraderException from .assig<|fim_middle|>n import Assign from .autograde import Autograde from .feedback import Feedback __all__ =...
code_fim
medium
{ "lang": "python", "repo": "jbussy/nbgrader", "path": "/nbgrader/converters/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlberCarri/ejercicio_Api path: /ejercicio_Api.py import requests import json import os #Para realizar este ejercicio he optado por elegir la siguiente página: https://date.nager.at/ #Esta página proporciona información sobre las diferentes fiestas nacionales de diferentes paises y de diferentes ...
code_fim
hard
{ "lang": "python", "repo": "AlberCarri/ejercicio_Api", "path": "/ejercicio_Api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> url="https://date.nager.at/api/v2/publicholidays/2019/%s"%pais print(url) response = requests.get(url) if response.status_code == 200: datos = json.loads(response.content) contador=1 for json_data in datos: print ("Nomb...
code_fim
hard
{ "lang": "python", "repo": "AlberCarri/ejercicio_Api", "path": "/ejercicio_Api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if opc == 1: mostrar_fiestas() elif opc == 2: mostrar_anyo() elif opc == 3: mostrar_otro() elif opc == 4: print("Gracias por su visita") break else: print("Opción no disponible") in...
code_fim
hard
{ "lang": "python", "repo": "AlberCarri/ejercicio_Api", "path": "/ejercicio_Api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def generate_reports(percent_threshold): str_full_report = "" str_warnings = "" for cs in CryptoStatus.select().order_by(CryptoStatus.current_percentage.desc(), CryptoStatus.crypto): status = "%5s: %6.2f%% | %s | $%s\n" % ( cs.crypt...
code_fim
hard
{ "lang": "python", "repo": "kdmukai/stop_loss_bot", "path": "/src/stop_loss_bot/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return cs @staticmethod def generate_reports(percent_threshold): str_full_report = "" str_warnings = "" for cs in CryptoStatus.select().order_by(CryptoStatus.current_percentage.desc(), CryptoStatus.crypto): status = "%5s: %6.2f%% | %s | $%s\n" % ( ...
code_fim
hard
{ "lang": "python", "repo": "kdmukai/stop_loss_bot", "path": "/src/stop_loss_bot/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kdmukai/stop_loss_bot path: /src/stop_loss_bot/__init__.py from decimal import Decimal from .models import CryptoStatus class StopLossBot(): @staticmethod def process_candle(candle, cs, is_current_candle=True): candle_timestamp = candle['time'] if is_current_candle: ...
code_fim
hard
{ "lang": "python", "repo": "kdmukai/stop_loss_bot", "path": "/src/stop_loss_bot/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return image_colors_df def store_rug_colors(rug_dir): def listdir_nohidden(path): for f in os.listdir(path): if not f.startswith('.'): yield f rug_filenames = listdir_nohidden(rug_dir) # Setup dataframe rug_colors_df = pd.DataFrame(columns...
code_fim
hard
{ "lang": "python", "repo": "kswiftspong/style_match", "path": "/model/color_clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kswiftspong/style_match path: /model/color_clustering.py from sklearn.cluster import KMeans import numpy as np import cv2 from collections import Counter from skimage.color import rgb2lab, deltaE_cie76 import os import pandas as pd import operator from itertools import islice import json def RGB...
code_fim
hard
{ "lang": "python", "repo": "kswiftspong/style_match", "path": "/model/color_clustering.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return rug_colors_df def save_rug_colors(rug_dir): rug_colors_df = store_rug_colors(rug_dir) rug_colors_df['lab_1'] = rug_colors_df.apply (lambda row: row['Lab'][0][0][0], axis=1) rug_colors_df['lab_2'] = rug_colors_df.apply (lambda row: row['Lab'][0][0][1], axis=1) rug_colors_df['la...
code_fim
hard
{ "lang": "python", "repo": "kswiftspong/style_match", "path": "/model/color_clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return content @app.route('/getrestbl/<task_id>',methods=['GET']) def get_res_tbl(task_id): # Get all mandatory informations we need # Info about params: https://datatables.net/manual/server-side#DataTables_Table_1 draw = int(request.args['draw']) # not secure # TODO: make it secure? ...
code_fim
hard
{ "lang": "python", "repo": "vincentiusmartin/QBiC-Pred", "path": "/website/app/views/result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vincentiusmartin/QBiC-Pred path: /website/app/views/result.py # clear the session given from index return render_template("result.html",stats_url=url_for('task_status',task_id=job_id),parents=parents) # /<taskid>/<filters> @app.route('/files/<filetype>/<task_id>/<filters>') def get_file_fro...
code_fim
hard
{ "lang": "python", "repo": "vincentiusmartin/QBiC-Pred", "path": "/website/app/views/result.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def query_filter(search_filter): query_or = {} query = {} inseq_substr = "" ex_query = {} #exact, exclude gene_or = "" for q in search_filter: if q["searchOpt"] == "in sequence": inseq_substr += "%s|" % q["searchKey"] elif q["searchOpt"] == "or": ...
code_fim
hard
{ "lang": "python", "repo": "vincentiusmartin/QBiC-Pred", "path": "/website/app/views/result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: freekang/HPHG path: /src/main.py ''' Reference implementation of HPHG and HPSG. Author: Jie Huang For more details, refer to the paper: Hyper-Path-Based Representation Learning for Hyper-Networks Jie Huang, Xin Liu, Yangqiu Song ''' import numpy as np import argparse import networkx as nx from...
code_fim
hard
{ "lang": "python", "repo": "freekang/HPHG", "path": "/src/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif args.method=='hpsg': walks = [list(map(str,walk)) for walk in walks] word2vec = Word2Vec(walks,size=args.dimensions,window=args.window_size,min_count=0, sg=1,workers=args.workers,iter=args.iter,negative=5,compute_loss=True) vectors = {} ...
code_fim
hard
{ "lang": "python", "repo": "freekang/HPHG", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ishota/CarND-Traffic-Sign-Classifier path: /src/preprocess_data.py # -*- coding: utf-8 -*- import numpy as np import tensorflow as tf from copy import deepcopy def shift_brightness(X_train): s_bright_X = deepcopy(X_train) for i in range(X_train.shape[0]): random_delta = max(0, ...
code_fim
medium
{ "lang": "python", "repo": "ishota/CarND-Traffic-Sign-Classifier", "path": "/src/preprocess_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r_hue_X = tf.image.random_hue(X_train, max_delta=0.2) processed_X_train = np.concatenate((processed_X_train, r_hue_X), axis=0) processed_y_train = np.concatenate((processed_y_train, y_train), axis=0) return processed_X_train, processed_y_train def input_normalize(images): tensor_ima...
code_fim
hard
{ "lang": "python", "repo": "ishota/CarND-Traffic-Sign-Classifier", "path": "/src/preprocess_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Get import records for `service_resource.py[i]`. """ if self.service_resource is None: return [] import_records: set[ImportRecord] = set() class_import_records = self.service_resource.get_required_import_records() for import_record i...
code_fim
hard
{ "lang": "python", "repo": "vemel/mypy_boto3_builder", "path": "/mypy_boto3_builder/structures/service_package.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_typed_dicts(self) -> set[TypeTypedDict]: result: set[TypeTypedDict] = set() for type_annotation in self.iterate_types(): if not isinstance(type_annotation, TypeTypedDict): continue result.add(type_annotation) methods: set[Method...
code_fim
hard
{ "lang": "python", "repo": "vemel/mypy_boto3_builder", "path": "/mypy_boto3_builder/structures/service_package.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vemel/mypy_boto3_builder path: /mypy_boto3_builder/structures/service_package.py """ Parsed Service package. """ from collections.abc import Iterable, Iterator from typing import Literal from mypy_boto3_builder.enums.service_module_name import ServiceModuleName from mypy_boto3_builder.import_hel...
code_fim
hard
{ "lang": "python", "repo": "vemel/mypy_boto3_builder", "path": "/mypy_boto3_builder/structures/service_package.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sohn21c/yoloMask path: /src/createDataset.py """ Author: James Sohn Last Modified: 11/06/19 This script is to create a dataset to train YOLO by adding custom object masks to random backgrounds while rotating, scaling and jittering color. For more details about the code, please visit the github r...
code_fim
hard
{ "lang": "python", "repo": "sohn21c/yoloMask", "path": "/src/createDataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if items[0] in self.target: _x, _y, _w, _h = float(items[1]), float(items[2]), float(items[3]), float(items[4]) tx = _x - _w/2 ty = _y - _h/2 bx = _x + _w/2 by = _y + _h/2 ...
code_fim
hard
{ "lang": "python", "repo": "sohn21c/yoloMask", "path": "/src/createDataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chrippa/python-flashmedia path: /tests/test_4cc.py from flashmedia.types import FourCC from nose.tools import * def test_pack(): assert FourCC("A") == b"A " assert FourCC("AB") == b"AB " assert FourCC("ABC") == b"ABC " assert FourCC("ABCD") == b"ABCD" <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "chrippa/python-flashmedia", "path": "/tests/test_4cc.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_unpack(): assert FourCC.unpack(b"A ")[0] == "A" assert FourCC.unpack(b"AB ")[0] == "AB" assert FourCC.unpack(b"ABC ")[0] == "ABC" assert FourCC.unpack(b"ABCD")[0] == "ABCD" def test_unpack_from(): assert FourCC.unpack_from(b"A ", 0)[0] == "A" assert FourCC.unpack_fro...
code_fim
medium
{ "lang": "python", "repo": "chrippa/python-flashmedia", "path": "/tests/test_4cc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert FourCC.unpack(b"A ")[0] == "A" assert FourCC.unpack(b"AB ")[0] == "AB" assert FourCC.unpack(b"ABC ")[0] == "ABC" assert FourCC.unpack(b"ABCD")[0] == "ABCD" def test_unpack_from(): assert FourCC.unpack_from(b"A ", 0)[0] == "A" assert FourCC.unpack_from(b"AB ", 0)[0] ==...
code_fim
medium
{ "lang": "python", "repo": "chrippa/python-flashmedia", "path": "/tests/test_4cc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: edebie/pyalcs path: /lcs/agents/racs/ClassifierList.py from __future__ import annotations from typing import Optional from lcs import TypedList, Perception from lcs.agents.racs import Configuration from . import Classifier from .components.alp import expected_case, unexpected_case, cover clas...
code_fim
hard
{ "lang": "python", "repo": "edebie/pyalcs", "path": "/lcs/agents/racs/ClassifierList.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def apply_reinforcement_learning(self, reward: int, p: float) -> None: """ Reinforcement Learning. Applies RL according to current reinforcement `reward` and back-propagated reinforcement `maximum_fitness`. Parameters ---------- reward: int ...
code_fim
hard
{ "lang": "python", "repo": "edebie/pyalcs", "path": "/lcs/agents/racs/ClassifierList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if t.is_element_exist_by_class_name(browser, "di-lic"): sys.stderr.write("登录失败。请将以下内容与浏览器界面一并反馈给开发者: ") raise ce.CustomBaseException(prefix="INFO", arg="di-lic exists: True.", code=100, addition=traceback.format_exc()) print("登录成功。") err_li...
code_fim
hard
{ "lang": "python", "repo": "qzwxsaedc/CoolQ-PluginAutoDownloader", "path": "/downloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qzwxsaedc/CoolQ-PluginAutoDownloader path: /downloader.py # -*- coding: UTF-8 -*- from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as ec import sys import os import json import time import tracebac...
code_fim
hard
{ "lang": "python", "repo": "qzwxsaedc/CoolQ-PluginAutoDownloader", "path": "/downloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: douglasqsantos/DQSHackingTools path: /passwordcracking/sha1hash.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://docs.python.org/3/library/hashlib.html # https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.tx...
code_fim
medium
{ "lang": "python", "repo": "douglasqsantos/DQSHackingTools", "path": "/passwordcracking/sha1hash.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def found(password,count): end = time.time() - start print('\n{}[+]{} The Password is: {}{}{} found in {:.2f} segs. Processed {}{}{} hashes'.format(GREEN,RESET,GREEN,str(password), RESET, end,GREEN,count,RESET)) sha1hash = input("[+] Enter Sha1 Hash: ") # Start the crack start = time.time() # coun...
code_fim
medium
{ "lang": "python", "repo": "douglasqsantos/DQSHackingTools", "path": "/passwordcracking/sha1hash.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> end = time.time() - start print('\n{}[+]{} The Password is: {}{}{} found in {:.2f} segs. Processed {}{}{} hashes'.format(GREEN,RESET,GREEN,str(password), RESET, end,GREEN,count,RESET)) sha1hash = input("[+] Enter Sha1 Hash: ") # Start the crack start = time.time() # count the amount of passwords p...
code_fim
medium
{ "lang": "python", "repo": "douglasqsantos/DQSHackingTools", "path": "/passwordcracking/sha1hash.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wtl5736/Introduction-to-Cryptography-Project path: /Project Code/Test Files/Test_2--Python_File.py #!/usr/bin/python3 """ Name: HW5 - Hash Function.py Author: Wesley Lee Assignment: HW5 #1 Date: 04-22-2018 """ <|fim_suffix|> binary_number = int(binary_number, 2) hash_func = (((((8192 * binar...
code_fim
medium
{ "lang": "python", "repo": "wtl5736/Introduction-to-Cryptography-Project", "path": "/Project Code/Test Files/Test_2--Python_File.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hash_list = [] collision_list = [] for x in range(0, 256): bin_num = bin(x)[2:].zfill(16) hash_func = hash_function(bin_num) #print("#" + str(x) + "\t", hash_func, "\t->\t", bin(hash_func)[2:].zfill(16)) #print(hash_func) if hash_func in hash_list: collision_list.append(hash_func) el...
code_fim
medium
{ "lang": "python", "repo": "wtl5736/Introduction-to-Cryptography-Project", "path": "/Project Code/Test Files/Test_2--Python_File.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print() #print(collision_list) print("\nNumber of Collisions:", len(collision_list), "out of 256 Tests") print("Ran Program in:", timeTaken, "seconds...") main()<|fim_prefix|># repo: wtl5736/Introduction-to-Cryptography-Project path: /Project Code/Test Files/Test_2--Python_File.py #!/usr/bin/pytho...
code_fim
hard
{ "lang": "python", "repo": "wtl5736/Introduction-to-Cryptography-Project", "path": "/Project Code/Test Files/Test_2--Python_File.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": context = Context(directory=".") loader = PythonLoader(modules=["helpers", "escape_helpers"]) renderer = MarkdownRenderer(render_module_header=False, insert_header_anchors=True, code_headers=True, render_typehint_in_data_header=True, docstrings_as_blockquote=True) ...
code_fim
hard
{ "lang": "python", "repo": "mu-semtech/mu-python-template", "path": "/README.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mu-semtech/mu-python-template path: /README.py from re import search, RegexFlag from pydoc_markdown.interfaces import Context from pydoc_markdown.contrib.loaders.python import PythonLoader from pydoc_markdown.contrib.renderers.markdown import MarkdownRenderer, MarkdownReferenceResolver from pydo...
code_fim
hard
{ "lang": "python", "repo": "mu-semtech/mu-python-template", "path": "/README.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LTTTDH/dataScienceHelpers path: /get_cv_params.py def get_cv_params(X, y, estimator, params, cv=5, scoring=<|fim_suffix|>eturn estimator_cv.best_score_, estimator_cv.best_params_<|fim_middle|>None): estimator_cv = GridSearchCV(estimator, params, cv=cv, scoring=scoring) estimator_cv.fit(X,...
code_fim
medium
{ "lang": "python", "repo": "LTTTDH/dataScienceHelpers", "path": "/get_cv_params.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>eturn estimator_cv.best_score_, estimator_cv.best_params_<|fim_prefix|># repo: LTTTDH/dataScienceHelpers path: /get_cv_params.py def get_cv_params(X, y, estimator, params, cv=5, scoring=<|fim_middle|>None): estimator_cv = GridSearchCV(estimator, params, cv=cv, scoring=scoring) estimator_cv.fit(X,...
code_fim
medium
{ "lang": "python", "repo": "LTTTDH/dataScienceHelpers", "path": "/get_cv_params.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>r=True, setup_requires=['pbr'], )<|fim_prefix|># repo: chrisgorgo/bids2datapackage path: /setup.py from setuptools import find_packages <|fim_middle|>from setuptools import setup setup( packages=find_packages(), pb
code_fim
medium
{ "lang": "python", "repo": "chrisgorgo/bids2datapackage", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chrisgorgo/bids2datapackage path: /setup.py from setuptools import find_packages <|fim_suffix|> packages=find_packages(), pbr=True, setup_requires=['pbr'], )<|fim_middle|>from setuptools import setup setup(
code_fim
easy
{ "lang": "python", "repo": "chrisgorgo/bids2datapackage", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> packages=find_packages(), pbr=True, setup_requires=['pbr'], )<|fim_prefix|># repo: chrisgorgo/bids2datapackage path: /setup.py from setuptools import find_packages <|fim_middle|>from setuptools import setup setup(
code_fim
easy
{ "lang": "python", "repo": "chrisgorgo/bids2datapackage", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_inner_product_infer_no_shape(self): graph = build_graph(nodes_attributes, [('node_1', 'inner'), ('node_2', 'inner'), ('inner', 'node_3'), ('node_3', 'op_output') ...
code_fim
hard
{ "lang": "python", "repo": "ni/dldt", "path": "/model-optimizer/mo/front/common/partial_infer/inner_product_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from mo.front.common.partial_infer.inner_product import caffe_inner_product from mo.graph.graph import Node from mo.utils.unittest.extractors import FakeValue from mo.utils.unittest.graph import build_graph nodes_attributes = {'node_1': {'value': None, 'kind': 'data'}, 'inner': {'type...
code_fim
hard
{ "lang": "python", "repo": "ni/dldt", "path": "/model-optimizer/mo/front/common/partial_infer/inner_product_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ni/dldt path: /model-optimizer/mo/front/common/partial_infer/inner_product_test.py """ Copyright (c) 2018-2019 Intel Corporation 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 Licen...
code_fim
hard
{ "lang": "python", "repo": "ni/dldt", "path": "/model-optimizer/mo/front/common/partial_infer/inner_product_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marrink-lab/cartographer path: /train_num_beads.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2018 University of Groningen # 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 ...
code_fim
hard
{ "lang": "python", "repo": "marrink-lab/cartographer", "path": "/train_num_beads.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> NUM_FEATURES = 7 FINGERPRINT_SIZE = 3 FILENAME = 'numbead_predictor.gz' BASE_PATH = '/home/.../Documents/database' XLS_FILE = os.path.join(BASE_PATH, 'DRUGS-06.xlsx') AA_DIR = os.path.join(BASE_PATH, 'atomistic') CG_DIR = os.path.join(BASE_PATH, 'Martini') MAP_DIR = os.path.join(BASE_PATH, 'mapping') s...
code_fim
hard
{ "lang": "python", "repo": "marrink-lab/cartographer", "path": "/train_num_beads.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhourahine/hsdparser path: /python/src/hsd/formatter.py """Formatting utilities for HSD content. """ import sys from hsd.common import HSDATTR_EQUAL __all__ = [ "HSDFormatter", "HSDStreamFormatter" ] class HSDFormatter: """Event controlled formatter producing HSD output.""" def __...
code_fim
hard
{ "lang": "python", "repo": "bhourahine/hsdparser", "path": "/python/src/hsd/formatter.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: parser: Event controled parser to be used. formatter: Formatter to be used. """ self._parser = parser self._formatter = formatter self._parser.start_handler = self._formatter.start_tag self._parser.close_handler = self._formatt...
code_fim
hard
{ "lang": "python", "repo": "bhourahine/hsdparser", "path": "/python/src/hsd/formatter.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: qinggniq/Algorithm-Practice path: /test_cast/2019-11-13/ClosedNumber/solution.py class Solution: def findTheClosedNumbers(self, num: int) -> list: def getNext(n): c = n c0 = 0 c1 = 0 while (c & 1) == 0 and c != 0: c0 += 1...
code_fim
hard
{ "lang": "python", "repo": "qinggniq/Algorithm-Practice", "path": "/test_cast/2019-11-13/ClosedNumber/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c = n c0 = 0 c1 = 0 while (c & 1) == 1: c1 += 1 c >>= 1 if c == 0: return -1 while (c & 1) == 0 and c != 0: c0 += 1 c >>= 1 p = c0 + c1 ...
code_fim
hard
{ "lang": "python", "repo": "qinggniq/Algorithm-Practice", "path": "/test_cast/2019-11-13/ClosedNumber/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021 path: /answers/Aryan Goyal/Day 10/Que 1.py def pangram(s): a = "abcdefghijklmnopqrstuvwxyz" f<|fim_suffix|>False return True # main string1 = input() if(pangram(string1) == True): print("Yes") else: print("No")<|fim_middle|>or i in ...
code_fim
easy
{ "lang": "python", "repo": "Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021", "path": "/answers/Aryan Goyal/Day 10/Que 1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>(string1) == True): print("Yes") else: print("No")<|fim_prefix|># repo: Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021 path: /answers/Aryan Goyal/Day 10/Que 1.py def pangram(s): a = "abcdefghijklmnopqrstuvwxyz" f<|fim_middle|>or i in a: if i not in s.lower(): return False ...
code_fim
medium
{ "lang": "python", "repo": "Codechef-SRM-NCR-Chapter/30-DaysOfCode-March-2021", "path": "/answers/Aryan Goyal/Day 10/Que 1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbidy/pywizlight path: /pywizlight/tests/test_bulb_rgbw_1_21_4.py """Tests for the Bulb API with a rgbtw bulb.""" from typing import AsyncGenerator import pytest from pywizlight import wizlight from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange from pywizlight.tests.f...
code_fim
hard
{ "lang": "python", "repo": "sbidy/pywizlight", "path": "/pywizlight/tests/test_bulb_rgbw_1_21_4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.asyncio async def test_model_description_rgbw_bulb(rgbw_bulb: wizlight) -> None: """Test fetching the model description rgbw bulb.""" bulb_type = await rgbw_bulb.get_bulbtype() assert bulb_type == BulbType( features=Features( color=True, color_tmp=True, effect=...
code_fim
hard
{ "lang": "python", "repo": "sbidy/pywizlight", "path": "/pywizlight/tests/test_bulb_rgbw_1_21_4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.asyncio async def test_supported_scenes(rgbw_bulb: wizlight) -> None: """Test supported scenes.""" assert await rgbw_bulb.getSupportedScenes() == [ "Ocean", "Romance", "Sunset", "Party", "Fireplace", "Cozy", "Forest", "P...
code_fim
hard
{ "lang": "python", "repo": "sbidy/pywizlight", "path": "/pywizlight/tests/test_bulb_rgbw_1_21_4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: youngspinachIII/doepy-1 path: /doepy/model_discrimination/chi_squared_test.py """ MIT License Copyright (c) 2019 Simon Olofsson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softw...
code_fim
hard
{ "lang": "python", "repo": "youngspinachIII/doepy-1", "path": "/doepy/model_discrimination/chi_squared_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> D = np.asarray(D) assert_is_shape(D, (num_models,)) # Squared Mahalanobis distance mahaf1 = lambda d, is2: np.sum( d * np.matmul(is2, d) ) # Mahalanobis distances for all test points mahaf2 = lambda Y, Z, iS: [ mahaf1(y-z, is2) for y,z,is2 in zip(Y,Z,iS) ] iS = np.linalg.inv(S) maha = [ np.sum...
code_fim
medium
{ "lang": "python", "repo": "youngspinachIII/doepy-1", "path": "/doepy/model_discrimination/chi_squared_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.build_system.cppflags = self.cppflags[self.required_thread] self.maintainers = ['JG', 'AJ'] self.tags = {'production', 'craype'} @run_before('compile') def skip_nvidia_cray_ex(self): envname = self.current_environ.name sysname = self.current_system.nam...
code_fim
hard
{ "lang": "python", "repo": "jgphpc/reframe", "path": "/cscs-checks/prgenv/mpi.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jgphpc/reframe path: /cscs-checks/prgenv/mpi.py # Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import os import reframe as rfm import reframe.utility...
code_fim
hard
{ "lang": "python", "repo": "jgphpc/reframe", "path": "/cscs-checks/prgenv/mpi.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabien-roy/cardbot path: /app/games/entities/fuck_you_game.py from app.games.entities.ordered_games import OrderedGame <|fim_suffix|> def draw(self): player, card = super().draw() result = '{} of {}'.format(card.house_value.name, card.house_suit.name) return player.na...
code_fim
easy
{ "lang": "python", "repo": "fabien-roy/cardbot", "path": "/app/games/entities/fuck_you_game.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> player, card = super().draw() result = '{} of {}'.format(card.house_value.name, card.house_suit.name) return player.name, result<|fim_prefix|># repo: fabien-roy/cardbot path: /app/games/entities/fuck_you_game.py from app.games.entities.ordered_games import OrderedGame <|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "fabien-roy/cardbot", "path": "/app/games/entities/fuck_you_game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> type = 'Fuck you' def draw(self): player, card = super().draw() result = '{} of {}'.format(card.house_value.name, card.house_suit.name) return player.name, result<|fim_prefix|># repo: fabien-roy/cardbot path: /app/games/entities/fuck_you_game.py from app.games.entities.or...
code_fim
easy
{ "lang": "python", "repo": "fabien-roy/cardbot", "path": "/app/games/entities/fuck_you_game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("news", "0006_article_copy_field"), ] operations = [ migrations.RunPython( article_content_to_copy, reverse_code=migrations.RunPython.noop ) ]<|fim_prefix|># repo: goodtune/vitriolic path: /touchtechnology/news/migrations/0007_article...
code_fim
hard
{ "lang": "python", "repo": "goodtune/vitriolic", "path": "/touchtechnology/news/migrations/0007_article_copy_field_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: goodtune/vitriolic path: /touchtechnology/news/migrations/0007_article_copy_field_data.py from django.db import migrations def article_content_to_copy(apps, schema_editor): <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ("news", "0006_article_copy_field"), ...
code_fim
hard
{ "lang": "python", "repo": "goodtune/vitriolic", "path": "/touchtechnology/news/migrations/0007_article_copy_field_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RunPython( article_content_to_copy, reverse_code=migrations.RunPython.noop ) ]<|fim_prefix|># repo: goodtune/vitriolic path: /touchtechnology/news/migrations/0007_article_copy_field_data.py from django.db import migrations def article_conten...
code_fim
hard
{ "lang": "python", "repo": "goodtune/vitriolic", "path": "/touchtechnology/news/migrations/0007_article_copy_field_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: idaholab/raven path: /ravenframework/Samplers/SparseGridCollocation.py # Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
code_fim
hard
{ "lang": "python", "repo": "idaholab/raven", "path": "/ravenframework/Samplers/SparseGridCollocation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> poly = OrthoPolynomials.factory.returnInstance(polyType) poly.initialize(quad) self.polyDict[varName] = poly self.importanceDict[varName] = float(dat['weight']) def localGenerateInput(self, model, oldInput): """ Function to select the next most informative point for r...
code_fim
hard
{ "lang": "python", "repo": "idaholab/raven", "path": "/ravenframework/Samplers/SparseGridCollocation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> py_version = config_file.python_version_to_autoset( partition.interpreter_constraints, python_setup.interpreter_versions_universe ) named_cache_dir = ".cache/mypy_cache" mypy_cache_dir = f"{named_cache_dir}/{sha256(build_root.path.encode()).hexdigest()}" run_cache_dir = ".tmp_c...
code_fim
hard
{ "lang": "python", "repo": "pantsbuild/pants", "path": "/src/python/pants/backend/python/typecheck/mypy/rules.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pantsbuild/pants path: /src/python/pants/backend/python/typecheck/mypy/rules.py PexRequest, PexResolveInfo, VenvPex, VenvPexProcess, ) from pants.backend.python.util_rules.pex_from_targets import RequirementsPexRequest from pants.backend.python.util_rules.python_sources import ( ...
code_fim
hard
{ "lang": "python", "repo": "pantsbuild/pants", "path": "/src/python/pants/backend/python/typecheck/mypy/rules.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KawaSwitch/Poke-Controller path: /SerialController/Camera.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys, os import cv2 import time, datetime class Camera: def __init__(self): self.camera = None self.capture_size = (1280, 720) self.capture_dir = "Captures" de...
code_fim
medium
{ "lang": "python", "repo": "KawaSwitch/Poke-Controller", "path": "/SerialController/Camera.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # Use the current time as the file name if not specified filename = dt_now.strftime('%Y-%m-%d_%H-%M-%S') if len(str(name)) == 0 else name ext = '.png' path = str(filename) + ext if not os.path.exists(self.capture_dir): os.makedirs(self.capture_dir) save_path = os.path.join(self.ca...
code_fim
hard
{ "lang": "python", "repo": "KawaSwitch/Poke-Controller", "path": "/SerialController/Camera.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # 实现了去重,降低了时间复杂度 # 目标和为0 results = [] nums.sort() # 排序既是为了去重,也是为了使用双指针 n = len(nums) for first in range(n): # if nums[first] > 0: # # 当第一个数大于目标值时,直接退出循环,降低时间消耗 # break if first > 0 and nums[first] == n...
code_fim
hard
{ "lang": "python", "repo": "showerhhh/leetcode_python", "path": "/t15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: showerhhh/leetcode_python path: /t15.py class Solution: def threeSum(self, nums): # 仅实现了去重,未降低时间复杂度 # 目标和为0 results = [] nums.sort() # 排序为了去重 n = len(nums) for first in range(n): if first > 0 and nums[first] == nums[first - 1]: ...
code_fim
hard
{ "lang": "python", "repo": "showerhhh/leetcode_python", "path": "/t15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.level >= LoggerLevel.TRACE: print(colored('[trace]', color='magenta', attrs=['bold']), colored(' '.join(map(str, message)), color='magenta')) def trace_current(self): if self.level >= LoggerLevel.TRACE: func = inspect.stack()[1][3] ...
code_fim
hard
{ "lang": "python", "repo": "rloic/Caramel", "path": "/tools/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def log(self, level, *args, **kwargs): if self.level >= level: print(*args, **kwargs) def fatal(self, *args, **kwargs): if self.level >= LoggerLevel.FATAL: print(colored('[fatal]', color='red', attrs=['bold']), *args, **kwargs) def critical(self, *args...
code_fim
hard
{ "lang": "python", "repo": "rloic/Caramel", "path": "/tools/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rloic/Caramel path: /tools/logger.py # coding: utf-8 # MIT License # # Copyright (c) 2018 Kalate Hexanome, 4IF, INSA Lyon # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Softw...
code_fim
hard
{ "lang": "python", "repo": "rloic/Caramel", "path": "/tools/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pfassina/BattleFortune path: /src/battlefortune.py import logging import os import shutil from src import calculate, read, run, visualize from src.config import CONFIG <|fim_suffix|> """ Runs BattleFortune, simulate battles, and return results. """ # PREPARE clone_game_files...
code_fim
medium
{ "lang": "python", "repo": "pfassina/BattleFortune", "path": "/src/battlefortune.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clone_game_files() -> None: logging.info("cloning game files") for turn in CONFIG.data.simulation_turns: if os.path.exists(CONFIG.data.simulation_path(turn)): logging.info("previous simulation files detected. removing old files.") shutil.rmtree(CONFIG.data.simu...
code_fim
medium
{ "lang": "python", "repo": "pfassina/BattleFortune", "path": "/src/battlefortune.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: self: An instance of the class position: The position integer Returns: list: The list all the digits in the position.] ''' return [int(d) for d in str(n)] def sum_positions(self,x_position, y_position): ''' Ret...
code_fim
hard
{ "lang": "python", "repo": "kilonzi/calm", "path": "/src/robot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kilonzi/calm path: /src/robot.py class Robot: ''' Implement the EMP Mines on Grid avoiding Robot ''' def __init__(self,condition) ->int: if isinstance(condition, int): self.condition = condition else: raise ValueError('Condition should be an In...
code_fim
hard
{ "lang": "python", "repo": "kilonzi/calm", "path": "/src/robot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def split_digits(self,n) -> list: ''' Returns the list of individual digits of the positions Args: self: An instance of the class position: The position integer Returns: list: The list all the digits in the position.] ''' ...
code_fim
hard
{ "lang": "python", "repo": "kilonzi/calm", "path": "/src/robot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) latitude = models.DecimalField( max_digits=10, decimal_places=6, default=0, )<|fim_prefix|># repo: yuriymironov96/traffic-optimizer path: /server/traffic_optimizer/locations/models.py from django.db import models class Location(models.Model): name = models.CharFiel...
code_fim
medium
{ "lang": "python", "repo": "yuriymironov96/traffic-optimizer", "path": "/server/traffic_optimizer/locations/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuriymironov96/traffic-optimizer path: /server/traffic_optimizer/locations/models.py from django.db import models class Location(models.Model): name = models.CharField( max_length=6<|fim_suffix|>) latitude = models.DecimalField( max_digits=10, decimal_places=6, ...
code_fim
hard
{ "lang": "python", "repo": "yuriymironov96/traffic-optimizer", "path": "/server/traffic_optimizer/locations/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mesoscale-activity-map/map-ephys path: /pipeline/fixes/fix_0015_undo_amp_scaling_fix.py #! /usr/bin/env python import logging import datajoint as dj import pathlib from tqdm import tqdm from datetime import datetime from pipeline import ephys, report from pipeline.fixes import schema, FixHisto...
code_fim
hard
{ "lang": "python", "repo": "mesoscale-activity-map/map-ephys", "path": "/pipeline/fixes/fix_0015_undo_amp_scaling_fix.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> amp_scale = 1 / 3.01 units2fix = ephys.Unit & FixedAmpUnit # only fix those units that underwent fix_0007 units2fix = units2fix - (UndoFixedAmpUnit & 'fixed=1') # exclude those that were already fixed if not units2fix: return # safety check, no jrclust results and no npx 1...
code_fim
hard
{ "lang": "python", "repo": "mesoscale-activity-map/map-ephys", "path": "/pipeline/fixes/fix_0015_undo_amp_scaling_fix.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # safety check, no jrclust results and no npx 1.0 assert len(units2fix & 'clustering_method LIKE "jrclust%"') == 0 assert len(units2fix.proj() * ephys.ProbeInsertion & 'probe_type LIKE "neuropixels 1.0%"') == 0 fix_hist_key = {'fix_name': pathlib.Path(__file__).name, '...
code_fim
hard
{ "lang": "python", "repo": "mesoscale-activity-map/map-ephys", "path": "/pipeline/fixes/fix_0015_undo_amp_scaling_fix.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: renehorstmann/Visu path: /python/example_visuwidget.py import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk from typing import Optional import visu as vu import numpy as np visu: Optional[vu.visubase.Visu] = None points: Optional[vu.object.RenderObject] = None visuwidg...
code_fim
hard
{ "lang": "python", "repo": "renehorstmann/Visu", "path": "/python/example_visuwidget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def render(visu: vu.visubase.Visu, data): visu.mode3D() points.render() if __name__ == '__main__': print('Start') ortho = True visu = vu.visubase.Visu(ortho, render, None) add_object() # gtk_init is called during import window = create_window() window.connect("des...
code_fim
hard
{ "lang": "python", "repo": "renehorstmann/Visu", "path": "/python/example_visuwidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sejsel/GW2Bot path: /migrate.py # Run this from the folder of old bot import time import json from pymongo import MongoClient start = time.time() client = MongoClient() old = client.gw2 new = client.toothy def update_keys(): for key in old.keys.find(): updated = { "_id"...
code_fim
hard
{ "lang": "python", "repo": "Sejsel/GW2Bot", "path": "/migrate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update_guilds(): with open("data/red/settings.json", encoding="utf-8", mode="r") as f: data = json.load(f) for guild in old.settings.find(): updates_channel = guild.get("channel") updates_channel = int(updates_channel) if updates_channel else None daily_updat...
code_fim
hard
{ "lang": "python", "repo": "Sejsel/GW2Bot", "path": "/migrate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jwesleye/system_checks path: /test_tensor.py import tensorflow as tf def test_torch_version(): <|fim_suffix|> assert len(tf.config.list_physical_devices('GPU')) != 0<|fim_middle|> assert tf.__version__ >= '2.9pip.0' def test_gpu():
code_fim
easy
{ "lang": "python", "repo": "jwesleye/system_checks", "path": "/test_tensor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert tf.__version__ >= '2.9pip.0' def test_gpu(): assert len(tf.config.list_physical_devices('GPU')) != 0<|fim_prefix|># repo: jwesleye/system_checks path: /test_tensor.py import tensorflow as tf <|fim_middle|>def test_torch_version():
code_fim
easy
{ "lang": "python", "repo": "jwesleye/system_checks", "path": "/test_tensor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(tf.config.list_physical_devices('GPU')) != 0<|fim_prefix|># repo: jwesleye/system_checks path: /test_tensor.py import tensorflow as tf def test_torch_version(): <|fim_middle|> assert tf.__version__ >= '2.9pip.0' def test_gpu():
code_fim
easy
{ "lang": "python", "repo": "jwesleye/system_checks", "path": "/test_tensor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(inputs) == len(self.in_channels) C4_lat = F.relu(self.conv4(inputs[-2])) C5_lat = F.relu(self.conv5(inputs[-1])) C5_lat = F.interpolate(C5_lat, scale_factor=2, mode="nearest") avg_pool = self.avg_pool(inputs[-1]) Cglb_lat = F.relu(self.convlast(a...
code_fim
hard
{ "lang": "python", "repo": "TonojiKiobya/thundernet_mmdetection", "path": "/mmdet/models/necks/cem.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: TonojiKiobya/thundernet_mmdetection path: /mmdet/models/necks/cem.py import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import xavier_init from mmdet.core import auto_fp16 from ..builder import NECKS @NECKS.register_module class CEM(nn.Module): def __init__(self, ...
code_fim
medium
{ "lang": "python", "repo": "TonojiKiobya/thundernet_mmdetection", "path": "/mmdet/models/necks/cem.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }