text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> camera.capture('image.jpg') pil_image = Image.open('image.jpg').convert('RGB') open_cv_image = np.array(pil_image) open_cv_image = open_cv_image[:, :, ::-1].copy() person = False # Define the Facial Recognition gray = cv2.cvtColor(open_cv_image, cv2.COLOR_BGR2GRAY) #print file face_casca...
code_fim
hard
{ "lang": "python", "repo": "drlamb/hotbox", "path": "/facerec.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: globus-gladier/gladier-xpcs path: /xpcs_portal/xpcs_index/management/commands/authorize_gladier.py from pprint import pprint import os import sys from gladier_xpcs.flow_reprocess import XPCSReprocessingFlow from django.core.management.base import BaseCommand from automate_app.models import FlowIn...
code_fim
hard
{ "lang": "python", "repo": "globus-gladier/gladier-xpcs", "path": "/xpcs_portal/xpcs_index/management/commands/authorize_gladier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: print(f'Checking {gconfig["flow_id"]}') existing_flow = Flow.objects.get(flow_id=gconfig['flow_id']) if existing_flow.definition_checksum != gconfig['flow_checksum']: print(f'Updating {existing_flow}, checksum has changed!') ...
code_fim
hard
{ "lang": "python", "repo": "globus-gladier/gladier-xpcs", "path": "/xpcs_portal/xpcs_index/management/commands/authorize_gladier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def on_key_press(self, symbol, modifiers): if symbol == pyglet.window.key.ESCAPE: self.window.pop_screen() if symbol == pyglet.window.key.ENTER: self.window.push_screen(GameScreen(self.window)) def on_key_release(self, symbol, modifiers): pass<|fim_...
code_fim
hard
{ "lang": "python", "repo": "elemel/void", "path": "/lib/void/title_screen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elemel/void path: /lib/void/title_screen.py # Copyright (c) 2008 Mikael Lind # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without ...
code_fim
hard
{ "lang": "python", "repo": "elemel/void", "path": "/lib/void/title_screen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LedgerHQ/ledgerctl path: /ledgerwallet/ledgerserver.py from abc import ABC, abstractmethod class LedgerServer(ABC): @abstractmethod def get_nonce(self) -> bytes: <|fim_suffix|> @abstractmethod def receive_certificate_chain(self): pass @abstractmethod def send_cer...
code_fim
medium
{ "lang": "python", "repo": "LedgerHQ/ledgerctl", "path": "/ledgerwallet/ledgerserver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_shared_secret(self): return None<|fim_prefix|># repo: LedgerHQ/ledgerctl path: /ledgerwallet/ledgerserver.py from abc import ABC, abstractmethod class LedgerServer(ABC): @abstractmethod def get_nonce(self) -> bytes: pass @abstractmethod def send_nonce(self, ...
code_fim
medium
{ "lang": "python", "repo": "LedgerHQ/ledgerctl", "path": "/ledgerwallet/ledgerserver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> qual_response = self.mturk.create_qualification_type( Name='Game command Screening Test', Keywords='test, qualification, boto', Description='This is a brief test to check if players know the game commands', QualificationTypeStatus='Active', ...
code_fim
hard
{ "lang": "python", "repo": "luise-strietzel/slurk-bots", "path": "/cola/amt_connector/aws_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: luise-strietzel/slurk-bots path: /cola/amt_connector/aws_config.py '''configuring MTurk account given settings / credentials in config.ini''' import configparser import boto3 class ConnectToMTurk(): def __init__(self): '''defines MTurk working environment''' CONFIG = config...
code_fim
hard
{ "lang": "python", "repo": "luise-strietzel/slurk-bots", "path": "/cola/amt_connector/aws_config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @admin.register(Problem) class ProblemAdmin(admin.ModelAdmin): list_display = ('number',) @admin.register(Submission) class SubmissionAdmin(admin.ModelAdmin): list_display = ('id', 'contestant', 'problem', 'submission_time') list_filter = ('problem',) readonly_fields = ('contestant', 'p...
code_fim
hard
{ "lang": "python", "repo": "archimedeans/integration-bee", "path": "/round/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class SubmissionInline(admin.TabularInline): model = Submission extra = 0 @admin.register(Contestant) class ContestantAdmin(admin.ModelAdmin): list_display = ('contestant_id', 'first_name', 'last_name') inlines = [SubmissionInline] @admin.register(Problem) class ProblemAdmin(admin.Mod...
code_fim
medium
{ "lang": "python", "repo": "archimedeans/integration-bee", "path": "/round/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: archimedeans/integration-bee path: /round/admin.py from django.contrib import admin from .models import Contestant, Problem, Submission # Register your models here. class SubmissionInline(admin.TabularInline): model = Submission extra = 0 @admin.register(Contestant) class ContestantA...
code_fim
medium
{ "lang": "python", "repo": "archimedeans/integration-bee", "path": "/round/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: opensafely/Shared-Care-Monitoring path: /analysis/study_definition.py AND (imd != -1) AND (rural_urban != -1) AND ( (on_methotrexate) OR (on_leflunomide) OR (on_azathioprine) ) """ ), registered=patients.registered_as_of("ind...
code_fim
hard
{ "lang": "python", "repo": "opensafely/Shared-Care-Monitoring", "path": "/analysis/study_definition.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Serious Mental Illness serious_mental_illness = patients.with_these_clinical_events( serious_mental_illness_codes, on_or_before = "index_date - 1 day", returning = "binary_flag", return_expectations = {"incidence": 0.1} ), ### MEDICATION ISSUES -...
code_fim
hard
{ "lang": "python", "repo": "opensafely/Shared-Care-Monitoring", "path": "/analysis/study_definition.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: opensafely/Shared-Care-Monitoring path: /analysis/study_definition.py missing") AND (sex = 'M' OR sex = 'F') AND (imd != -1) AND (rural_urban != -1) AND ( (on_methotrexate) OR (on_leflunomide) OR (on_azathioprine) ) """ ), ...
code_fim
hard
{ "lang": "python", "repo": "opensafely/Shared-Care-Monitoring", "path": "/analysis/study_definition.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log_entry= f"error happened in {location}\n error was: {error_message}\n" logging.debug(log_entry)<|fim_prefix|># repo: aZade-Dehghanpour/appraisal_report_generator path: /appraisal_report_app/controllers/record_logs.py import logging logger = logging.getLogger(__name__) <|fim_middle|>def reco...
code_fim
easy
{ "lang": "python", "repo": "aZade-Dehghanpour/appraisal_report_generator", "path": "/appraisal_report_app/controllers/record_logs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aZade-Dehghanpour/appraisal_report_generator path: /appraisal_report_app/controllers/record_logs.py import logging logger = logging.getLogger(__name__) <|fim_suffix|> log_entry= f"error happened in {location}\n error was: {error_message}\n" logging.debug(log_entry)<|fim_middle|>def...
code_fim
easy
{ "lang": "python", "repo": "aZade-Dehghanpour/appraisal_report_generator", "path": "/appraisal_report_app/controllers/record_logs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Error raised when loading the playlist failed """ class DataError(GenericError): """ Error raised when reading transport stream data failed """ class DependencyError(GenericError): """ Error raised when a dependency is not installed """<|fim_prefix|># repo: svti...
code_fim
medium
{ "lang": "python", "repo": "svti-teamvideo/iframe-playlist-generator", "path": "/iframeplaylistgenerator/exceptions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: svti-teamvideo/iframe-playlist-generator path: /iframeplaylistgenerator/exceptions.py class GenericError(Exception): """ Generic error """ def __str__(self): return "%s(%s)" % (self.__class__.__name__, self.args) <|fim_suffix|>class DependencyError(GenericError): """ ...
code_fim
hard
{ "lang": "python", "repo": "svti-teamvideo/iframe-playlist-generator", "path": "/iframeplaylistgenerator/exceptions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Reference: https://stackoverflow.com/a/50610630 '''<|fim_prefix|># repo: skeptycal/template path: /conftest.py #!/usr/bin/env python3 ''' conftest.py - pytest configuration test (keep one in the root directory to aid in module loading for pytest.) <|fim_middle|> "Pytest looks for the con...
code_fim
hard
{ "lang": "python", "repo": "skeptycal/template", "path": "/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skeptycal/template path: /conftest.py #!/usr/bin/env python3 ''' conftest.py - pytest configuration test (keep one in the root directory to aid in module loading for pytest.) <|fim_suffix|> Reference: https://stackoverflow.com/a/50610630 '''<|fim_middle|> "Pytest looks for the con...
code_fim
hard
{ "lang": "python", "repo": "skeptycal/template", "path": "/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check_directory_exists(directorypath): if not os.path.isdir(directorypath): raise FileNotFoundError('No directory at location \'%s\'' % directorypath)<|fim_prefix|># repo: ds-ga-1007/final_project path: /ak6179/src/yelp_data/yelp_data_utils.py import os def check_file_exists(filepath):...
code_fim
medium
{ "lang": "python", "repo": "ds-ga-1007/final_project", "path": "/ak6179/src/yelp_data/yelp_data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ds-ga-1007/final_project path: /ak6179/src/yelp_data/yelp_data_utils.py import os def check_file_exists(filepath): <|fim_suffix|>def check_directory_exists(directorypath): if not os.path.isdir(directorypath): raise FileNotFoundError('No directory at location \'%s\'' % directorypath)...
code_fim
medium
{ "lang": "python", "repo": "ds-ga-1007/final_project", "path": "/ak6179/src/yelp_data/yelp_data_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isdir(directorypath): raise FileNotFoundError('No directory at location \'%s\'' % directorypath)<|fim_prefix|># repo: ds-ga-1007/final_project path: /ak6179/src/yelp_data/yelp_data_utils.py import os def check_file_exists(filepath): if not os.path.isfile(filepath): ...
code_fim
easy
{ "lang": "python", "repo": "ds-ga-1007/final_project", "path": "/ak6179/src/yelp_data/yelp_data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amjith/wsgi-shell path: /ispyd/client.py import cmd import ConfigParser import glob import os import socket import sys import threading class ClientShell(cmd.Cmd): prompt = '(ispyd) ' def __init__(self, config_file, stdin=None, stdout=None): cmd.Cmd.__init__(self, stdin=stdin, ...
code_fim
hard
{ "lang": "python", "repo": "amjith/wsgi-shell", "path": "/ispyd/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> thread1 = threading.Thread(target=write) thread1.setDaemon(True) thread2 = threading.Thread(target=read) thread2.setDaemon(True) thread1.start() thread2.start() thread2.join() return True def main(): shell = ClientShell(sys.argv[1]) ...
code_fim
hard
{ "lang": "python", "repo": "amjith/wsgi-shell", "path": "/ispyd/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> client = socket.socket(server[0], socket.SOCK_STREAM) client.connect(server[1]) def write(): while 1: try: c = sys.stdin.read(1) if not c: client.shutdown(socket.SHUT_RD) ...
code_fim
hard
{ "lang": "python", "repo": "amjith/wsgi-shell", "path": "/ispyd/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lqh-0514/indoor_space_cnn_classifier path: /scripts/frame_extraction.py import cv2 import os from os import listdir from os.path import isfile, join from sys import stdout import psycopg2 import pickle import numpy as np from PIL import Image def gen_coord(line, time): percentage = None for i...
code_fim
hard
{ "lang": "python", "repo": "lqh-0514/indoor_space_cnn_classifier", "path": "/scripts/frame_extraction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for spec_id in results: conn = psycopg2.connect(conn_string) cur = conn.cursor() query = '''select * from penn_station.image_lookup_50ms where spec_id = '%s'; ''' % (spec_id[0]) # print(query) cur.execute(query) images = cur.fetchall() output_dir = os.path.join(os.getcwd(), '..', 'categories', sp...
code_fim
hard
{ "lang": "python", "repo": "lqh-0514/indoor_space_cnn_classifier", "path": "/scripts/frame_extraction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: highvoltag3/lambdel path: /lambda_handler.py #!/usr/bin/env python from PIL import Image import boto3 import json import botocore from urllib import unquote as urlunquote class Mandel(object): def __init__(self, zoom, tilex, tiley, pixelsx=100, pixelsy=100, defimagepixelsx...
code_fim
hard
{ "lang": "python", "repo": "highvoltag3/lambdel", "path": "/lambda_handler.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> bucketname = 'dbarnetttestimageforlambda' tilex, tiley = urlunquote(event['coords']).strip("()").replace(' ', '').split(',') zoom = event['zoom'] keyname = Key="%s:%s:%s" % (zoom, tilex, tiley) s3 = boto3.resource('s3') try: #s3.Bucket(bucketname).get_object(keyname) ...
code_fim
hard
{ "lang": "python", "repo": "highvoltag3/lambdel", "path": "/lambda_handler.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pbiernat/ripr path: /test/test_multiFunc.py import unittest import subprocess import sys,os from ripr import test_harness from ripr import gui from ripr import analysis_engine import binaryninja class x64_multiTest(unittest.TestCase): def test(self): print ("Starting Test") ...
code_fim
hard
{ "lang": "python", "repo": "pbiernat/ripr", "path": "/test/test_multiFunc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t = open('/tmp/riprtest/%s.py' % binary, 'w+') t.write(p.codeobj.final) t.close() testProc = subprocess.check_output(['python', '/tmp/riprtest/%s.py' % binary]) testProc = testProc.split("\n") self.assertIn('15', testProc[-2]) class x86_multiTest(unittes...
code_fim
hard
{ "lang": "python", "repo": "pbiernat/ripr", "path": "/test/test_multiFunc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#plotting graph with out fitted model plt.scatter(x,y) plt.plot([min(x),max(x)],[min(h),max(h)],color='red') #regression line plt.show()<|fim_prefix|># repo: Aakash-kaushik/machine-learning path: /linear_regression/linear_regression.py import numpy as np import pandas as pd import matplotlib.pyplot as pl...
code_fim
hard
{ "lang": "python", "repo": "Aakash-kaushik/machine-learning", "path": "/linear_regression/linear_regression.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aakash-kaushik/machine-learning path: /linear_regression/linear_regression.py import numpy as np import pandas as pd import matplotlib.pyplot as plt #getting the data into the program data=pd.read_csv("ex1data1.txt") data=np.array(data) zero=np.zeros([np.size(data,0),1],int) one=zero+1 x=np.arra...
code_fim
hard
{ "lang": "python", "repo": "Aakash-kaushik/machine-learning", "path": "/linear_regression/linear_regression.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> temp[2] = (cls.mulcInv[state[2]] ^ cls.mulcInv[state[6]] ^ cls.muldInv[state[10]] ^ cls.mul4Inv[state[14]]) temp[7] = (cls.mul3Inv[state[2]] ^ cls.mul8Inv[state[6]] ^ cls.mul4Inv[state[10]] ^ cls.mul5Inv[state[14]]) temp[8] = (cls.mul7Inv[state[2]] ^ cls.mul6Inv[state[6]] ^ cls.m...
code_fim
hard
{ "lang": "python", "repo": "tianwenlong001/LightWeightBlockCiphers", "path": "/LW-BlockCiphersPython/LED_64_D/LED_64_4_D1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> temp = [None] * 16 temp[0] = (cls.mulcInv[state[0]] ^ cls.mulcInv[state[4]] ^ cls.muldInv[state[8]] ^ cls.mul4Inv[state[12]]) temp[5] = (cls.mul3Inv[state[0]] ^ cls.mul8Inv[state[4]] ^ cls.mul4Inv[state[8]] ^ cls.mul5Inv[state[12]]) temp[10] = (cls.mul7Inv[state[0]] ^ ...
code_fim
hard
{ "lang": "python", "repo": "tianwenlong001/LightWeightBlockCiphers", "path": "/LW-BlockCiphersPython/LED_64_D/LED_64_4_D1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tianwenlong001/LightWeightBlockCiphers path: /LW-BlockCiphersPython/LED_64_D/LED_64_4_D1.py class LED_64_4_D1: keySize = 64 keySizeConst0 = (keySize >> 4) keySizeConst1 = (0x01 ^ (keySize >> 4)) keySizeConst2 = (0x02 ^ (keySize & 0x0F)) keySizeConst3 = (0x03 ^ (keySize & ...
code_fim
hard
{ "lang": "python", "repo": "tianwenlong001/LightWeightBlockCiphers", "path": "/LW-BlockCiphersPython/LED_64_D/LED_64_4_D1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devdil/ParkingLotProblem path: /src/tests/main/controllers/commandlineparsercontroller_test.py from src.main.controllers.commandlineparsercontroller import CommandLineParserController from src.main.exceptions.commandlineexception import UnsupportedCommandException import unittest class CommandL...
code_fim
hard
{ "lang": "python", "repo": "devdil/ParkingLotProblem", "path": "/src/tests/main/controllers/commandlineparsercontroller_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> commandlinecontroller = CommandLineParserController() with self.assertRaises(UnsupportedCommandException): commandlinecontroller.validate_command("gojek is awesome") with self.assertRaises(UnsupportedCommandException): commandlinecontroller.validate_comma...
code_fim
hard
{ "lang": "python", "repo": "devdil/ParkingLotProblem", "path": "/src/tests/main/controllers/commandlineparsercontroller_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> commandlinecontroller = CommandLineParserController() self.assertEqual(("create_parking_lot",['6']), commandlinecontroller.parse("create_parking_lot 6")) self.assertEqual(("park", ['KA-01-HH-1234','White']), commandlinecontroller.parse("park KA-01-HH-1234 White")) self.ass...
code_fim
hard
{ "lang": "python", "repo": "devdil/ParkingLotProblem", "path": "/src/tests/main/controllers/commandlineparsercontroller_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def ReconfigureRegion(templateBaseDir, regionDir, fileName, keys): regionTemplateDir = os.path.join(templateBaseDir, "region") if (not os.path.isdir(regionTemplateDir)): raise Exception("Region Template Directory " + regionTemplateDir + " doesn't exist") """ Update the Region Co...
code_fim
hard
{ "lang": "python", "repo": "mdickson/maestro", "path": "/src/inworldz/util/provision.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdickson/maestro path: /src/inworldz/util/provision.py import os.path import fnmatch import psutil import glob from ConfigParser import SafeConfigParser import inworldz.util.properties as DefaultProperties from inworldz.util.filesystem import strip_suffix import xml.etree.ElementTree as ET fro...
code_fim
hard
{ "lang": "python", "repo": "mdickson/maestro", "path": "/src/inworldz/util/provision.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): sma1, sma2 = bt.ind.SMA(period=self.p.pfast), bt.ind.SMA(period=self.p.pslow) self.signal_add(bt.SIGNAL_LONG, bt.ind.CrossOver(sma1, sma2)) cerebro = bt.Cerebro() data = bt.feeds.YahooFinanceData(dataname='YHOO.MX', fromdate=datetime(2016, 1, 1), ...
code_fim
medium
{ "lang": "python", "repo": "cimadure/datascience", "path": "/from_others/trading_back.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cimadure/datascience path: /from_others/trading_back.py from datetime import datetime import backtrader as bt class SmaCross(bt.SignalStrategy): <|fim_suffix|>cerebro.addstrategy(SmaCross) cerebro.run() cerebro.plot()<|fim_middle|> params = (('pfast', 10), ('pslow', 30),) def __init__(s...
code_fim
hard
{ "lang": "python", "repo": "cimadure/datascience", "path": "/from_others/trading_back.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># how long we wait between subsequent tracking, in seconds #this part before tracking starts measureDelay = 1.0 timepointA = time.monotonic(); while True: # this is the main loop of the tracker timepointB = time.monotonic() # in here all the per-tracking-loop logic if(timepointB-timepoi...
code_fim
hard
{ "lang": "python", "repo": "PUT-PTM/LapTracker", "path": "/LapTracker/LapTracker/Simulator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PUT-PTM/LapTracker path: /LapTracker/LapTracker/Simulator.py import csv import threading import time import sys from Distance import * from LineIntersection import * from OutOfTrack import * class Packet(object): def __init__(self, lat, lon, date): self.lat = float(lat) self....
code_fim
hard
{ "lang": "python", "repo": "PUT-PTM/LapTracker", "path": "/LapTracker/LapTracker/Simulator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TEMPLATE TO BE PUT INTO LapTracker.py # how long we wait between subsequent tracking, in seconds #this part before tracking starts #measureDelay = 2.0 #timepointA = time.monotonic(); # this is the main loop of the tracker #while(True): # timepointB = time.monotonic() # # in here all the per-trac...
code_fim
hard
{ "lang": "python", "repo": "PUT-PTM/LapTracker", "path": "/LapTracker/LapTracker/Simulator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> window.configure( width=100, height=100, x=0, y=0, border_width=1, ) for i in range(20): try: # Remove useless lib print stdout, sys.stdout = sys.stdout, StringIO() d = display.Display(sys.argv[1]) sys.stdout = stdout ...
code_fim
medium
{ "lang": "python", "repo": "paradoxxxzero/qtile", "path": "/test/scripts/window.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paradoxxxzero/qtile path: /test/scripts/window.py #!/usr/bin/env python2 """ This program is carefully crafted to exercise a number of corner-cases in Qtile. """ import sys import time from Xlib import display, error, X, protocol from StringIO import StringIO <|fim_suffix|> try: whi...
code_fim
hard
{ "lang": "python", "repo": "paradoxxxzero/qtile", "path": "/test/scripts/window.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>configure(window) window.map() d.sync() configure(window) try: while 1: event = d.next_event() if event.__class__ == protocol.event.ClientMessage: if d.get_atom_name(event.data[1][0]) == "WM_DELETE_WINDOW": sys.exit(1) except error.ConnectionClosedError: ...
code_fim
hard
{ "lang": "python", "repo": "paradoxxxzero/qtile", "path": "/test/scripts/window.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self): return self.impl() class _GetchUnix: def __init__(self): import tty, sys def __call__(self): import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ...
code_fim
hard
{ "lang": "python", "repo": "mathandy/Ear-Those-Notes", "path": "/getch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathandy/Ear-Those-Notes path: /getch.py """" This module sets of the getch() function, which is like input(), but only takes a single character, and doesn't require the user to press enter. Credit: https://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user """ # Fo...
code_fim
hard
{ "lang": "python", "repo": "mathandy/Ear-Those-Notes", "path": "/getch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amdexa/web-console path: /app.py #!/usr/bin/env python3 from gevent import monkey monkey.patch_all() from flask import Flask from flask import request from flask import Response from flask import render_template from functools import wraps from gevent.pywsgi import WSGIServer app = Flask(__name...
code_fim
medium
{ "lang": "python", "repo": "amdexa/web-console", "path": "/app.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> auth = request.authorization if not auth or not check_auth(auth.username, auth.password): return authenticate() return f(*args, **kwargs) return decorated @app.route('/') @requires_auth def index(): return render_template("index.html") server = WSGIServer(('0.0....
code_fim
hard
{ "lang": "python", "repo": "amdexa/web-console", "path": "/app.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zanfire/qgis-utils path: /gjko-plugin/dialogs/Ui_Progress.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'dialogs/Ui_Progress.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, Qt...
code_fim
medium
{ "lang": "python", "repo": "zanfire/qgis-utils", "path": "/gjko-plugin/dialogs/Ui_Progress.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(401, 91) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizeP...
code_fim
medium
{ "lang": "python", "repo": "zanfire/qgis-utils", "path": "/gjko-plugin/dialogs/Ui_Progress.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return QtGui.QApplication.translate(context, text, disambig) class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(401, 91) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) ...
code_fim
medium
{ "lang": "python", "repo": "zanfire/qgis-utils", "path": "/gjko-plugin/dialogs/Ui_Progress.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuergenBS/rocket-python path: /rocketchat/calls/im/create_room.py import logging from rocketchat.calls.base import PostMixin, RocketChatBase logger = logging.getLogger(__name__) class CreateImRoom(PostMixin, RocketChatBase): endpoint = "/api/v1/im.create" <|fim_suffix|> return sel...
code_fim
hard
{ "lang": "python", "repo": "JuergenBS/rocket-python", "path": "/rocketchat/calls/im/create_room.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def build_payload(self, **kwargs): return {"username": kwargs.get("username")} def post_response(self, result): try: _room = result.get('room') room_dict = dict() room_dict['id'] = _room.get('_id') for username in _room.get("usernam...
code_fim
hard
{ "lang": "python", "repo": "JuergenBS/rocket-python", "path": "/rocketchat/calls/im/create_room.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> kwargs.update(request.GET.dict()) body, status = self.view_factory.create().get(**kwargs) return HttpResponse(json.dumps(body), status=status, content_type='application/json') def post(self, request, *args, **kwargs): kwargs.update(request.POST.dict()) body, st...
code_fim
medium
{ "lang": "python", "repo": "vartagg/abidria-api", "path": "/abidria/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vartagg/abidria-api path: /abidria/views.py import json import urllib.parse from django.http import HttpResponse from django.views import View class ViewWrapper(View): <|fim_suffix|> kwargs.update(request.POST.dict()) body, status = self.view_factory.create().post(**kwargs) ...
code_fim
hard
{ "lang": "python", "repo": "vartagg/abidria-api", "path": "/abidria/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ltqsoft/BEER path: /BlenderMalt/Malt/Render/Lighting.py # Copyright (c) 2020 BlenderNPR and contributors. MIT license. import ctypes LIGHT_SUN = 1 LIGHT_POINT = 2 LIGHT_SPOT = 3 class C_Light(ctypes.Structure): _fields_ = [ ('color', ctypes.c_float*3), ('type', ctypes.c_int...
code_fim
medium
{ "lang": "python", "repo": "ltqsoft/BEER", "path": "/BlenderMalt/Malt/Render/Lighting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class LightsBuffer(ctypes.Structure): _fields_ = [ ('lights', C_Light*128), ('lights_count', ctypes.c_int), ]<|fim_prefix|># repo: ltqsoft/BEER path: /BlenderMalt/Malt/Render/Lighting.py # Copyright (c) 2020 BlenderNPR and contributors. MIT license. import ctypes LIGHT_SUN ...
code_fim
hard
{ "lang": "python", "repo": "ltqsoft/BEER", "path": "/BlenderMalt/Malt/Render/Lighting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not output_file: output_file = input_file + '.fsv_meta' with TempDirectory() as temp_dir: self._do_generate(input_file, output_file, temp_dir) def _do_generate(self, input_file, output_file, work_dir): # temporary files desc_file = os.path.join(work_dir, 'desc') merk...
code_fim
hard
{ "lang": "python", "repo": "aosp-mirror/platform_build", "path": "/tools/releasetools/fsverity_metadata_generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aosp-mirror/platform_build path: /tools/releasetools/fsverity_metadata_generator.py #!/usr/bin/env python # # Copyright 2021 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Yo...
code_fim
hard
{ "lang": "python", "repo": "aosp-mirror/platform_build", "path": "/tools/releasetools/fsverity_metadata_generator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dragomirradev/wikihow-qa path: /services/wikihow-bert/bert_pipeline_new.py from __future__ import print_function, division import logging import os import time import torch import torch.nn.functional as F import torch.optim as optim from pytorch_pretrained_bert import BertTokenizer, BertConfig #...
code_fim
hard
{ "lang": "python", "repo": "dragomirradev/wikihow-qa", "path": "/services/wikihow-bert/bert_pipeline_new.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def save_model(model, optimizer, epoch, mode, total_loss): print("Saving current model") torch.save({ 'epoch': epoch, 'phase': mode, 'model_state_dict': model.state_dict(), 'optimizer_state_dict': optimizer.state_dict(), 'total_loss': total_loss, }, PAT...
code_fim
hard
{ "lang": "python", "repo": "dragomirradev/wikihow-qa", "path": "/services/wikihow-bert/bert_pipeline_new.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/haul path: /haul/extenders/pipeline/google.py # coding: utf-8 import re def blogspot_s1600_extender(pipeline_index, finder_image_urls, extender_image_urls=[], *args, **kwargs): """ Example: ...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/haul", "path": "/haul/extenders/pipeline/google.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> search_re = re.compile(r'/w\d+\-h\d+\-no/', re.IGNORECASE) for image_url in finder_image_urls: if 'googleusercontent.com/' in image_url.lower(): if search_re.search(image_url): extender_image_url = search_re.sub('/s1600/', image_url) now_extende...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/haul", "path": "/haul/extenders/pipeline/google.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def googleusercontent_s1600_extender(pipeline_index, finder_image_urls, extender_image_urls=[], *args, **kwargs): """ Example: https://lh6.googleusercontent.com/-T6V-utZHzbE/Ukjn-1MDO...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/haul", "path": "/haul/extenders/pipeline/google.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Let's plot the line y = y-bar plt.scatter(x, y) plt.plot([0,10],[np.mean(y), np.mean(y)]) plt.show() # Let's see how the regression did plt.scatter(x, y) plt.plot([0,10],[0,a*10+b]) plt.show()<|fim_prefix|># repo: randy3465/yatml path: /l1-fundamentals/p1-linreg.py import matplotlib.pyplot a...
code_fim
hard
{ "lang": "python", "repo": "randy3465/yatml", "path": "/l1-fundamentals/p1-linreg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Let's see how the regression did plt.scatter(x, y) plt.plot([0,10],[0,a*10+b]) plt.show()<|fim_prefix|># repo: randy3465/yatml path: /l1-fundamentals/p1-linreg.py import matplotlib.pyplot as plt import numpy as np plt.xkcd() # Some random points x = [1,1,2,3.5,5,6,7.5,8,8,10] y = [2,1,5,6...
code_fim
medium
{ "lang": "python", "repo": "randy3465/yatml", "path": "/l1-fundamentals/p1-linreg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: randy3465/yatml path: /l1-fundamentals/p1-linreg.py import matplotlib.pyplot as plt import numpy as np plt.xkcd() <|fim_suffix|># Let's plot the line y = y-bar plt.scatter(x, y) plt.plot([0,10],[np.mean(y), np.mean(y)]) plt.show() # Let's see how the regression did plt.scatter(x, ...
code_fim
hard
{ "lang": "python", "repo": "randy3465/yatml", "path": "/l1-fundamentals/p1-linreg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>config = Config(args) poker = Poker( config, version_control_service=GitlabVersionControlService(config), messaging_service=MessagingServiceMultiplex( config, [ SlackMessagingService(config) ] ) ) poker.send_pokes()<|fim_prefix|># repo: CaperAi/branchpok...
code_fim
hard
{ "lang": "python", "repo": "CaperAi/branchpoke", "path": "/caper/branchpoke/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CaperAi/branchpoke path: /caper/branchpoke/main.py from argparse import ArgumentParser from caper.branchpoke.config import Config from caper.branchpoke.gl import GitlabVersionControlService from caper.branchpoke.messaging import MessagingServiceMultiplex from caper.branchpoke.poke import Poker f...
code_fim
hard
{ "lang": "python", "repo": "CaperAi/branchpoke", "path": "/caper/branchpoke/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: myao9494/heatrapy path: /heatrapy/solvers/__init__.py """Solvers. This submodule contains the solvers for the computation of thermal processes. """ <|fim_suffix|>__all__ = [implicit_k, implicit_general, explicit_k, explicit_general]<|fim_middle|>from .implicit_k import implicit_k from .implici...
code_fim
medium
{ "lang": "python", "repo": "myao9494/heatrapy", "path": "/heatrapy/solvers/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [implicit_k, implicit_general, explicit_k, explicit_general]<|fim_prefix|># repo: myao9494/heatrapy path: /heatrapy/solvers/__init__.py """Solvers. This submodule contains the solvers for the computation of thermal processes. <|fim_middle|>""" from .implicit_k import implicit_k from .implici...
code_fim
medium
{ "lang": "python", "repo": "myao9494/heatrapy", "path": "/heatrapy/solvers/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._ubat[1] # Battery current @reify def _ibat(self): data = self.communicate('W', '\x36\x05\x00') ibat_scale, ignore, ibat_offset = unpack('<h B h', data[3:8]) return (ibat_scale, ibat_offset) @property def ibat_scale(self): return se...
code_fim
hard
{ "lang": "python", "repo": "tuomassalo/ib.victron", "path": "/ib/victron/mk2.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuomassalo/ib.victron path: /ib/victron/mk2.py # Basic format is # 1. <Length> 0xFF <Command> <Data 0 > ... <Data n-1 > <Checksum> # 2. <Length> is the number of bytes in the frame, excluding the length and # checksum bytes. # 3. If the MSB of <Length> is a 1, then this frame has LED status appen...
code_fim
hard
{ "lang": "python", "repo": "tuomassalo/ib.victron", "path": "/ib/victron/mk2.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> data = self.communicate('F', '\x00') ubat = unpack('<H', data[6:8])[0] ibat = unpack('<i', data[8:11] + ('\0' if data[10] < '\x80' else '\xff'))[0] icharge = unpack('<i', data[11:14] + ('\0' if data[13] < '\x80' else '\xff'))[0] return DataObject({ 'ubat...
code_fim
hard
{ "lang": "python", "repo": "tuomassalo/ib.victron", "path": "/ib/victron/mk2.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> :param str subscribe_condition: 订阅条件 :param dict mapping: 策略名与执行方法的映射 :param str from_key: 关注的事件中的字段名 :param BaseExecFuncSet func_set: 执行方法类 :param int process_count: 进程数量 """ sen = MqPushCallbackSensor(subscribe_condition) dec = decis...
code_fim
hard
{ "lang": "python", "repo": "meetbill/ARK", "path": "/ark/assemble/amqpush_keymapping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: meetbill/ARK path: /ark/assemble/amqpush_keymapping.py # -*- coding: UTF-8 -*- ################################################################################ # # Copyright (c) 2018 Baidu.com, Inc. All Rights Reserved # #######################################################################...
code_fim
medium
{ "lang": "python", "repo": "meetbill/ARK", "path": "/ark/assemble/amqpush_keymapping.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>g.vs['pagerank'] = g.pagerank() log_vals = [-math.log(x) for x in g.vs["pagerank"]] plt.hist(log_vals, bins = 100) plt.title("PageRank Stats of Entities") plt.xlabel("Pagerank of entities (-ve log scale)") plt.ylabel("# of entities") plt.savefig("pgrank_distn.png") plt.close() g.vs["tx_balance"] = (np.ar...
code_fim
hard
{ "lang": "python", "repo": "animeshbchowdhury/bitcoinCodeRepos", "path": "/bstatCode/source/graph_stats.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: animeshbchowdhury/bitcoinCodeRepos path: /bstatCode/source/graph_stats.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 4 23:03:10 2017 @author: ritwiksadhu """ import math from igraph import Graph, IN, OUT import scipy.stats as stats import numpy as np from matplotlib i...
code_fim
hard
{ "lang": "python", "repo": "animeshbchowdhury/bitcoinCodeRepos", "path": "/bstatCode/source/graph_stats.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#Cliques in the graph cliques_list = g.maximal_cliques(min = 4) file = open('/media/ritwiksadhu/2612F1F212F1C739/Users/Ritwik Sadhu/AnacondaProjects/Bitcoin/Clique_info.txt', mode ='w') file.writelines('Number of cliques in the graph (size >= 3): ' + str(len(cliques_list))) file.writelines('Maximal clique...
code_fim
hard
{ "lang": "python", "repo": "animeshbchowdhury/bitcoinCodeRepos", "path": "/bstatCode/source/graph_stats.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: macs3-project/MACS path: /MACS3/Commands/callpeak_cmd.py error_stream("Chromosome names in treatment: %s" % ",".join(sorted(tchrnames))) error_stream("Chromosome names in control: %s" % ",".join(sorted(cchrnames))) sys.exit() def run( args ): """The Main function/pipelin...
code_fim
hard
{ "lang": "python", "repo": "macs3-project/MACS", "path": "/MACS3/Commands/callpeak_cmd.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # filter out low FE peaks peakdetect.peaks.filter_fc( fc_low = options.fecutoff ) #4 output #4.1 peaks in XLS info("#4 Write output xls file... %s" % (options.peakxls)) ofhd_xls = open( options.peakxls, "w" ) ofhd_xls.write("# This file is generated by MACS version %s\n" % (MA...
code_fim
hard
{ "lang": "python", "repo": "macs3-project/MACS", "path": "/MACS3/Commands/callpeak_cmd.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ return binomial_cdf_inv(1-p,tags_number,1.0/genome_size) def load_frag_files_options ( options ): """From the options, load treatment fragments and control fragments (if available). """ options.info("#1 read treatment fragments...") tp = options.parser(options.tfile[0], buff...
code_fim
hard
{ "lang": "python", "repo": "macs3-project/MACS", "path": "/MACS3/Commands/callpeak_cmd.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: waldemarantypov/invest_tgbot path: /tgbot/handlers/handlers.py ard_for_modify_options, make_keyboard_for_modify_to_invest_or_back,\ make_keyboard_for_add_stock_go_back, make_keyboard_for_delete_stock, make_keyboard_for_portfolio_total,\ make_keyboard_for_portfolio_net, make_keyboard_for_p...
code_fim
hard
{ "lang": "python", "repo": "waldemarantypov/invest_tgbot", "path": "/tgbot/handlers/handlers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: waldemarantypov/invest_tgbot path: /tgbot/handlers/handlers.py elif query.data == 'Total': text = portfolio_output_total(p, s) reply_markup = make_keyboard_for_portfolio_costs(language) elif query.data == 'Costs': text = portfolio_output_costs(p, s) reply_ma...
code_fim
hard
{ "lang": "python", "repo": "waldemarantypov/invest_tgbot", "path": "/tgbot/handlers/handlers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Portfolio Second menu Button: Balance Inline: modify stock check ''' @check_language @send_typing_action @handler_logging() def inline_modify_stock_check(update, context, language): try: context.bot.edit_message_reply_markup(chat_id=update.effective_chat.id, ...
code_fim
hard
{ "lang": "python", "repo": "waldemarantypov/invest_tgbot", "path": "/tgbot/handlers/handlers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Orieus/one_def_classification path: /labelfactory/activelearning/test_block_psel.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ This script is aimed at evaluating the behavior of tourney_prob, which computes the selection probabilities in a set of size N. The selection probabi...
code_fim
hard
{ "lang": "python", "repo": "Orieus/one_def_classification", "path": "/labelfactory/activelearning/test_block_psel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t0 = time() p_selb = tourney_prob_block(n, ts, k_min, k_max) print("---- Block computation in {} seconds.".format(time() - t0)) print("\nResult differences:") # print("---- True selection probabilities: {}".format(p_sel)) # print("---- Block selection probabilities: {}".format(p_selb)) print("--...
code_fim
hard
{ "lang": "python", "repo": "Orieus/one_def_classification", "path": "/labelfactory/activelearning/test_block_psel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/1170-Compare-Strings-by-Frequency-of-the-Smallest-Character/soln.py class Solution: def numSmallerByFrequency(self, queries: List[str], words: List[str]) -> List[int]: <|fim_suffix|> chars = [0] * 26 for ch in word: ...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/1170-Compare-Strings-by-Frequency-of-the-Smallest-Character/soln.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> chars = [0] * 26 for ch in word: chars[ord(ch) - ord('a')] += 1 for i in range(26): if chars[i]: return chars[i] freqs = [compute_f(word) for word in words] freqs.sort() ans = [] for que...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/1170-Compare-Strings-by-Frequency-of-the-Smallest-Character/soln.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_model_endog_regi_error(self): #Columbus: reg = SP.GM_Endog_Error_Regimes(self.y, self.X1, self.yd, self.q, self.regimes, self.w, regime_err_sep=True) betas = np.array([[ 7.91729500e+01], [ 5.80693176e+00], [ -3.84036576e+00], [ 1.46462983e-01], ...
code_fim
hard
{ "lang": "python", "repo": "ocefpaf/pysal", "path": "/pysal/model/spreg/tests/test_error_sp_regimes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_model_combo_regi_error(self): #Columbus: reg = SP.GM_Combo_Regimes(self.y, self.X1, self.regimes, self.yd, self.q, w=self.w, regime_lag_sep=True, regime_err_sep=True) betas = np.array([[ 42.01035248], [ -0.13938772], [ -0.6528306 ], [ 0.54737621],...
code_fim
hard
{ "lang": "python", "repo": "ocefpaf/pysal", "path": "/pysal/model/spreg/tests/test_error_sp_regimes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ocefpaf/pysal path: /pysal/model/spreg/tests/test_error_sp_regimes.py import unittest import scipy import pysal.lib import numpy as np from pysal.model.spreg import error_sp_regimes as SP from pysal.model.spreg.error_sp import GM_Error, GM_Endog_Error, GM_Combo from pysal.lib.common import RTOL ...
code_fim
hard
{ "lang": "python", "repo": "ocefpaf/pysal", "path": "/pysal/model/spreg/tests/test_error_sp_regimes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>dp[0]=[1,0] dp[1]=[0,1] for i in range(2,N+1): dp[i][0]=dp[i-1][0]+dp[i-2][0] dp[i][1]=dp[i-1][1]+dp[i-2][1] print(dp[N][0],dp[N][1])<|fim_prefix|># repo: DongHyunByun/algorithm_practice path: /dp/[boj]1003_피보나치함수_dp.py T=int(input()) for t in range(T...
code_fim
medium
{ "lang": "python", "repo": "DongHyunByun/algorithm_practice", "path": "/dp/[boj]1003_피보나치함수_dp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }