code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): if cl[i] == a + b: print(i + 1) <|reserved_special_token_1|> n, a, b = map(int, input().split()) cl = list(map(int, input().split())) for i in range(n): if cl[i] == a + b: print(i + 1)...
flexible
{ "blob_id": "ff081a5ff46ab37dc5a144fb4616c06ef3bca490", "index": 7286, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n if cl[i] == a + b:\n print(i + 1)\n", "step-3": "n, a, b = map(int, input().split())\ncl = list(map(int, input().split()))\nfor i in range(n):\n if cl[...
[ 0, 1, 2 ]
#!/bin/python import numpy as np import os from sklearn.svm.classes import SVC import pickle import sys # Apply the SVM model to the testing videos; Output the score for each video if __name__ == '__main__': if len(sys.argv) != 5: print("Usage: {0} model_file feat_dir feat_dim output_file".format(sys.ar...
normal
{ "blob_id": "385dccfab4d7c37d10d968658b51e231691a7b49", "index": 1556, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n if len(sys.argv) != 5:\n print('Usage: {0} model_file feat_dir feat_dim output_file'.format(\n sys.argv[0]))\n print('model_file -...
[ 0, 1, 2, 3 ]
# import sys # sys.stdin = open("농작물input.txt") T = int(input()) for n in range(1, T+1): N = int(input()) arr = [list(map(int, list(input()))) for _ in range(N)] # print(arr) a = N//2 b = N//2 result = 0 for i in range(N): for j in range(a, b+1): result += arr[i][j] ...
normal
{ "blob_id": "2236591b3a30f51442beb20c6c43cc9e6cd921d2", "index": 7530, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(1, T + 1):\n N = int(input())\n arr = [list(map(int, list(input()))) for _ in range(N)]\n a = N // 2\n b = N // 2\n result = 0\n for i in range(N):\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def precip_stats_to_climatology(fili, start_year=1981, end_year=2015): """ Calculates average climatology for annual data - either Jan to Dec or accummulation period """ nyear = end_year - start_year + 1 ds =...
flexible
{ "blob_id": "eb403fbb307332c18ffdcdf52589c714f0719960", "index": 3052, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef precip_stats_to_climatology(fili, start_year=1981, end_year=2015):\n \"\"\"\n Calculates average climatology for annual data - either Jan to Dec or accummulation period\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def make_moves_from_path(path): moves = [] p = path[:] for i in range(len(p) - 1): moves.append((p[i + 1], p[i], 1, [p[i + 1], p[i]])) return moves def find_nearest_hole(o, r, graph, start): visited, queue = [], [(start, [start])] results = [] while q...
flexible
{ "blob_id": "800edfc61635564abf8297c4f33c59d48cc99960", "index": 4058, "step-1": "<mask token>\n\n\ndef make_moves_from_path(path):\n moves = []\n p = path[:]\n for i in range(len(p) - 1):\n moves.append((p[i + 1], p[i], 1, [p[i + 1], p[i]]))\n return moves\n\n\ndef find_nearest_hole(o, r, gra...
[ 7, 11, 12, 16, 19 ]
<|reserved_special_token_0|> def open_lid(): motor_lid.throttle = 1 time.sleep(0.25) motor_lid.throttle = 0 def close_lid(): motor_lid.throttle = -1 time.sleep(0.25) motor_lid.throttle = 0 def blink(times): for _ in range(times): ss.digital_write(LED, True) time.sleep(0...
flexible
{ "blob_id": "608c116cd42132bd63be5056f0aaf5c78933886e", "index": 7536, "step-1": "<mask token>\n\n\ndef open_lid():\n motor_lid.throttle = 1\n time.sleep(0.25)\n motor_lid.throttle = 0\n\n\ndef close_lid():\n motor_lid.throttle = -1\n time.sleep(0.25)\n motor_lid.throttle = 0\n\n\ndef blink(tim...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class FactorGraphTrueSkillCalculator(SkillCalculator): def __init__(self): super(FactorGraphTrueSkillCalculator, self).__init__( SupportedOptions.PARTIAL_PLAY | SupportedOptions.PARTIAL_UPDATE, atLeast(2), atLeast(1)) <|reserved_special_token_0|> ...
flexible
{ "blob_id": "009be282e45d191eb8f4d7d2986a2f182d64c1dd", "index": 2935, "step-1": "<mask token>\n\n\nclass FactorGraphTrueSkillCalculator(SkillCalculator):\n\n def __init__(self):\n super(FactorGraphTrueSkillCalculator, self).__init__(\n SupportedOptions.PARTIAL_PLAY | SupportedOptions.PARTIA...
[ 6, 7, 8, 9, 10 ]
<|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": "f85a703b47d981397ed6048e941030a3fbee7b6d", "index": 229, "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 = [('talk', '0023...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': fieldnames = None field_max_width = dict() result = {'headers': [], 'details': []} is_header = True tidpid = dict() for line in subprocess.run(['/usr/bin/procstat', '-ath'], ...
flexible
{ "blob_id": "f4ae34be2be2b47b3394e6da751c53c51a1c3174", "index": 6678, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n fieldnames = None\n field_max_width = dict()\n result = {'headers': [], 'details': []}\n is_header = True\n tidpid = dict()\n for line in su...
[ 0, 1, 2, 3 ]
from django.db import models class Location(models.Model): id_location = models.AutoField(primary_key=True) city = models.CharField(max_length=100, null=True) street_name = models.CharField(max_length=100, null=True) street_number = models.IntegerField(null=True) zip = models.IntegerField(null=Tru...
normal
{ "blob_id": "914f477518918619e0e42184bd03c2a7ed16bb01", "index": 86, "step-1": "<mask token>\n\n\nclass Relation_type(models.Model):\n <mask token>\n <mask token>\n\n def __str__(self):\n return str(self.name)\n\n\nclass Relation(models.Model):\n id_relation = models.AutoField(primary_key=True...
[ 9, 18, 20, 21, 24 ]
""" Copyright (C) 2005 - 2016 Splunk Inc. All Rights Reserved. """ import logging import sys if sys.platform == "win32": import os, msvcrt msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) import splunk.adm...
normal
{ "blob_id": "675dc9467dd6db9c2a429941af56d78d6c0e1c08", "index": 4135, "step-1": "<mask token>\n\n\nclass MissingTransitionException(InvalidConfigException):\n \"\"\"\n Describes a capability that is missing.\n \"\"\"\n\n def __init__(self, transitions):\n self.transitions = transitions\n ...
[ 14, 16, 18, 23, 26 ]
# create item based on name using post method, get specific item or list of items using get method, update item using put and delete item using del method. import os from flask import Flask from flask_restful import Api from flask_jwt import JWT, timedelta from security import authenticate, identity from resources.us...
normal
{ "blob_id": "7525691ece4fe66bb175e470db3ac78f701e3730", "index": 199, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.add_resource(Store, '/store/<string:name>')\napi.add_resource(Item, '/item/<string:name>')\napi.add_resource(ItemList, '/items')\napi.add_resource(StoreList, '/stores')\napi.add_resour...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ImageProcessor(object): <|reserved_special_token_0|> def __init__(self, config): self.config = config self.is_first_img = True self.next_feature_id = 0 self.detector = cv2.FastFeatureDetector_create(self.config. fast_threshold) ...
flexible
{ "blob_id": "02f196623907703255bf149db0435104d086da97", "index": 8292, "step-1": "<mask token>\n\n\nclass ImageProcessor(object):\n <mask token>\n\n def __init__(self, config):\n self.config = config\n self.is_first_img = True\n self.next_feature_id = 0\n self.detector = cv2.Fas...
[ 18, 20, 23, 25, 31 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2, N + 1): prime -= set(range(i ** 2, N + 1, i)) for number in prime: print(number) <|reserved_special_token_1|> M, N = 3, 16 prime = set(range(M, N + 1)) for i in range(2, N + 1): prime -= set(range(...
flexible
{ "blob_id": "d190eb27ea146cf99ac7f8d29fb5f769121af60e", "index": 9437, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, N + 1):\n prime -= set(range(i ** 2, N + 1, i))\nfor number in prime:\n print(number)\n", "step-3": "M, N = 3, 16\nprime = set(range(M, N + 1))\nfor i in range(2...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Dataset: def __init__(self, config, path, batch_size, shuffle, is_training, is_testing): self.config = config self.is_training = is_training self.is_testing = is_testing self.path = path """ each archive contains: fa...
flexible
{ "blob_id": "f94fcf6ed54f247093050216c0c331ce188da919", "index": 9228, "step-1": "<mask token>\n\n\nclass Dataset:\n\n def __init__(self, config, path, batch_size, shuffle, is_training,\n is_testing):\n self.config = config\n self.is_training = is_training\n self.is_testing = is_te...
[ 2, 4, 5, 6, 7 ]
import openpyxl from openpyxl import Workbook import openpyxl as openpyxl from openpyxl.chart import BarChart wb = openpyxl.load_workbook('/Users/mac/Desktop/stu_scores _Grade 2.xlsx') sheet = wb['stu_scores_01'] data = openpyxl.chart.Reference(sheet, min_col=3, min_row=34, max_row=34,max_col=7) cat = openpyxl.chart....
normal
{ "blob_id": "bb9ff561ff94bbe4d20f14287ba313386ea78609", "index": 9121, "step-1": "<mask token>\n", "step-2": "<mask token>\ncharObj.append(seriesObj)\ncharObj.set_categories(cat)\nsheet.add_chart(charObj, 'I2')\n<mask token>\ncharObj.append(seriesObj)\ncharObj.set_categories(cat)\nsheet.add_chart(charObj, 'I18...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def add(size, cont): sh.sendlineafter('Your choice :', '1') sh.sendlineafter('Size of Heap(0x10 or 0x20 only) : ', str(size)) sh.sendlineafter('Content:', str(cont)) def edit(index, cont): sh.sendlineafter('Your choice :', '2') sh.sendlineafter('Index :', str(index))...
flexible
{ "blob_id": "eeedf4930a7fa58fd406a569db6281476c2e3e35", "index": 4870, "step-1": "<mask token>\n\n\ndef add(size, cont):\n sh.sendlineafter('Your choice :', '1')\n sh.sendlineafter('Size of Heap(0x10 or 0x20 only) : ', str(size))\n sh.sendlineafter('Content:', str(cont))\n\n\ndef edit(index, cont):\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def f_1(x, a): return 1 / (x + 5) * np.sin(a * x) def f_2(x, a): return np.sin(a * x) + 1 def f_3(x, a): return np.sin(a * x ** 2) <|reserved_special_token_0|> def f_5(x): return x * np.tan(x) def f_6(x, a, b): return (1 + a * x + b * x ** 2) / (2 / 3 * (b + ...
flexible
{ "blob_id": "27edc753ebb9d60715a2ffa25d77e69ef363d010", "index": 3568, "step-1": "<mask token>\n\n\ndef f_1(x, a):\n return 1 / (x + 5) * np.sin(a * x)\n\n\ndef f_2(x, a):\n return np.sin(a * x) + 1\n\n\ndef f_3(x, a):\n return np.sin(a * x ** 2)\n\n\n<mask token>\n\n\ndef f_5(x):\n return x * np.tan...
[ 6, 9, 12, 13, 14 ]
from pyspark import SparkContext, SparkConf conf = SparkConf().setAppName("same_host").setMaster("local") sc = SparkContext(conf=conf) julyFirstLogs = sc.textFile("/Users/iamsuman/src/iamsuman/myspark/mypyspark/data/nasa_19950701.tsv") augFirstLogs = sc.textFile("/Users/iamsuman/src/iamsuman/myspark/mypyspark/data/na...
normal
{ "blob_id": "36fce3837e0341d94ff6099a06be8cf757a1cfa9", "index": 3596, "step-1": "<mask token>\n", "step-2": "<mask token>\ncleanedHostIntersection.saveAsTextFile('out/nasa_logs_same_hosts.csv')\n", "step-3": "<mask token>\nconf = SparkConf().setAppName('same_host').setMaster('local')\nsc = SparkContext(conf...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TensorflowV1ModelStep(BaseTensorflowModelStep): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, create_graph, create_loss, create_optimizer, create_feed_dict=None, data_inputs_dtype=None, expe...
flexible
{ "blob_id": "76a22408bb423d9a5bc5bc007decdbc7c6cc98f7", "index": 8397, "step-1": "<mask token>\n\n\nclass TensorflowV1ModelStep(BaseTensorflowModelStep):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, create_graph, create_loss, create_optimizer,\n create_feed_dict=None, da...
[ 13, 15, 16, 19, 21 ]
<|reserved_special_token_0|> class Obj: def __init__(self, name): self.name = name self.down = [] def add_child(self, obj): self.down.append(obj) def prnt(self, prev): if not self.down: print(prev + '=' + self.name) else: for d in self.dow...
flexible
{ "blob_id": "7d3f4e0a5031f9ce618c568b440c7425489060a1", "index": 4122, "step-1": "<mask token>\n\n\nclass Obj:\n\n def __init__(self, name):\n self.name = name\n self.down = []\n\n def add_child(self, obj):\n self.down.append(obj)\n\n def prnt(self, prev):\n if not self.down:...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @register.filter def jsonify(object): return mark_safe(json.dumps(object, cls=DjangoJSONEncoder)) @register.simple_tag def get_crop_url(crop, width=None, scale=1): if width: return crop.url_at_width(width * sca...
flexible
{ "blob_id": "987579da6b7ae208a66e375e0c9eca32b97199c5", "index": 4704, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@register.filter\ndef jsonify(object):\n return mark_safe(json.dumps(object, cls=DjangoJSONEncoder))\n\n\n@register.simple_tag\ndef get_crop_url(crop, width=None, scale=1):\n if...
[ 0, 3, 4, 5 ]
def phi(n): r = n d = 2 p = n while r > 1: if r % d == 0: p -= int(r/d) while r % d == 0: r = int(r/d) d += 1 return p m = (0, 1) for n in range(2, 1000000): p = phi(n) m = max(m, (n/p, n)) if n % 10000 == 0: print(n) prin...
normal
{ "blob_id": "e4f97018567559fc2714b75654974fb7c51f770f", "index": 5266, "step-1": "<mask token>\n", "step-2": "def phi(n):\n r = n\n d = 2\n p = n\n while r > 1:\n if r % d == 0:\n p -= int(r / d)\n while r % d == 0:\n r = int(r / d)\n d += 1\n r...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.2 on 2020-10-25 01:19 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('jobs', '0001_initial'), ] operations = [ migrations.AddField( model_name='job', name='link', ...
normal
{ "blob_id": "562888201719456ed2f3c32e81ffd7d2c39dabc3", "index": 7303, "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 = [('jobs', '000...
[ 0, 1, 2, 3, 4 ]
import boring.dialog import boring.form FORMSTRING = ''' Project name@string Width@int|Height@int Background color@color Fullscreen@check ''' class NewProjectWindow(boring.dialog.DefaultDialog): def __init__(self, master, _dict=None): self._dict = _dict self.output = None boring.dialog.Def...
normal
{ "blob_id": "76420ec1b37d4b9b85f35764a7f8a0e1f19a15dd", "index": 5745, "step-1": "<mask token>\n\n\nclass NewProjectWindow(boring.dialog.DefaultDialog):\n\n def __init__(self, master, _dict=None):\n self._dict = _dict\n self.output = None\n boring.dialog.DefaultDialog.__init__(self, maste...
[ 4, 5, 6, 7, 8 ]
import mxnet as mx import numpy as np import logging # Example performance: # INFO:root:Epoch[34] Train-accuracy=0.601388 # INFO:root:Epoch[34] Validation-accuracy=0.620949 logger = logging.getLogger() logger.setLevel(logging.DEBUG) # running device dev = mx.gpu() # batch size and input shape batch_size = 64 data_sh...
normal
{ "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 ]
_base_ = [ '../models/cascade_rcnn_r50_fpn.py', #'coco_instance.py', '../datasets/dataset.py', '../runtime/valid_search_wandb_runtime.py', '../schedules/schedule_1x.py' ] pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth' # noqa model...
normal
{ "blob_id": "2874e05d6d5e0f13924e5920db22ea3343707dfa", "index": 3898, "step-1": "<mask token>\n", "step-2": "_base_ = ['../models/cascade_rcnn_r50_fpn.py', '../datasets/dataset.py',\n '../runtime/valid_search_wandb_runtime.py', '../schedules/schedule_1x.py']\npretrained = (\n 'https://github.com/SwinTra...
[ 0, 1, 2 ]
import sqlite3 import os #Search for a patient name #Every doctor enter a name, it will find the patinet name that is similar to the patient name #Once a match is found, the system will output a list of matched patient names. #Then, the doctor select the patient to continue def patientSelect(CONN, staff): c = CONN...
normal
{ "blob_id": "b3b4d27b60c71cbd979ad4887fa80408665ea1ac", "index": 2853, "step-1": "<mask token>\n\n\ndef patientSelect(CONN, staff):\n c = CONN.cursor()\n print('Search for Patient')\n select = input(\"Enter patient name(type 'exit' to leave): \")\n if select == 'exit':\n os.system('clear')\n ...
[ 7, 9, 11, 12, 13 ]
from random import randint #funções def leialetra(): ''' =>Função para validar letras. parm=msg: Recebe dados to tipo string sendo Ss ou Nn. return: String de valor S. ''' while True: try: msg = str(input('Deseja fazer uma pergunta? [s/n] ')).upper()[0] e...
normal
{ "blob_id": "1fff681363c4c91c47c2818681a3f2f125dd8c83", "index": 2022, "step-1": "<mask token>\n\n\ndef leialetra():\n \"\"\"\n =>Função para validar letras.\n parm=msg: Recebe dados to tipo string sendo Ss ou Nn.\n return: String de valor S.\n \"\"\"\n while True:\n try:\n ...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 2.0.3 on 2018-04-30 16:25 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('threads', '0007_auto_20180430_1617'), ] operations = [ migrations.AlterField( model_name='thread', ...
normal
{ "blob_id": "6cd250b3bffd87657ec7cc28eaffe817c6d9f73f", "index": 9794, "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 = [('threads', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DataSource: def __init__(self, name, usableRows, errorRows, indices): self.name = name self.usableRows = usableRows self.errorRows = errorRows self.indices = indices def getHeaderIndexes(indices, headers): counter = -1 a, b, c, d, e, f,...
flexible
{ "blob_id": "38c1b82a29a5ad0b4581e63fb083ca2487a79817", "index": 9544, "step-1": "<mask token>\n\n\nclass DataSource:\n\n def __init__(self, name, usableRows, errorRows, indices):\n self.name = name\n self.usableRows = usableRows\n self.errorRows = errorRows\n self.indices = indice...
[ 5, 6, 8, 9, 10 ]
# Generated by Django 2.1.2 on 2018-10-19 22:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.AlterField( model_name='mascota', name='descripcion', ...
normal
{ "blob_id": "fcfec60a2302ee0c1385add053d4371040a2aff4", "index": 3667, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
import items import grupo class Conexion: def __init__(self, direccion, destino): self.set_direccion(direccion) self.set_destino(destino) def __repr__(self): return str(self.direccion()) + ' => ' + str(self.destino()) def direccion(self): return self._direccion def se...
normal
{ "blob_id": "f59e61977f7c72ab191aadccbd72d23f831b3a1c", "index": 7050, "step-1": "<mask token>\n\n\nclass Conexion:\n\n def __init__(self, direccion, destino):\n self.set_direccion(direccion)\n self.set_destino(destino)\n <mask token>\n <mask token>\n\n def set_direccion(self, direccion...
[ 20, 22, 25, 26, 27 ]
<|reserved_special_token_0|> class KibbleESWrapper(object): <|reserved_special_token_0|> def __init__(self, ES): self.ES = ES <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def s...
flexible
{ "blob_id": "f4b704a1416bfd6524340a68a20981957abf4340", "index": 9850, "step-1": "<mask token>\n\n\nclass KibbleESWrapper(object):\n <mask token>\n\n def __init__(self, ES):\n self.ES = ES\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def scroll(sel...
[ 17, 19, 23, 25, 28 ]
#!/usr/bin/python3 import os import sys import subprocess path = sys.argv[1] name, ext = os.path.splitext(path) options = ['g++', '-O3', 'src/' + path, '-o', f'./bin/{name}', '-std=c++11', '-lgmp'] subprocess.call(options) subprocess.call([f'./bin/{name}'])
normal
{ "blob_id": "5dd79f8ebd74099871d4367cafd83359c4f24e26", "index": 5385, "step-1": "<mask token>\n", "step-2": "<mask token>\nsubprocess.call(options)\nsubprocess.call([f'./bin/{name}'])\n", "step-3": "<mask token>\npath = sys.argv[1]\nname, ext = os.path.splitext(path)\noptions = ['g++', '-O3', 'src/' + path,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Office(Room): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Office(Room): def __init__(self): pass <|reserved_special_token_1|> from room import Room ...
flexible
{ "blob_id": "d3af5ac87474a99f1ade222995884bc8e035ce35", "index": 6142, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Office(Room):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Office(Room):\n\n def __init__(self):\n pass\n", "step-4": "from room import Room\n\n\nclass...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestingPenaltyTracker(unittest.TestCase): <|reserved_special_token_0|> @classmethod def tearDownClass(cls): cls.testPenaltyTracker = None cls.controlDatabase = None os.remove(os.path.join(os.getcwd(), 'Tests', 'test_penalty.db')) <|reserved_s...
flexible
{ "blob_id": "607d8bc79caa9d767bdb7e77a5db52295d90236f", "index": 1759, "step-1": "<mask token>\n\n\nclass TestingPenaltyTracker(unittest.TestCase):\n <mask token>\n\n @classmethod\n def tearDownClass(cls):\n cls.testPenaltyTracker = None\n cls.controlDatabase = None\n os.remove(os.p...
[ 3, 5, 6, 7, 8 ]
import sys from PyQt5.QtWidgets import (QMainWindow, QWidget, QHBoxLayout, QVBoxLayout, QFrame, QSplitter, QStyleFactory, QApplication, QPushButton, QTextEdit, QLabel, QFileDialog, QMessageBox) from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QColor import myLoadData from UIPack import setLossParameterDia...
normal
{ "blob_id": "302605d8bb45b1529742bf9441d476f0276085b9", "index": 9, "step-1": "<mask token>\n\n\nclass MyMainWindow(QMainWindow):\n <mask token>\n <mask token>\n\n def initConnect(self):\n self.dataFileChooseButton.clicked.connect(self.chooseData)\n self.dataFileChooseButtonT.clicked.conne...
[ 9, 11, 12, 15, 18 ]
<|reserved_special_token_0|> class WiiGestureClassifier: <|reserved_special_token_0|> def __init__(self): super(self.__class__, self).__init__() <|reserved_special_token_0|> def parseArrays(self, data): parsedData = [] for gesture in data: parsedGesture = WiiGestu...
flexible
{ "blob_id": "0b7bba826b82c3751c072395431e17bc1dc9bb90", "index": 6037, "step-1": "<mask token>\n\n\nclass WiiGestureClassifier:\n <mask token>\n\n def __init__(self):\n super(self.__class__, self).__init__()\n <mask token>\n\n def parseArrays(self, data):\n parsedData = []\n for ...
[ 7, 8, 10, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(mydoc) <|reserved_special_token_1|> <|reserved_special_token_0|> myclient = pymongo.MongoClient('mongodb://localhost:27017/') mydb = myclient['mydatabase'] mycol = mydb['customers'] mydict = [{'name': 'Eric', 'address': '...
flexible
{ "blob_id": "6c6026a7ff0345c37e62de7c0aac0ee3bcde2c82", "index": 5879, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(mydoc)\n", "step-3": "<mask token>\nmyclient = pymongo.MongoClient('mongodb://localhost:27017/')\nmydb = myclient['mydatabase']\nmycol = mydb['customers']\nmydict = [{'name': 'Eri...
[ 0, 1, 2, 3, 4 ]
from compas.geometry import Line # This import is use to test __repr__. from compas.geometry import Point # noqa: F401 def test_line(): p1 = [0, 0, 0] p2 = [1, 0, 0] line = Line(p1, p2) assert line.start == p1 assert line.end == p2 def test_equality(): p1 = [0, 0, 0] p2 = [1, 0, 0] ...
normal
{ "blob_id": "03629e62b11e66eeb0e111fee551c75c8463cbb8", "index": 1059, "step-1": "<mask token>\n\n\ndef test_line():\n p1 = [0, 0, 0]\n p2 = [1, 0, 0]\n line = Line(p1, p2)\n assert line.start == p1\n assert line.end == p2\n\n\n<mask token>\n\n\ndef test___getitem__():\n p1 = [0, 0, 0]\n p2 ...
[ 2, 3, 4, 5, 6 ]
import os bind = "0.0.0.0:" + str(os.environ.get("MAESTRO_PORT", 5005)) workers = os.environ.get("MAESTRO_GWORKERS", 2)
normal
{ "blob_id": "818e6842d4a1f8978ec14bca06981ec933c00376", "index": 6280, "step-1": "<mask token>\n", "step-2": "<mask token>\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005))\nworkers = os.environ.get('MAESTRO_GWORKERS', 2)\n", "step-3": "import os\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Auction(models.Model): title = models.CharField(max_length=20) current_price = models.DecimalField(max_digits=10, decimal_places=2, default=0, null=True, blank=True, verbose_name='current bid') updated_time = models.DateTimeField(auto_now_add=False, auto_now= ...
flexible
{ "blob_id": "9bb15842b39c7fd3e6f6c0048a51c2b2112ddb94", "index": 8082, "step-1": "<mask token>\n\n\nclass Auction(models.Model):\n title = models.CharField(max_length=20)\n current_price = models.DecimalField(max_digits=10, decimal_places=2,\n default=0, null=True, blank=True, verbose_name='current ...
[ 15, 20, 23, 25, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def chat(request): chat_list = Chat.objects.order_by('id_chat') chat_dict = {'chat': chat_list} return render(request, 'chats/Chat.html', context=chat_dict) <|reserved_special_token_1|> from django.shortcuts impor...
flexible
{ "blob_id": "4a14265a9a2338be66e31110bba696e224b6a70f", "index": 8395, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef chat(request):\n chat_list = Chat.objects.order_by('id_chat')\n chat_dict = {'chat': chat_list}\n return render(request, 'chats/Chat.html', context=chat_dict)\n", "step...
[ 0, 1, 2, 3 ]
from sys import exit from os import stat file = open("fiunamfs.img","r") nombre = file.read(8) file.seek(10) version = file.read(3) file.seek(20) etiqueta = file.read(15) file.seek(40) cluster = file.read(5) file.seek(47) numero = file.read(2) file.seek(52) numeroCompleto = file.read(8) file.close() archivos = [] tam...
normal
{ "blob_id": "da69fd937153fe2112b9f64411882527274247ef", "index": 1878, "step-1": "<mask token>\n\n\ndef clusterVacio():\n arreAux = []\n busca = 1\n bandera = True\n for i in range(len(clusters)):\n clu = clusters[i]\n arreAux.append(int(clu[0]))\n print(arreAux)\n while bandera:\...
[ 8, 9, 10, 12, 13 ]
from collections import Counter def main(): N = int(input()) A = tuple(map(int, input().split())) c = Counter(A).most_common() if c[0][0] == 0 and c[0][1] == N: print("Yes") elif len(c) == 2 and c[0][1] == 2*N//3 and c[1][0] == 0 and c[1][1] == N//3: print("Yes") elif ...
normal
{ "blob_id": "7c6ada250770e04b395dda774a78042da69e2854", "index": 8681, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n c = Counter(A).most_common()\n if c[0][0] == 0 and c[0][1] == N:\n print('Yes')\n elif le...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app = Flask(__name__) app.config['SECRET_KEY'] = 'SuperSecretKey' app.config['SQLALCHEMY_DATABASE_URI' ] = 'postgresql://info2180-project1:password123@localhost/profilebook' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True ...
flexible
{ "blob_id": "7b45c9e31bfb868b1abde6af0d8579b52f86d9c3", "index": 5689, "step-1": "<mask token>\n", "step-2": "<mask token>\napp = Flask(__name__)\napp.config['SECRET_KEY'] = 'SuperSecretKey'\napp.config['SQLALCHEMY_DATABASE_URI'\n ] = 'postgresql://info2180-project1:password123@localhost/profilebook'\napp.c...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def create_database(cursor): try: cursor.execute("CREATE DATABASE {} DEFAULT CHARACTER SET 'utf8'". format(DB_NAME)) except mysql.connector.Error as err: print('Failed creating database: {}'.format(err)) exit(1) <|reserved_special_token_0|> ...
flexible
{ "blob_id": "38abc4bc99f3b15b416c77481818464a6c7f11ef", "index": 3844, "step-1": "<mask token>\n\n\ndef create_database(cursor):\n try:\n cursor.execute(\"CREATE DATABASE {} DEFAULT CHARACTER SET 'utf8'\".\n format(DB_NAME))\n except mysql.connector.Error as err:\n print('Failed cr...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class WordsSetAccumulatorParam(AccumulatorParam): def zero(self, v): return set() def addInPlace(self, acc1, acc2): return acc1.union(acc2) class WordsDictAccumulatorParam(AccumulatorParam): def zero(self, v): return dict() def addInPlace(self...
flexible
{ "blob_id": "ee58ed68d2f3c43f9611f6c6e4cd2b99adcb43d2", "index": 2616, "step-1": "<mask token>\n\n\nclass WordsSetAccumulatorParam(AccumulatorParam):\n\n def zero(self, v):\n return set()\n\n def addInPlace(self, acc1, acc2):\n return acc1.union(acc2)\n\n\nclass WordsDictAccumulatorParam(Accu...
[ 10, 14, 15, 18, 20 ]
""" Author: Alan Danque Date: 20210323 Purpose:Final Data Wrangling, strips html and punctuation. """ from sklearn.tree import export_graphviz import pydot import pickle from pathlib import Path import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.ensemble import ...
normal
{ "blob_id": "b9678b447bc6e7c4e928ffa6b8cd58639e41a801", "index": 2688, "step-1": "<mask token>\n", "step-2": "<mask token>\nresults_dir.mkdir(parents=True, exist_ok=True)\n<mask token>\nprint(data.shape)\n<mask token>\nprint(\"\"\"\nDataFrame Shape :\"\"\", shape)\nprint(\"\"\"\nNumber of rows :\"\"\", shape[0...
[ 0, 1, 2, 3, 4 ]
from typing import List, Tuple import pytest def fit_transform(*args: str) -> List[Tuple[str, List[int]]]: if len(args) == 0: raise TypeError('expected at least 1 arguments, got 0') categories = args if isinstance(args[0], str) else list(args[0]) uniq_categories = set(categories) bi...
normal
{ "blob_id": "b236abaa5e206a8244083ee7f9dcdb16741cb99d", "index": 3072, "step-1": "<mask token>\n\n\ndef test_str_fit_transformr():\n assert fit_transform(['Moscow', 'New York', 'Moscow', 'London']) == [(\n 'Moscow', [0, 0, 1]), ('New York', [0, 1, 0]), ('Moscow', [0, 0, 1]\n ), ('London', [1, 0,...
[ 3, 4, 6, 7, 8 ]
#!/usr/bin/python #=============================================================================== # # Board Data File Analyzer # # Copyright (c) 2017 by QUALCOMM Atheros, Incorporated. # All Rights Reserved # QUALCOMM Atheros Confidential and Proprietary # # Notifications and licenses are retained for attribution purp...
normal
{ "blob_id": "5c12ff4f88af991fa275cd08adf3678ee4a678f3", "index": 8532, "step-1": "#!/usr/bin/python\n#===============================================================================\n#\n# Board Data File Analyzer\n#\n# Copyright (c) 2017 by QUALCOMM Atheros, Incorporated.\n# All Rights Reserved\n# QUALCOMM Ather...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if k2 >= k: print(' Yes, the scene can be set.') else: print(" Sorry, but the scene can't be set.") <|reserved_special_token_1|> <|reserved_special_token_0|> s = int(input('Input your area of square (S): ')) r = i...
flexible
{ "blob_id": "31a2fa5b2febc2ef80b57e45c2ebb662b886c4b7", "index": 6043, "step-1": "<mask token>\n", "step-2": "<mask token>\nif k2 >= k:\n print(' Yes, the scene can be set.')\nelse:\n print(\" Sorry, but the scene can't be set.\")\n", "step-3": "<mask token>\ns = int(input('Input your area of squ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get(upload_page) driver.find_element_by_id('inputfile').send_keys(file_path + '\\test.txt') <|reserved_special_token_1|> <|reserved_special_token_0|> file_path = os.path.abspath('./files//') driver = webdriver.Firefox() ...
flexible
{ "blob_id": "9e28fa1f221df13f9cc8e6b71586da961ebdc0e0", "index": 4580, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get(upload_page)\ndriver.find_element_by_id('inputfile').send_keys(file_path + '\\\\test.txt')\n", "step-3": "<mask token>\nfile_path = os.path.abspath('./files//')\ndriver = web...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(forbidpath, 'rb') as f: for line in f: word = line.strip() forbidkword[word] = 0 <|reserved_special_token_0|> with open(inputpath, 'rb') as f: for line in f: splits = line.strip().split('\...
flexible
{ "blob_id": "84a516e924252d897be7444e11acfecd66474090", "index": 1177, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(forbidpath, 'rb') as f:\n for line in f:\n word = line.strip()\n forbidkword[word] = 0\n<mask token>\nwith open(inputpath, 'rb') as f:\n for line in f:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def predict(model, row): preds = [] for perc in range(-10, 11): new_row = row.copy() row_copy = row.copy() new_row = new_row.drop(labels=['Area', 'Year', 'Crop', 'Previous crop', 'Yield']) nitrogen = new_row['N'] * ((100 + perc) / 100) ...
flexible
{ "blob_id": "0ebd3ca5fd29b0f2f2149dd162b37f39668f1c58", "index": 7397, "step-1": "<mask token>\n\n\ndef predict(model, row):\n preds = []\n for perc in range(-10, 11):\n new_row = row.copy()\n row_copy = row.copy()\n new_row = new_row.drop(labels=['Area', 'Year', 'Crop',\n '...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='sgcharts-pointer-generator', version=__version__, python_requires='>=3.5.0', install_requires=['tensorflow==1.10.0', 'pyrouge==0.1.3', 'spacy==2.0.12', 'en_core_web_sm==2.0.0', 'sgcharts-stringx==1.1.1'], p...
flexible
{ "blob_id": "e52b01cc7363943f5f99b1fa74720c6447b1cfae", "index": 6266, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='sgcharts-pointer-generator', version=__version__,\n python_requires='>=3.5.0', install_requires=['tensorflow==1.10.0',\n 'pyrouge==0.1.3', 'spacy==2.0.12', 'en_core_web_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, count + 1): something = '=' num1, num2 = map(int, input().split()) if num1 > num2: something = '>' elif num1 < num2: something = '<' print(f'#{i} {something}') <|reserved_spe...
flexible
{ "blob_id": "abcefa0a3312e158517ec8a15421d1d07220da6a", "index": 5271, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, count + 1):\n something = '='\n num1, num2 = map(int, input().split())\n if num1 > num2:\n something = '>'\n elif num1 < num2:\n something = '<...
[ 0, 1, 2 ]
#!/usr/bin/python3 # -*- coding: utf-8 -*- import random a = random.sample(range(100), 10) print("All items: {}".format(a)) it = iter(a) # call a.__iter__() print("Num01: {}".format(next(it))) # call it.__next__() print("Num02: {}".format(next(it))) print("Num03: {}".format(it.__next__())) it = iter(a) i = 1 while...
normal
{ "blob_id": "f5513bea4ca5f4c2ac80c4bf537a264a4052d1e9", "index": 8866, "step-1": "<mask token>\n\n\nclass Node2:\n\n def __init__(self, value):\n self._value = value\n self._children = []\n self._idx = 0\n\n def __repr__(self):\n return 'Node2({!r})'.format(self._value)\n <ma...
[ 12, 13, 15, 16, 24 ]
<|reserved_special_token_0|> class EngageScraper(ABC): def __init__(self, tz_string): super().__init__() self._agenda_locations = [] self._tz = timezone(tz_string) @property def agenda_locations(self): return self._agenda_locations @agenda_locations.setter def ag...
flexible
{ "blob_id": "ec224924206c41cf8203c6aa8002ddf6b0e70e9b", "index": 1116, "step-1": "<mask token>\n\n\nclass EngageScraper(ABC):\n\n def __init__(self, tz_string):\n super().__init__()\n self._agenda_locations = []\n self._tz = timezone(tz_string)\n\n @property\n def agenda_locations(s...
[ 8, 10, 11, 12 ]
# coding: utf-8 from flask import Blueprint, make_response, render_template, request from flask_restful import Resource from flask_security import login_required from ..clients.service import list_clients from ..roles.service import list_roles from ...models import Client, Role admin = Blueprint('admin', __name__, u...
normal
{ "blob_id": "f5f1a4db33cea8421cb4236606dfb288efee7621", "index": 2142, "step-1": "<mask token>\n\n\n@admin.route('/', methods=['GET'])\n@login_required\ndef index():\n headers = {'Content-Type': 'text/html'}\n return make_response(render_template('index.html'), headers)\n\n\n<mask token>\n\n\n@admin.route(...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class DataTello: def __init__(self): self.tello = Tello() self.__data = [] self.__array = [] self.tempoVoo = 420000 """ ___Padrão para nome dos arquivos das tabelas___ Onde x é o nº da tabela e y a quantidade de tempo em segundo...
flexible
{ "blob_id": "9e751bbddabbec7c5e997578d99ef1b8c35efe06", "index": 8108, "step-1": "<mask token>\n\n\nclass DataTello:\n\n def __init__(self):\n self.tello = Tello()\n self.__data = []\n self.__array = []\n self.tempoVoo = 420000\n \"\"\"\n ___Padrão para nome dos arqui...
[ 6, 7, 8, 9, 10 ]
# coding: utf-8 """Supporting model logic for predicting emotional content of user input. """ import pandas as pd import gensim from sklearn.model_selection import train_test_split from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC #load data for emo2vec loc = 'https://s3-us-west-1.a...
normal
{ "blob_id": "f5f26819be4b98fab3d46e57e1a5431e54342aed", "index": 414, "step-1": "<mask token>\n\n\ndef dropper():\n for ex in affected['word']:\n if ex not in model.vocab:\n idx_to_drop.append(affected.loc[affected.word == ex].index[0])\n\n\n<mask token>\n", "step-2": "<mask token>\nprint(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> trade_bot.start(sleep=1) print('Done!') <|reserved_special_token_1|> <|reserved_special_token_0|> brokers = create_brokers('LIVE', config.CURRENCIES, config.EXCHANGES) gp = brokers[2] trade_bot = ArbitrageBot(config, brokers) t...
flexible
{ "blob_id": "4436fa36ec21edb3be467f74d8b9705780535f22", "index": 6786, "step-1": "<mask token>\n", "step-2": "<mask token>\ntrade_bot.start(sleep=1)\nprint('Done!')\n", "step-3": "<mask token>\nbrokers = create_brokers('LIVE', config.CURRENCIES, config.EXCHANGES)\ngp = brokers[2]\ntrade_bot = ArbitrageBot(co...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if r.status_code == 200: text = r.text pattern = 'Přispěvatel' m = re.search(pattern, text) pattern2 = '<strong>([0-9]{1,})' m2 = re.search(pattern2, text[m.start():]) pattern3 = 'currency " >([0-9]{1,})' ...
flexible
{ "blob_id": "f3329962004a4454c04327da56d8dd1d0f1d45e7", "index": 763, "step-1": "<mask token>\n", "step-2": "<mask token>\nif r.status_code == 200:\n text = r.text\n pattern = 'Přispěvatel'\n m = re.search(pattern, text)\n pattern2 = '<strong>([0-9]{1,})'\n m2 = re.search(pattern2, text[m.start(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_branches_dir(root_dir): branches_dir = [] folds = os.listdir(root_dir) while folds: branch_dir = root_dir + '/' + folds.pop() branches_dir.append(branch_dir) return branches_dir def tolist(xml, detname): try: data = minidom.parse(xml) ...
flexible
{ "blob_id": "2b7bb02a25504e7481d3bc637ea09bcf9addb990", "index": 7699, "step-1": "<mask token>\n\n\ndef get_branches_dir(root_dir):\n branches_dir = []\n folds = os.listdir(root_dir)\n while folds:\n branch_dir = root_dir + '/' + folds.pop()\n branches_dir.append(branch_dir)\n return br...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> log.uploadLogs(4) <|reserved_special_token_1|> <|reserved_special_token_0|> log = LogUpload() log.uploadLogs(4) <|reserved_special_token_1|> from logupload import * log = LogUpload() log.uploadLogs(4)
flexible
{ "blob_id": "421837698b7fc188c84a3221271f11a40d1625d9", "index": 7280, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.uploadLogs(4)\n", "step-3": "<mask token>\nlog = LogUpload()\nlog.uploadLogs(4)\n", "step-4": "from logupload import *\nlog = LogUpload()\nlog.uploadLogs(4)\n", "step-5": null, ...
[ 0, 1, 2, 3 ]
# maze = [0, 3, 0, 1, -3] with open('./day_5/input.txt') as f: maze = f.readlines() f.close maze = [int(line.strip()) for line in maze] # I think I will just expand on the original functions # from now on rather than separating part one from two def escape_maze(maze): end = len(maze) - 1 step_counter = 0 ...
normal
{ "blob_id": "a4dfac7e15064d92c806a4e3f972f06e4dca6b11", "index": 5181, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef escape_maze(maze):\n end = len(maze) - 1\n step_counter = 0\n offset = 0\n while True:\n cur_index = offset\n offset = offset + maze[cur_index]\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for cnt in range(20, len(rows)): row_previous2 = rows[cnt - 2] row_previous1 = rows[cnt - 1] row = rows[cnt] open = row[2] high = row[3] low = row[4] close = row[5] vol = row[6] vol_buy, vol_sel...
flexible
{ "blob_id": "9aaaa744780dbd32b14e09a34976a2a0a3ce34f7", "index": 7864, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor cnt in range(20, len(rows)):\n row_previous2 = rows[cnt - 2]\n row_previous1 = rows[cnt - 1]\n row = rows[cnt]\n open = row[2]\n high = row[3]\n low = row[4]\n cl...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from django.urls import path, include from serverside.router import router from rest_framework.authtoken import views as auth_views from . import views from .views import CustomObtainAuthToken urlpatterns = [path('users/', views.UserCreateAPIView.as_view(), name= 'user-list'), path(...
normal
{ "blob_id": "49d76458b8adcf6eea9db2ef127609ff96e03ad1", "index": 6270, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('users/', views.UserCreateAPIView.as_view(), name=\n 'user-list'), path('users/login/', CustomObtainAuthToken.as_view()),\n path('users/<int:pk>/', views.ReadUse...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import codecs import time import json import os class OitYitikuscrapyDataPipeline(object): def open_spider(self, spider): ...
normal
{ "blob_id": "315996a783d7b95fd87374a8fe2602a572de071e", "index": 3495, "step-1": "<mask token>\n\n\nclass OitYitikuscrapyDataPipeline(object):\n\n def open_spider(self, spider):\n path = 'D:\\\\xiti10001\\\\data\\\\{}\\\\'.format(time.strftime('%Y%m%d',\n time.localtime()))\n isExists...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def chk_tmp_file(f_tmp): pass def get_file_base(path): fname = os.path.basename(path) return fname.split('.ts')[0] def _exec_transcode(path): f_base = get_file_base(path) work_base = get_work_base(f_base) f_in = os.path.join(dir_ts_files, f_base + '.ts') f_...
flexible
{ "blob_id": "502e2d2222863236a42512ffc98c2cc9deaf454f", "index": 7058, "step-1": "<mask token>\n\n\ndef chk_tmp_file(f_tmp):\n pass\n\n\ndef get_file_base(path):\n fname = os.path.basename(path)\n return fname.split('.ts')[0]\n\n\ndef _exec_transcode(path):\n f_base = get_file_base(path)\n work_ba...
[ 6, 7, 8, 9, 11 ]
import numpy as np import torch import torch.nn as nn from torch.nn.functional import interpolate from torchvision.ops.boxes import batched_nms class MTCNN(): def __init__(self, device=None, model=None): if device is None: device = 'cuda' if torch.cuda.is_available() else 'cpu' self.device = device url = '...
normal
{ "blob_id": "865121e7eb5f9c70adf44d33d21f30c22f13ec56", "index": 7012, "step-1": "<mask token>\n\n\nclass MTCNN:\n\n def __init__(self, device=None, model=None):\n if device is None:\n device = 'cuda' if torch.cuda.is_available() else 'cpu'\n self.device = device\n url = 'https...
[ 17, 18, 19, 21, 23 ]
<|reserved_special_token_0|> class OiRAFixture(PloneSandboxLayer): <|reserved_special_token_0|> def setUpZope(self, app, configurationContext): z2.installProduct(app, 'Products.membrane') z2.installProduct(app, 'Products.statusmessages') import Products.statusmessages xmlconfi...
flexible
{ "blob_id": "eec2b818ea9d50161bad60e8bf83dcb7ce9bf9fa", "index": 7428, "step-1": "<mask token>\n\n\nclass OiRAFixture(PloneSandboxLayer):\n <mask token>\n\n def setUpZope(self, app, configurationContext):\n z2.installProduct(app, 'Products.membrane')\n z2.installProduct(app, 'Products.statusm...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class House2: <|reserved_special_token_0|> <|reserved_special_token_0|> class Vehicle(ABC): def __init__(self, speed, year): self.speed = speed self.year = year def start(self): print('Starting engine') def stop(self): print('Stoppi...
flexible
{ "blob_id": "0e4c82d6eb77d2b6357925c9aab516bcc3310a4c", "index": 140, "step-1": "<mask token>\n\n\nclass House2:\n <mask token>\n <mask token>\n\n\nclass Vehicle(ABC):\n\n def __init__(self, speed, year):\n self.speed = speed\n self.year = year\n\n def start(self):\n print('Start...
[ 9, 12, 13, 14, 17 ]
<|reserved_special_token_0|> def calc_returns(batch, gamma): """ Calculate the simple returns (full rollout) for advantage i.e. sum discounted rewards up till termination """ rewards = batch['rewards'] assert not np.any(np.isnan(rewards)) not_dones = 1 - batch['dones'] T = len(rewards)...
flexible
{ "blob_id": "07095bc815f5342b66ef4ca74b769321f3ef2ec5", "index": 7240, "step-1": "<mask token>\n\n\ndef calc_returns(batch, gamma):\n \"\"\"\n Calculate the simple returns (full rollout) for advantage\n i.e. sum discounted rewards up till termination\n \"\"\"\n rewards = batch['rewards']\n asse...
[ 3, 4, 5, 6, 7 ]
# the age of some survivors survived_age = [48.0, 15.0, 40.0, 36.0, 47.0, \ 32.0, 60.0, 31.0, 17.0, 36.0, 39.0, 36.0, 32.5, \ 39.0, 38.0, 36.0, 52.0, 29.0, 35.0, 35.0, 49.0, \ 16.0, 27.0, 22.0, 27.0, 35.0, 3.0, 11.0, 36.0, \ 1.0, 19.0, 24.0, 33.0, 43.0, 24.0, 32.0, 49.0, \ 30.0, 49.0, 60.0, 23.0, 26.0, 24.0, 40.0, 25.0...
normal
{ "blob_id": "85c51f155439ff0cb570faafc48ac8da094515bf", "index": 3362, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('The ave_age of survivors is {}'.format(ave_survived_age))\nprint('The ave_age of victims is {}'.format(ave_non_survived_age))\n", "step-3": "survived_age = [48.0, 15.0, 40.0, 36....
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # encoding: utf-8 """ @version: ?? @author: ami @license: Apache Licence @file: dictTest.py @time: 2019/9/25 18:26 @tools: PyCharm """ def func(): pass class Main(): def __init__(self): pass if __name__ == '__main__': pass d = {'name': 'Bob', ...
normal
{ "blob_id": "797cedc9dc2a47713b9554e4f5975a4505ecf6d3", "index": 9568, "step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func():\n pass\n\n\nclass Main:\n\n def __init__(self):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\...
[ 1, 3, 4, 5, 6 ]
from django.conf.urls import url #from .views import CommandReceiveView from .views import index, send_message urlpatterns = [ #url(r'^bot/(?P<bot_token>.+)/$', CommandReceiveView.as_view(), name='command'), url(r'^send_message$', send_message, name='send_message'), url(r'^$', index, name='index'), ]
normal
{ "blob_id": "6cc56f73e58366a3906da537cc27fdd5a066ee34", "index": 2647, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^send_message$', send_message, name='send_message'),\n url('^$', index, name='index')]\n", "step-3": "from django.conf.urls import url\nfrom .views import index, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from django.db import models from django.db.models import F, Q, Sum, Avg from django.db import transaction from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.contrib.sites.models import Site ...
flexible
{ "blob_id": "d551cab1856fbdb91918f9171d5c02b8dab84aba", "index": 8223, "step-1": "<mask token>\n", "step-2": "from django.db import models\nfrom django.db.models import F, Q, Sum, Avg\nfrom django.db import transaction\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttype...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def wheeln(pos, sft): if pos + sft > 255: pos = pos + sft - 256 else: pos = pos + sft if pos < 0 or pos > 255: return 0, 0, 0 if pos < 85: return int(255 - pos * 3), int(pos * 3), 0 elif pos < 170: pos -= 85 return 0, int...
flexible
{ "blob_id": "1dd223854c10e69a397098511eab50b9ebd347c8", "index": 6027, "step-1": "<mask token>\n\n\ndef wheeln(pos, sft):\n if pos + sft > 255:\n pos = pos + sft - 256\n else:\n pos = pos + sft\n if pos < 0 or pos > 255:\n return 0, 0, 0\n if pos < 85:\n return int(255 - p...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Timer: def __init__(self): self._time = 0 self.is_stopped = False self._start() <|reserved_special_token_0|> <|reserved_special_token_0|> @property def time(self): self._stop() return self._time def to_string(self): ...
flexible
{ "blob_id": "458124aa0d6f04268ad052f74d546b12d3f3f5f7", "index": 8989, "step-1": "<mask token>\n\n\nclass Timer:\n\n def __init__(self):\n self._time = 0\n self.is_stopped = False\n self._start()\n <mask token>\n <mask token>\n\n @property\n def time(self):\n self._stop...
[ 23, 29, 31, 33, 35 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Check mean system norm errors in regression tests This script determines the pass/fail status of a regression test by comparing the "Mean System Norm" values output at each timestep against "gold values" from the reference file provided by the user. Success is deter...
normal
{ "blob_id": "d03669924233edf33fcb6645f5ed7ab118f54a95", "index": 7610, "step-1": "<mask token>\n\n\ndef load_norm_file(fname):\n \"\"\"Parse the norm file and return the mean system norms\"\"\"\n try:\n with open(fname, 'r') as fh:\n lines = fh.readlines()\n norms = [float(ll.s...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def snakesAndLadders(self, board: List[List[int]]) ->int: ...
flexible
{ "blob_id": "da5a366d1cc4f192a220dc38c7a74aeb3fba7cdb", "index": 9839, "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 snakesAndLadders(self, board: List[List[int]]) ->int:\n N = le...
[ 0, 1, 2, 3, 4 ]
import torch import torch.nn as nn from tqdm import tqdm import torch.nn.functional as F import torch.multiprocessing as mp from policy_network import Policy_Network from util import safe_log from util import index2word, rearrange_vector_list, get_num_gpus, set_seed class TestWorker(mp.Process): def __init__(self,...
normal
{ "blob_id": "c7333d838b87d4c275d9dbb6d7e3047c313b4bc0", "index": 9212, "step-1": "<mask token>\n\n\nclass TestWorker(mp.Process):\n <mask token>\n <mask token>\n\n def rollout(self):\n batch_question, batch_question_len, batch_head, batch_answers = (self\n .env.return_batch_data())\n ...
[ 6, 9, 10, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cmdline.execute('scrapy crawl ariz'.split()) <|reserved_special_token_1|> from scrapy import cmdline cmdline.execute('scrapy crawl ariz'.split()) <|reserved_special_token_1|> from scrapy import cmdline cmdline.execute("scrap...
flexible
{ "blob_id": "abb2cfd2113e8de6c7bba42c357f0ec140b224a9", "index": 3311, "step-1": "<mask token>\n", "step-2": "<mask token>\ncmdline.execute('scrapy crawl ariz'.split())\n", "step-3": "from scrapy import cmdline\ncmdline.execute('scrapy crawl ariz'.split())\n", "step-4": "from scrapy import cmdline\ncmdline...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.execute( "select name from sqlite_master where type = 'table' order by name") print('Tables name:', cursor.fetchall()) cursor.execute('PRAGMA table_info(user)') print('Table structure:', cursor.fetchall()) cursor.execut...
flexible
{ "blob_id": "dd8f4b08b88d487b68e916e9f92c08c9c0bc39da", "index": 2681, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(\n \"select name from sqlite_master where type = 'table' order by name\")\nprint('Tables name:', cursor.fetchall())\ncursor.execute('PRAGMA table_info(user)')\nprint('Ta...
[ 0, 1, 2, 3, 4 ]
from pymt_heat import Heatmodel heat = Heatmodel() n = heat.get_component_name() print(n)
normal
{ "blob_id": "82801ce564f4f29e084e6f842d7868eb60f582cb", "index": 6225, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(n)\n", "step-3": "<mask token>\nheat = Heatmodel()\nn = heat.get_component_name()\nprint(n)\n", "step-4": "from pymt_heat import Heatmodel\nheat = Heatmodel()\nn = heat.get_comp...
[ 0, 1, 2, 3 ]
import socket import threading import os import time import psutil import shutil class server: def __init__(self): self.commandSock = socket.socket() self.commandPort = 8080 self.transferSock = socket.socket() self.transferPort = 8088 self.chatSock=socket.socket() ...
normal
{ "blob_id": "4736f4e06f166b3c3fd8379a2021eb84a34fcbd3", "index": 6099, "step-1": "<mask token>\n\n\nclass server:\n\n def __init__(self):\n self.commandSock = socket.socket()\n self.commandPort = 8080\n self.transferSock = socket.socket()\n self.transferPort = 8088\n self.ch...
[ 7, 9, 11, 15, 16 ]
import math import time t1 = time.time() # n(3n-1)/2 def isPentagon(item): num = math.floor(math.sqrt(item*2//3))+1 if num*(3*num-1)//2 == item: return True return False # n(2n-1) def isHexagon(item): num = math.floor(math.sqrt(item//2))+1 if num*(2*num-1) == item: return True ...
normal
{ "blob_id": "0aec3fbc9f4b9f33aee021fa417c43f0feb0e3d1", "index": 3296, "step-1": "<mask token>\n\n\ndef isPentagon(item):\n num = math.floor(math.sqrt(item * 2 // 3)) + 1\n if num * (3 * num - 1) // 2 == item:\n return True\n return False\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef i...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mge_to_caffe(mge_fpath, prototxt='out.prototxt', caffemodel= 'out.caffemodel', outspec=None, use_empty_blobs=False): assert isinstance(mge_fpath, str), 'mge_fpath must be string' irgraph = MGE_FrontEnd(mge_fpath,...
flexible
{ "blob_id": "a83230e71cc1bcc843d00487746f16114d304eec", "index": 4908, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mge_to_caffe(mge_fpath, prototxt='out.prototxt', caffemodel=\n 'out.caffemodel', outspec=None, use_empty_blobs=False):\n assert isinstance(mge_fpath, str), 'mge_fpath must b...
[ 0, 1, 2, 3 ]
from pymouse import PyMouse m = PyMouse() w,h = m.screen_size() class base_controller: def __init__(self): pass def move(self,xy:list): ''' 移动 ''' m.move(xy[0]*w,xy[1]*h) def click(self, xy:list): ''' 点击 ''' m.click(xy[0]*w,xy...
normal
{ "blob_id": "b2f2f1e4b7070ac867b71e538f759e527eb1ffb9", "index": 416, "step-1": "<mask token>\n\n\nclass base_controller:\n <mask token>\n\n def move(self, xy: list):\n \"\"\"\n 移动\n \"\"\"\n m.move(xy[0] * w, xy[1] * h)\n\n def click(self, xy: list):\n \"\"\"\n ...
[ 6, 8, 10, 11, 12 ]
<|reserved_special_token_0|> class Preprocessor(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class WithUrlPreprocessor(Preprocessor): def __init__(self, max_workers=4): super...
flexible
{ "blob_id": "8cd50e1f0e0feb4d753443220f9fa9065e80e0ef", "index": 6358, "step-1": "<mask token>\n\n\nclass Preprocessor(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass WithUrlPreprocessor(Preprocessor):\n\n def __init__(self, max_workers=4):\n ...
[ 4, 6, 7, 10, 11 ]
# Generated by Django 3.2.4 on 2021-07-18 02:05 from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): initial = True dependencies = [ ('tracker', '0003_auto_20210626_0735'), ] operations = [ migrations.CreateMod...
normal
{ "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 ]
<|reserved_special_token_0|> class Graph: def draw(self, directory, filename, rules, start_state, accept_states): g = graphviz.Digraph(format='svg', graph_attr={'rankdir': 'LR'}) self.add_start_edge(g, start_state) edges = {} for rule in rules: from_state = self.state_...
flexible
{ "blob_id": "c0e94a0d20397ebbbdddf726307b19b6c5c85ae6", "index": 9082, "step-1": "<mask token>\n\n\nclass Graph:\n\n def draw(self, directory, filename, rules, start_state, accept_states):\n g = graphviz.Digraph(format='svg', graph_attr={'rankdir': 'LR'})\n self.add_start_edge(g, start_state)\n ...
[ 6, 7, 9, 10, 12 ]
# -*- coding: utf-8 -*- # Copyright 2013, Achim Köhler # All rights reserved, see accompanied file license.txt for details. # $REV$ import argparse import traylauncher if __name__ == "__main__": args = argparse.Namespace() args.notray = False traylauncher.start(args)
normal
{ "blob_id": "8faaf9eb2e78b7921dd1cac4772e2415671201c7", "index": 8481, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n args = argparse.Namespace()\n args.notray = False\n traylauncher.start(args)\n", "step-3": "import argparse\nimport traylauncher\nif __name__ == '_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_data_path(file_name): return os.path.join(DATA_DIR, file_name) def assert_strings(test_case, actual, expected): message = ( """ Expected: ""\"%s""\" Actual: ""\"%s""\" Expected: %s A...
flexible
{ "blob_id": "83d35c413af0cefb71964671b43df1e815aa2115", "index": 3945, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_data_path(file_name):\n return os.path.join(DATA_DIR, file_name)\n\n\ndef assert_strings(test_case, actual, expected):\n message = (\n \"\"\"\n\n Expected: \"\...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def cardinal(ordinal): return int(''.join([char for char in ordinal if char.isdigit()])) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def cardinal(ordinal): return int(''....
flexible
{ "blob_id": "d4b1b6bdf125f2791c219b7db579c234eda0a73c", "index": 9220, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cardinal(ordinal):\n return int(''.join([char for char in ordinal if char.isdigit()]))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef cardinal(ordinal):\n return i...
[ 0, 1, 2, 3, 4 ]
#THIS IS PYTHON3 import tkinter as tk from tkinter import * from PIL import ImageTk from PIL import Image #to handle non-gif image formats import cv2 import numpy as np from statistics import mode import time import random import predict as ml def calcSuccess(predictedCounter, randAssault): vidLabel.pack_forge...
normal
{ "blob_id": "8cf6a9243182a4f6b68199a8967e06790396dc10", "index": 5967, "step-1": "<mask token>\n\n\ndef calcSuccess(predictedCounter, randAssault):\n vidLabel.pack_forget()\n if predictedCounter == 'parry_R':\n instructionLabel.config(text='RIGHT PARRY')\n if randAssault == 4 or randAssault =...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Usuario(Configuration.db.Model): <|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 __repr__(self): return '<Usuario %r...
flexible
{ "blob_id": "598a0771dd1447034f2db95c67dd0dcf968f43a7", "index": 8229, "step-1": "<mask token>\n\n\nclass Usuario(Configuration.db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<Usuario %r>' % self.i...
[ 8, 10, 12, 14, 16 ]