code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def test_oembed_founded(oembed_providers): oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers) url = 'https://www.instagram.com/p/BNHh2YJDdcY/' oembed_url = oembed_url_extractor.get_oembed_url(url) assert isinstance(oembed_url, str) def test_oembed_discove...
flexible
{ "blob_id": "7b2ad0b4eca7b31b314e32ad57d51be82f0eaf61", "index": 6979, "step-1": "<mask token>\n\n\ndef test_oembed_founded(oembed_providers):\n oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers)\n url = 'https://www.instagram.com/p/BNHh2YJDdcY/'\n oembed_url = oembed_url_extractor.get_o...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(args): min = -0.0 max = 0.5 Q = 10 if os.path.isfile(args.incat): cbc.coaddBatchCutFull(args.root, args.incat, filter=args.filter, idField=args.idField, prefix=args.prefix, zCutoutSize...
flexible
{ "blob_id": "c0503536672aa824eaf0d19b9d4b5431ef910432", "index": 1028, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(args):\n min = -0.0\n max = 0.5\n Q = 10\n if os.path.isfile(args.incat):\n cbc.coaddBatchCutFull(args.root, args.incat, filter=args.filter,\n id...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ContentsBlockIterator(BaseBlockIterator): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ContentsBlockIterator(BaseBlockIterator): def __init__(self, *args, **kwargs): super().__init...
flexible
{ "blob_id": "b888745b3ce815f7c9eb18f5e76bacfadfbff3f5", "index": 3153, "step-1": "<mask token>\n\n\nclass ContentsBlockIterator(BaseBlockIterator):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ContentsBlockIterator(BaseBlockIterator):\n\n def __init__(self, *args, **kwargs):\n ...
[ 1, 2, 3, 4 ]
import matplotlib.pyplot as plt import cv2 # 0 img = cv2.imread('test.jpg', cv2.IMREAD_GRAYSCALE) # IMREAD_COLOR = 1 # IMREAD_UNCHANGED = -1 cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows() # cv2.imwrite('watchgray,png', img) plt.imshow(img, cmap='gray', interpolation='bicu...
normal
{ "blob_id": "34ccaaf5eb47afd556588cd94cddbddaee1f0b53", "index": 2851, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('image', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\nplt.imshow(img, cmap='gray', interpolation='bicubic')\nplt.show()\n", "step-3": "<mask token>\nimg = cv2.imread('test....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @adapter(IProcessStarting) def start_successlogging(unused): """start successlogging if configured.""" from App.config import getConfiguration config = getConfiguration().product_config.get('successlogging') if config is None: return global _log_good, _log_bad ...
flexible
{ "blob_id": "2edbf18c90da1ff40fd9abaf25a35dbdaf733bc1", "index": 2786, "step-1": "<mask token>\n\n\n@adapter(IProcessStarting)\ndef start_successlogging(unused):\n \"\"\"start successlogging if configured.\"\"\"\n from App.config import getConfiguration\n config = getConfiguration().product_config.get('...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class IsOwnerOrStaffOrReadOnly(BasePermission): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class IsOwnerOrStaffOrReadOnly(BasePermission): def has_object_permission(self, request, view, obj): ...
flexible
{ "blob_id": "4488612164435ab062ca66000f0d7dc3ccd89da2", "index": 8150, "step-1": "<mask token>\n\n\nclass IsOwnerOrStaffOrReadOnly(BasePermission):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IsOwnerOrStaffOrReadOnly(BasePermission):\n\n def has_object_permission(self, request...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def check_compound_set(description_mol, validate_dict): y_m_d = description_mol.GetProp('generation_date').split('-') submitter_dict = {'submitter__name': description_mol.GetProp( 'submitter_name'), 'submitter__email': description_mol.GetProp( 'submitter_email'), '...
flexible
{ "blob_id": "0082f75332321dba498f06d4c4a99c9248829b59", "index": 654, "step-1": "<mask token>\n\n\ndef check_compound_set(description_mol, validate_dict):\n y_m_d = description_mol.GetProp('generation_date').split('-')\n submitter_dict = {'submitter__name': description_mol.GetProp(\n 'submitter_name...
[ 9, 10, 14, 16, 18 ]
#### # This is the script for storing the schema of your TerminusDB # database for your project. # Use 'terminusdb commit' to commit changes to the database and # use 'terminusdb sync' to change this file according to # the exsisting database schema #### from typing import List from terminusdb_client.woqlschema impor...
normal
{ "blob_id": "f702cdef3782ddc96244f3cf8e2026581d60baa9", "index": 1537, "step-1": "<mask token>\n\n\nclass State(DocumentTemplate):\n _key = ValueHashKey()\n country: 'Country'\n name: str\n", "step-2": "<mask token>\n\n\nclass Address(DocumentTemplate):\n <mask token>\n city: 'City'\n coordin...
[ 2, 13, 14, 15, 16 ]
<|reserved_special_token_0|> class AllabolaSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_specia...
flexible
{ "blob_id": "d60a2100127db859162890204655d313cdc2a4a5", "index": 4614, "step-1": "<mask token>\n\n\nclass AllabolaSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n f.write('fn,ln,zip,ct,st,co...
[ 2, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ScenesMiddleware(BaseMiddleware): <|reserved_special_token_0|> async def on_post_process_message(self, message: types.Message, results: tuple, data: dict): if data: return user_...
flexible
{ "blob_id": "11db76cba3dd76cad0d660a0e189d3e4c465071b", "index": 8836, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ScenesMiddleware(BaseMiddleware):\n <mask token>\n\n async def on_post_process_message(self, message: types.Message, results:\n tuple, data: dict):\n if data...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/', methods=['GET', 'POST']) def home(): if request.method == 'POST': entry_content = request.form.get('content') output = client.specific_resource_analysis(body={'document': { 'text': entry_content}}, params={'language': language, '...
flexible
{ "blob_id": "d0f2d47a786b85367f96897e7cd8c2ef8c577e2b", "index": 2961, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef home():\n if request.method == 'POST':\n entry_content = request.form.get('content')\n output = client.specific_resource_analysis(body={'document': {\...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def solution2(a, b): answer = [(a[i] * b[i]) for i in range(len(a))] return sum(answer) <|reserved_special_token_0|> def solution5(a, b): answer = sum([(i * j) for i, j in zip(a, b)]) return answer <|reserved_special_token_1|> def solution(a, b): answer = 0 ...
flexible
{ "blob_id": "5b8322761975ebec76d1dccd0290c0fb1da404e5", "index": 5999, "step-1": "<mask token>\n\n\ndef solution2(a, b):\n answer = [(a[i] * b[i]) for i in range(len(a))]\n return sum(answer)\n\n\n<mask token>\n\n\ndef solution5(a, b):\n answer = sum([(i * j) for i, j in zip(a, b)])\n return answer\n...
[ 2, 3, 4, 5, 6 ]
# import draw as p # ако няма __init__.py # from draw.point import Point from draw import Rectangle from draw import Point from draw import ShapeUtils if __name__ == '__main__': pn1 = Point(9,8) pn2 = Point(6,4) print(f'dist: {pn1} and {pn1} = {ShapeUtils.distance(pn1,pn2)}') rc1 = Rectangle(4...
normal
{ "blob_id": "b984dc052201748a88fa51d25c3bd3c22404fa96", "index": 6571, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n pn1 = Point(9, 8)\n pn2 = Point(6, 4)\n print(f'dist: {pn1} and {pn1} = {ShapeUtils.distance(pn1, pn2)}')\n rc1 = Rectangle(40, 20, 120, 300)\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def first_append_to_last(arr): return arr + [arr[0]] <|reserved_special_token_0|> def RMS(arr): n = len(arr) sq_sum = sum(a ** 2 for a in arr) return (sq_sum / n) ** 0.5 <|reserved_special_token_0|> def L1(P1, P2): x1, y1 = P1 x2, y2 = P2 return abs(x2 ...
flexible
{ "blob_id": "8bbc929e2ff2321b97195031fa675fbdab269fcb", "index": 3288, "step-1": "<mask token>\n\n\ndef first_append_to_last(arr):\n return arr + [arr[0]]\n\n\n<mask token>\n\n\ndef RMS(arr):\n n = len(arr)\n sq_sum = sum(a ** 2 for a in arr)\n return (sq_sum / n) ** 0.5\n\n\n<mask token>\n\n\ndef L1...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.put(x, ind=idx, v=1) print(x) <|reserved_special_token_1|> <|reserved_special_token_0|> x = np.zeros(10) idx = [1, 4, 5, 9] np.put(x, ind=idx, v=1) print(x) <|reserved_special_token_1|> import numpy as np x = np.zeros(10)...
flexible
{ "blob_id": "9e2485554a5a8de07dd3df39cc255f2a1ea2f164", "index": 4769, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.put(x, ind=idx, v=1)\nprint(x)\n", "step-3": "<mask token>\nx = np.zeros(10)\nidx = [1, 4, 5, 9]\nnp.put(x, ind=idx, v=1)\nprint(x)\n", "step-4": "import numpy as np\nx = np.zeros(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def RED(t): GPIO.output(21, 1) time.sleep(1) GPIO.output(21, 0) <|reserved_special_token_0|> def dataTransfer(conn): while True: data = conn.recv(1024) data = data.decode('utf-8') dataMessage = data.split(' ', 1) command = dataMessage[0]...
flexible
{ "blob_id": "78efe97d838774cb831ef205186db29f392e1953", "index": 1584, "step-1": "<mask token>\n\n\ndef RED(t):\n GPIO.output(21, 1)\n time.sleep(1)\n GPIO.output(21, 0)\n\n\n<mask token>\n\n\ndef dataTransfer(conn):\n while True:\n data = conn.recv(1024)\n data = data.decode('utf-8')\n...
[ 2, 4, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(join(here, 'VERSION')) as VERSION_FILE: __versionstr__ = VERSION_FILE.read().strip() with open(join(here, 'requirements.txt')) as REQUIREMENTS: INSTALL_REQUIRES = REQUIREMENTS.read().split('\n') with io.open(join...
flexible
{ "blob_id": "8d5978bc579115eb3065dce1bae08f1790f2d83c", "index": 2832, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(join(here, 'VERSION')) as VERSION_FILE:\n __versionstr__ = VERSION_FILE.read().strip()\nwith open(join(here, 'requirements.txt')) as REQUIREMENTS:\n INSTALL_REQUIRES = REQ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AdaBoostClassifier: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def predict(self, X, threshold=0): """Predict the ca...
flexible
{ "blob_id": "905d8be76ef245a2b8fcfb3f806f8922d351ecf0", "index": 8877, "step-1": "<mask token>\n\n\nclass AdaBoostClassifier:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def predict(self, X, threshold=0):\n \"\"\"Predict the catagories...
[ 3, 7, 8, 9, 12 ]
import gc import unittest import numpy as np from pydrake.autodiffutils import AutoDiffXd from pydrake.common import RandomDistribution, RandomGenerator from pydrake.common.test_utilities import numpy_compare from pydrake.common.test_utilities.deprecation import catch_drake_warnings from pydrake.common.value import Va...
normal
{ "blob_id": "f17ae8a44f8b032feac7c18fe39663054fea40c0", "index": 5282, "step-1": "<mask token>\n\n\nclass TestGeneral(unittest.TestCase):\n\n def _check_instantiations(self, template, supports_symbolic=True):\n default_cls = template[None]\n self.assertTrue(template[float] is default_cls)\n ...
[ 25, 26, 28, 30, 35 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> hp.mollview(fu, title='Full map +50 GLAT', sub=311) hp.mollview(se, title='Above threshold (4.0) +50 GLAT', sub=312) hp.mollview(ma, title='Diff +50 GLAT', sub=313) plt.savefig('figs/diff4a.pdf', bbox_inches='tight', pad_inches=0....
flexible
{ "blob_id": "d86fd2e6ef5dab4444772192471538842112b3fd", "index": 2675, "step-1": "<mask token>\n", "step-2": "<mask token>\nhp.mollview(fu, title='Full map +50 GLAT', sub=311)\nhp.mollview(se, title='Above threshold (4.0) +50 GLAT', sub=312)\nhp.mollview(ma, title='Diff +50 GLAT', sub=313)\nplt.savefig('figs/d...
[ 0, 1, 2, 3, 4 ]
import sys import utils #import random def findNearestPoint(points,no_used , src): # If no nearest point found, return max. dest = src minDist = sys.float_info.max for i in range(len(points)): if no_used[i] and i!=src: dist = utils.length(points[src], poi...
normal
{ "blob_id": "943db90aa7721ddad3d7f5103c4d398fbf4e143b", "index": 2768, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findNearestPoint(points, no_used, src):\n dest = src\n minDist = sys.float_info.max\n for i in range(len(points)):\n if no_used[i] and i != src:\n dist ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('report.csv') as csvfile: data = csv.reader(csvfile, delimiter=',') for row in data: p = tf.add_paragraph() p.text = row[0] p.level = 1 p = tf.add_paragraph() p.text = row[...
flexible
{ "blob_id": "e1f003b6a687e5654a1ee6c595e789ced02cd6c3", "index": 7086, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('report.csv') as csvfile:\n data = csv.reader(csvfile, delimiter=',')\n for row in data:\n p = tf.add_paragraph()\n p.text = row[0]\n p.level = 1\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class conv2D: <|reserved_special_token_0|> <|reserved_special_token_0|> def forward(self, input_feature_maps): output = np.zeros(self.output_shape) input_feature_maps = self.apply_zero_padding(input_feature_maps) for i in range(0, self.kernel_shape[0])...
flexible
{ "blob_id": "ff99b5fd168d7987e488d7f6d0455619e988f15a", "index": 3574, "step-1": "<mask token>\n\n\nclass conv2D:\n <mask token>\n <mask token>\n\n def forward(self, input_feature_maps):\n output = np.zeros(self.output_shape)\n input_feature_maps = self.apply_zero_padding(input_feature_map...
[ 24, 25, 28, 33, 39 ]
import random import time import unittest from old import dict_groupby class TestDictGroupBy(unittest.TestCase): def setUp(self): random.seed(0) self.sut = dict_groupby def generate_transaction(self): return { 'transaction_type': random.choice(['a', 'b', 'c']), ...
normal
{ "blob_id": "f8e6f6e1be6c4ea306b7770c918b97808a0765b2", "index": 6580, "step-1": "<mask token>\n\n\nclass TestDictGroupBy(unittest.TestCase):\n\n def setUp(self):\n random.seed(0)\n self.sut = dict_groupby\n <mask token>\n\n def generate_facility(self):\n num_transactions = random.r...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for sequence_file in sequences: f_in = open(current_dir + '/sample_genomes/' + sequence_file, 'r') f_out.write(f_in.read()) f_in.close() data = [] fa_file = current_dir + '/sample_genomes/' + sequence_file ...
flexible
{ "blob_id": "9696e5799d46adb5b92c0900e2064b927addfd93", "index": 2506, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor sequence_file in sequences:\n f_in = open(current_dir + '/sample_genomes/' + sequence_file, 'r')\n f_out.write(f_in.read())\n f_in.close()\n data = []\n fa_file = curre...
[ 0, 1, 2, 3, 4 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "ead843f1edcfe798613effb049e3ca79dcd03b71", "index": 7919, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# this is the example code from the t0p-level README..d from spatialmath import SE3 import roboticstoolbox as rtb import swift robot = rtb.models.DH.Panda() print(robot) T = robot.fkine(robot.qz) print(T) # IK T = SE3(0.7, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1]) sol = robot.ikine_LMS(T) # solve IK, ignore additio...
normal
{ "blob_id": "cc1a1491ffbcf470705aeea079faac290dbaa25e", "index": 5965, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(robot)\n<mask token>\nprint(T)\n<mask token>\nprint(sol.q)\nprint(robot.fkine(sol.q))\n<mask token>\nrobot.plot(qtraj.q, movie='panda1.gif')\n<mask token>\nprint(robot)\n<mask token...
[ 0, 1, 2, 3, 4 ]
from django.db import models from django.core.validators import RegexValidator, MaxValueValidator # from Delivery.models import Delivery # from Customers.models import Customer, Address, Order, Item # Create your models here. class Restaurant(models.Model): Restaurant_ID = models.AutoField(primary_key=True) ...
normal
{ "blob_id": "7ea1ee7c55cd53f7137c933790c3a22957f0ffea", "index": 4987, "step-1": "<mask token>\n\n\nclass Food(models.Model):\n Food_ID = models.AutoField(primary_key=True)\n Food_Name = models.CharField(max_length=250)\n Food_Pic = models.ImageField(upload_to='Restaurants/Pictures/Food')\n Food_Cate...
[ 2, 4, 5, 6, 8 ]
#determines where the robot is located. def sense(p, Z, colors, sensor_right): #initialization q = [] pHit = sensor_right; pMiss = 1 - sensor_right; #number of rows m = len(colors) #number of columns n = len(colors[0]) #sum s = 0 for i in range(m): temp = [] ...
normal
{ "blob_id": "10937ee1e48d23b12b76a2abc44ee8bd0647aef5", "index": 9248, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef localize(colors, measurements, motions, sensor_right, p_move):\n p = []\n m = len(colors)\n n = len(colors[0])\n size = m * n\n for i in range(m):\n temp = [...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import mcvine.cli from numpy import array from mcvine_workflow.singlextal.resolution import use_res_comps as urc beam_neutrons_path = '/SNS/users/p63/ORNL_public_research/MCViNE_Covmat_comparison/mcvine_resolution/beams/beam_125_1e9/out/neutrons' instrument = urc.instrument('ARCS', '3.*meter', '13...
normal
{ "blob_id": "47c5fb03cb427d5c9f7703e1715e026b6f2c7a35", "index": 4660, "step-1": "<mask token>\n", "step-2": "<mask token>\nurc.run(beam_neutrons_path, instrument, samplexmlpath, psi, hkl2Q, pixel,\n t_m2p, Q, E, hkl_projection, Nbuffer=100000)\n", "step-3": "<mask token>\nbeam_neutrons_path = (\n '/SN...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.usefixtures('driver') class BaseClass: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.usefixtures('driver') class BaseClass: """BaseClass takes in dr...
flexible
{ "blob_id": "1b49cb59ebdb548cfc7567cd5cb4affe30f33aac", "index": 5576, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n <mask token>\n", "step-3": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n \"\"\"BaseClass tak...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Добрый день,', name) <|reserved_special_token_1|> name = input('Введите ваше имя ') print('Добрый день,', name) <|reserved_special_token_1|> name = input("Введите ваше имя ") print("Добрый день,", name)
flexible
{ "blob_id": "e44c4b2c3b60d34d4540ec2d3a782c777c52fbc0", "index": 8662, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Добрый день,', name)\n", "step-3": "name = input('Введите ваше имя ')\nprint('Добрый день,', name)\n", "step-4": "name = input(\"Введите ваше имя \")\nprint(\"Добрый день,\", n...
[ 0, 1, 2, 3 ]
#Some people are standing in a queue. A selection process follows a rule where people standing on even positions are selected. Of the selected people a queue is formed and again out of these only people on even position are selected. This continues until we are left with one person. Find out the position of that person...
normal
{ "blob_id": "358fd8efd5c3823255ab64d5f8b88b343415ed0e", "index": 2708, "step-1": "def even(n):\n if n == 0 or n == 1:\n return\n elif n == 2:\n return 2\n else:\n for i in reversed(range(n + 1)):\n if 2 ** i < n:\n return 2 ** i\n\n\n<mask token>\n", "ste...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_amount(): """Get valid donation amount from user""" while True: try: amount = input('How much did they donate: ') if str(amount).lower() == 'exit': return amount else: return float(amount) ...
flexible
{ "blob_id": "8a192fc08a65c80b8733a9d07374156c09f36598", "index": 2823, "step-1": "<mask token>\n\n\ndef get_amount():\n \"\"\"Get valid donation amount from user\"\"\"\n while True:\n try:\n amount = input('How much did they donate: ')\n if str(amount).lower() == 'exit':\n ...
[ 6, 7, 8, 9, 12 ]
#Web Scraping #Make sure you have bs4, webbrowser and request installed as your third party modules import bs4, webbrowser, requests try: data = requests.get("http://en.wikipedia.org/wiki/Python") data.raise_for_status() my_data = bs4.BeautifulSoup(data.text, "lxml") print("List o...
normal
{ "blob_id": "27e9635adf6109f3ab13b9d8dd5809973b61ca03", "index": 413, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n data = requests.get('http://en.wikipedia.org/wiki/Python')\n data.raise_for_status()\n my_data = bs4.BeautifulSoup(data.text, 'lxml')\n print('List of all the header tag...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('CrawlerSlaveYoke') print('CSY-000000023.py') <|reserved_special_token_1|> # Author: Andreas Francois Vermeulen print("CrawlerSlaveYoke") print("CSY-000000023.py")
flexible
{ "blob_id": "322795bce189428823c45a26477555052c7d5022", "index": 8933, "step-1": "<mask token>\n", "step-2": "print('CrawlerSlaveYoke')\nprint('CSY-000000023.py')\n", "step-3": "# Author: Andreas Francois Vermeulen\nprint(\"CrawlerSlaveYoke\")\nprint(\"CSY-000000023.py\")\n", "step-4": null, "step-5": nu...
[ 0, 1, 2 ]
def pixels_generator(w, h): i = 0 while i < (w * h): yield divmod(i, w) i = i + 1
normal
{ "blob_id": "bb481fa038835abc6d61a4985b1e30c7c00bff96", "index": 158, "step-1": "<mask token>\n", "step-2": "def pixels_generator(w, h):\n i = 0\n while i < w * h:\n yield divmod(i, w)\n i = i + 1\n", "step-3": "def pixels_generator(w, h):\n i = 0\n while i < (w * h):\n yield...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for category in ('beauty', 'fashion', 'mobile'): with open('%s/%s_data_info_val_competition.csv' % (data_dir, category), 'r' ) as infile: next(infile) for line in infile: curr_id = line.stri...
flexible
{ "blob_id": "82556291c456b9e43e4e589ea4a77d320430344b", "index": 7478, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor category in ('beauty', 'fashion', 'mobile'):\n with open('%s/%s_data_info_val_competition.csv' % (data_dir, category), 'r'\n ) as infile:\n next(infile)\n for ...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn import linear_model from features import calculateTargets currency = 'EURUSD' interval = '1440' df = pd.read_csv( r'../data/' + currency.upper() + interval + '.csv', names=['date', 'time', 'open', 'high', 'low', 'close', 'volu...
normal
{ "blob_id": "8c0bae9e49c5ea9fbdee7c5c864afff16cc9f8b8", "index": 3757, "step-1": "import matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nfrom sklearn import linear_model\nfrom features import calculateTargets\n\ncurrency = 'EURUSD'\ninterval = '1440'\n\ndf = pd.read_csv(\n r'../data/' + cur...
[ 0 ]
<|reserved_special_token_0|> def _mako_get_namespace(context, name): try: return context.namespaces[__name__, name] except KeyError: _mako_generate_namespaces(context) return context.namespaces[__name__, name] <|reserved_special_token_0|> def _mako_inherit(template, context): _...
flexible
{ "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 random import random def random_numbers(): print('start generator') while True: val = random() print(f'will yield {val}') yield val def run_random_numbers(): print(f'{random_numbers=}') rnd_gen = random_numbers() print(f'{rnd_gen=}') print(f'{next(rnd_gen)=}') ...
normal
{ "blob_id": "e5979aeb7cff0e2a75966924382bae87aebcfcb2", "index": 3312, "step-1": "<mask token>\n\n\ndef exercise_gen(ret_val, times):\n \"\"\"Return `ret_value` `times` times.\n If generator will receive some value from outside, update `ret_value`\"\"\"\n\n\ndef exercise1():\n \"\"\"Make it pass\"\"\"\n...
[ 2, 4, 6, 9, 10 ]
import os import random import pygame # Class for all the game's obstacles class Obstacle(pygame.sprite.Sprite): # Class constructor def __init__(self, game_params, game_speed): self.obs_type = random.randrange(0, 3) # Becomes a pterodactyl obstacle if (self.obs_type == 0): ...
normal
{ "blob_id": "09dac7bfe98a15b3e79edcb0d0a53c0ab4d771ca", "index": 7053, "step-1": "<mask token>\n\n\nclass Obstacle(pygame.sprite.Sprite):\n\n def __init__(self, game_params, game_speed):\n self.obs_type = random.randrange(0, 3)\n if self.obs_type == 0:\n self.create_pterodactyl(game_p...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def find_roads(probability_map, *, input_threshold=0.3, max_roads=None, min_strength=0.17, num_angles=720, roads_min_angle=np.pi / 8, roads_min_distance=50, debugimage=None, debugprint=None): """ Finds full-image...
flexible
{ "blob_id": "f76185095ebb1adbf7ae22ffb500ffc3d6b0a30d", "index": 6019, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_roads(probability_map, *, input_threshold=0.3, max_roads=None,\n min_strength=0.17, num_angles=720, roads_min_angle=np.pi / 8,\n roads_min_distance=50, debugimage=None,...
[ 0, 3, 4, 5, 6 ]
"""Test Assert module.""" import unittest from physalia import asserts from physalia.fixtures.models import create_random_sample from physalia.models import Measurement # pylint: disable=missing-docstring class TestAssert(unittest.TestCase): TEST_CSV_STORAGE = "./test_asserts_db.csv" def setUp(self): ...
normal
{ "blob_id": "eda1c1db5371f5171f0e1929e98d09e10fdcef24", "index": 1677, "step-1": "<mask token>\n\n\nclass TestAssert(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_consumption_below(self):\n sample = create_random_sample(10, 1)\n asserts.consumption_below(sample, 11)\n ...
[ 4, 5, 6, 7, 8 ]
#connect4_JayNa.py #Jay Na #CS111 Spring 2018 #This file creates a version of the game Connect4, where the user plays against an AI from graphics import * import random class ConnectWindow: def __init__(self): self.window = GraphWin("Connect Four", 690, 590) self.window.setMouseHandler(self.handleClick) self....
normal
{ "blob_id": "abbad57e945d2195021948a0e0838c6bfd9c6a1e", "index": 769, "step-1": "<mask token>\n\n\nclass ConnectWindow:\n <mask token>\n\n def startScreen(self):\n \"\"\"This function creates the board and intializes the board count for each column\"\"\"\n self.background = Rectangle(Point(0,...
[ 2, 8, 10, 11, 16 ]
from ipyleaflet import Map, DrawControl, Marker, Rectangle from sentinelhub import BBox, CRS from ipywidgets import widgets as w class BBoxSelector: def __init__(self, bbox, zoom=8, resolution=10): center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2 self.map = Map(center=center,...
normal
{ "blob_id": "0545aff80e19e47cb9e5b1941e92ff5cb109f9e6", "index": 1921, "step-1": "<mask token>\n\n\nclass BBoxSelector:\n\n def __init__(self, bbox, zoom=8, resolution=10):\n center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2\n self.map = Map(center=center, zoom=zoom, scroll_w...
[ 3, 4, 5, 6, 7 ]
<|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": "53519c704ca9aff62140f187d4246208350fa9ba", "index": 4610, "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 = [('PDPAPI', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PinEnvDiscrete(Env): <|reserved_special_token_0|> def __init__(self, simulation, x, y, trajectory, scorer=0, max_displacement=False, predict=False, original=False, sample=False): self.simulation = simulation height, width = simulation.cloth.initial_p...
flexible
{ "blob_id": "21974274b1e7800b83eb9582ab21714f04230549", "index": 4299, "step-1": "<mask token>\n\n\nclass PinEnvDiscrete(Env):\n <mask token>\n\n def __init__(self, simulation, x, y, trajectory, scorer=0,\n max_displacement=False, predict=False, original=False, sample=False):\n self.simulatio...
[ 8, 9, 10, 12, 13 ]
<|reserved_special_token_0|> class ebiz_supplier_account_create(osv.osv_memory): <|reserved_special_token_0|> <|reserved_special_token_0|> def create_supplier_action(self, cr, uid, ids, context=None): active_ids = context.get('active_ids', False) supplier_ids = self.pool['ebiz.supplier.ac...
flexible
{ "blob_id": "309f8016dfebcc3595291b127edb4634f72298ec", "index": 4387, "step-1": "<mask token>\n\n\nclass ebiz_supplier_account_create(osv.osv_memory):\n <mask token>\n <mask token>\n\n def create_supplier_action(self, cr, uid, ids, context=None):\n active_ids = context.get('active_ids', False)\n...
[ 2, 4, 5, 6, 7 ]
import os from linkedin_scraper import get_jobs chrome_driver_path = os.path.join(os.path.abspath(os.getcwd()), 'chromedriver') df = get_jobs('Data Scientist', 40, False, chrome_driver_path) df.to_csv('linkedin_jobs.csv', index=False)
normal
{ "blob_id": "6ae529a5e5658ba409ec3e7284d8b2911c60dd00", "index": 906, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.to_csv('linkedin_jobs.csv', index=False)\n", "step-3": "<mask token>\nchrome_driver_path = os.path.join(os.path.abspath(os.getcwd()), 'chromedriver')\ndf = get_jobs('Data Scientist', ...
[ 0, 1, 2, 3 ]
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import random PATH = "C:\\Program Files (x86)\\chromedriver.exe" destination = "https://news.ycombinator.com/" class hackernewsUpvoter(): def __init__(self, username, password, website): self.driver = webdriver.Chro...
normal
{ "blob_id": "742b655ee6aad2575f67e7329ed7a14c4fb6aa06", "index": 7242, "step-1": "<mask token>\n\n\nclass hackernewsUpvoter:\n <mask token>\n\n def sign_in(self, login_page='https://news.ycombinator.com/login'):\n self.driver.get(login_page)\n time.sleep(2)\n account = self.driver.find...
[ 4, 5, 7, 8, 10 ]
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. from PyQt5 import QtWidgets, uic import sys import pymysql import mysql.connector class Ui_Login(QtWidgets.QDi...
normal
{ "blob_id": "0ff6e22f8704a0c6c0ffff3c53761b9d3a531b6d", "index": 683, "step-1": "<mask token>\n\n\nclass Ui_Login(QtWidgets.QDialog):\n\n def __init__(self):\n super(Ui_Login, self).__init__()\n uic.loadUi('login.ui', self)\n self.icon = self.findChild(QtWidgets.QLabel, 'ilogin')\n ...
[ 5, 7, 8, 9, 10 ]
import serial import mysql.connector ser = serial.Serial('/dev/serial0', 9600) while True: data = ser.readline() if data[0]==";": print(data) data = data.split(";") if data[1] == "1": fonction = data[1] add = data[2] tmp = data[3] debit = data[4] ser.write([123]) #test affichage print "Sa...
normal
{ "blob_id": "b1a6593e7b528238e7be5ea6da4d1bfee0d78067", "index": 7824, "step-1": "import serial\nimport mysql.connector\n\nser = serial.Serial('/dev/serial0', 9600)\n\nwhile True:\n\tdata = ser.readline()\n\tif data[0]==\";\":\n\t\tprint(data)\n\t\tdata = data.split(\";\")\n\t\tif data[1] == \"1\":\n\t\t\tfoncti...
[ 0 ]
<|reserved_special_token_0|> def ms_matrices(E, Q, matrix_terms, dim): """Compute the Möller-Stetter matrices in the monomial basis from a reduced Macaulay matrix Parameters ---------- E : (m, k) ndarray Columns of the reduced Macaulay matrix corresponding to the quotient basis Q : (l...
flexible
{ "blob_id": "14fb6776ac30802edf43c43acbee64263c6bdd7b", "index": 2777, "step-1": "<mask token>\n\n\ndef ms_matrices(E, Q, matrix_terms, dim):\n \"\"\"Compute the Möller-Stetter matrices in the monomial basis from a\n reduced Macaulay matrix\n\n Parameters\n ----------\n E : (m, k) ndarray\n ...
[ 5, 6, 8, 10, 12 ]
# # @lc app=leetcode id=267 lang=python3 # # [267] Palindrome Permutation II # # https://leetcode.com/problems/palindrome-permutation-ii/description/ # # algorithms # Medium (33.28%) # Total Accepted: 24.8K # Total Submissions: 74.4K # Testcase Example: '"aabb"' # # Given a string s, return all the palindromic perm...
normal
{ "blob_id": "4e538251dedfe0b9ffb68de2de7dc50681320f1f", "index": 8619, "step-1": "#\n# @lc app=leetcode id=267 lang=python3\n#\n# [267] Palindrome Permutation II\n#\n# https://leetcode.com/problems/palindrome-permutation-ii/description/\n#\n# algorithms\n# Medium (33.28%)\n# Total Accepted: 24.8K\n# Total Sub...
[ 0 ]
from flask import Flask import os app = Flask(__name__) @app.route("/healthz") def healthz(): return "ok" @app.route("/alive") def alive(): return "ok" @app.route("/hello") # def healthz(): # introduces application crash bug def hello(): myhost = os.uname()[1] body = ("V1 - Hello World! - %s" % m...
normal
{ "blob_id": "0259fddbe3ce030030a508ce7118a6a03930aa51", "index": 7375, "step-1": "<mask token>\n\n\n@app.route('/healthz')\ndef healthz():\n return 'ok'\n\n\n@app.route('/alive')\ndef alive():\n return 'ok'\n\n\n@app.route('/hello')\ndef hello():\n myhost = os.uname()[1]\n body = 'V1 - Hello World! -...
[ 3, 4, 5, 6, 7 ]
class Solution(object): def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ def helper(sb, string, level): if len(string) == 0: if level == 4: ans.append(sb[:-1]) return if level ...
normal
{ "blob_id": "ec4348c61cd1c9130543bb20f9ca199399e1caff", "index": 226, "step-1": "class Solution(object):\n def restoreIpAddresses(self, s):\n \"\"\"\n :type s: str\n :rtype: List[str]\n \"\"\"\n\n def helper(sb, string, level):\n if len(string) == 0:\n ...
[ 0 ]
from typing import Union, Tuple import numpy as np from UQpy.utilities.kernels.baseclass.GrassmannianKernel import GrassmannianKernel class ProjectionKernel(GrassmannianKernel): def __init__(self, kernel_parameter: Union[int, float] = None): """ :param kernel_parameter: Number of independent p-...
normal
{ "blob_id": "14ce803e3deb529b489c150c7ecc702118448acb", "index": 9022, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProjectionKernel(GrassmannianKernel):\n <mask token>\n\n def element_wise_operation(self, xi_j: Tuple) ->float:\n \"\"\"\n Compute the Projection kernel entr...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class EndpointsUnitTests(unittest.TestCase): <|reserved_special_token_0|> @patch('github_approval_checker.utils.util.verify_signature') @patch('github_approval_checker.api.endpoints.connexion') @patch('github_approval_checker.api.endpoints.GithubHandler') @patch('gith...
flexible
{ "blob_id": "7626202d1e3ec7321addbb028be2275b882efda2", "index": 6453, "step-1": "<mask token>\n\n\nclass EndpointsUnitTests(unittest.TestCase):\n <mask token>\n\n @patch('github_approval_checker.utils.util.verify_signature')\n @patch('github_approval_checker.api.endpoints.connexion')\n @patch('githu...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def show_im(dataset): data = np.uint8(dataset[0]).reshape((30, 96)) * 255 im = Image.fromarray(data) im.show() def test_model(captcha): im = Image.open(os.path.join(basedir, 'downloader', 'captchas', captcha)) im = im.convert('L') im = grey_to_binary(im) im =...
flexible
{ "blob_id": "8e34b5e15c5b6107d6841e7b567abf967c631f1b", "index": 7440, "step-1": "<mask token>\n\n\ndef show_im(dataset):\n data = np.uint8(dataset[0]).reshape((30, 96)) * 255\n im = Image.fromarray(data)\n im.show()\n\n\ndef test_model(captcha):\n im = Image.open(os.path.join(basedir, 'downloader', ...
[ 2, 3, 4, 5, 6 ]
import logging from utils import Utils from block import Block from message import Message from transaction import Transaction class Response: def __init__(self, node, data): self.node = node self.data = data self.selector() def selector(self): if self.data['flag'] == 1: ...
normal
{ "blob_id": "55b8590410bfe8f12ce3b52710238a79d27189a7", "index": 5125, "step-1": "<mask token>\n\n\nclass Response:\n <mask token>\n <mask token>\n\n def chain_size(self):\n server_chain_size = self.node.get_ledger_size()\n self.return_response(1, server_chain_size)\n\n def chain_sync(s...
[ 5, 6, 8, 9, 10 ]
''' !pip install wget from zipfile import ZipFile import wget print('Beginning file downlaod with wget module') url = 'https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip' wget.download(url, 'sample_data/') print('2. Extract all files in ZIP to different dir...
normal
{ "blob_id": "13c9f0f58ec6da317c3802f594bb0db7c275dee9", "index": 21, "step-1": "<mask token>\n\n\ndef create_training_data():\n for category in CATEGORIES:\n path = os.path.join(DATADIR, category)\n classIndex = CATEGORIES.index(category)\n for img in os.listdir(path):\n try:\n...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': fix_extra_refs(currentAddress) <|reserved_special_token_1|> <|reserved_special_token_0|> from utils.references import * if __name__ == '__main__': fix_extra_refs(currentAddress) <|reserved_s...
flexible
{ "blob_id": "30a57197e3156023ac9a7c4a5218bfe825e143d9", "index": 5978, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n fix_extra_refs(currentAddress)\n", "step-3": "<mask token>\nfrom utils.references import *\nif __name__ == '__main__':\n fix_extra_refs(currentAddress...
[ 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": "1e853d58c2066f3fbd381d0d603cd2fcece0cf15", "index": 7933, "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 = [('travels', '...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import inspect from script.data_handler.Base.df_plotterMixIn import df_plotterMixIn from script.util.MixIn import LoggerMixIn from script.util.PlotTools import PlotTools DF = pd.DataFrame Series = pd.Series class null_clean_methodMixIn: @staticmethod def drop_col(df: D...
normal
{ "blob_id": "198beb5a17575d781f7bce1ab36a6213ad7331b3", "index": 5853, "step-1": "<mask token>\n\n\nclass Base_dfCleaner(LoggerMixIn, null_clean_methodMixIn, df_plotterMixIn):\n <mask token>\n <mask token>\n\n def __init__(self, df: DF, df_Xs_keys, df_Ys_key, silent=False, verbose=0):\n LoggerMix...
[ 8, 15, 16, 17, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: ret, square = result.read() area = square[100:200, 100:200] cv2.imshow('video', square) cv2.imshow('video2', area) print(square) if cv2.waitKey(25) & 255 == ord('q'): break result.releas...
flexible
{ "blob_id": "934921b22d036bd611134ce74f6eba3a2710018e", "index": 529, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, square = result.read()\n area = square[100:200, 100:200]\n cv2.imshow('video', square)\n cv2.imshow('video2', area)\n print(square)\n if cv2.waitKey(25...
[ 0, 1, 2, 3, 4 ]
"""Note: AWS Glue split from spark since it requires different test dependencies.""" from tests.integration.backend_dependencies import BackendDependencies from tests.integration.integration_test_fixture import IntegrationTestFixture aws_glue_integration_tests = [] deployment_patterns = [ # TODO: The AWS_GLUE dep...
normal
{ "blob_id": "e288403cb310bb7241b25e74d1b5bcc63967128c", "index": 1031, "step-1": "<mask token>\n", "step-2": "<mask token>\naws_glue_integration_tests += deployment_patterns\n", "step-3": "<mask token>\naws_glue_integration_tests = []\ndeployment_patterns = [IntegrationTestFixture(name=\n 'how_to_use_grea...
[ 0, 1, 2, 3, 4 ]
'''OpenGL extension EXT.YUV_target This module customises the behaviour of the OpenGL.raw.GLES2.EXT.YUV_target to provide a more Python-friendly API Overview (from the spec) This extension adds support for three new YUV related items: first rendering to YUV images, second sampling from YUV images while keeping ...
normal
{ "blob_id": "08420d31713859946b2f19cebf68c333331cb80e", "index": 1494, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef glInitYuvTargetEXT():\n \"\"\"Return boolean indicating whether this extension is available\"\"\"\n from OpenGL import extensions\n return extensions.hasGLExtension(_EXTE...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(anios * dias_por_anio * horas_por_dia * segundos_por_hora) <|reserved_special_token_1|> anios = 30 dias_por_anio = 365 horas_por_dia = 24 segundos_por_hora = 60 print(anios * dias_por_anio * horas_por_dia * segundos_por_h...
flexible
{ "blob_id": "f153da7e4537f807f6c9d9d268a00443933d8315", "index": 4167, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(anios * dias_por_anio * horas_por_dia * segundos_por_hora)\n", "step-3": "anios = 30\ndias_por_anio = 365\nhoras_por_dia = 24\nsegundos_por_hora = 60\nprint(anios * dias_por_anio ...
[ 0, 1, 2, 3 ]
from sklearn.base import BaseEstimator class movingAverage(BaseEstimator): '''Implements a moving average.''' def __init__(self, lag): self.lag = lag def movingAverage(self, periods=5): '''Implements a naiveLV forecast.''' try: # sets data x = self.data['Values'] d = ...
normal
{ "blob_id": "f4e45c19105d4ee1520acc0cd61dadfe27904d0f", "index": 8134, "step-1": "from sklearn.base import BaseEstimator\n\n\nclass movingAverage(BaseEstimator):\n '''Implements a moving average.'''\n\n def __init__(self, lag):\n self.lag = lag\n\ndef movingAverage(self, periods=5):\n '''Implemen...
[ 0 ]
import numpy as np import numdifftools as nd from scipy import stats from scipy import optimize from functools import partial class TCRPowerCalculator: def __init__(self, pcmodel): self.pcmodel = pcmodel self.predict_variance = self.pcmodel.predict_variance self.predict_mean = self.pcmodel.predict_mean self....
normal
{ "blob_id": "d327151c9659078e12e4aca46631de33e7ca4dcf", "index": 167, "step-1": "<mask token>\n\n\nclass TCRPowerCalculator:\n <mask token>\n\n def predict_detection_probability_2step(self, tcr_frequency, num_reads,\n num_cells, detect_thresh=1):\n \"\"\"\n\t\t2-step detection probability mod...
[ 3, 4, 5, 6, 7 ]
s = input() if len(s) < 26: for i in range(26): c = chr(ord("a")+i) if c not in s: print(s+c) exit() else: for i in reversed(range(1,26)): if s[i-1] < s[i]: s1 = s[0:i-1] for j in range(26): c = chr(ord("a")+j) ...
normal
{ "blob_id": "9931fc25118981bcce80cffd3fda9dc99d951bf5", "index": 180, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(s) < 26:\n for i in range(26):\n c = chr(ord('a') + i)\n if c not in s:\n print(s + c)\n exit()\nelse:\n for i in reversed(range(1, 26)):\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> loops(loop, phoneNumber, message) <|reserved_special_token_1|> <|reserved_special_token_0|> phoneNumber = 'fill the number' message = 'fill with ur message' loop = 1 loops(loop, phoneNumber, message) <|reserved_special_token_...
flexible
{ "blob_id": "81dfdf0479fc1f136fa5153840d8c7015f9db676", "index": 32, "step-1": "<mask token>\n", "step-2": "<mask token>\nloops(loop, phoneNumber, message)\n", "step-3": "<mask token>\nphoneNumber = 'fill the number'\nmessage = 'fill with ur message'\nloop = 1\nloops(loop, phoneNumber, message)\n", "step-4...
[ 0, 1, 2, 3, 4 ]
# 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. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
normal
{ "blob_id": "5e2fcc6379a8ecee0378d26108e4deab9d17dba6", "index": 7483, "step-1": "<mask token>\n\n\nclass NSDescriptorsViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n\n def get_success_headers(self, data):\n return {'Location': data['_links']['self']}\n\n def ...
[ 6, 7, 8, 9, 10 ]
class Reader: @staticmethod def read_file(file_path): return ''
normal
{ "blob_id": "8c51b2c06f971c92e30d6b2d668fdd2fd75142d2", "index": 4846, "step-1": "<mask token>\n", "step-2": "class Reader:\n <mask token>\n", "step-3": "class Reader:\n\n @staticmethod\n def read_file(file_path):\n return ''\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
import tensorflow as tf import blood_model import os import numpy as np FLAGS = tf.app.flags.FLAGS RUN = 'new_test_hm' tf.app.flags.DEFINE_string('checkpoint_dir', RUN+'/checkpoints', """Directory where to write event logs and checkpoint.""") tf.app.flags.DEFINE_string('summaries_dir', RUN+...
normal
{ "blob_id": "f653e906d3026de4bb1e705162f4321bb75e8705", "index": 4166, "step-1": "<mask token>\n\n\ndef check_filesystem():\n \"\"\"\n either start a new checkpoint or continue from existing checkpoint folder\n \"\"\"\n if FLAGS.continue_run:\n if not tf.gfile.Exists(FLAGS.summaries_dir):\n ...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> while True: print('Light Levels:' + input.light_level()) if input.light_level() < 6: light.set_all(light.rgb(255, 0, 255)) elif input.light_level() < 13: light.set_all(light.rgb(255, 0, 0)) else: light.clear() <|reserved_spec...
flexible
{ "blob_id": "7277b045f85d58383f26ab0d3299feb166f45e36", "index": 2575, "step-1": "<mask token>\n", "step-2": "while True:\n print('Light Levels:' + input.light_level())\n if input.light_level() < 6:\n light.set_all(light.rgb(255, 0, 255))\n elif input.light_level() < 13:\n light.set_all(...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('data_dir', help='path to training images') parser.add_argument('--save_dir', default='.', help= 'path where checkpoint is saved') parser.add_argument('--arch', default='vgg11', help= 'which pre-trained...
flexible
{ "blob_id": "0c3947a1699c78080661a55bbaa9215774b4a18e", "index": 4751, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('data_dir', help='path to training images')\nparser.add_argument('--save_dir', default='.', help=\n 'path where checkpoint is saved')\nparser.add_argument('--arch',...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def target2_text(first_input, *params): return first_input <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def input2_text(first_input, *params): return my_dataset.voc.idx2docs(first_input) def target2_text(first_input, *params): ...
flexible
{ "blob_id": "77884dd72f5efe91fccad27e6328c4ad34378be2", "index": 6953, "step-1": "<mask token>\n\n\ndef target2_text(first_input, *params):\n return first_input\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef input2_text(first_input, *params):\n return my_dataset.voc.idx2docs(first_input)\n\n\ndef...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class RSTTable(Table): def run(self) ->List[Node]: ... class CSVTable(Table): option_spec: Dict[str, Callable[[str], Any]] = ... class DocutilsDialect(csv.Dialect): delimiter: str = ... quotechar: str = ... doublequote: bool = ... s...
flexible
{ "blob_id": "9abf2b9b90d18332ede94cf1af778e0dda54330b", "index": 949, "step-1": "<mask token>\n\n\nclass RSTTable(Table):\n\n def run(self) ->List[Node]:\n ...\n\n\nclass CSVTable(Table):\n option_spec: Dict[str, Callable[[str], Any]] = ...\n\n\n class DocutilsDialect(csv.Dialect):\n delim...
[ 11, 19, 20, 22, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('sample.csv') as rf: csv_reader = csv.DictReader(rf) with open('sample1.csv', 'w') as wf: csv_headers = ['fname', 'lname', 'email'] if os.path.isfile('sample1.csv'): q = input('File al...
flexible
{ "blob_id": "43196258b61801799b8d6b7d23f5816d84cb5dff", "index": 7294, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('sample.csv') as rf:\n csv_reader = csv.DictReader(rf)\n with open('sample1.csv', 'w') as wf:\n csv_headers = ['fname', 'lname', 'email']\n if os.path.isfile...
[ 0, 1, 2, 3 ]
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is a collection of monkey patches and workarounds for bugs in earlier versions of Numpy. """ from ...utils import minversion __all__ = ['NUMPY_LT_1_10_4', 'NUMPY_LT_1_11', 'NUMPY_LT_1_12', 'NUMPY_LT_1_13', 'NUMPY_LT_1_14', ...
normal
{ "blob_id": "9376d697158faf91f066a88e87d317e79a4d9240", "index": 6575, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['NUMPY_LT_1_10_4', 'NUMPY_LT_1_11', 'NUMPY_LT_1_12',\n 'NUMPY_LT_1_13', 'NUMPY_LT_1_14', 'NUMPY_LT_1_14_1', 'NUMPY_LT_1_14_2']\nNUMPY_LT_1_10_4 = not minversion('numpy', '1....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DummyWorker: def echo(self, message='hello', delay=0, fail=False): sleep(delay) if fail: raise Exception('failed') self.message = message return self.message def test_default(working_path): task = Task(DummyWorker(), 'echo').sta...
flexible
{ "blob_id": "d2e46944ab05c5e8c1979101728b7b25900be342", "index": 415, "step-1": "<mask token>\n\n\nclass DummyWorker:\n\n def echo(self, message='hello', delay=0, fail=False):\n sleep(delay)\n if fail:\n raise Exception('failed')\n self.message = message\n return self.me...
[ 4, 5, 7, 9, 10 ]
""" Sprites - animations for objects. """ import config import os import pygame class Sheet(object): """ An single large image composed of smaller images used for sprite animations. All the sprites on the sheet must be the same size. The width x height give the sprite dimensions in pixels. The rows x colu...
normal
{ "blob_id": "080aa8b99cdded7a947880a1c3399f68b28ae44d", "index": 6318, "step-1": "<mask token>\n\n\nclass Sprite(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass CompositeSprite(Sprite):\n \"\"\" A sprite that is composed of multiples sprites layered on top of each\n...
[ 16, 18, 19, 21, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup(name='SumoSound', packages=['SumoSound'], version='1.0.2', license= 'MIT', description= 'A python library to a...
flexible
{ "blob_id": "81c9cabaa611f8e884708d535f0b99ff83ec1c0d", "index": 8319, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:\n long_description = f.read()\nsetup(name='SumoSound', packages=['SumoSound'], version='1.0.2', license=\n ...
[ 0, 1, 2, 3, 4 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "d40e1cfa2ef43f698e846c25ac9f5471d69e71a0", "index": 5253, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
from context import vicemergencyapi from vicemergencyapi.vicemergency import VicEmergency from geographiclib.geodesic import Geodesic from shapely.geometry import Point def geoDistance(p1, p2): return Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x)['s12'] melbourne = Point(144.962272, -37.812274) def compare(f...
normal
{ "blob_id": "920f00632599945397364dd0f52f21234e17f9ef", "index": 9445, "step-1": "<mask token>\n\n\ndef geoDistance(p1, p2):\n return Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x)['s12']\n\n\n<mask token>\n\n\ndef compare(f):\n return geoDistance(f.getLocation(), melbourne)\n\n\n<mask token>\n", "step-2...
[ 2, 3, 4, 5, 6 ]
from . import match from . import mimetype from .mimetype import MIMEType def sniff_unknown(resource: bytes, sniff_scriptable: bool = False): #might need more arguments raise NotImplementedError def sniff_mislabeled_binary(resource: bytes) -> MIMEType: raise NotImplementedError def sniff_mislabeled_feed(reso...
normal
{ "blob_id": "a2344f405aa681daff12166b7aad1230652373de", "index": 3499, "step-1": "<mask token>\n\n\ndef sniff_mislabeled_feed(resource: bytes) ->MIMEType:\n raise NotImplementedError\n\n\ndef sniff(resource: bytes, mime_type_string: str='unknown/unknown',\n no_sniff: bool=False, check_for_apache_bug: bool=...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .exec_generator import *
flexible
{ "blob_id": "b6ee3c980357ab22a7969c21207b34546c87092d", "index": 7305, "step-1": "<mask token>\n", "step-2": "from .exec_generator import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import time import random from BlockchainNetwork.MVB import * from threading import Thread coloredlogs.install() logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') log = logging.getLogger(__name__) class MVBTest: def __init__(self, initialNodeCnt): sel...
normal
{ "blob_id": "8ad9efbbb2d9e2a5f73ebbb999da3ed93e4c1974", "index": 9655, "step-1": "<mask token>\n\n\nclass MVBTest:\n <mask token>\n <mask token>\n\n def doubleSpendTest(self):\n \"\"\"\n txOutputs is the genesis output.\n txOutputs[0] was used twice in this test.\n ...
[ 11, 15, 17, 18, 19 ]
import json from typing import TYPE_CHECKING import pytest from eth_utils import is_checksum_address from rotkehlchen.globaldb.handler import GlobalDBHandler from rotkehlchen.types import ChainID if TYPE_CHECKING: from rotkehlchen.chain.ethereum.node_inquirer import EthereumInquirer def test_evm_contracts_data...
normal
{ "blob_id": "52dc8a4f9165a88dddc1da16e0adb045c4d851ed", "index": 5017, "step-1": "<mask token>\n\n\ndef test_evm_contracts_data(globaldb):\n \"\"\"Test that all evm contract entries in the packaged global DB have legal data\"\"\"\n serialized_chain_ids = [x.serialize_for_db() for x in ChainID]\n with gl...
[ 2, 3, 4, 5, 6 ]
filename = 'learning_python.txt' # with open(filename) as file_object: # contents = file_object.read() # print(contents) # with open(filename) as file_object: # for line in file_object: # print(line.rstrip()) with open(filename) as file_object: lines = file_object.readlines() c_string = '' for line in lines: ...
normal
{ "blob_id": "2f0dc8697e979f307c86a08832b0eae86357d416", "index": 2497, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(filename) as file_object:\n lines = file_object.readlines()\n<mask token>\nfor line in lines:\n c_string += line.rstrip()\nprint(f\"{c_string.replace('Python', 'Scala')}\"...
[ 0, 1, 2, 3 ]
""" Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter ...
normal
{ "blob_id": "8be4bf5c1a5a7b841edc915793571686ee0bffe6", "index": 113, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def remove_element(self, nums: list[int], val: int) ->int:\n last_p...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python from ks_auth import sess from ks_auth import trust_auth from ks_auth import ks from ks_auth import utils from novaclient import client import novaclient.exceptions from time import sleep from uuid import uuid4 import sys # RDTIBCC-1042 VERSION = '2' nova = client.Client(VERSION, session=sess) u...
normal
{ "blob_id": "9f40162348d33d70639692dac87777a2799999e9", "index": 6688, "step-1": "#!/usr/bin/env python\nfrom ks_auth import sess\nfrom ks_auth import trust_auth\nfrom ks_auth import ks\nfrom ks_auth import utils\nfrom novaclient import client\nimport novaclient.exceptions\nfrom time import sleep\nfrom uuid impo...
[ 0 ]
from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning from ._tqdm_pandas import tqdm_pandas as tqdm_pandas from .cli import main as main from .gui import tqdm as tqdm_gui, trange as tgrange from .std import TqdmDeprecationWarning as TqdmDeprecationWarning, TqdmExperimental...
normal
{ "blob_id": "25b7af2a8036f35a0bca665867d1729b7c9c113c", "index": 5846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tnrange(*args, **kwargs):\n ...\n", "step-3": "<mask token>\n\n\ndef tqdm_notebook(*args, **kwargs):\n ...\n\n\ndef tnrange(*args, **kwargs):\n ...\n", "step-4": "fro...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', HomeView.as_view(), name='HomeView'), path( 'LoginView/', LoginView.as_view(), name='LoginView'), path( 'SignUpView/', SignUpView.as_view(), name='SignUpView'), path( 'SettingsView/', SettingsVi...
flexible
{ "blob_id": "5bd8cee2595215fda6ab523a646cf918e3d84a50", "index": 937, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', HomeView.as_view(), name='HomeView'), path(\n 'LoginView/', LoginView.as_view(), name='LoginView'), path(\n 'SignUpView/', SignUpView.as_view(), name='SignUpV...
[ 0, 1, 2, 3 ]
import json from asgiref.sync import async_to_sync from daphne_API.diversifier import activate_diversifier from daphne_API.models import Design def send_archs_back(channel_layer, channel_name, archs): async_to_sync(channel_layer.send)(channel_name, { ...
normal
{ "blob_id": "564c613491b0d1797b216a0bd425690e9fae12bc", "index": 7725, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef send_archs_from_queue_to_main_dataset(context):\n background_queue_qs = Design.objects.filter(activecontext_id__exact=\n context.eosscontext.activecontext.id)\n arch_...
[ 0, 1, 2, 3, 4 ]
import sys import pytest from presidio_evaluator.evaluation import Evaluator from tests.conftest import assert_model_results_gt from presidio_evaluator.models.flair_model import FlairModel @pytest.mark.slow @pytest.mark.skipif("flair" not in sys.modules, reason="requires the Flair library") def test_flair_simple(sm...
normal
{ "blob_id": "813d27e8f9c1a416dab2f891dd71e4791bb92dbb", "index": 1040, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.slow\n@pytest.mark.skipif('flair' not in sys.modules, reason=\n 'requires the Flair library')\ndef test_flair_simple(small_dataset):\n flair_model = FlairModel(mode...
[ 0, 1, 2, 3 ]
import cv2 as cv def nothing(x): pass cv.namedWindow('Binary') cv.createTrackbar('threshold', 'Binary', 0, 255, nothing) cv.setTrackbarPos('threshold', 'Binary', 127) img_color = cv.imread('../sample/ball.png', cv.IMREAD_COLOR) img_gray = cv.cvtColor(img_color, cv.COLOR_BGR2GRAY) while(True): thre = cv.get...
normal
{ "blob_id": "034d4027ea98bca656178b66c5c6e6e8b13e4b9e", "index": 4219, "step-1": "<mask token>\n\n\ndef nothing(x):\n pass\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef nothing(x):\n pass\n\n\ncv.namedWindow('Binary')\ncv.createTrackbar('threshold', 'Binary', 0, 255, nothing)\ncv.setTrackbarPos(...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python ''' Script for analysis of wavefunctions on GaSb/InAs/GaSb simmetric quantum wells. This piece code is part of the project "phd_gasb_inas", which comprises the work related to the Phd. Dissertation named: "Quantum transport of charge and spin in topological insulators 2D". Author: Marcos Medeiro...
normal
{ "blob_id": "a012055d11202c68d9eddf5cf2a17043f9bbaf0a", "index": 6851, "step-1": "<mask token>\n\n\ndef map_density(ax, syst, psi_sqrd, colormap='Reds'):\n kwant.plotter.map(syst, psi_sqrd, ax=ax, fig_size=(7, 3), cmap=colormap,\n vmax=0.99 * max(psi_sqrd))\n tools.edit_axis(ax, 'dens')\n return ...
[ 4, 5, 7, 8, 9 ]