text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: thanh-vt/python-basic-programming path: /variable_and_data_type/date_demo.py import datetime as dt x = dt.datetime.now() print(x) print(x.year) print(x.strftime("%A")) y = dt.datetime(2020, 5, 17) print(y) # Weekday, short version print(y.strftime("%a")) # Weekday, full version print(y.strftime...
code_fim
hard
{ "lang": "python", "repo": "thanh-vt/python-basic-programming", "path": "/variable_and_data_type/date_demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>the first day of week, 00-53 print(y.strftime("%U")) # Week number of year, Monday as the first day of week, 00-53 print(y.strftime("%W")) # Local version of date and time print(y.strftime("%c")) # Local version of date print(y.strftime("%x")) # Local version of time print(y.strftime("%X")) # A % characte...
code_fim
hard
{ "lang": "python", "repo": "thanh-vt/python-basic-programming", "path": "/variable_and_data_type/date_demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>me("%I")) # AM/PM print(y.strftime("%p")) # Minute 00-59 print(y.strftime("%M")) # Second 00-59 print(y.strftime("%S")) # Microsecond 000000-999999 print(y.strftime("%f")) # UTC offset print(y.strftime("%z")) # Timezone print(y.strftime("%Z")) # Day number of year 001-366 print(y.strftime("%j")) # Week nu...
code_fim
hard
{ "lang": "python", "repo": "thanh-vt/python-basic-programming", "path": "/variable_and_data_type/date_demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chonkerboi/pantheon-hermes path: /pantheon-hermes/pantheon/hermes/gpu/nvidia/helpers.py import logging from .. import REGISTRY LOGGER = logging.getLogger(__name__) <|fim_suffix|> klass = REGISTRY[info['model']] gpu = klass(int(info['device_minor']), info['bus_location']) LOGGER.inf...
code_fim
easy
{ "lang": "python", "repo": "chonkerboi/pantheon-hermes", "path": "/pantheon-hermes/pantheon/hermes/gpu/nvidia/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> klass = REGISTRY[info['model']] gpu = klass(int(info['device_minor']), info['bus_location']) LOGGER.info('Initialized %s', gpu) return gpu<|fim_prefix|># repo: chonkerboi/pantheon-hermes path: /pantheon-hermes/pantheon/hermes/gpu/nvidia/helpers.py import logging from .. import REGISTRY ...
code_fim
easy
{ "lang": "python", "repo": "chonkerboi/pantheon-hermes", "path": "/pantheon-hermes/pantheon/hermes/gpu/nvidia/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrief/djangocms-cascade path: /cmsplugin_cascade/migrations/0018_iconfont_color.py from django.db import migrations from cmsplugin_cascade.models import CascadeElement def forwards(apps, schema_editor): for cascade_element in CascadeElement.objects.all(): if cascade_element.plugin_t...
code_fim
hard
{ "lang": "python", "repo": "jrief/djangocms-cascade", "path": "/cmsplugin_cascade/migrations/0018_iconfont_color.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('cmsplugin_cascade', '0017_fake_proxy_models'), ] operations = [ migrations.RunPython(forwards, reverse_code=backwards), ]<|fim_prefix|># repo: jrief/djangocms-cascade path: /cmsplugin_cascade/migrations/0018_icon...
code_fim
hard
{ "lang": "python", "repo": "jrief/djangocms-cascade", "path": "/cmsplugin_cascade/migrations/0018_iconfont_color.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p.addUserDebugLine(pts[0], pts[4], color, 1, parentObjectUniqueId=parentUid, parentLinkIndex=parentLinkIndex) p.addUserDebugLine(pts[1], pts[5], color, ...
code_fim
hard
{ "lang": "python", "repo": "WolfireGames/overgrowth", "path": "/Projects/bullet3-2.89/examples/pybullet/examples/reset_dynamic_info.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WolfireGames/overgrowth path: /Projects/bullet3-2.89/examples/pybullet/examples/reset_dynamic_info.py import pybullet as p import time import math p.connect(p.GUI) planeId = p.loadURDF(fileName="plane.urdf", baseOrientation=[0.25882, 0, 0, 0.96593]) p.loadURDF(fileName="cube.urdf", basePosition=...
code_fim
hard
{ "lang": "python", "repo": "WolfireGames/overgrowth", "path": "/Projects/bullet3-2.89/examples/pybullet/examples/reset_dynamic_info.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.path_exists(path): key = self.bucket.get_key(path) else: key = self.bucket.new_key(path) key.set_contents_from_string(contents) def write_file(self, filename, path): key = self.bucket.new_key(path) fp = open(filename) ke...
code_fim
medium
{ "lang": "python", "repo": "quboletest/quboletsdb", "path": "/qdstsdb/S3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: quboletest/quboletsdb path: /qdstsdb/S3.py ## # Copyright (c) 2015. Qubole Inc # 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 # # http://www.apache.org/license...
code_fim
hard
{ "lang": "python", "repo": "quboletest/quboletsdb", "path": "/qdstsdb/S3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>while True: try: command = input() if command: manage_input(client, command) except KeyboardInterrupt: print("Interrupting... Bye!") except: print("Some unexpected error occurred.")<|fim_prefix|># repo: mgrabina/galoonline path: /client.py #!/usr/bi...
code_fim
hard
{ "lang": "python", "repo": "mgrabina/galoonline", "path": "/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>notifications_thread = threading.Thread(target=background, args=(client,)) notifications_thread.daemon = True notifications_thread.start() while True: try: command = input() if command: manage_input(client, command) except KeyboardInterrupt: print("Interruptin...
code_fim
hard
{ "lang": "python", "repo": "mgrabina/galoonline", "path": "/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mgrabina/galoonline path: /client.py #!/usr/bin/python import os from src import tcp_client import threading # Welcoming player client = tcp_client.connect() def background(client_conn): while True: notification = None try: notification = tcp_client.recv_respon...
code_fim
hard
{ "lang": "python", "repo": "mgrabina/galoonline", "path": "/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /CondTools/L1Trigger/python/L1TriggerKeyDummy_cff.py import FWCore.ParameterSet.Config as cm<|fim_suffix|>igger.L1TriggerKeyRcdSource_cfi import *<|fim_middle|>s from CondTools.L1Trigger.L1TriggerKeyDummy_cfi import * from CondTools.L1Tr
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CondTools/L1Trigger/python/L1TriggerKeyDummy_cff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>igger.L1TriggerKeyRcdSource_cfi import *<|fim_prefix|># repo: cms-sw/cmssw path: /CondTools/L1Trigger/python/L1TriggerKeyDummy_cff.py import FWCore.ParameterSet.Config as cm<|fim_middle|>s from CondTools.L1Trigger.L1TriggerKeyDummy_cfi import * from CondTools.L1Tr
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CondTools/L1Trigger/python/L1TriggerKeyDummy_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Brok-Bucholtz/Pyomize path: /analyze/stats.py from sklearn.feature_extraction.text import CountVectorizer from analyze.dimension_reduction import get_file_stats_data from github_database import engine, Commit, File from sqlalchemy.orm import sessionmaker, joinedload from numpy import mean from co...
code_fim
hard
{ "lang": "python", "repo": "Brok-Bucholtz/Pyomize", "path": "/analyze/stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> db_session = sessionmaker(bind=engine)() commits = db_session \ .query(Commit) \ .all() regex_search = compile('^([\s]+)?([^\s]+)') lancaster_stemmer = LancasterStemmer() commit_message_first_words = [lancaster_stemmer.stem(regex_search.match(commit.message).group().st...
code_fim
hard
{ "lang": "python", "repo": "Brok-Bucholtz/Pyomize", "path": "/analyze/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _break_into_labels(X, y): data = zip(X, y) dict = {} for label in set(y): value = ([], []) for element in data: if element[1] == label: value[0].append(element[0][0]) value[1].append(element[0][1]) dict[label] = value ...
code_fim
hard
{ "lang": "python", "repo": "Brok-Bucholtz/Pyomize", "path": "/analyze/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MJ10/DSA-Project path: /proxy_server.py # import required modules import socket import threading import signal from time import strftime, localtime, time import utils import re import sys import logging from cache import LFUCache class Server: """ Main Proxy Server Class """ de...
code_fim
hard
{ "lang": "python", "repo": "MJ10/DSA-Project", "path": "/proxy_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Handles the thread for each connection :param conn: Connection of the current client being served :param client_addr: Address of the current client being served :return: None """ req = conn.recv(self.config['MAX_REQUEST_LENGTH']) line1 =...
code_fim
hard
{ "lang": "python", "repo": "MJ10/DSA-Project", "path": "/proxy_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertResultIsCFRetained(CGFontCopyFullName) v = CGFontCopyFullName(font) self.assertIsInstance(v, unicode) v = CGFontGetAscent(font) self.assertIsInstance(v, (int, long)) v = CGFontGetDescent(font) self.assertIsInstance(v, (int, long)) ...
code_fim
hard
{ "lang": "python", "repo": "apple-open-source/macos", "path": "/pyobjc/pyobjc/pyobjc-framework-Quartz-2.5.1/PyObjCTest/test_cgfont.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apple-open-source/macos path: /pyobjc/pyobjc/pyobjc-framework-Quartz-2.5.1/PyObjCTest/test_cgfont.py from PyObjCTools.TestSupport import * from Quartz.CoreGraphics import * import sys try: unicode except NameError: unicode = str try: long except NameError: long = int if sys.v...
code_fim
hard
{ "lang": "python", "repo": "apple-open-source/macos", "path": "/pyobjc/pyobjc/pyobjc-framework-Quartz-2.5.1/PyObjCTest/test_cgfont.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> v = CGFontGetXHeight(font) self.assertIsInstance(v, (int, long)) v = CGFontGetFontBBox(font) self.assertIsInstance(v, CGRect) v = CGFontGetItalicAngle(font) self.assertIsInstance(v, float) v = CGFontGetStemV(font) self.assertIsInstance(v, ...
code_fim
hard
{ "lang": "python", "repo": "apple-open-source/macos", "path": "/pyobjc/pyobjc/pyobjc-framework-Quartz-2.5.1/PyObjCTest/test_cgfont.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eghbalz/lighter path: /examples/coco_looking/tests/test_coco_looking.py import os import unittest from lighter.config import Config from lighter.context import Context from lighter.decorator import inject, config, device, context, search, strategy, InjectOption, reference, hook, \ references...
code_fim
hard
{ "lang": "python", "repo": "eghbalz/lighter", "path": "/examples/coco_looking/tests/test_coco_looking.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> exists, path = get_lighter_path('models', 'defaults.template') self.assertTrue(exists) def test_reference(self): Context.create(DEFAULT_CONFIG_FILE) class Demo: @reference(name='model') def __init__(self): pass demo = De...
code_fim
hard
{ "lang": "python", "repo": "eghbalz/lighter", "path": "/examples/coco_looking/tests/test_coco_looking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class SearchExperiment: @context @search(params=[('demo', GridParameter(ref='test', min=1, max=10))]) def __init__(self): self.config.set_value('test', 2) def run(self): self.search.demo.update_config(self.config) ...
code_fim
hard
{ "lang": "python", "repo": "eghbalz/lighter", "path": "/examples/coco_looking/tests/test_coco_looking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KevinMidboe/Node-Com-Handler path: /old_v0.1/apolloActivity/ip/urls.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Author: KevinMidboe # @Date: 2016-11-23 20:43:37 # @Last Modified by: KevinMidboe # @Last Modified time: 2016-11-23 20:43:50 <|fim_suffix|>from . import views urlpatterns...
code_fim
easy
{ "lang": "python", "repo": "KevinMidboe/Node-Com-Handler", "path": "/old_v0.1/apolloActivity/ip/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ]<|fim_prefix|># repo: KevinMidboe/Node-Com-Handler path: /old_v0.1/apolloActivity/ip/urls.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Author: KevinMidboe # @Date: 2016-11-23 20:43:37 # @Last Modified by: KevinMi...
code_fim
easy
{ "lang": "python", "repo": "KevinMidboe/Node-Com-Handler", "path": "/old_v0.1/apolloActivity/ip/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c-v-d-z/omnia-timeseries-python path: /omnia_timeseries/api.py tipleDatapointsRequestItem, GetTimeseriesResponseModel, MessageModel, StreamSubscriptionRequestModel, StreamSubscriptionDataModel, TimeseriesPatchRequestItem, TimeseriesRequestItem ) import logging TimeseriesVersion =...
code_fim
hard
{ "lang": "python", "repo": "c-v-d-z/omnia-timeseries-python", "path": "/omnia_timeseries/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c-v-d-z/omnia-timeseries-python path: /omnia_timeseries/api.py p_client.request( request_type='post', url=f"{self._base_url}/{id}/data", params={'async': is_async} if is_async is not None else None, payload=data ) def write_multiple(sel...
code_fim
hard
{ "lang": "python", "repo": "c-v-d-z/omnia-timeseries-python", "path": "/omnia_timeseries/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_latest_multi_datapoint(self, request: List[GetMultipleDatapointsRequestItem], federationSource: Optional[str] = None, accept: ContentType = "application/json") -> GetDatapointsResponseModel...
code_fim
hard
{ "lang": "python", "repo": "c-v-d-z/omnia-timeseries-python", "path": "/omnia_timeseries/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' 后验概率分布 mu,sigma,pi : 待更新的参数 return: 返回一个矩阵,每一行为一个样本的后验概率分布 ''' gamma = np.empty((len(self.sample), 3)) for i in range(len(self.sample)): for k in range(3): gamma[i][k] = (pi[k]*self.gaussian(self.sample[i],...
code_fim
hard
{ "lang": "python", "repo": "guessable/machineLearning", "path": "/Bayes/EM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guessable/machineLearning path: /Bayes/EM.py #!/usr/bin/env python3 # _*_ coding:utf-8 _*_ ''' EM算法 ''' import numpy as np import matplotlib.pyplot as plt class EM(): ''' 高斯混合模型 ''' def __init__(self, mu, sigma, pi, size=400): ''' 混合分布的真实参数 mu : [m...
code_fim
hard
{ "lang": "python", "repo": "guessable/machineLearning", "path": "/Bayes/EM.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-01101101/product-analytics path: /fight-churn/data-generation/py/behavior.py import pandas as pd import numpy as np import os from shutil import copyfile from customer import Customer def is_pos_def(x): """ Quick check of whether the given matrix is positive definite https://stac...
code_fim
hard
{ "lang": "python", "repo": "m-01101101/product-analytics", "path": "/fight-churn/data-generation/py/behavior.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.exp_fun(np.diagonal(self.behave_cov)) def generate_customer(self, start_of_month): """ Given a mean and covariance matrix, the event rates for the customer are drawn from the multi-variate gaussian distribution. subtract 0.5 and set min at 0.5 per m...
code_fim
hard
{ "lang": "python", "repo": "m-01101101/product-analytics", "path": "/fight-churn/data-generation/py/behavior.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class FatTailledBehaviorModel(GaussianBehaviorModel): def __init__(self, name, random_seed=None, version=None): self.exp_base = 1.6 self.log_fun = lambda x: np.log(x) / np.log(self.exp_base) self.exp_fun = lambda x: np.power(self.exp_base, x) super(FatTailledBehaviorMo...
code_fim
hard
{ "lang": "python", "repo": "m-01101101/product-analytics", "path": "/fight-churn/data-generation/py/behavior.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GrapherDev/TextSummary path: /news_NewWordFound/FoundNewWords_pymysql.py import pymysql # 连接数据库 conn = pymysql.connect(host='127.0.0.1',port = 3306,user = 'root', <|fim_suffix|> ") r = c.fetchone() print(r) # f = open('event_news_ref.txt', 'w') print("write to .txt file!")<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "GrapherDev/TextSummary", "path": "/news_NewWordFound/FoundNewWords_pymysql.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>cute("select content from event_news_ref into outfile '/var/lib/mysql-files/event_news_ref.txt'; ") r = c.fetchone() print(r) # f = open('event_news_ref.txt', 'w') print("write to .txt file!")<|fim_prefix|># repo: GrapherDev/TextSummary path: /news_NewWordFound/FoundNewWords_pymysql.py import pymysql # ...
code_fim
medium
{ "lang": "python", "repo": "GrapherDev/TextSummary", "path": "/news_NewWordFound/FoundNewWords_pymysql.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> >>> import pyglass >>> previews = pyglass.preview('design_v1.sketch') >>> previews ['/var/folders/fq/xtn_qh1x6c3drpp3ycytx1fr0000gn/T/pyglassY92Xqs', '/var/folders/fq/xtn_qh1x6c3drpp3ycytx1fr0000gn/T/pyglassZ34Jab'] :copyright: (c) 2014 by Pixelapse. :license: MIT, see LICENSE for more det...
code_fim
medium
{ "lang": "python", "repo": "Pixelapse/pyglass", "path": "/pyglass/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" __title__ = 'pyglass' __author__ = 'Shravan Reddy' __license__ = 'MIT' __copyright__ = 'Copyright 2014 Pixelapse' from .api import preview<|fim_prefix|># repo: Pixelapse/pyglass path: /pyglass/__init__.py # -*- coding: utf-8 -*- """ pyglass library ~~~~~~~~~~~~~~~~~~~~~ <|fim_middle|>pyglass extr...
code_fim
hard
{ "lang": "python", "repo": "Pixelapse/pyglass", "path": "/pyglass/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pixelapse/pyglass path: /pyglass/__init__.py # -*- coding: utf-8 -*- """ pyglass library ~~~~~~~~~~~~~~~~~~~~~ pyglass extracts QuickLook preview images from files. <|fim_suffix|>:copyright: (c) 2014 by Pixelapse. :license: MIT, see LICENSE for more details. """ __title__ = 'pyglass' __autho...
code_fim
hard
{ "lang": "python", "repo": "Pixelapse/pyglass", "path": "/pyglass/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>',views.predictor,name='predictor') ]<|fim_prefix|># repo: sourabhyadav999/Diabetes-Predictor path: /app/urls.py from django.urls import path from . impo<|fim_middle|>rt views urlpatterns =[ path('',views.home,name='home'), path('predictor
code_fim
medium
{ "lang": "python", "repo": "sourabhyadav999/Diabetes-Predictor", "path": "/app/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sourabhyadav999/Diabetes-Predictor path: /app/urls.py from django.urls import path from . impo<|fim_suffix|>s.home,name='home'), path('predictor',views.predictor,name='predictor') ]<|fim_middle|>rt views urlpatterns =[ path('',view
code_fim
easy
{ "lang": "python", "repo": "sourabhyadav999/Diabetes-Predictor", "path": "/app/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sourabhyadav999/Diabetes-Predictor path: /app/urls.py from django.urls import path from . import views urlpatterns =[ path('',view<|fim_suffix|>',views.predictor,name='predictor') ]<|fim_middle|>s.home,name='home'), path('predictor
code_fim
easy
{ "lang": "python", "repo": "sourabhyadav999/Diabetes-Predictor", "path": "/app/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhijit-mahajani-imgtec/creator-system-test-framework path: /framework/path.py #/************************************************************************************************************************ # Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies. #...
code_fim
medium
{ "lang": "python", "repo": "abhijit-mahajani-imgtec/creator-system-test-framework", "path": "/framework/path.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return objectID, objectInstanceID, resourceID def makePath(objectID, instanceID, resourceID): path = '/' if objectID is not None: path = path + str(objectID) + '/' if instanceID is not None: path = path + str(instanceID) + '/' if resourceID is not None: path = ...
code_fim
medium
{ "lang": "python", "repo": "abhijit-mahajani-imgtec/creator-system-test-framework", "path": "/framework/path.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def makePath(objectID, instanceID, resourceID): path = '/' if objectID is not None: path = path + str(objectID) + '/' if instanceID is not None: path = path + str(instanceID) + '/' if resourceID is not None: path = path + str(resourceID) if len(path) > 1 and pat...
code_fim
hard
{ "lang": "python", "repo": "abhijit-mahajani-imgtec/creator-system-test-framework", "path": "/framework/path.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PencilAndBike/caffe-to-theano path: /layers.py import numpy as np import theano import theano.tensor as T #from theano.tensor.signal import downsample from theano.tensor.nnet import conv from pylearn2.expr.normalize import CrossChannelNormalization from theano.sandbox.rng_mrg import MRG_RandomS...
code_fim
hard
{ "lang": "python", "repo": "PencilAndBike/caffe-to-theano", "path": "/layers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save_layer(self,name='', p_only=False): if p_only: return np.save(open('layer_'+self.name+name+'_filters','w'), self.w.get_value(borrow=True)) # np.save(open('layer_'+self.name+name+'_bias','w'), self.b.get_value(borrow=True)) def load_layer(self,name=''): ...
code_fim
hard
{ "lang": "python", "repo": "PencilAndBike/caffe-to-theano", "path": "/layers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zyh1999/pytorch-quantum path: /examples/core/callbacks.py import copy import time from typing import List, Any, Dict import torch import torch.nn.functional as F import tqdm from torch.utils.data import DataLoader from torchpack.callbacks.callback import Callback, Callbacks from torchpack.util...
code_fim
hard
{ "lang": "python", "repo": "zyh1999/pytorch-quantum", "path": "/examples/core/callbacks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class MinError(Callback): def __init__(self, *, output_tensor: str = 'outputs', target_tensor: str = 'targets', name: str = 'error') -> None: self.output_tensor = output_tensor self.target_tensor = target_tensor ...
code_fim
hard
{ "lang": "python", "repo": "zyh1999/pytorch-quantum", "path": "/examples/core/callbacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # test gradient w.r.t. x works and gradient implicit ~= gradient autodiff delta = jax.random.uniform(rngs[4], (n, dim)) reg_ot_delta_plus = potential(a, x + eps * delta, True, h) reg_ot_delta_minus = potential(a, x - eps * delta, True, h) delta_dot_grad = jnp.sum(delta * grad...
code_fim
hard
{ "lang": "python", "repo": "Piyushi-0/ott", "path": "/tests/core/sinkhorn_jacobian_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class SinkhornJacobianTest(jax.test_util.JaxTestCase): @parameterized.named_parameters( dict( testcase_name='Bal-Lse', lse_mode=True, tau_a=1.0, tau_b=1.0), dict( testcase_name='Unbal-Scal', lse_mode=False, tau_a=.88, ...
code_fim
hard
{ "lang": "python", "repo": "Piyushi-0/ott", "path": "/tests/core/sinkhorn_jacobian_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Piyushi-0/ott path: /tests/core/sinkhorn_jacobian_test.py # coding=utf-8 # Copyright 2021 Google 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 # # http://www...
code_fim
hard
{ "lang": "python", "repo": "Piyushi-0/ott", "path": "/tests/core/sinkhorn_jacobian_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># # # # # EXECUÇÃO PROGRAMA # # # # # ''' A execução do programa deve ser feita retirando as aspas triplas para execução dos algoritmos. Isso foi necessário para que não haja execução dos 5 algoritmos, cada um executando um loop de 10 ciclos. Dependendo do algoritmo isso pode tomar muito ...
code_fim
hard
{ "lang": "python", "repo": "felipeclau/EstruturadeDados_AC02", "path": "/AC03.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: felipeclau/EstruturadeDados_AC02 path: /AC03.py # Disciplina: ESTRUTURA DE DADOS # Turma: BD3B NOITE # Nome Alunos: BRUNO BARROCA # FELIPE CHIN LAU # LETICIA MARQUES # Professor: JORGE CARLOS VALVERDE REBAZA # Data entrega: 28/04/2020 ''' Pergunta 1: Ranking de Algoritm...
code_fim
hard
{ "lang": "python", "repo": "felipeclau/EstruturadeDados_AC02", "path": "/AC03.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 1.5) Implementação do algoritmo quicksort. Obter resultados de desempenho médio para M = 10 # listas com valores aleatórios de tamanhos N = 1000, N = 10000, N = 100000, N = 1000000 # e N = 10000000. (2 pontos) # quick_sort ''' for i in range(10): lista = [randint(0, N) for i in range(...
code_fim
hard
{ "lang": "python", "repo": "felipeclau/EstruturadeDados_AC02", "path": "/AC03.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_button(self, driver): post = driver.create_post(OFF_TOPIC_ID, "!button") reply = expect_reply(driver, post, retries=2) assert len(reply["props"]["attachments"]) == 1 attachment = reply["props"]["attachments"][0] assert attachment["actions"] == [ ...
code_fim
hard
{ "lang": "python", "repo": "attzonko/mmpy_bot", "path": "/tests/integration_tests/test_webhook_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> asyncio.run(driver.trigger_own_webhook("ping", {"channel_id": OFF_TOPIC_ID})) time.sleep(RESPONSE_TIMEOUT) as_expected = False for post in driver.posts.get_posts_for_channel(OFF_TOPIC_ID)["posts"].values(): # TODO: Check that the post was created after we trigg...
code_fim
medium
{ "lang": "python", "repo": "attzonko/mmpy_bot", "path": "/tests/integration_tests/test_webhook_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: attzonko/mmpy_bot path: /tests/integration_tests/test_webhook_example.py import asyncio import time from .utils import start_bot # noqa, only imported so that the bot is started from .utils import OFF_TOPIC_ID, RESPONSE_TIMEOUT from .utils import driver as driver_fixture from .utils import expe...
code_fim
medium
{ "lang": "python", "repo": "attzonko/mmpy_bot", "path": "/tests/integration_tests/test_webhook_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, requirements=ApiRequirement.LOGIN|ApiRequirement.HTTPS, fields=('email',)): self.requirements = requirements self.fields = fields self.__doc__ = _api_filter_contacts_view.doc def __call__(self): # Empty call so that django will accept is as a vie...
code_fim
hard
{ "lang": "python", "repo": "symmetricapi/django-symmetric", "path": "/symmetric/management/overrides.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: symmetricapi/django-symmetric path: /symmetric/management/overrides.py from django.apps import apps import symmetric.filters import symmetric.views from symmetric.views import ApiAction, ApiRequirement get_model = apps.get_model """ Override most of the api views to collect information about...
code_fim
hard
{ "lang": "python", "repo": "symmetricapi/django-symmetric", "path": "/symmetric/management/overrides.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Empty call so that django will accept is as a view pass symmetric.views.api_view = _api_view symmetric.views.api_related_view = _api_related_view _api_filter_contacts_view.doc = symmetric.views.api_filter_contacts_view.__doc__ symmetric.views.api_filter_contacts_view = _api_filter_cont...
code_fim
hard
{ "lang": "python", "repo": "symmetricapi/django-symmetric", "path": "/symmetric/management/overrides.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': d = DaemonRunner('GPS_DAEMON_CFG', ['gps.ini', '/etc/carpi/gps.ini']) d.run(GpsDaemon())<|fim_prefix|># repo: rGunti/CarPi-GPSDaemon path: /gpsdaemon/__init__.py """ CARPI GPS DAEMON (C) 2018, Raphael "rGunti" Guntersweiler Licensed under MIT """ from daemoncommons.daem...
code_fim
easy
{ "lang": "python", "repo": "rGunti/CarPi-GPSDaemon", "path": "/gpsdaemon/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rGunti/CarPi-GPSDaemon path: /gpsdaemon/__init__.py """ CARPI GPS DAEMON (C) 2018, Raphael "rGunti" Guntersweiler Licensed under MIT """ from daemoncommons.daemon import DaemonRunner <|fim_suffix|>if __name__ == '__main__': d = DaemonRunner('GPS_DAEMON_CFG', ['gps.ini', '/etc/carpi/gps.ini']...
code_fim
easy
{ "lang": "python", "repo": "rGunti/CarPi-GPSDaemon", "path": "/gpsdaemon/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class NewHoodForm(forms.ModelForm): class Meta: model = Hood exclude = ['user']<|fim_prefix|># repo: GabrielSpear/NeighbourhoodWatch path: /hood/forms.py from .models import Profile, Post, Hood from django import forms class NewProfileForm(forms.ModelForm): class Meta: ...
code_fim
medium
{ "lang": "python", "repo": "GabrielSpear/NeighbourhoodWatch", "path": "/hood/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Hood exclude = ['user']<|fim_prefix|># repo: GabrielSpear/NeighbourhoodWatch path: /hood/forms.py from .models import Profile, Post, Hood from django import forms <|fim_middle|>class NewProfileForm(forms.ModelForm): class Meta: model = Profile ...
code_fim
hard
{ "lang": "python", "repo": "GabrielSpear/NeighbourhoodWatch", "path": "/hood/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GabrielSpear/NeighbourhoodWatch path: /hood/forms.py from .models import Profile, Post, Hood from django import forms class NewProfileForm(forms.ModelForm): class Meta: model = Profile exclude = ['user'] <|fim_suffix|> class NewHoodForm(forms.ModelForm): class Meta: ...
code_fim
medium
{ "lang": "python", "repo": "GabrielSpear/NeighbourhoodWatch", "path": "/hood/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AuroraDysis/evernote-telegram-bot path: /tests/unit/test_mongo.py import unittest from unittest import expectedFailure from unittest.case import SkipTest from pymongo.errors import ServerSelectionTimeoutError from evernotebot.bot.storage import Mongo class TestMongoStorage(unittest.TestCase): ...
code_fim
hard
{ "lang": "python", "repo": "AuroraDysis/evernote-telegram-bot", "path": "/tests/unit/test_mongo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_save(self): data = {'id': 3, 'name': 'Batman'} self.client.create(data) data['name'] = 'Joker' self.client.save(data) data = self.client.get(3) self.assertEqual(data['name'], 'Joker')<|fim_prefix|># repo: AuroraDysis/evernote-telegram-bot path:...
code_fim
hard
{ "lang": "python", "repo": "AuroraDysis/evernote-telegram-bot", "path": "/tests/unit/test_mongo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = {'id': 2, 'name': 'Batman'} self.client.save(data) def test_save(self): data = {'id': 3, 'name': 'Batman'} self.client.create(data) data['name'] = 'Joker' self.client.save(data) data = self.client.get(3) self.assertEqual(data['nam...
code_fim
hard
{ "lang": "python", "repo": "AuroraDysis/evernote-telegram-bot", "path": "/tests/unit/test_mongo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if is_reg(src): print('\tmov %s, %s' % (reg[2:], src[2:])) else: offset = symtbl.get_offset(funcname, src) print('\tldr %s, [fp, %s]' % (reg[2:], str(hex(offset)))) def store_reg(funcname, reg, dst): if is_reg(dst): print('\tmov %s, %s' % (dst[2:], reg...
code_fim
hard
{ "lang": "python", "repo": "xu3kev/bril", "path": "/bril2arm64/codegen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if op in comparisons or op in binary_oprands: dst = instr['dest'] arg0 = instr['args'][0] arg1 = instr['args'][1] if not is_reg(arg0): load_reg(funcname, arg0, '__x9') arg0 = '__x9' if not is_reg(arg1): load_reg(funcname, arg1...
code_fim
hard
{ "lang": "python", "repo": "xu3kev/bril", "path": "/bril2arm64/codegen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xu3kev/bril path: /bril2arm64/codegen.py import sys import symbol_table symtbl = symbol_table.symbol_table() binary_oprands = { 'or': 'orr', 'and': 'and', 'div': 'sdiv', 'mul': 'mul', 'sub': 'sub', 'add': 'add'} unary_oprands = {'not': 'mvn'} comp...
code_fim
hard
{ "lang": "python", "repo": "xu3kev/bril", "path": "/bril2arm64/codegen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> matrix = random.random(size = (row, col)) for i in range(row): for j in range(col): matrix[i][j] = (matrix[i][j] - 0.5) * 4 return matrix # Because all the pic from one original pic(only pixel changed), it issuitable to use euclidean metric def distance_x(img1, img2): ...
code_fim
hard
{ "lang": "python", "repo": "josh200501/deepxplore", "path": "/GeneticAlgorithm/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # start_point = ( # random.randint(0, gradients.shape[1] - rect_shape[0]), random.randint(0, gradients.shape[2] - rect_shape[1])) new_grads = np.zeros_like(gradients) patch = gradients[:, start_point[0]:start_point[0] + rect_shape[0], start_point[1]:start_point[1] + rect_shape[1]] ...
code_fim
hard
{ "lang": "python", "repo": "josh200501/deepxplore", "path": "/GeneticAlgorithm/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: josh200501/deepxplore path: /GeneticAlgorithm/utils.py import numpy as np import random def initialization(img, num, stepsize): img_list = [] for i in range(num): method = random.randint(1, 3) trans_matrix = generate_value(len(img), len(img[0])) rect_shape = (ra...
code_fim
hard
{ "lang": "python", "repo": "josh200501/deepxplore", "path": "/GeneticAlgorithm/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>* Array * Boolean ##Input description N/A ##Output description A truth table for the language that you're programming in. e.g. Expression | Bool ----------|---- "Hello World!" | True '' | False '0' | True 1 | True 0 | False 0.0 | False [] | False [1,2,3] | True True | True False | False #Finally Have a go...
code_fim
hard
{ "lang": "python", "repo": "DayGitH/Python-Challenges", "path": "/DailyProgrammer/DP20150522C.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DayGitH/Python-Challenges path: /DailyProgrammer/DP20150522C.py """ [2015-05-22] Challenge #215 [Hard] Metaprogramming Madness! https://www.reddit.com/r/dailyprogrammer/comments/36vuzm/20150522_challenge_215_hard_metaprogramming/ #Description You're working in the devils language. Looser than P...
code_fim
hard
{ "lang": "python", "repo": "DayGitH/Python-Challenges", "path": "/DailyProgrammer/DP20150522C.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mozilla/standup path: /standup/status/migrations/0013_backup_teamuser.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def copy_to_teamusercopy(apps, schema_editor): """Copy from TeamUser to TeamUserCopy""" TeamUser = apps.get_model('s...
code_fim
hard
{ "lang": "python", "repo": "mozilla/standup", "path": "/standup/status/migrations/0013_backup_teamuser.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('status', '0012_teamusercopy'), ] operations = [ migrations.RunPython(copy_to_teamusercopy, copy_from_teamusercopy) ]<|fim_prefix|># repo: mozilla/standup path: /standup/status/migrations/0013_backup_teamuser.py # -*- coding: utf-8 -*- from __future__ im...
code_fim
hard
{ "lang": "python", "repo": "mozilla/standup", "path": "/standup/status/migrations/0013_backup_teamuser.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Let the view draw frame info for debugging, in case view.showFrame == # True and self.isPage or if self.showFrame. Mark that we are drawing # foreground here. view.drawPageMetaInfo(self, p) # Supposedly drawing outside rotation/scaling mode, so the origin of ...
code_fim
medium
{ "lang": "python", "repo": "jjp9624022/PageBot", "path": "/Lib/pagebot/elements/mask.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.stroke not in (None, noColor) and self.strokeWidth: context.stroke(self.stroke) context.strokeWidth(self.strokeWidth) doDraw = True if doDraw: context.rect(px, py, self.w, self.h) if self.drawAfter is not None: # Call if def...
code_fim
medium
{ "lang": "python", "repo": "jjp9624022/PageBot", "path": "/Lib/pagebot/elements/mask.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jjp9624022/PageBot path: /Lib/pagebot/elements/mask.py #!/usr/bin/env python3 # -*- coding: UTF-8 -*- # ----------------------------------------------------------------------------- # # P A G E B O T # # Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens # www.pagebot.io # ...
code_fim
hard
{ "lang": "python", "repo": "jjp9624022/PageBot", "path": "/Lib/pagebot/elements/mask.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f"{instr=}") len_mask = len(instr["instr"][0][2]) for i in instr["instr"]: # print(f"{i=}") # breakpoint() binary_rep = "{0:b}".format(int(i[0])) # print(f"{binary_rep=}") transformed = [] # print(f"{i=}"...
code_fim
hard
{ "lang": "python", "repo": "Stegallo/adventofcode", "path": "/y_2020/day14.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stegallo/adventofcode path: /y_2020/day14.py import copy from .common import AoCDay class Day(AoCDay): def __init__(self): super().__init__(14) def _preprocess_input(self): # print(f"{self._input_data}") self.__input = [i for i in self._input_data] # pr...
code_fim
hard
{ "lang": "python", "repo": "Stegallo/adventofcode", "path": "/y_2020/day14.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': _out('reading in messages...') chunk = 3 df = pd.read_csv('short_' + str(chunk) + '.csv') lengthen_urls(df, out_dir='', fname='long_' + str(chunk) + '.csv')<|fim_prefix|># repo: snspam/sn_spam path: /one_off/lengthen_urls.py import re import sys import httplib2...
code_fim
hard
{ "lang": "python", "repo": "snspam/sn_spam", "path": "/one_off/lengthen_urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': _out('reading in messages...') chunk = 3 df = pd.read_csv('short_' + str(chunk) + '.csv') lengthen_urls(df, out_dir='', fname='long_' + str(chunk) + '.csv')<|fim_prefix|># repo: snspam/sn_spam path: /one_off/lengthen_urls.py import re import sys import httplib2 ...
code_fim
medium
{ "lang": "python", "repo": "snspam/sn_spam", "path": "/one_off/lengthen_urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: snspam/sn_spam path: /one_off/lengthen_urls.py import re import sys import httplib2 import pandas as pd # public def lengthen_urls(df, c='text', regex_str=r'(http[^\s]+)', out_dir='', fname='comments.csv'): h = httplib2.Http('.cache') regex = re.compile(regex_str) <|...
code_fim
hard
{ "lang": "python", "repo": "snspam/sn_spam", "path": "/one_off/lengthen_urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def test_cancel_noops_if_joined( decoy: Decoy, state_store: StateStore, command_executor: CommandExecutor, subject: QueueWorker, ) -> None: """It should noop on cancel if the worker has already been `join`'d.""" subject.start() await subject.join() subject.cancel() ...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/tests/opentrons/protocol_engine/execution/test_queue_worker.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> await subject.join() decoy.verify( await command_executor.execute(command_id=matchers.Anything()), times=0, ) async def test_cancel_noops_if_joined( decoy: Decoy, state_store: StateStore, command_executor: CommandExecutor, subject: QueueWorker, ) -> None: ...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/tests/opentrons/protocol_engine/execution/test_queue_worker.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Opentrons/opentrons path: /api/tests/opentrons/protocol_engine/execution/test_queue_worker.py """Tests for the command QueueWorker in opentrons.protocol_engine.""" from typing import Generator import pytest from decoy import Decoy, matchers from opentrons.protocol_engine.state import StateStore...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/tests/opentrons/protocol_engine/execution/test_queue_worker.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> parser.addoption( "--reactor", default="default", choices=["default", "asyncio"], ) @pytest.fixture(scope="class") def reactor_pytest(request): if not request.cls: # doctests return request.cls.reactor_pytest = request.config.getoption("--reactor")...
code_fim
hard
{ "lang": "python", "repo": "scrapy/scrapy", "path": "/conftest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scrapy/scrapy path: /conftest.py import platform import sys from pathlib import Path import pytest from twisted import version as twisted_version from twisted.python.versions import Version from twisted.web.http import H2_ENABLED from scrapy.utils.reactor import install_reactor from tests.keys ...
code_fim
hard
{ "lang": "python", "repo": "scrapy/scrapy", "path": "/conftest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture(autouse=True) def requires_uvloop(request): if not request.node.get_closest_marker("requires_uvloop"): return if sys.implementation.name == "pypy": pytest.skip("uvloop does not support pypy properly") if platform.system() == "Windows": pytest.skip("uvlo...
code_fim
hard
{ "lang": "python", "repo": "scrapy/scrapy", "path": "/conftest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print(gt_classes) print(positive_classes) print(true_positive_classes) print('Overall accuracy: {0}'.format(sum(true_positive_classes)/float(sum(positive_classes)))) print 'IoU:' iou_list = [] for i in range(13): iou = true_positive_classes[i]/float(gt_classes[i]+positive_classes[i]-true_positive_cla...
code_fim
hard
{ "lang": "python", "repo": "WangYueFt/dgcnn", "path": "/tensorflow/sem_seg/eval_iou_accuracy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WangYueFt/dgcnn path: /tensorflow/sem_seg/eval_iou_accuracy.py import numpy as np pred_data_label_filenames = [] for i in range(1,7): file_name = 'log{}/output_filelist.txt'.format(i) pred_data_label_filenames += [line.rstrip() for line in open(file_name)] gt_label_filenames = [f.rstrip('_p...
code_fim
medium
{ "lang": "python", "repo": "WangYueFt/dgcnn", "path": "/tensorflow/sem_seg/eval_iou_accuracy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class BlogIndexView(ListView): model=Blog template_name='blog/index.html' def post(request, success_url=None, form_class=CreateBlogForm, template_name='blog/blog_post.html', extra_context=None): if request.method == 'POST': form = form...
code_fim
hard
{ "lang": "python", "repo": "encorehu/hublog", "path": "/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def post(request, success_url=None, form_class=CreateBlogForm, template_name='blog/blog_post.html', extra_context=None): if request.method == 'POST': form = form_class(data=request.POST, files=request.FILES) if form.is_valid(): ...
code_fim
hard
{ "lang": "python", "repo": "encorehu/hublog", "path": "/blog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }