text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> return self.ip_request("metro_code") def page_view(r, *args): # Analytics info = IPInfo(get_client_ip(r)) try: if r.user.is_authenticated: new_connection = UserClientConnection( ip=get_client_ip(r), ...
code_fim
hard
{ "lang": "python", "repo": "SmithJesko/volny-films", "path": "/analytics/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tyc1922/seq2annotation path: /blackbox_tests/test_keras_train/serve_model_from_h5.py from seq2annotation.server.tensorflow_keras_h5_inference import Infe<|fim_suffix|>kup_table.json') result = inference.infer("看一下上海的天气。") print(result)<|fim_middle|>rence inference = Inference('./results/h5_mode...
code_fim
medium
{ "lang": "python", "repo": "tyc1922/seq2annotation", "path": "/blackbox_tests/test_keras_train/serve_model_from_h5.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>kup_table.json') result = inference.infer("看一下上海的天气。") print(result)<|fim_prefix|># repo: tyc1922/seq2annotation path: /blackbox_tests/test_keras_train/serve_model_from_h5.py from seq2annotation.server.tensorflow_keras_h5_inference import Inference inference = Inference('./results/h5_model/model.h5', '...
code_fim
medium
{ "lang": "python", "repo": "tyc1922/seq2annotation", "path": "/blackbox_tests/test_keras_train/serve_model_from_h5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kksuresh25/Cancer-AI path: /Logistic Regression/log_tunehyperparameters.py #import libraries from sklearn.model_selection import GridSearchCV, StratifiedShuffleSplit, train_test_split import numpy as np import matplotlib.pyplot as plt from imblearn.over_sampling import SMOTE from svm_constructdat...
code_fim
hard
{ "lang": "python", "repo": "kksuresh25/Cancer-AI", "path": "/Logistic Regression/log_tunehyperparameters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for score in scores: print() print("# Tuning hyper-parameters for %s" % score) print() clf = GridSearchCV(LogisticRegression(), tuned_parameters, cv=5, scoring= score) clf.fit(x_train_res,y_train_res) print("Best parameters set found on development set:") ...
code_fim
hard
{ "lang": "python", "repo": "kksuresh25/Cancer-AI", "path": "/Logistic Regression/log_tunehyperparameters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Find and output results for best parameters based on scoring metric #Other metrics: 'accuracy','recall','precision','f1' scores = ['roc_auc'] for score in scores: print() print("# Tuning hyper-parameters for %s" % score) print() clf = GridSearchCV(LogisticRegression(), tuned_parameters, ...
code_fim
hard
{ "lang": "python", "repo": "kksuresh25/Cancer-AI", "path": "/Logistic Regression/log_tunehyperparameters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getitem__(self, item): return self._dependencies_[item] def update(self, dep_env_info, pkg_name): self._dependencies_[pkg_name] = dep_env_info def merge_lists(seq1, seq2): return [s for s in seq1 if s not in seq2] + seq2 # With vars if its set t...
code_fim
hard
{ "lang": "python", "repo": "lasote/conan", "path": "/conans/model/env_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DepsEnvInfo(EnvInfo): """ All the env info for a conanfile dependencies """ def __init__(self): super(DepsEnvInfo, self).__init__() self._dependencies_ = OrderedDict() @property def dependencies(self): return self._dependencies_.items() @property ...
code_fim
hard
{ "lang": "python", "repo": "lasote/conan", "path": "/conans/model/env_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lasote/conan path: /conans/model/env_info.py import copy import re from collections import OrderedDict, defaultdict from conans.errors import ConanException from conans.util.log import logger def unquote(text): text = text.strip() if len(text) > 1 and (text[0] == text[-1]) and text[0] ...
code_fim
hard
{ "lang": "python", "repo": "lasote/conan", "path": "/conans/model/env_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gocardless/gocardless-pro-python path: /tests/integration/payout_items_integration_test.py # WARNING: Do not edit by hand, this file was generated by Crank: # # https://github.com/gocardless/crank # import json import requests import responses from nose.tools import ( assert_equal, assert...
code_fim
hard
{ "lang": "python", "repo": "gocardless/gocardless-pro-python", "path": "/tests/integration/payout_items_integration_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_502_payout_items_list_retries(): fixture = helpers.load_fixture('payout_items')['list'] with helpers.stub_502_then_response(fixture) as rsps: response = helpers.client.payout_items.list(*fixture['url_params']) assert_equal(2, len(rsps.calls)) assert_equal(rsps.calls[0].r...
code_fim
hard
{ "lang": "python", "repo": "gocardless/gocardless-pro-python", "path": "/tests/integration/payout_items_integration_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pauvrepetit/leetcode path: /others/剑指 Offer/45/main.py from typing import List class Solution: <|fim_suffix|> length = 0 str_nums = [] for num in nums: str_nums.append(str(num)) length = max(length, len(str(num))) str_nums.sort(key=lambda x ...
code_fim
easy
{ "lang": "python", "repo": "pauvrepetit/leetcode", "path": "/others/剑指 Offer/45/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> length = 0 str_nums = [] for num in nums: str_nums.append(str(num)) length = max(length, len(str(num))) str_nums.sort(key=lambda x : [x + x + x[0] * (length - len(x))]) res = "" for s in str_nums: res += s return r...
code_fim
easy
{ "lang": "python", "repo": "pauvrepetit/leetcode", "path": "/others/剑指 Offer/45/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AKuederle/python-WoLo path: /tests/example_objects.py import wolo.log as log import wolo.task as task import wolo.parameters as parameters def test_func(x): return "this is a test" example_log = [] example_log.append(log.TaskLog(index=[0], task_class="0", last_run_success=True)) sublog1 = [...
code_fim
medium
{ "lang": "python", "repo": "AKuederle/python-WoLo", "path": "/tests/example_objects.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def input(self): test_input = parameters.Parameter("test_input", self.args[0]) return test_input def run(self): return "test_report" def output(self): test_output = parameters.Parameter("test_output", self.kwargs["kwarg"]) return test_output<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "AKuederle/python-WoLo", "path": "/tests/example_objects.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): linked_list = LinkedList(None, None) while True: name = input(f'Name of patient ({EXIT} to quit): ') if name == EXIT: break priority = int(input('Priority: ')) if linked_list.value is None: linked_list.value = (name, priority) else: if linked_list.value[1] > priority: ...
code_fim
medium
{ "lang": "python", "repo": "hsiaohan416/stancode", "path": "/SC_projects/tree_and_linked_list/priority_queue_linked_list.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsiaohan416/stancode path: /SC_projects/tree_and_linked_list/priority_queue_linked_list.py """ File: priority_queue.py Name: Sharon -------------------------- This file shows how to construct a linked list from scratch and use it to implement a priority queue. """ <|fim_suffix|> self.value = ...
code_fim
medium
{ "lang": "python", "repo": "hsiaohan416/stancode", "path": "/SC_projects/tree_and_linked_list/priority_queue_linked_list.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sourceDir = os.path.abspath('../txt') dicodir = os.path.abspath('../dico/fr') print("loading dico") wordList = set([x.strip() for x in open(dicodir + "/fr.dic", "r", encoding="utf-16")]) print("dico loaded") print(len(wordList)) filenames = glob.glob(sourceDir + "/*.txt") filenames.sort(key=lambda x:in...
code_fim
hard
{ "lang": "python", "repo": "stonecauldron/monetschuman", "path": "/code/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stonecauldron/monetschuman path: /code/process.py import glob import os import re from collections import deque import dateparser # $ pip import dateparser headerReg = r"[0-9]+\. (.+) de (.+) à (.+)" class Text: def __init__(self, id, header, content): self.id = id contentLin...
code_fim
hard
{ "lang": "python", "repo": "stonecauldron/monetschuman", "path": "/code/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("loading dico") wordList = set([x.strip() for x in open(dicodir + "/fr.dic", "r", encoding="utf-16")]) print("dico loaded") print(len(wordList)) filenames = glob.glob(sourceDir + "/*.txt") filenames.sort(key=lambda x:int(os.path.basename(x).split('.')[0])) data =[''.join([line for line in open(fnam...
code_fim
hard
{ "lang": "python", "repo": "stonecauldron/monetschuman", "path": "/code/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cryptomental/py-evm path: /eth/beacon/state_machines/configs.py from typing import ( NamedTuple, ) BeaconConfig = NamedTuple( 'BeaconConfig', ( (<|fim_suffix|> ('CYCLE_LENGTH', int), ('MIN_COMMITTEE_SIZE', int), ('MIN_DYNASTY_LENGTH', int), ('SHARD_...
code_fim
medium
{ "lang": "python", "repo": "cryptomental/py-evm", "path": "/eth/beacon/state_machines/configs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ('SHARD_COUNT', int), ('SLOT_DURATION', int), ('SQRT_E_DROP_TIME', int), ) )<|fim_prefix|># repo: cryptomental/py-evm path: /eth/beacon/state_machines/configs.py from typing import ( NamedTuple, ) BeaconConfig = NamedTuple( 'BeaconConfig', ( ('BASE_REWARD_Q...
code_fim
medium
{ "lang": "python", "repo": "cryptomental/py-evm", "path": "/eth/beacon/state_machines/configs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bopopescu/google-cloud-sdk path: /.install/.backup/platform/gsutil/gslib/tests/test_stat.py # -*- coding: utf-8 -*- # # Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lic...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/google-cloud-sdk", "path": "/.install/.backup/platform/gsutil/gslib/tests/test_stat.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> object_uri = self.CreateObject(contents='z') stdout = self.RunGsUtil(['stat', suri(object_uri)], return_stdout=True) self.assertIn(object_uri.uri, stdout) self.assertIn('Creation time:', stdout) self.assertIn('Cache-Control:', stdout) self.assertIn('Content-Encoding:', stdout) ...
code_fim
medium
{ "lang": "python", "repo": "bopopescu/google-cloud-sdk", "path": "/.install/.backup/platform/gsutil/gslib/tests/test_stat.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: beardedfoo/scrappy-serverless path: /server.py # pylint: disable=invalid-name,unused-import,missing-docstring,wrong-import-order,line-too-long,trailing-whitespace """A basic FaaS in Python""" from __future__ import print_function from flask import Flask, Response, request from redis import Redis ...
code_fim
hard
{ "lang": "python", "repo": "beardedfoo/scrappy-serverless", "path": "/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app = Flask(__name__) # Connect to redis & test connection redis_conn = Redis('redis') redis_conn.info() @app.route('/healthz') def healthz(): """Reports service health""" return "OK\n" # PLAN: Show list of runnable functions @ / @app.route('/') def index(): """Serves the home page""" r...
code_fim
hard
{ "lang": "python", "repo": "beardedfoo/scrappy-serverless", "path": "/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # define the fields for your item here like: # name = scrapy.Field() id = scrapy.Field() name = scrapy.Field() # Name in url, removed invalid chars for file name limitation. displayName = scrapy.Field() # Original name user input. url = scrapy.Field() author = scrapy.Field() ...
code_fim
medium
{ "lang": "python", "repo": "jarvisji/ScrapyCrawler", "path": "/CrawlWorker/items.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class FeedItem(scrapy.Item): url = scrapy.Field() updatedTime = scrapy.Field()<|fim_prefix|># repo: jarvisji/ScrapyCrawler path: /CrawlWorker/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items...
code_fim
hard
{ "lang": "python", "repo": "jarvisji/ScrapyCrawler", "path": "/CrawlWorker/items.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jarvisji/ScrapyCrawler path: /CrawlWorker/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy <|fim_suffix|> # define the fields for your item here like: # name = sc...
code_fim
medium
{ "lang": "python", "repo": "jarvisji/ScrapyCrawler", "path": "/CrawlWorker/items.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rafhaelom/Python path: /PythonBrasil/EstruturaSequencial/10.py # 10. Faça um Programa que peça a temperatura em graus Celsi<|fim_suffix|>oat(input("Digite a temperatura em Celsius: ")) print("A temperatura em Fahrenheit eh: ", (1.8 * temCelsius) + 32, "ºF")<|fim_middle|>us, transforme e mostre e...
code_fim
medium
{ "lang": "python", "repo": "rafhaelom/Python", "path": "/PythonBrasil/EstruturaSequencial/10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>oat(input("Digite a temperatura em Celsius: ")) print("A temperatura em Fahrenheit eh: ", (1.8 * temCelsius) + 32, "ºF")<|fim_prefix|># repo: rafhaelom/Python path: /PythonBrasil/EstruturaSequencial/10.py # 10. Faça um Programa que peça a temperatura em graus Celsi<|fim_middle|>us, transforme e mostre e...
code_fim
medium
{ "lang": "python", "repo": "rafhaelom/Python", "path": "/PythonBrasil/EstruturaSequencial/10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # method response = client.get('/get-only1/') r = APIResult(response) assert r.error == None response = client.get('/get-only2/') r = APIResult(response) assert r.error == None response = client.post('/get-only2/') assert response.status_code == 405 # not allowed ...
code_fim
hard
{ "lang": "python", "repo": "randydu/django-urlman", "path": "/tests/test_urlman.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: randydu/django-urlman path: /tests/test_urlman.py from django_urlman.urlman import _geturl, _APIWrapper, mount, module_path, APIResult, get_wrapper, _dump_urls from django_urlman.decorators import api, url, HEAD, GET, POST, PUT, PATCH, DELETE, READ, WRITE from django_urlman.marker import mark fr...
code_fim
hard
{ "lang": "python", "repo": "randydu/django-urlman", "path": "/tests/test_urlman.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client.cookies['a'] = 5 response = client.post('/t1/') # from cookie assert response.status_code == 200 r = APIResult(response) assert r.error == None assert r.result == 5 if False: #todo: setup testing env properly client.cookies.pop('a') client.session['a'] =...
code_fim
hard
{ "lang": "python", "repo": "randydu/django-urlman", "path": "/tests/test_urlman.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for key in envkeys: print(key + (maxlen - len(key)) * " " + ": " + os.environ[key]) print(80 * "-") # import all tests from .core import * from .ops import *<|fim_prefix|># repo: riga/tfdeploy path: /tests/__init__.py # -*- coding: utf-8 -*- # some logs import os import sys import numpy as n...
code_fim
hard
{ "lang": "python", "repo": "riga/tfdeploy", "path": "/tests/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: riga/tfdeploy path: /tests/__init__.py # -*- coding: utf-8 -*- # some logs import os import sys import numpy as np import tensorflow as tf print(80 * "-") print("python : " + sys.version.split(" ")[0]) print("tensorflow: " + tf.__version__) print("numpy : " + np.version.version) try: ...
code_fim
medium
{ "lang": "python", "repo": "riga/tfdeploy", "path": "/tests/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def all_results(slug: str, record_id: int, expanded: bool = False) -> List[ComparisonObject]: """ Computes the Pearson correlation between the current user and all other users who have filled out this form. Arguments --------- slug -- The slug to...
code_fim
hard
{ "lang": "python", "repo": "parthsarin/personality-quiz", "path": "/personality-quiz/quiz_api/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> record_id: int, expanded: bool = False) -> List[ComparisonObject]: """ Computes the Pearson correlation between the current user and all other users who have filled out this form. Arguments --------- slug -- The slug to identify the quiz. recor...
code_fim
hard
{ "lang": "python", "repo": "parthsarin/personality-quiz", "path": "/personality-quiz/quiz_api/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: parthsarin/personality-quiz path: /personality-quiz/quiz_api/process.py """ File: process.py ---------------- Processes the results from the quiz. """ from .db import get_num_submissions, get_submission_for_form from typing import Collection, Tuple, TypedDict, Union, List from numbers import Num...
code_fim
hard
{ "lang": "python", "repo": "parthsarin/personality-quiz", "path": "/personality-quiz/quiz_api/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ori = p.getQuaternionFromEuler(np.array(p.getEulerFromQuaternion(ORI)) + np.array([-180,0,0])) p.changeConstraint(pr2_cid, POS, ori, maxForce=500) p.setJointMotorControl2(pr2_gripper, 0, controlMode=p.POSITION_CONTROL,targetPosition=gripper_max_joint - GRIPPER * gripper_max_joint,force=1....
code_fim
hard
{ "lang": "python", "repo": "wx-b/learning_from_play", "path": "/data_collection/pybullet_GUI_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: if USE_VR: global POS global ORI global GRIPPER events = p.getVREvents() e = events[0] POS = list(e[POSITION]) ORI = list(e[ORIENTATION]) GRIPPER = e[ANALOG] print(p.getEulerFromQua...
code_fim
hard
{ "lang": "python", "repo": "wx-b/learning_from_play", "path": "/data_collection/pybullet_GUI_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wx-b/learning_from_play path: /data_collection/pybullet_GUI_server.py #import os #os.system(r'"C:\Users\sholt\Desktop\bullet3\bin\App_PhysicsServer_SharedMemory_VR_vs2010_x64_release.exe"') USE_VR = None import socket import pybullet as p import time import pybullet_data import numpy as np from...
code_fim
hard
{ "lang": "python", "repo": "wx-b/learning_from_play", "path": "/data_collection/pybullet_GUI_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cadurosar/laplacian_networks path: /cifar_10/read_results.py import pandas as pd import argparse import matplotlib.pyplot as plt def read_clean(args): df = pd.read_pickle("test_results/fgsm.pkl") df = df.drop(["k", "m", "seed", "snr", "accuracy_before_norm", "mean_eps...
code_fim
hard
{ "lang": "python", "repo": "cadurosar/laplacian_networks", "path": "/cifar_10/read_results.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): all_results = ["clean", "fgsm", "gaussian", "dropout", "pgd", "deepfool", "quantized", "all"] parser = argparse.ArgumentParser(description='Read Training results') parser.add_argument( '--result', choices=all_results, default='all', help='which ...
code_fim
hard
{ "lang": "python", "repo": "cadurosar/laplacian_networks", "path": "/cifar_10/read_results.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIsNone(sum_fracts([[0, 2], [0, 2]]))<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu_6_tests/test_irreducible_sum_of_rationals.py import unittest from katas.kyu_6.irreducible_sum_of_rationals import sum_fracts class SumOfRationalsTestCase(unittest.TestCase): def test_equ...
code_fim
easy
{ "lang": "python", "repo": "mveselov/CodeWars", "path": "/tests/kyu_6_tests/test_irreducible_sum_of_rationals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_equal_1(self): self.assertEqual(sum_fracts([[1, 2], [1, 3], [1, 4]]), [13, 12]) def test_equal_2(self): self.assertEqual(sum_fracts([[1, 3], [5, 3]]), 2) def test_is_none_1(self): self.assertIsNone(sum_fracts([[0, 2], [0, 2]]))<|fim_prefix|># repo: mveselov/C...
code_fim
easy
{ "lang": "python", "repo": "mveselov/CodeWars", "path": "/tests/kyu_6_tests/test_irreducible_sum_of_rationals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mveselov/CodeWars path: /tests/kyu_6_tests/test_irreducible_sum_of_rationals.py import unittest from katas.kyu_6.irreducible_sum_of_rationals import sum_fracts <|fim_suffix|> def test_equal_2(self): self.assertEqual(sum_fracts([[1, 3], [5, 3]]), 2) def test_is_none_1(self): ...
code_fim
medium
{ "lang": "python", "repo": "mveselov/CodeWars", "path": "/tests/kyu_6_tests/test_irreducible_sum_of_rationals.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = ark_blockchain.MemAccounts2Delegates filter_fields = { 'accountid': ['exact'], 'dependentid': ['exact'] } interfaces = (relay.Node,) class BlocksType(DjangoObjectType): rowid = graphene.Field(BigInt) timestamp = grap...
code_fim
hard
{ "lang": "python", "repo": "BlockHub/django-ark", "path": "/ark/types.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BlockHub/django-ark path: /ark/types.py from graphene import relay import graphene from graphene_django import DjangoObjectType import ark.models as ark_blockchain from graphene_django.converter import convert_django_field from django.db import models from ark.converter import BigInt, Binary @c...
code_fim
hard
{ "lang": "python", "repo": "BlockHub/django-ark", "path": "/ark/types.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Unable to communicate with server.""" class HTTPException(Exception): """Base exception for all HTTP-derived exceptions.""" code = 'N/A' def __init__(self, details=None): self.details = details or self.__class__.__name__ def __str__(self): return "%s (HTTP %s)" %...
code_fim
medium
{ "lang": "python", "repo": "kickstandproject/sarlacc", "path": "/sarlacc/common/exception.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kickstandproject/sarlacc path: /sarlacc/common/exception.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC. # Copyright (C) 2013 PolyBeacon, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file exc...
code_fim
medium
{ "lang": "python", "repo": "kickstandproject/sarlacc", "path": "/sarlacc/common/exception.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc051-abc100/abc071/a.py '''input 1 999 1000 A 5 2 7 B ''' # -*- coding: utf-8 -*- <|fim_suffix|>if __name__ == '__main__': x, a, b = list(map(int, input().split())) if abs(x - a) < abs(x - b): print('A') else: print('B')...
code_fim
easy
{ "lang": "python", "repo": "KATO-Hiro/AtCoder", "path": "/ABC/abc051-abc100/abc071/a.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': x, a, b = list(map(int, input().split())) if abs(x - a) < abs(x - b): print('A') else: print('B')<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc051-abc100/abc071/a.py '''input 1 999 1000 A 5 2 7 B ''' # -*- coding: utf-8 -*- ...
code_fim
easy
{ "lang": "python", "repo": "KATO-Hiro/AtCoder", "path": "/ABC/abc051-abc100/abc071/a.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> '''Returns the coordinates of the chunk containing the block at the given coords. Does not guarantee that the chunk exists, just that that block would mathematically be there.''' x, y = p return (x//Const.CHUNK_SIZE, y//Const.CHUNK_SIZE) @staticmethod def chunksToBlocks(p...
code_fim
hard
{ "lang": "python", "repo": "ultrasans540/clonaria", "path": "/clonaria/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Returns a list of block coordinates to be used for physics calculations based on those nearest to entities.''' blocks = [] for entity in entities: #blocks.append(Util.getClosestSolidBlock(entity.body.velocity.normalized(), entity.world, entity.body.position)) ...
code_fim
hard
{ "lang": "python", "repo": "ultrasans540/clonaria", "path": "/clonaria/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ultrasans540/clonaria path: /clonaria/util.py if (ix-x)**2 + (iy-y)**2 < r**2: blocks.append((ix, iy)) return blocks @staticmethod def line(p1, p2): ''' Returns a list of all block coordinates between the two points, inclusive, using Brensenha...
code_fim
hard
{ "lang": "python", "repo": "ultrasans540/clonaria", "path": "/clonaria/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: astral-sh/ruff path: /scripts/check_ecosystem.py e logger = logging.getLogger(__name__) class Repository(NamedTuple): """A GitHub repository at a specific ref.""" org: str repo: str ref: str | None select: str = "" ignore: str = "" exclude: str = "" # Generatin...
code_fim
hard
{ "lang": "python", "repo": "astral-sh/ruff", "path": "/scripts/check_ecosystem.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> async def limited_parallelism(coroutine: T) -> T: async with semaphore: return await coroutine results = await asyncio.gather( *[ limited_parallelism(compare(ruff1, ruff2, repo, checkouts)) for repo in repositories.values() ], re...
code_fim
hard
{ "lang": "python", "repo": "astral-sh/ruff", "path": "/scripts/check_ecosystem.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: astral-sh/ruff path: /scripts/check_ecosystem.py /usr/bin/env python3 """Check two versions of ruff against a corpus of open-source code. Example usage: scripts/check_ecosystem.py <path/to/ruff1> <path/to/ruff2> """ from __future__ import annotations import argparse import asyncio import d...
code_fim
hard
{ "lang": "python", "repo": "astral-sh/ruff", "path": "/scripts/check_ecosystem.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: justinharringa/aprendendo-python path: /exercicios/pietra/13-52-aula 13 p desafio 52.py numero = int(input('digite um numero : ')) if nu<|fim_suffix|> #eu não estou conseguindo fazer de jeito nenhum<|fim_middle|>mero % 1 == 6 : print('ele não é um numero primo') else: print('ele é um...
code_fim
medium
{ "lang": "python", "repo": "justinharringa/aprendendo-python", "path": "/exercicios/pietra/13-52-aula 13 p desafio 52.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rimo') else: print('ele é um numero primo') #eu não estou conseguindo fazer de jeito nenhum<|fim_prefix|># repo: justinharringa/aprendendo-python path: /exercicios/pietra/13-52-aula 13 p desafio 52.py numero = int(input('digite um numero : ')) if nu<|fim_middle|>mero % 1 == 6 : print('ele nã...
code_fim
easy
{ "lang": "python", "repo": "justinharringa/aprendendo-python", "path": "/exercicios/pietra/13-52-aula 13 p desafio 52.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #eu não estou conseguindo fazer de jeito nenhum<|fim_prefix|># repo: justinharringa/aprendendo-python path: /exercicios/pietra/13-52-aula 13 p desafio 52.py numero = int(input('digite um numero : ')) if nu<|fim_middle|>mero % 1 == 6 : print('ele não é um numero primo') else: print('ele é um...
code_fim
medium
{ "lang": "python", "repo": "justinharringa/aprendendo-python", "path": "/exercicios/pietra/13-52-aula 13 p desafio 52.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MSLacerda/serenata-de-amor path: /jarbas/chamber_of_deputies/tests/test_tweets_command.py from collections import namedtuple from itertools import permutations from unittest.mock import MagicMock, PropertyMock, patch from django.test import TestCase from mixer.backend.django import mixer from j...
code_fim
hard
{ "lang": "python", "repo": "MSLacerda/serenata-de-amor", "path": "/jarbas/chamber_of_deputies/tests/test_tweets_command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @patch('jarbas.chamber_of_deputies.management.commands.tweets.twitter.Api') def test_tweets_with_clean_database(self, api): api.return_value.GetUserTimeline.return_value = range(3) with self.settings(**self.credentials): command = Command() self.assertEqual((0,...
code_fim
hard
{ "lang": "python", "repo": "MSLacerda/serenata-de-amor", "path": "/jarbas/chamber_of_deputies/tests/test_tweets_command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_save_duplicated_tweet(self): status = 9999999999999999999999999 reimbursement = mixer.blend(Reimbursement, search_vector=None) tweet = mixer.blend(Tweet, status=status, reimbursement=reimbursement) command = Command() command.log = MagicMock() c...
code_fim
hard
{ "lang": "python", "repo": "MSLacerda/serenata-de-amor", "path": "/jarbas/chamber_of_deputies/tests/test_tweets_command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>kpoint from .logger import TxtLogger, StdoutLogger<|fim_prefix|># repo: angeloskath/pytorch-boilerplate path: /pbp/callbacks/__init__.py """Define and implement the callback interface.""<|fim_middle|>" from .base import Callback, CallbackList, CallbackListFactory from .checkpoint import ModelChec
code_fim
medium
{ "lang": "python", "repo": "angeloskath/pytorch-boilerplate", "path": "/pbp/callbacks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: angeloskath/pytorch-boilerplate path: /pbp/callbacks/__init__.py """Define and implement the callback interface.""<|fim_suffix|>backListFactory from .checkpoint import ModelCheckpoint from .logger import TxtLogger, StdoutLogger<|fim_middle|>" from .base import Callback, CallbackList, Call
code_fim
easy
{ "lang": "python", "repo": "angeloskath/pytorch-boilerplate", "path": "/pbp/callbacks/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_time_feat(self): values_list = [] span = [] # function tag TMP(constituency tree) if self.tmp_function_tag_of_verb: for node in self.tmp_function_tag_of_verb: node_min_span, node_max_span = node.get_tree_span() span ...
code_fim
hard
{ "lang": "python", "repo": "UKPLab/props-de", "path": "/propsde/proposition_structure/syntactic_item.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># if self.prefix == VERBAL_PREDICATE_FEATURE_FUNCTION_PREFIX: # self.set_time_feat() # self.set_tense_feat() def set_tense_feat(self): if self.feats["Tense"]["Span"]: return value = "" if self.time_ann_of_verb: for ta in ...
code_fim
hard
{ "lang": "python", "repo": "UKPLab/props-de", "path": "/propsde/proposition_structure/syntactic_item.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UKPLab/props-de path: /propsde/proposition_structure/syntactic_item.py import inspect from propsde.dependency_tree.tree import DepTree import sys import datetime # class to represent a predicate, calculate and store its features # a prefix by with to identify feature extracting function in the ...
code_fim
hard
{ "lang": "python", "repo": "UKPLab/props-de", "path": "/propsde/proposition_structure/syntactic_item.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matheusnalmeida/GraphModels path: /GraphModels/Util/util.py from __future__ import annotations import sys from typing import TYPE_CHECKING from GraphModels.Graph.aresta import Aresta from GraphModels.Buscas.caminho import Caminho from GraphModels.Buscas.fronteira import Fronteira if TYPE_CHECKI...
code_fim
hard
{ "lang": "python", "repo": "matheusnalmeida/GraphModels", "path": "/GraphModels/Util/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not caminho: return "Nao existe caminho entre os vertices {0} e {1}\nCaso exista um caminho, não foi possivel encontralo devido a possiveis valores invalidos de heuristica".format(str(verticeInicio),str(verticeFim)) else: return "O caminho de menor distancia entr...
code_fim
hard
{ "lang": "python", "repo": "matheusnalmeida/GraphModels", "path": "/GraphModels/Util/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rostyq/brspy path: /reader/utils.py from cv2 import imread from json import load from bson import loads def read_pic(path, **kwargs): <|fim_suffix|> def read_txt(path): with open(path, 'r') as f: return load(f) def read_dat(path): with open(path, 'rb') as f: ...
code_fim
easy
{ "lang": "python", "repo": "rostyq/brspy", "path": "/reader/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(path, 'rb') as f: return loads(f.read())<|fim_prefix|># repo: rostyq/brspy path: /reader/utils.py from cv2 import imread from json import load from bson import loads def read_pic(path, **kwargs): return imread(path, -1, **kwargs) def read_txt(path): with open(...
code_fim
easy
{ "lang": "python", "repo": "rostyq/brspy", "path": "/reader/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KesavanKing/test-infra path: /scenarios/kubernetes_heapster.py #!/usr/bin/env python # Copyright 2017 The Kubernetes Authors. # # 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 Lice...
code_fim
hard
{ "lang": "python", "repo": "KesavanKing/test-infra", "path": "/scenarios/kubernetes_heapster.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> public = '%s.pub' % private service = '/service-account.json' temp = tempfile.mkdtemp(prefix='heapster-') try: check( 'docker', 'run', '--rm=true', '-v', '/etc/localtime:/etc/localtime:ro', '-v', '/var/run/docker.sock:/var/run/docker.sock', ...
code_fim
hard
{ "lang": "python", "repo": "KesavanKing/test-infra", "path": "/scenarios/kubernetes_heapster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open(FILE_PATH, mode='rb') as file: # b is important -> binary tbl = Table(file.read()) assert tbl.size() == 9994 v = tbl.view() df = v.to_df() assert df.shape == (9994, 21)<|fim_prefix|># repo: amitnyc83/perspective path: /python/p...
code_fim
easy
{ "lang": "python", "repo": "amitnyc83/perspective", "path": "/python/perspective/perspective/tests/table/test_table_arrow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amitnyc83/perspective path: /python/perspective/perspective/tests/table/test_table_arrow.py from perspective.table import Table import os.path FILE_PATH = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "..", "examples", "simple", "superstore.arrow") <|fim_suffix|> def te...
code_fim
easy
{ "lang": "python", "repo": "amitnyc83/perspective", "path": "/python/perspective/perspective/tests/table/test_table_arrow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Help Message box def _msgBoxHelp(): msg.showinfo(Help.Title, Help.Message) # How to Message box def _msgBoxHT(): msg.showinfo(HT.Title, HT.Message) # Exit GUI cleanly def _quit(): window.quit() window.destroy() exit() # Add app to the GUI def _addApp(): addApp = tk.Toplevel() ...
code_fim
hard
{ "lang": "python", "repo": "BGameiro2000/Media_Organize", "path": "/GUI/MediaMenu.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BGameiro2000/Media_Organize path: /GUI/MediaMenu.py #!/usr/bin/env python3 """ This code is under Apache License 2.0 Written by B_Gameiro (Bernardo Bernardino Gameiro) More in SoloLearn: https://www.sololearn.com/Profile/8198571 GitHub: https://github.com/BGameiro76 Repl.it: https://repl.i...
code_fim
hard
{ "lang": "python", "repo": "BGameiro2000/Media_Organize", "path": "/GUI/MediaMenu.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class WXCategoryViewSet(CategoryModelViewSet): pass class WXServiceViewSet(ServiceViewSet): pass class WXSystemSettingsViewSet(SystemSettingsViewSet): pass class WXTaskViewSet(TaskViewSet): pass class WXTicketLogViewSet(EventLogViewSet): pass class WXPriorityMatrixViewSet(Pr...
code_fim
hard
{ "lang": "python", "repo": "TencentBlueKing/bk-itsm", "path": "/weixin/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class WXFieldViewSet(FieldViewSet): serializer_class = WXFieldSerializer class WXSysDictViewSet(SysDictViewSet): pass class WXCategoryViewSet(CategoryModelViewSet): pass class WXServiceViewSet(ServiceViewSet): pass class WXSystemSettingsViewSet(SystemSettingsViewSet): pass c...
code_fim
hard
{ "lang": "python", "repo": "TencentBlueKing/bk-itsm", "path": "/weixin/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TencentBlueKing/bk-itsm path: /weixin/views.py # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-ITSM 蓝鲸流程服务 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-ITSM 蓝鲸流程服务 is licensed under the MIT License. ...
code_fim
hard
{ "lang": "python", "repo": "TencentBlueKing/bk-itsm", "path": "/weixin/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matthewwardrop/formulaic path: /formulaic/transforms/identity.py from typing import Any <|fim_suffix|> """ Performs the identity/trivial transform of mapping data to itself. """ return data<|fim_middle|> def identity(data: Any) -> Any:
code_fim
easy
{ "lang": "python", "repo": "matthewwardrop/formulaic", "path": "/formulaic/transforms/identity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Performs the identity/trivial transform of mapping data to itself. """ return data<|fim_prefix|># repo: matthewwardrop/formulaic path: /formulaic/transforms/identity.py from typing import Any <|fim_middle|>def identity(data: Any) -> Any:
code_fim
easy
{ "lang": "python", "repo": "matthewwardrop/formulaic", "path": "/formulaic/transforms/identity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @action(detail=False, methods=['post']) def signup(self, request): """ User sign up """ serializer = UserSignUpSerializer(data=request.data) serializer.is_valid(raise_exception=True) user = serializer.save() data = UserModelSerializer(user).d...
code_fim
hard
{ "lang": "python", "repo": "kevinGarcia15/cinemaAPI", "path": "/cinema/users/views/users.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinGarcia15/cinemaAPI path: /cinema/users/views/users.py """Users views""" #django Rest Framework from rest_framework import status, viewsets from rest_framework.response import Response from rest_framework.decorators import action #serializers from cinema.users.serilizer import( User...
code_fim
medium
{ "lang": "python", "repo": "kevinGarcia15/cinemaAPI", "path": "/cinema/users/views/users.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> serializer = UserLoginSerializer(data=request.data) serializer.is_valid(raise_exception=True) user, token = serializer.save() data={ 'user': UserModelSerializer(user).data, 'access_token': token } return Response(data, status=status...
code_fim
hard
{ "lang": "python", "repo": "kevinGarcia15/cinemaAPI", "path": "/cinema/users/views/users.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WayneYann/Ligpy-Cantera path: /Ligscipy/ODE_scipy/solve_ODEs_T500_Pseudotsuga_menziesii.py -1*k_500_266 * RLIGM2A**1.0 * KETM2**1.0 -1*k_500_267 * RCH3**1.0 * KETM2**1.0 -1*k_500_268 * PRKETM2**1.0 * KETM2**1.0 -1*k_500_269 * RKET**1.0 * KETM2**1.0 -1*k_500_270 * PRADIO**1.0 * KETM2**1.0 -1*...
code_fim
hard
{ "lang": "python", "repo": "WayneYann/Ligpy-Cantera", "path": "/Ligscipy/ODE_scipy/solve_ODEs_T500_Pseudotsuga_menziesii.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> k_500_305 = 565.07955524 k_500_306 = 36650.6934391 k_500_307 = 565.07955524 k_500_308 = 565.07955524 k_500_309 = 8092.74573078 k_500_310 = 565.07955524 k_500_311 = 1786.93845375 k_500_312 = 4234.06962773 k_500_313 = 0.490727268768 k_500_314 = 341.544655951 k_500_315 = 341.544655951 k_500_316 = 36650.6934...
code_fim
hard
{ "lang": "python", "repo": "WayneYann/Ligpy-Cantera", "path": "/Ligscipy/ODE_scipy/solve_ODEs_T500_Pseudotsuga_menziesii.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>t = [stoptime * float(i) / (numpoints - 1) for i in range(numpoints)] y0 = [ADIO, ADIOM2, ALD3, C10H2, C10H2M2, C10H2M4, C2H6, C3H4O, C3H4O2, C3H6, C3H6O2, C3H8O2, CH2CO, CH3CHO, CH3OH, CH4, CHAR, CO, CO2, COUMARYL, ETOH, H2, H2O, KET, KETD, KETDM2, KETM2, LIG, LIGC, LIGH, LIGM2, LIGO, MGUAI, OH, PADIO, P...
code_fim
hard
{ "lang": "python", "repo": "WayneYann/Ligpy-Cantera", "path": "/Ligscipy/ODE_scipy/solve_ODEs_T500_Pseudotsuga_menziesii.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: stoned/py-junos-eznc path: /lib/jnpr/junos/factory/factory_cls.py # stdlib from copy import deepcopy # local from .cfgtable import CfgTable from .optable import OpTable from .table import Table from .view import View from .viewfields import ViewFields def FactoryCfgTable(table_name=None, dat...
code_fim
hard
{ "lang": "python", "repo": "stoned/py-junos-eznc", "path": "/lib/jnpr/junos/factory/factory_cls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> view_name = kvargs.get('view_name','RunstatView') new_cls = type(view_name, (View,), {}) if 'extends' in kvargs: base_cls = kvargs['extends'] new_cls.FIELDS = deepcopy(base_cls.FIELDS) new_cls.FIELDS.update(fields) if 'groups' in kvargs: new_cls.GROUPS = deepcopy(base_cls.GROU...
code_fim
hard
{ "lang": "python", "repo": "stoned/py-junos-eznc", "path": "/lib/jnpr/junos/factory/factory_cls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: QCDIS/FAIRCells path: /fair-cells/helper/handlers.py import base64 import json import os import importlib from typing import Optional from tornado.web import RequestHandler, HTTPError from .notebook_runner import NotebookRunner from .util import get_config class NotebookRunnerHandler(RequestH...
code_fim
hard
{ "lang": "python", "repo": "QCDIS/FAIRCells", "path": "/fair-cells/helper/handlers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if 'display' in cell or 'result' in cell: if 'display' in cell: data = cell['display']['data'] else: data = cell['result']['data'] if 'image/png' in data: img = data['image/png'] self.set_header('...
code_fim
hard
{ "lang": "python", "repo": "QCDIS/FAIRCells", "path": "/fair-cells/helper/handlers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ax = plt.subplot(221) ax.text(0, subplot_label_y, 'origin') ax.imshow(resize_image_uint8.eval()) ax = plt.subplot(222) ax.text(0, subplot_label_y, 'up_down') ax.imshow(tf.image.convert_image_dtype(flipped, dtype=tf.uint8).eval()) ax = plt.subplot(223) ax.text(0, subplot_l...
code_fim
hard
{ "lang": "python", "repo": "qianhk/FeiPython", "path": "/Python3Test/imageDeal/image_show_origin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ax = plt.subplot(223) ax.text(0, subplot_label_y, 'left_right') ax.imshow(tf.image.convert_image_dtype(flipped2, dtype=tf.uint8).eval()) ax = plt.subplot(224) ax.text(0, subplot_label_y, 'transpose') ax.imshow(tf.image.convert_image_dtype(flipped3, dtype=tf.uint8).eval()) plt...
code_fim
hard
{ "lang": "python", "repo": "qianhk/FeiPython", "path": "/Python3Test/imageDeal/image_show_origin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: qianhk/FeiPython path: /Python3Test/imageDeal/image_show_origin.py #!/usr/bin/env python3 # coding=utf-8 import matplotlib.pyplot as plt import tensorflow as tf jpgFile = tf.gfile.FastGFile('../data/cat.jpg', 'rb') image_raw_data = jpgFile.read() dest_dir = '../logs/imageDeal/' def resize_30...
code_fim
hard
{ "lang": "python", "repo": "qianhk/FeiPython", "path": "/Python3Test/imageDeal/image_show_origin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_inside_triangle(self): """Tests the inside triangle algorithm.""" # defining triangle vertices v1x, v1y = 0, 0 v2x, v2y = 1, 1 v3x, v3y = 1, 0 # test vertices are inside self.assertTrue(inside_triangle(v1x, v1y, v2x, v2y, v3x, v3y, v1x...
code_fim
medium
{ "lang": "python", "repo": "vsnever/raysect-source", "path": "/raysect/core/math/cython/tests/test_triangle.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vsnever/raysect-source path: /raysect/core/math/cython/tests/test_triangle.py # Copyright (c) 2014-2023, Dr Alex Meakins, Raysect Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditi...
code_fim
hard
{ "lang": "python", "repo": "vsnever/raysect-source", "path": "/raysect/core/math/cython/tests/test_triangle.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }