code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def convert_idx(text, tokens): current = 0 spans = [] for token in tokens: current = text.find(token, current) if current < 0: print('Token {} cannot be found'.format(token)) raise Exception() spans.append((current, current + len...
flexible
{ "blob_id": "5cd9d4fe9889c4d53b50d86fa78ae84d0c242536", "index": 3693, "step-1": "<mask token>\n\n\ndef convert_idx(text, tokens):\n current = 0\n spans = []\n for token in tokens:\n current = text.find(token, current)\n if current < 0:\n print('Token {} cannot be found'.format(...
[ 5, 6, 7, 8, 10 ]
#!/usr/bin/env python3 import numpy as np from DMP.PIDMP import RLDMPs import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D np.random.seed(50) dmp_y0 = np.array([-1.52017496, 0.04908739, 1.41433029]) dmp_goal = np.array([-1.50848603, 0.0591503 , 1.44347592]) load_file_name = "w_0_2_right_3...
normal
{ "blob_id": "5e6bbb10ec82e566c749dd4d794eabd2e8f7a648", "index": 4488, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(50)\n<mask token>\nrl.load_weight(load_file_name)\n<mask token>\nprint(rl.w)\n<mask token>\nplt.scatter(x, track.y[0][:, 0], c='b', label='random')\nplt.scatter(x, track.y[...
[ 0, 1, 2, 3, 4 ]
""" ====================== @author:小谢学测试 @time:2021/9/8:8:34 @email:xie7791@qq.com ====================== """ import pytest # @pytest.fixture() # def login(): # print("登录方法") # def pytest_conftest(config): # marker_list = ["search","login"] # for markers in marker_list: # config.addinivalue_line("m...
normal
{ "blob_id": "b52429f936013ac60659950492b67078fabf3a13", "index": 4042, "step-1": "<mask token>\n", "step-2": "<mask token>\nimport pytest\n", "step-3": "\"\"\"\n======================\n@author:小谢学测试\n@time:2021/9/8:8:34\n@email:xie7791@qq.com\n======================\n\"\"\"\nimport pytest\n# @pytest.fixture(...
[ 0, 1, 2 ]
import vobject import glob import sys vobj=vobject.readOne(open("Nelson.vcf")) print vobj.contents def main(args): suma = 0 titulos = ['nombre del archivo', 'Total', 'subtotoal', 'rfc', 'fecha', 'ivaTrasladado', 'isrTrasladado', 'ivaRetenido', 'isrRetenido'] import csv out = csv.writer(open("out.csv"...
normal
{ "blob_id": "a1115766c5f17abc1ba90a3314cb5b9c4aab73d6", "index": 8169, "step-1": "import vobject\nimport glob\nimport sys\n\nvobj=vobject.readOne(open(\"Nelson.vcf\"))\nprint vobj.contents\n\n\ndef main(args):\n suma = 0\n titulos = ['nombre del archivo', 'Total', 'subtotoal', 'rfc', 'fecha', 'ivaTrasladad...
[ 0 ]
""" ============================== Visualize Cylinder with Wrench ============================== We apply a constant body-fixed wrench to a cylinder and integrate acceleration to twist and exponential coordinates of transformation to finally compute the new pose of the cylinder. """ import numpy as np from pytransform...
normal
{ "blob_id": "2019a2a5588e57164ff4226ef3bcbbc506f2b315", "index": 7432, "step-1": "<mask token>\n\n\ndef animation_callback(step, cylinder, cylinder_frame, prev_cylinder2world,\n Stheta_dot, inertia_inv):\n if step == 0:\n prev_cylinder2world[:, :] = np.eye(4)\n Stheta_dot[:] = 0.0\n wrench...
[ 1, 3, 4, 5, 6 ]
from functools import wraps from flask import request, abort # Apply Aspect Oriented Programming to server routes using roles # e.g. we want to specify the role, perhaps supplied # by the request or a jwt token, using a decorator # to abstract away the authorization # possible decorator implementation def roles_requ...
normal
{ "blob_id": "1adaca88cf41d4e4d3a55996022278102887be07", "index": 3707, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef roles_required(roles):\n\n def decorator(func):\n\n @wraps(func)\n def wrapper(*args, **kwargs):\n print(roles, 'required')\n print(args, kw...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def RangeExtender(filename, directory): fileNC = nc.Dataset(directory + filename, 'r') nu = fileNC['nu'][:] filename, ext = os.path.splitext(filename) fileOut = nc.Dataset(directory + filename + '_50000cm-1.nc', 'w') nu_orig_length = len(nu) step = abs(nu[1] - nu[0...
flexible
{ "blob_id": "f3527185117fd7205f55f47f2f08448a7d7b0100", "index": 8143, "step-1": "<mask token>\n\n\ndef RangeExtender(filename, directory):\n fileNC = nc.Dataset(directory + filename, 'r')\n nu = fileNC['nu'][:]\n filename, ext = os.path.splitext(filename)\n fileOut = nc.Dataset(directory + filename ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(' sum of n numbers with help of for loop. ') <|reserved_special_token_0|> for num in range(0, n + 1, 1): sum = sum + num print('Output: SUM of first ', n, 'numbers is: ', sum) print(' sum of n numbers with help of while loop. ') <|reserved_special_t...
flexible
{ "blob_id": "d3c36ad36c50cd97f2101bc8df99d1961b0ad7ea", "index": 4078, "step-1": "<mask token>\n", "step-2": "print(' sum of n numbers with help of for loop. ')\n<mask token>\nfor num in range(0, n + 1, 1):\n sum = sum + num\nprint('Output: SUM of first ', n, 'numbers is: ', sum)\nprint(' sum of n numbers w...
[ 0, 1, 2, 3 ]
import math def Distance(t1, t2): RADIUS = 6371000. # earth's mean radius in km p1 = [0, 0] p2 = [0, 0] p1[0] = t1[0] * math.pi / 180. p1[1] = t1[1] * math.pi / 180. p2[0] = t2[0] * math.pi / 180. p2[1] = t2[1] * math.pi / 180. d_lat = (p2[0] - p1[0]) d_lon = (p2[1] - p1[1]) ...
normal
{ "blob_id": "f3f5b14917c89c5bc2866dd56e212bd3ec8af1cd", "index": 4841, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tile_number(lon_deg, lat_deg, zoom):\n n = 2.0 ** zoom\n xtile = int((lon_deg + 180.0) / 360.0 * n)\n ytile = int((lat_deg + 90.0) / 180.0 * n)\n return xtile, ytile\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def hello(): messagebox.showinfo('Say Hello', 'Hello World') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def hello(): messagebox.showinfo('Say Hello', 'Hello World') <|reserved_special_token_0|> B1.pack() mainloop() <|reserved_...
flexible
{ "blob_id": "61e38ae6ae2a1ed061f9893742f45b3e44f19a68", "index": 6110, "step-1": "<mask token>\n\n\ndef hello():\n messagebox.showinfo('Say Hello', 'Hello World')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef hello():\n messagebox.showinfo('Say Hello', 'Hello World')\n\n\n<mask token>\nB1.pack()...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .gunicorn import * from .server_app import *
flexible
{ "blob_id": "ed5dd954dedb00bf645f9ca14b5ca9cd122b2adc", "index": 6183, "step-1": "<mask token>\n", "step-2": "from .gunicorn import *\nfrom .server_app import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
def test(x): print x
normal
{ "blob_id": "78e008b4a51cdbbb81dead7bc5945ee98ccad862", "index": 8266, "step-1": "def test(x):\n print x\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
rule run_all: shell: ''' echo 'Hello World!' '''
normal
{ "blob_id": "c967a63d03f9f836d97ae917dba2a7bfb7a54a0e", "index": 9673, "step-1": "rule run_all:\n shell:\n '''\n echo 'Hello World!'\n '''\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def lucky(ticket): def sum_(number): number = str(number) while len(number) != 6: number = '0' + number x = list(map(int, number)) return sum(x[:3]) == sum(x[3:]) return 'Счастливый' if sum_(ticket) == sum_...
flexible
{ "blob_id": "85ac851e28dba3816f18fefb727001b8e396cc2b", "index": 5278, "step-1": "<mask token>\n", "step-2": "def lucky(ticket):\n\n def sum_(number):\n number = str(number)\n while len(number) != 6:\n number = '0' + number\n x = list(map(int, number))\n return sum(x[:...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def console_check(csl, f): if csl == 'playstation-4': f.write('\tdbo:computingPlatform dbpedia:PlayStation_4.') if csl == 'playstation-3': f.write('\tdbo:computingPlatform dbpedia:PlayStation_3.') if csl == 'playstation-2': f.write('\tdbo:computingPlatf...
flexible
{ "blob_id": "b290763362af96f5af03fa31f4936339cef66a1d", "index": 2062, "step-1": "<mask token>\n\n\ndef console_check(csl, f):\n if csl == 'playstation-4':\n f.write('\\tdbo:computingPlatform dbpedia:PlayStation_4.')\n if csl == 'playstation-3':\n f.write('\\tdbo:computingPlatform dbpedia:Pla...
[ 6, 7, 8, 9, 10 ]
# encoding: utf-8 ''' Created on Nov 26, 2015 @author: tal Based in part on: Learn math - https://github.com/fchollet/keras/blob/master/examples/addition_rnn.py See https://medium.com/@majortal/deep-spelling-9ffef96a24f6#.2c9pu8nlm """ Modified by Pavel Surmenok ''' import argparse import numpy as np from keras.l...
normal
{ "blob_id": "572a098053ebae4f42cd020d1003cc18eceb6af0", "index": 4984, "step-1": "<mask token>\n\n\ndef generate_model(output_len, chars=None):\n \"\"\"Generate the model\"\"\"\n print('Build model...')\n chars = chars or CHARS\n model = Sequential()\n for layer_number in range(INPUT_LAYERS):\n ...
[ 6, 7, 8, 10, 12 ]
from ..scope_manager import ScopeManager from ..span import Span from ..tracer import Tracer from .propagator import Propagator class MockTracer(Tracer): def __init__(self, scope_manager: ScopeManager | None = ...) -> None: ... def register_propagator(self, format: str, propagator: Propagator) -> None: ... ...
normal
{ "blob_id": "76d2c80c673f9a0444e72721909a51479ff35521", "index": 1785, "step-1": "<mask token>\n\n\nclass MockTracer(Tracer):\n\n def __init__(self, scope_manager: (ScopeManager | None)=...) ->None:\n ...\n\n def register_propagator(self, format: str, propagator: Propagator) ->None:\n ...\n ...
[ 3, 4, 5, 6, 7 ]
from timemachines.skatertools.testing.allregressiontests import REGRESSION_TESTS import time import random TIMEOUT = 60*5 # Regression tests run occasionally to check various parts of hyper-param spaces, etc. if __name__=='__main__': start_time = time.time() elapsed = time.time()-start_time while elapsed ...
normal
{ "blob_id": "710bb0e0efc2c4a3ba9b1ae85e1c22e81f8ca68e", "index": 7960, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n start_time = time.time()\n elapsed = time.time() - start_time\n while elapsed < TIMEOUT:\n a_test = random.choice(REGRESSION_TESTS)\n p...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 """SCALE UI: feature tests.""" import pytest import xpaths from function import ( wait_on_element, is_element_present, wait_on_element_disappear ) from pytest_bdd import ( given, scenario, then, when, ) @pytest.mark.dependency(name='Set_Group') @scenario('features/NAS-T1250...
normal
{ "blob_id": "f4aaf0449bff68814090552ea4f6ccac85dacf1b", "index": 5617, "step-1": "<mask token>\n\n\n@given('the browser is open, navigate to the SCALE URL, and login')\ndef the_browser_is_open_navigate_to_the_scale_url_and_login(driver, nas_ip,\n root_password):\n \"\"\"the browser is open, navigate to the...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def sum_numbers(numbers=None): sum = 0 if numbers == None: for number in range(1, 101): sum += number return sum for number in numbers: sum += number return sum
flexible
{ "blob_id": "a85d06d72b053b0ef6cb6ec2ba465bfb8975b28e", "index": 3879, "step-1": "<mask token>\n", "step-2": "def sum_numbers(numbers=None):\n sum = 0\n if numbers == None:\n for number in range(1, 101):\n sum += number\n return sum\n for number in numbers:\n sum += num...
[ 0, 1 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ created by gjwei on 3/26/17 """ class ListNode(object): def __init__(self, x): self.val = x self.next = None a = ListNode(1) a.next = ListNode(3) a.next = None print a.val print a.next def main(): print "hello" a = [] for i in r...
normal
{ "blob_id": "4a0cbd59ffae4fb5ba6e3bd871231e37065d1aed", "index": 3464, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\" \n created by gjwei on 3/26/17\n \n\"\"\"\nclass ListNode(object):\n def __init__(self, x):\n self.val = x\n self.next = None\n\n\na = ListNode(1)\na.next = L...
[ 0 ]
# -*- coding: utf-8 -*- # @time : 2021/1/10 10:25 # @Author : Owen # @File : mainpage.py from selenium.webdriver.common.by import By from homework.weixin.core.base import Base from homework.weixin.core.contact import Contact ''' 企业微信首页 ''' class MainPage(Base): #跳转到联系人页面 def goto_contact(self): ...
normal
{ "blob_id": "7775d260f0db06fad374d9f900b03d8dbcc00762", "index": 6504, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MainPage(Base):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass MainPage(Base):\n\n def goto_contact(self):\n self.find(By.CSS_SELECTOR, '#menu_contacts').c...
[ 0, 1, 2, 3, 4 ]
print(60 * 60) seconds_per_hour = 60 * 60 print(24 * seconds_per_hour) seconds_per_day = 24 * seconds_per_hour print(seconds_per_day / seconds_per_hour) print(seconds_per_day // seconds_per_hour)
normal
{ "blob_id": "358879d83ed3058530031d50fb69e3ce11fbd524", "index": 1057, "step-1": "<mask token>\n", "step-2": "print(60 * 60)\n<mask token>\nprint(24 * seconds_per_hour)\n<mask token>\nprint(seconds_per_day / seconds_per_hour)\nprint(seconds_per_day // seconds_per_hour)\n", "step-3": "print(60 * 60)\nseconds_...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> MyScheduler = Scheduler() <|reserved_special_token_1|> from .scheduler import Scheduler MyScheduler = Scheduler()
flexible
{ "blob_id": "d472a15d6fa826e50a550996369b00b6c599a1c7", "index": 5401, "step-1": "<mask token>\n", "step-2": "<mask token>\nMyScheduler = Scheduler()\n", "step-3": "from .scheduler import Scheduler\nMyScheduler = Scheduler()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# PySNMP SMI module. Autogenerated from smidump -f python DS0BUNDLE-MIB # by libsmi2pysnmp-0.1.3 at Thu May 22 11:57:37 2014, # Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) # Imports ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer",...
normal
{ "blob_id": "fab15d34d29301e53a26577725cdd66dca7507bc", "index": 2330, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n ds0Bundle.setOrganization('IETF Trunk MIB Working Group')\nif mibBuilder.loadTexts:\n ds0Bundle.setContactInfo(\n \"\"\" David Fowler\n\nPos...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import c...
normal
{ "blob_id": "84db1803a352e0ed8c01b7166f522d46ec89b6f5", "index": 2487, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor train_index, test_index in kf.split(x):\n xtr = x.iloc[train_index]\n ytr = y[train_index]\n<mask token>\nif k % 2 == 0:\n k = k + 1\nelse:\n k = k\n<mask token>\nprint('S...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestURLs: def test_url_1(self): assert is_url('http://heise.de') <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_valid_url_https_path(self): assert is_url('https://heise.de/thi_s&is=difficult') ...
flexible
{ "blob_id": "021f224d031477bd305644261ad4d79d9eca98b3", "index": 5474, "step-1": "<mask token>\n\n\nclass TestURLs:\n\n def test_url_1(self):\n assert is_url('http://heise.de')\n <mask token>\n <mask token>\n <mask token>\n\n def test_valid_url_https_path(self):\n assert is_url('http...
[ 3, 4, 7, 8, 10 ]
# encoding: utf-8 # -*- coding: utf-8 -*- """ The flask application package. """ #parse arguments from flask import Flask from flask_cors import CORS import argparse parser = argparse.ArgumentParser() parser.add_argument('-t', '--testing', action='store_true') #to use the testing database parser.add_argument('-i', ...
normal
{ "blob_id": "e403a84ec2a3104cb908933f6949458cccc791c3", "index": 4737, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-t', '--testing', action='store_true')\nparser.add_argument('-i', '--init', action='store_true')\nparser.add_argument('-r', '--reinit', action='store_true')\n<mask to...
[ 0, 1, 2, 3, 4 ]
#Importacion de Dependencias Flask from flask import Blueprint,Flask, render_template, request,redirect,url_for,flash #modelado de basedato. from App import db # Importacion de modulo de ModeloCliente from App.Modulos.Proveedor.model import Proveedor #Inportacion de modulo de formularioCliente from App.Modulos.Proveedo...
normal
{ "blob_id": "99ecb927e22bc303dd9dffd2793887e7398dbb83", "index": 3649, "step-1": "<mask token>\n\n\n@_Proveedor.route('/Proveedor', methods=['GET', 'POST'])\ndef proveedor():\n frm = form.Fr_Proveedor(request.form)\n if request.method == 'POST':\n pr = Proveedor.query.filter_by(CI=frm.CI.data).first...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class PersonInfo(scrapy.Item): person_id = scrapy.Field() buy_car = scrapy.Field() address = scrapy.Field() class OtherItem(scrapy.Item): """ 可以定义另外一个item """ user_info = scrapy.Field() main_url = scrapy.Field() nick_name = scrapy.Field() ...
flexible
{ "blob_id": "9dbadb2421b04961e8e813831d06abc1ff301566", "index": 3283, "step-1": "<mask token>\n\n\nclass PersonInfo(scrapy.Item):\n person_id = scrapy.Field()\n buy_car = scrapy.Field()\n address = scrapy.Field()\n\n\nclass OtherItem(scrapy.Item):\n \"\"\"\n 可以定义另外一个item\n \"\"\"\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('RUNNING ON CPU') <|reserved_special_token_0|> assert config.changePrice == True print(config.config) <|reserved_special_token_0|> for t in range(993, 4592): broker, totalOrders = broker_funcs.thresholdBrokerage(traderIDs, t, broker, totalOr...
flexible
{ "blob_id": "21aee78e8cbb1ca150bca880e79dc0d84326e2d4", "index": 4162, "step-1": "<mask token>\n", "step-2": "print('RUNNING ON CPU')\n<mask token>\nassert config.changePrice == True\nprint(config.config)\n<mask token>\nfor t in range(993, 4592):\n broker, totalOrders = broker_funcs.thresholdBrokerage(trade...
[ 0, 1, 2, 3, 4 ]
import urllib.request from bs4 import BeautifulSoup def getTitlesFromAll(amount, rating='all'): output = '' for i in range(1, amount+1): try: if rating == 'all': html = urllib.request.urlopen('https://habr.com/all/page'+ str(i) +'/').read() else: ...
normal
{ "blob_id": "d6cfea95c76021bdbfbb4471878c653564c9accd", "index": 1816, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getTitlesFromAll(amount, rating='all'):\n output = ''\n for i in range(1, amount + 1):\n try:\n if rating == 'all':\n html = urllib.request....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def AnalyzeFrames(vidpath): print('\nGetting video info & writing out image files for each frame...\n') vidObj = cv2.VideoCapture(vidpath) fps = vidObj.get(cv2.CAP_PROP_FPS) print('Frames per second: {0}\n'.format(fps)) count = 0 jpeglist = [] success = 1 w...
flexible
{ "blob_id": "d70d3d8eef711441ac89c2d98c72a5f95e0ab20d", "index": 5261, "step-1": "<mask token>\n\n\ndef AnalyzeFrames(vidpath):\n print('\\nGetting video info & writing out image files for each frame...\\n')\n vidObj = cv2.VideoCapture(vidpath)\n fps = vidObj.get(cv2.CAP_PROP_FPS)\n print('Frames per...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, os.path.dirname(__file__)) <|reserved_special_token_0|> for volume, frequency in notes: samples = square_wave(int(44100 / frequency // 2)) samples = gain(samples, volume) samples = repeat(samples, qu...
flexible
{ "blob_id": "4fb563985bd99599e88676e167ee84a95b018aba", "index": 5414, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, os.path.dirname(__file__))\n<mask token>\nfor volume, frequency in notes:\n samples = square_wave(int(44100 / frequency // 2))\n samples = gain(samples, volume)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Postfix: def __init__(self, regex): self.__regex = regex.expression self.__modr = Postfix.modRegex(self.__regex) self.__pila = Stack() self.__postfix = self.convertInfixToPostfix() <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "acc39044fa1ae444dd4a737ea37a0baa60a2c7bd", "index": 4040, "step-1": "<mask token>\n\n\nclass Postfix:\n\n def __init__(self, regex):\n self.__regex = regex.expression\n self.__modr = Postfix.modRegex(self.__regex)\n self.__pila = Stack()\n self.__postfix = self.convert...
[ 4, 5, 7, 9, 11 ]
""" A set of constants to describe the package. Don't put any code in here, because it must be safe to execute in setup.py. """ __title__ = 'space_tracer' # => name in setup.py __version__ = '4.10.2' __author__ = "Don Kirkby" __author_email__ = "donkirkby@gmail.com" __description__ = "Trade time for space when debug...
normal
{ "blob_id": "6cb29ebd9c0f2660d0eb868bec87ffd97cf4d198", "index": 6262, "step-1": "<mask token>\n", "step-2": "<mask token>\n__title__ = 'space_tracer'\n__version__ = '4.10.2'\n__author__ = 'Don Kirkby'\n__author_email__ = 'donkirkby@gmail.com'\n__description__ = 'Trade time for space when debugging your code.'...
[ 0, 1, 2 ]
class Coms: def __init__(self, name, addr, coord): self.name = name self.addr = addr self.coord = coord def getString(self): return "회사명\n"+self.name+"\n\n주소\n"+self.addr def getTeleString(self): return "회사명 : " + self.name + ", 주소 : " + self.addr class Jobs: d...
normal
{ "blob_id": "bcc24d5f97e46433acb8bcfb08fe582f51eb28ce", "index": 2932, "step-1": "<mask token>\n\n\nclass Jobs:\n\n def __init__(self, name, type, experience, education, keyword, salary,\n url, start, end):\n self.name = name\n self.type = type\n self.experience = experience\n ...
[ 4, 5, 6, 7, 9 ]
import pandas as pd from fbprophet import Prophet import os from utils.json_utils import read_json, write_json from sklearn.model_selection import train_test_split import numpy as np from sklearn.metrics import mean_absolute_error root_dir = "/home/charan/Documents/workspaces/python_workspaces/Data/ADL_Project/" final...
normal
{ "blob_id": "25dd7ea4a154e5693c65f8c42107224efee42516", "index": 4533, "step-1": "<mask token>\n\n\ndef mean_absolute_percentage_error(y_true, y_pred):\n y_true, y_pred = np.array(y_true), np.array(y_pred)\n return np.mean(np.abs((y_true - y_pred) / y_true)) * 100\n\n\n<mask token>\n", "step-2": "<mask t...
[ 1, 2, 3, 4, 5 ]
from microbit import * import speech while True: speech.say("I am a DALEK - EXTERMINATE", speed=120, pitch=100, throat=100, mouth=200) #kokeile muuttaa parametrejä
normal
{ "blob_id": "dad78d7948fb1038f9cf66732f39c18a18f2a3c8", "index": 5233, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n speech.say('I am a DALEK - EXTERMINATE', speed=120, pitch=100, throat=\n 100, mouth=200)\n", "step-3": "from microbit import *\nimport speech\nwhile True:\n s...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Mon Feb 20 17:13:46 2017 @author: pmonnot """ import blpapi import datetime # Create a Session session = blpapi.Session() # Start a Session if not session.start(): print "Failed to start session." if not session.openService("//blp/refdata"): print "Faile...
normal
{ "blob_id": "a8a2d672369f61c6412229380cc6097d152ba126", "index": 9883, "step-1": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Mon Feb 20 17:13:46 2017\r\n\r\n@author: pmonnot\r\n\"\"\"\r\n\r\nimport blpapi\r\nimport datetime\r\n\r\n# Create a Session\r\nsession = blpapi.Session()\r\n# Start a Session\r\nif n...
[ 0 ]
print ("Hello Workls!")
normal
{ "blob_id": "c52d1c187edb17e85a8e2b47aa6731bc9a41ab1b", "index": 561, "step-1": "<mask token>\n", "step-2": "print('Hello Workls!')\n", "step-3": "print (\"Hello Workls!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_pixel_pixelMatchesColor(): """屏幕像素获取、屏幕像素匹配""" print(pixelMatchesColor(44, 107, (148, 212, 234), tolerance=20)) print(pixelMatchesColor(44, 107, (100, 212, 234), tolerance=20)) <|reserved_special_token_0|>...
flexible
{ "blob_id": "c15faf9df8fa2e1ad89ea2c922ab0551eaa69d3f", "index": 1936, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_pixel_pixelMatchesColor():\n \"\"\"屏幕像素获取、屏幕像素匹配\"\"\"\n print(pixelMatchesColor(44, 107, (148, 212, 234), tolerance=20))\n print(pixelMatchesColor(44, 107, (100, 21...
[ 0, 1, 2, 3, 4 ]
#dict1 = {"я":"i","люблю":"love","Питон":"Рython"} #user_input = input("---->") #print(dict1[user_input]) #list1 =[i for i in range(0,101) if i%7 ==0 if i%5 !=0] #print(list1) #stroka = "я обычная строка быть которая должна быть длиннее чем десять символ" #stroka1=stroka.split() #dict1={} #for i in stroka1: # ...
normal
{ "blob_id": "c0512a90b6a4e50c41d630f6853d1244f78debfb", "index": 4350, "step-1": "#dict1 = {\"я\":\"i\",\"люблю\":\"love\",\"Питон\":\"Рython\"}\n#user_input = input(\"---->\")\n#print(dict1[user_input])\n\n\n#list1 =[i for i in range(0,101) if i%7 ==0 if i%5 !=0]\n#print(list1)\n\n\n\n#stroka = \"я обычная стро...
[ 1 ]
<|reserved_special_token_0|> def get_links_from_markdown(path, name): try: with open(path, 'r') as file: md = file.read() html = markdown.markdown(md) soup = BeautifulSoup(html, 'html.parser') return soup.find_all('a') except PermissionError: pri...
flexible
{ "blob_id": "274185896ab5c11256d69699df69fc2c0dde4f2d", "index": 987, "step-1": "<mask token>\n\n\ndef get_links_from_markdown(path, name):\n try:\n with open(path, 'r') as file:\n md = file.read()\n html = markdown.markdown(md)\n soup = BeautifulSoup(html, 'html.parser...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ceis_arquivo.reset_index() ceis_arquivo.info() <|reserved_special_token_0|> ceis_sp.to_csv('ceis_sp.csv') <|reserved_special_token_1|> <|reserved_special_token_0|> ceis_arquivo = pd.read_csv('20180225_CEIS.csv', sep=';', encodi...
flexible
{ "blob_id": "d2325b07d11e64df0b26d0de9992a6f496e92a30", "index": 2879, "step-1": "<mask token>\n", "step-2": "<mask token>\nceis_arquivo.reset_index()\nceis_arquivo.info()\n<mask token>\nceis_sp.to_csv('ceis_sp.csv')\n", "step-3": "<mask token>\nceis_arquivo = pd.read_csv('20180225_CEIS.csv', sep=';', encodi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ii = [('CoolWHM.py', 1), ('SoutRD.py', 1), ('BrewDTO.py', 2), ( 'FitzRNS2.py', 1), ('LyelCPG3.py', 1), ('TaylIF.py', 2)]
flexible
{ "blob_id": "fbba928d51ccd08dbac25fcf2098be3a0d494d34", "index": 6659, "step-1": "<mask token>\n", "step-2": "ii = [('CoolWHM.py', 1), ('SoutRD.py', 1), ('BrewDTO.py', 2), (\n 'FitzRNS2.py', 1), ('LyelCPG3.py', 1), ('TaylIF.py', 2)]\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1 ]
# # @lc app=leetcode.cn id=784 lang=python3 # # [784] 字母大小写全排列 # # @lc code=start # 回溯法 --> 通过 64 ms 13.5 MB class Solution: def __init__(self): self.result = [] def letterCasePermutation(self, S: str) -> List[str]: arr = list(S) self.backtracing(arr, 0) return self.result ...
normal
{ "blob_id": "632c690261b31c7ac0e1d90c814e3b9a7a0dcb29", "index": 7663, "step-1": "class Solution:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n\n def backtracing(self, arr, start):\n if start == len(arr):\n self.r...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class System: <|reserved_special_token_0|> def bind_manager(self, manager): self.manager = manager <|reserved_special_token_0|> def process(self, entity, deltaTime): pass <|reserved_special_token_0|> <|reserved_special_token_0|> def update_en...
flexible
{ "blob_id": "14f7f31fa64799cdc08b1363b945da50841d16b5", "index": 3020, "step-1": "<mask token>\n\n\nclass System:\n <mask token>\n\n def bind_manager(self, manager):\n self.manager = manager\n <mask token>\n\n def process(self, entity, deltaTime):\n pass\n <mask token>\n <mask tok...
[ 13, 14, 17, 18, 24 ]
<|reserved_special_token_0|> def bar(): print('Explicit context to bar') gevent.sleep(0) print('Implicit contenxt switch back to bar') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def foo(): print('Running in foo') gevent.sleep(0) print('Explici...
flexible
{ "blob_id": "7f131e17f4fbd7d6b333a51dae557ddb07c30046", "index": 9077, "step-1": "<mask token>\n\n\ndef bar():\n print('Explicit context to bar')\n gevent.sleep(0)\n print('Implicit contenxt switch back to bar')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef foo():\n print('Running in foo')...
[ 1, 2, 3, 4, 5 ]
cijferICOR = float(input('Wat is je cijfer voor ICOR?: ')) x = 30 beloningICOR = cijferICOR * x beloning = 'beloning €' print(beloning, beloningICOR) cijferPROG = float(input('Wat is je cijfer voor PROG: ')) beloningPROG = cijferPROG * x print(beloning, beloningPROG) cijferCSN = float(input('Wat is je cijfer voor CSN?:...
normal
{ "blob_id": "74bca94cbcba0851e13d855c02fbc13fb0b09e6a", "index": 4263, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(beloning, beloningICOR)\n<mask token>\nprint(beloning, beloningPROG)\n<mask token>\nprint(beloning, beloningCSN)\n<mask token>\nprint('de gemiddelde beloning is:€ ', gemiddelde / 3)...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Sat Sep 29 19:10:06 2018 @author: labuser """ # 2018-09-29 import os import numpy as np from scipy.stats import cauchy from scipy.optimize import curve_fit import matplotlib.pyplot as plt import pandas as pd def limit_scan(fname, ax): data = pd.read_csv(fname, sep='\t', ...
normal
{ "blob_id": "aee8fa7bc1426945d61421fc72732e43ddadafa1", "index": 3191, "step-1": "<mask token>\n\n\ndef cauchy_model(x, a, loc, scale, y0):\n return a * cauchy.pdf(x, loc, scale) + y0\n\n\ndef cauchy_fit(x, y, d):\n if d is -1:\n a0 = -(max(y) - min(y)) * (max(x) - min(x)) / 10\n loc0 = x[np....
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def PrintaLog(texto): t = time.time() logtime = time.ctime(t) stringprint = '%s %s\n' % (logtime, texto) f = open('/var/log/patriot', 'a') f.write(stringprint) f.flush() f.close() def PrintaMSG(texto): command = 'python3 alertiqt.py "' + texto + '"' p...
flexible
{ "blob_id": "fde62dd3f5ee3cc0a1568b037ada14835c327046", "index": 6298, "step-1": "<mask token>\n\n\ndef PrintaLog(texto):\n t = time.time()\n logtime = time.ctime(t)\n stringprint = '%s %s\\n' % (logtime, texto)\n f = open('/var/log/patriot', 'a')\n f.write(stringprint)\n f.flush()\n f.close...
[ 4, 6, 9, 10, 11 ]
import json import glob import sys searchAreaName = sys.argv[1] # searchAreaName = "slovenia_177sqkm_shards/20161220-162010-c9e0/slovenia_177sqkm_predicted/predict_slovenia_177sqkm_shard" print('./{0}_??.txt'.format(searchAreaName)) all_predicts = glob.glob('./{0}_??.txt'.format(searchAreaName)) def getBboxes(bboxes):...
normal
{ "blob_id": "8f9d823785d42d02a0a3d901d66b46a5cd59cdd7", "index": 7465, "step-1": "<mask token>\n\n\ndef getBboxes(bboxes):\n return [bb for bb in bboxes if sum(bb) > 0.0]\n\n\n<mask token>\n", "step-2": "<mask token>\nprint('./{0}_??.txt'.format(searchAreaName))\n<mask token>\n\n\ndef getBboxes(bboxes):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "ac664cd7d62f89399e37f74e0234b3ad244fe460", "index": 6158, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('tutorials',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def tm(): for i in range(3): print(time.ctime()) time.sleep(2) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def tm(): for i in range(3): print(time.ctime()) time.sleep(2) <|reserved_special_token_0|...
flexible
{ "blob_id": "9d7bc2d93b855fbd22a4707a6237ac51069beb53", "index": 9385, "step-1": "<mask token>\n\n\ndef tm():\n for i in range(3):\n print(time.ctime())\n time.sleep(2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef tm():\n for i in range(3):\n print(time.ctime())\n ti...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def max_digit(number: int) ->int: return max(int(i) for i in str(number)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def max_digit(number: int) ->int: return max(int(i) ...
flexible
{ "blob_id": "b25e9374458ead85535495e77a5c64117a8b1808", "index": 5761, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef max_digit(number: int) ->int:\n return max(int(i) for i in str(number))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef max_digit(number: int) ->int:\n return max(i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def notify_no_new_mapping_found(): email_str = """ <p>Python script does not find any new creative names from keepingtrac data. Stage 2 of processing RenTrak data will begin when we load new data to RenTrak tables. </p> <p><b>No further action on your p...
flexible
{ "blob_id": "71c6d5e385e3db8444d7ef8b0231e72db8538eb7", "index": 8106, "step-1": "<mask token>\n\n\ndef notify_no_new_mapping_found():\n email_str = \"\"\"\n <p>Python script does not find any new creative names from keepingtrac data.\n Stage 2 of processing RenTrak data will begin when we load ...
[ 4, 6, 7, 8, 10 ]
from whylogs.core.annotation_profiling import Rectangle def test_rect(): rect = Rectangle([[0, 0], [10, 10]], confidence=0.8, labels=[{"name": "test"}]) test = Rectangle([[0, 0], [5, 5]]) assert rect.area == 100 assert rect.intersection(test) == 25 assert rect.iou(test) == 25 / 100.0 def test_r...
normal
{ "blob_id": "b65d25198d55ab4a859b9718b7b225fa92c13a2b", "index": 1202, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_rect():\n rect = Rectangle([[0, 0], [10, 10]], confidence=0.8, labels=[{'name':\n 'test'}])\n test = Rectangle([[0, 0], [5, 5]])\n assert rect.area == 100\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logger.setLevel(logging.DEBUG) <|reserved_special_token_0|> model.fit(X=train, eval_data=val, batch_end_callback=mx.callback. Speedometer(batch_size, 50), epoch_end_callback=mx.callback. do_checkpoint(model_prefix)) <|re...
flexible
{ "blob_id": "e82b9aa0f7dc669b3d5622c093b766c7e168221c", "index": 5757, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogger.setLevel(logging.DEBUG)\n<mask token>\nmodel.fit(X=train, eval_data=val, batch_end_callback=mx.callback.\n Speedometer(batch_size, 50), epoch_end_callback=mx.callback.\n do_c...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Vertex(): def __init__(self, key): self.id = key self.connections = {} def add_neighbor(self, nbr, weight=0): self.connections[nbr] = weight def get_connections(self): return self.connections.keys() def get_id(sel...
normal
{ "blob_id": "3af78dcc0bb0b6f253af01d2945ad6ada02ca7a0", "index": 7270, "step-1": "class Vertex:\n <mask token>\n <mask token>\n\n def get_connections(self):\n return self.connections.keys()\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Graph:\n\n def __init__(self):\n ...
[ 10, 12, 13, 15, 17 ]
from pytube import YouTube, Playlist import json import sys import os import urllib.request p = os.path.abspath('appdata') def collect(yt, dir): code = yt.thumbnail_url urllib.request.urlretrieve(code, os.path.join(dir, yt.title + '.jpg')) out = yt.streams.filter(only_audio=True, file_extension='mp4').ord...
normal
{ "blob_id": "06dd963b62c0a746438dcf01c67ef5de1a4c5e8f", "index": 1558, "step-1": "<mask token>\n\n\ndef collect(yt, dir):\n code = yt.thumbnail_url\n urllib.request.urlretrieve(code, os.path.join(dir, yt.title + '.jpg'))\n out = yt.streams.filter(only_audio=True, file_extension='mp4').order_by(\n ...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, '.') <|reserved_special_token_1|> import sys sys.path.insert(0, '.') <|reserved_special_token_1|> import sys sys.path.insert(0, ".")
flexible
{ "blob_id": "b95eadd60093d5235dc0989205edff54ef611215", "index": 2399, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, '.')\n", "step-3": "import sys\nsys.path.insert(0, '.')\n", "step-4": "\nimport sys\n\nsys.path.insert(0, \".\")", "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CRUD(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE ) name = models.TextField(blank=True, null=True) content = models.TextField(blank=True, null=True) image = models.ImageField(upload_to=upload_updated_image, null=T...
flexible
{ "blob_id": "5749f30d1a1efd5404654d755bca4515adcf4bca", "index": 1810, "step-1": "<mask token>\n\n\nclass CRUD(models.Model):\n user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE\n )\n name = models.TextField(blank=True, null=True)\n content = models.TextField(blank=True,...
[ 4, 8, 9, 10, 11 ]
import wizard import report
normal
{ "blob_id": "9d07fd14825ed1e0210fa1f404939f68a3bb039c", "index": 4762, "step-1": "<mask token>\n", "step-2": "import wizard\nimport report\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Plugin_OBJ: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Plugin_OBJ: def __init__(self, fhdhr, plugin_utils): self.fhdhr = fhdhr self.plugin_uti...
flexible
{ "blob_id": "ee0cf2325c94821fa9f5115e8848c71143eabdbf", "index": 4775, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Plugin_OBJ:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Plugin_OBJ:\n\n def __init__(self, fhdhr, plugin_utils):\n self.fhdhr = fhdhr\n self.plug...
[ 0, 1, 2, 3, 4 ]
import numpy as np import matplotlib.pyplot as plt import sys import os from azavg_util import plot_azav from binormalized_cbar import MidpointNormalize from diagnostic_reading import ReferenceState dirname = sys.argv[1] datadir = dirname + '/data/' plotdir = dirname + '/plots/' if (not os.path.isdir(plotdir)): ...
normal
{ "blob_id": "e5c30488c8c1682171c57a11a8ecedc5ccd4d851", "index": 5607, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.isdir(plotdir):\n os.makedirs(plotdir)\n<mask token>\nplot_azav(fig, ax, ro_m, rr, cost, sint, contours=False, notfloat=False,\n units='')\nplt.title('$({\\\\rm{Ro}}_...
[ 0, 1, 2, 3, 4 ]
from import_.Import import Import from classifier.Classifier import Classifier from export.Export import Export from preprocessing.PreProcess import PreProcess def main(): date_column = "date of last vet visit" target = "age at death" export_file_dir = "./output/" export_model_dir = "./model/xgb_mode...
normal
{ "blob_id": "696b9db78cc7f6002eb39b640e0e5b2b53e52e91", "index": 8448, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n date_column = 'date of last vet visit'\n target = 'age at death'\n export_file_dir = './output/'\n export_model_dir = './model/xgb_model.dat'\n import_ = ...
[ 0, 1, 2, 3, 4 ]
from microbit import * import radio radio.on() # receiver will show the distance to the beacon # the number of receivers should be easily adjustable while True: message=radio.receive_full() # the stronger the signal the higher the number if message: strength = message[1]+100 displaystrength...
normal
{ "blob_id": "dffa5e2f34788c6f5a5ccc7d8375317a830288b5", "index": 7994, "step-1": "<mask token>\n", "step-2": "<mask token>\nradio.on()\nwhile True:\n message = radio.receive_full()\n if message:\n strength = message[1] + 100\n displaystrength = int(strength / 10 + 1)\n display.show(s...
[ 0, 1, 2, 3 ]
from prediction_model import PredictionModel import util.nlp as nlp import re class NLPPredictionModel(object): def getPasswordProbabilities(self, sweetwordList): # can not deal with sweetword that contains no letters result = [] for s in sweetwordList: words = re.findall(r"[...
normal
{ "blob_id": "1c01fbf7eafd49ada71cb018a62ead5988dcf251", "index": 2968, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NLPPredictionModel(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NLPPredictionModel(object):\n\n def getPasswordProbabilities(self, sweetwordList):\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Tue Jul 18 13:39:05 2017 @author: jaredhaeme15 """ import cv2 import numpy as np from collections import deque import imutils import misc_image_tools frameFileName = r"H:\Summer Research 2017\Whirligig Beetle pictures and videos\large1.mp4" cap = cv2.VideoCapture(r"H:\Summer ...
normal
{ "blob_id": "5ccfad17ede9f685ea9ef9c514c0108a61c2dfd6", "index": 8699, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 1:\n successFlag, frame = cap.read()\n if not successFlag:\n cv2.waitKey(0)\n break\n lower_hsv_thresholdcr = np.array([0, 250, 250])\n upper_hsv_threshold...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c' DEPLOY_SLUG = 'al-qassemi' NUM_SLIDES_AFTER_CONTENT = 2 AUDIO = True VIDEO = False FILMSTRIP = False PROGRESS_BAR = False <|reserved_special_token_1|> COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_...
flexible
{ "blob_id": "f398b724fc28bc25ddb8baf492f34075db0c1f61", "index": 7703, "step-1": "<mask token>\n", "step-2": "COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c'\nDEPLOY_SLUG = 'al-qassemi'\nNUM_SLIDES_AFTER_CONTENT = 2\nAUDIO = True\nVIDEO = False\nFILMSTRIP = False\nPROGRESS_BAR = False\n", ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def on_connect(client, userdata, flags, rc): """0: Connection successful 1: Connection refused - incorrect protocol version 2: Connection refused - invalid client identifier 3: Connection refused - server unavailable 4: Connection refused - bad username or password ...
flexible
{ "blob_id": "f3664f5f69207c3f2dcec96c90cd220003da0904", "index": 4142, "step-1": "<mask token>\n\n\ndef on_connect(client, userdata, flags, rc):\n \"\"\"0: Connection successful\n 1: Connection refused - incorrect protocol version\n 2: Connection refused - invalid client identifier\n 3: Connection re...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> @gapit_test('vkCmdCopyQueryPoolResults_test') class FifthToEighthQueryResultsIn64BitWithWaitBitCopyWithZeroOffsets(GapitTest ): <|reserved_special_token_0|> @gapit_test('vkCmdCopyQueryPoolResults_test') class AllFourQueryResultsIn32BitAnd12StrideWithPartialAndAvailabilityBitWith...
flexible
{ "blob_id": "c2f6fa4d9a6e2ee5f0593bef775ce8f811225613", "index": 2047, "step-1": "<mask token>\n\n\n@gapit_test('vkCmdCopyQueryPoolResults_test')\nclass FifthToEighthQueryResultsIn64BitWithWaitBitCopyWithZeroOffsets(GapitTest\n ):\n <mask token>\n\n\n@gapit_test('vkCmdCopyQueryPoolResults_test')\nclass All...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) EMOTICONS = {'O:)': 'angel', 'o:)': 'angel', 'O:-)': 'angel', 'o:-)': 'angel', 'o:-3': 'angel', 'o:3': 'angel', 'O;^)': 'angel', '>:[': 'annoyed/disappointed', ':-(...
flexible
{ "blob_id": "3f3ed0165120dc135a4ce1f282dbdf9dad57adf8", "index": 980, "step-1": "<mask token>\n", "step-2": "<mask token>\nPROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))\nEMOTICONS = {'O:)': 'angel', 'o:)': 'angel', 'O:-)': 'angel', 'o:-)':\n 'angel', 'o:-3': 'angel', 'o:3': 'angel', 'O;^)': 'ang...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "b6a0a49e05fbc0ac7673d6c9e8ca4d263c8bb5cd", "index": 7132, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('service', '...
[ 0, 1, 2, 3, 4 ]
import utils from problems_2019 import intcode def run(commands=None): memory = utils.get_input()[0] initial_inputs = intcode.commands_to_input(commands or []) program = intcode.Program(memory, initial_inputs=initial_inputs, output_mode=intcode.OutputMode.BUFFER) while True: _, return_signal...
normal
{ "blob_id": "e3aa38b5d01823ed27bca65331e9c7315238750a", "index": 8974, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@utils.part\ndef part_1():\n commands = ['south', 'take food ration', 'west', 'north', 'north',\n 'east', 'take astrolabe', 'west', 'south', 'south', 'east', 'north',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(tp + (4,)) <|reserved_special_token_1|> tp = 1, 2, 3 print(tp + (4,))
flexible
{ "blob_id": "8e9db58488f6ee8aa0d521a19d9d89504d119076", "index": 6689, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(tp + (4,))\n", "step-3": "tp = 1, 2, 3\nprint(tp + (4,))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class TFCompile(TFLayer): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TFComModel(TFModel, TFCompile): """ 基于TensorFlow的复合模型,即使用一个算子构建模型的和模型的编译 """ def build_model(self): raise NotImplementedError ...
flexible
{ "blob_id": "cdabb4a118cb0ef55c271a446fa190a457ebe142", "index": 7383, "step-1": "<mask token>\n\n\nclass TFCompile(TFLayer):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TFComModel(TFModel, TFCompile):\n \"\"\"\n 基于TensorFlow的复合模型,即使用一个算子构建模型的和模型的编译\n \"\"\"\n\n def build_model(s...
[ 5, 8, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for video_id in list_video_id: url = ('https://www.googleapis.com/youtube/v3/videos?id=' + video_id + '&part=statistics&key=' + API_KEY) response = requests.get(url).json() for i in response['items']: r...
flexible
{ "blob_id": "3c341b17f260cc745c8659ee769493216522ac19", "index": 2073, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor video_id in list_video_id:\n url = ('https://www.googleapis.com/youtube/v3/videos?id=' + video_id +\n '&part=statistics&key=' + API_KEY)\n response = requests.get(url).js...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def is_bad_version(v): return version_api.is_bad(v) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_bad_version(v): return version_api.is_bad(v) def first_bad_version(n): version_api.n = n api_calls_count = 0 left,...
flexible
{ "blob_id": "df4c03d9faedf2d347593825c7221937a75a9c10", "index": 5360, "step-1": "<mask token>\n\n\ndef is_bad_version(v):\n return version_api.is_bad(v)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef is_bad_version(v):\n return version_api.is_bad(v)\n\n\ndef first_bad_version(n):\n version_ap...
[ 1, 2, 3, 4, 5 ]
__title__ = 'pyaddepar' __version__ = '0.6.0' __author__ = 'Thomas Schmelzer' __license__ = 'MIT' __copyright__ = 'Copyright 2019 by Lobnek Wealth Management'
normal
{ "blob_id": "cc985ae061c04696dbf5114273befd62321756ae", "index": 9569, "step-1": "<mask token>\n", "step-2": "__title__ = 'pyaddepar'\n__version__ = '0.6.0'\n__author__ = 'Thomas Schmelzer'\n__license__ = 'MIT'\n__copyright__ = 'Copyright 2019 by Lobnek Wealth Management'\n", "step-3": null, "step-4": null...
[ 0, 1 ]
<|reserved_special_token_0|> def tf_idf(words): word_dict = {} for w in words: if w in word_dict.keys(): word_dict[w] += 1 else: word_dict[w] = 1 max_freq = max(word_dict.values()) for w in words: word_dict[w] = word_dict[w] / max_freq * math.log(N / n_d...
flexible
{ "blob_id": "e877f16e604682488d85142174ce4f3f6cee3f18", "index": 7882, "step-1": "<mask token>\n\n\ndef tf_idf(words):\n word_dict = {}\n for w in words:\n if w in word_dict.keys():\n word_dict[w] += 1\n else:\n word_dict[w] = 1\n max_freq = max(word_dict.values())\n ...
[ 2, 3, 4, 5, 6 ]
#função: Definir se o número inserido é ímpar ou par #autor: João Cândido p = 0 i = 0 numero = int(input("Insira um número: ")) if numero % 2 == 0: p = numero print (p, "é um número par") else: i = numero print (i, "é um número ímpar")
normal
{ "blob_id": "382bc321c5fd35682bc735ca4d6e293d09be64ec", "index": 9990, "step-1": "<mask token>\n", "step-2": "<mask token>\nif numero % 2 == 0:\n p = numero\n print(p, 'é um número par')\nelse:\n i = numero\n print(i, 'é um número ímpar')\n", "step-3": "p = 0\ni = 0\nnumero = int(input('Insira um...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LoLServerStatusHandler(Handler): def load_servers(self): servers_filepath = os.path.join(os.path.dirname(__file__), '../../data/lol/status.json') return load_json(servers_filepath) def get_filepath(self, server): return '/lol/{region}/st...
flexible
{ "blob_id": "493552469943e9f9f0e57bf92b874c8b67943de5", "index": 6751, "step-1": "<mask token>\n\n\nclass LoLServerStatusHandler(Handler):\n\n def load_servers(self):\n servers_filepath = os.path.join(os.path.dirname(__file__),\n '../../data/lol/status.json')\n return load_json(server...
[ 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'qtGSD_DESIGN.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(...
normal
{ "blob_id": "9dde8e5fd0e83860ee86cf5402ab6eeb5b07ab2c", "index": 7761, "step-1": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n\n def setupUi(self, MainWindow):\n MainWindow.setObjectName(_fromUtf8('M...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ImageSelection: def __init__(self, path): self.path = path def brightness_check(self, image): """count function to set value of brightness, 0 - full black, 100 - full bright""" with Image.open(image).convert('L') as img: z = ImageStat.St...
flexible
{ "blob_id": "897075810912e8360aa5cdedda3f12ce7c868263", "index": 4547, "step-1": "<mask token>\n\n\nclass ImageSelection:\n\n def __init__(self, path):\n self.path = path\n\n def brightness_check(self, image):\n \"\"\"count function to set value of brightness, 0 - full black, 100 - full brigh...
[ 5, 6, 7, 8, 9 ]
import smtplib import os from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from datetime import datetime from threading import Thread FROM = os.getenv('EMAIL_FROM') TO = os.getenv('EMAIL_TO') HOST = os.getenv('EMAIL_HOST') PORT = os.getenv('EMAIL_PORT') PASSWORD = os.getenv('EMAIL_PAS...
normal
{ "blob_id": "60c3f6775d5112ff178bd3774c776819573887bb", "index": 9367, "step-1": "<mask token>\n\n\ndef _send(body, subject):\n msg = MIMEMultipart()\n msg['From'] = FROM\n msg['To'] = TO\n msg['Subject'] = subject\n msg.attach(MIMEText(body, 'plain'))\n server = smtplib.SMTP(host=HOST, port=in...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014 Vincent Celis # # 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 limitation the righ...
normal
{ "blob_id": "a61bc654eecb4e44dce3e62df752f80559a2d055", "index": 9184, "step-1": "<mask token>\n", "step-2": "<mask token>\nROUTE_LIST = [webapp2.Route('/api/history<name:/(?:[a-zA-Z0-9_-]+/?)*>',\n handler=handlers.HistoryApi, name='historyApi'), webapp2.Route(\n '/api<name:/(?:[a-zA-Z0-9_-]+/?)*>', han...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def gauss_seidel(relax, est, stop): """ Método iterativo de Gauss-Seidel para o sistema linear do trabalho. Onde relax é o fator de relaxação, est é o valor inicial, stop é o critério de parada, n é a qu...
flexible
{ "blob_id": "51540a80c7b29dc0bbb6342ee45008108d54b6f2", "index": 714, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef gauss_seidel(relax, est, stop):\n \"\"\"\n Método iterativo de Gauss-Seidel para o sistema linear do trabalho.\n Onde relax é o fator de relaxação, est é o valor ini...
[ 0, 1, 2, 3 ]
import MySQLdb import MySQLdb.cursors from flask import _app_ctx_stack, current_app class MySQL(object): def __init__(self, app=None): self.app = app if app is not None: self.init_app(app) def init_app(self, app): """Initialize the `app` for use with this :class:`...
normal
{ "blob_id": "db8c2f6f5da0b52c268634043e1132984f610eed", "index": 8405, "step-1": "<mask token>\n\n\nclass MySQL(object):\n\n def __init__(self, app=None):\n self.app = app\n if app is not None:\n self.init_app(app)\n <mask token>\n\n @property\n def connect(self):\n kw...
[ 4, 5, 6, 7, 8 ]
# -*- coding:ascii -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 10 _modified_time = 1428612037.145222 _enable_loop = True _template_filename = 'C:\\Users\\Cody\\Desktop\\Heritage\\chf\\templates/account.rentalcart.html' _t...
normal
{ "blob_id": "57967f36a45bb3ea62708bbbb5b2f4ddb0f4bb16", "index": 29, "step-1": "<mask token>\n\n\ndef _mako_get_namespace(context, name):\n try:\n return context.namespaces[__name__, name]\n except KeyError:\n _mako_generate_namespaces(context)\n return context.namespaces[__name__, nam...
[ 3, 5, 6, 7, 8 ]
from __future__ import absolute_import from __future__ import division from __future__ import print_function from abc import ABCMeta, abstractmethod import numpy as np from deeprl.trainers import BaseTrainer from deeprl.callbacks import EGreedyDecay from deeprl.policy import EGreedyPolicy class BaseDQNTrainer(BaseTra...
normal
{ "blob_id": "8bf0141cee2832134d61e49652330c7d21583dcd", "index": 5201, "step-1": "<mask token>\n\n\nclass BaseDQNTrainer(BaseTrainer):\n <mask token>\n <mask token>\n <mask token>\n\n def update_model(self, batch):\n batch_s = np.array([i[0] for i in batch])\n batch_a = np.array([i[1] f...
[ 3, 4, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^admin/', admin.site.urls), url('^logout/$', auth_views .logout, {'next_page': '/'}, name='logout'), url('^$', index_view, name ='index'), url('^login/$', login_view, name='login'), url('^register/$', ...
flexible
{ "blob_id": "06627821c09d02543974a3c90664e84e11c980ed", "index": 7631, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^admin/', admin.site.urls), url('^logout/$', auth_views\n .logout, {'next_page': '/'}, name='logout'), url('^$', index_view, name\n ='index'), url('^login/$', lo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class InvalidUsage(Exception): status_code = 400 def __init__(self, message, status_code=None, payload=None): Exception.__init__(self) self.message = message if status_code is not None: self.status_code = status_code self.payload = payl...
flexible
{ "blob_id": "8980ac4db2657d3dbd2b70b33a4d13a077d4590e", "index": 2266, "step-1": "<mask token>\n\n\nclass InvalidUsage(Exception):\n status_code = 400\n\n def __init__(self, message, status_code=None, payload=None):\n Exception.__init__(self)\n self.message = message\n if status_code i...
[ 7, 9, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import brainlit.algorithms.generate_fragments from brainlit.algorithms.generate_fragments import *
flexible
{ "blob_id": "a52743fc911beb7e51644073131b25c177d4ad29", "index": 852, "step-1": "<mask token>\n", "step-2": "import brainlit.algorithms.generate_fragments\nfrom brainlit.algorithms.generate_fragments import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def convolve(image, fltr): r_p = 0 c_p = 0 conv_list = [] while r_p + 1 <= image.shape[0] - 1: while c_p + 1 <= image.shape[1] - 1: x = np.sum(np.multiply(image[r_p:r_p + 2, c_p:c_p + 2], fltr)) conv_list.append(x) c_p += 1 ...
flexible
{ "blob_id": "aea92827753e12d2dc95d63ddd0fe4eb8ced5d14", "index": 3815, "step-1": "<mask token>\n\n\ndef convolve(image, fltr):\n r_p = 0\n c_p = 0\n conv_list = []\n while r_p + 1 <= image.shape[0] - 1:\n while c_p + 1 <= image.shape[1] - 1:\n x = np.sum(np.multiply(image[r_p:r_p + ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "d69bffb85d81ab3969bfe7dfe2759fa809890208", "index": 503, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('articals', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ratio(area, width, height): ratio = float(width) / float(height) if ratio < 1: ratio = 1 / ratio if (area < 1063.62 or area > 73862.5) or (ratio < 3 or ratio > 6): return False return True <...
flexible
{ "blob_id": "ab610af97d2b31575ea496b8fddda693353da8eb", "index": 2870, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ratio(area, width, height):\n ratio = float(width) / float(height)\n if ratio < 1:\n ratio = 1 / ratio\n if (area < 1063.62 or area > 73862.5) or (ratio < 3 or rat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> while True: print('running') <|reserved_special_token_1|> while True: print("running")
flexible
{ "blob_id": "8917481957ecd4c9692cfa93df0b759feaa344af", "index": 4944, "step-1": "<mask token>\n", "step-2": "while True:\n print('running')\n", "step-3": "while True:\n print(\"running\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> def longestSubstring(self, s: str, k: int) ->int: def helper(s, k): if...
flexible
{ "blob_id": "6ba830aafbe8e4b42a0b927328ebcad1424cda5e", "index": 8381, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def longestSubstring(self, s: str, k: int) ->int:\n\n def helper(s, k):\n ...
[ 0, 1, 2, 3, 4 ]