code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import os import log import core import time __description__ = 'OS X Auditor' __author__ = 'Atarimaster & @Jipe_' __version__ = '0.5.0' ROOT_PATH = '/' Euid = str(os.geteuid()) Egid = str(os.getegid()) def generate_header(): header = {} # Description(Audited By) description = "Report generated by " + _...
normal
{ "blob_id": "547d67bce7eb05e55e02c73a22342ca572e89f39", "index": 9959, "step-1": "<mask token>\n\n\ndef GetAuditedSystemVersion():\n global OSX_VERSION\n SysVersion = 'Unknown system version'\n SystemVersionPlist = False\n SystemVersionPlist = core.UniversalReadPlist(\n '/System/Library/CoreSe...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def pixels_generator(w, h): i = 0 while i < w * h: yield divmod(i, w) i = i + 1 <|reserved_special_token_1|> def pixels_generator(w, h): i = 0 while i < (w * h): yield divmod(i, w) i = i + 1
flexible
{ "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|> FILE = 'Luke' NAME = 'Luke Walker' NATIONALITY = 'American' CLASS = 'Manipulator' WEAPON = '' BIRTH = '' BIRTH_LOCATION = '' LETTER = 'W' RECRUITMENT_ORDER = 10 SUMMARY = '' ABILITIES = '' BACKSTORY = '' HIGHLIGHTS = '' SUMMONS = 'Tonberry', 'Grimnir', 'Griev...
flexible
{ "blob_id": "fa3ab879541c04e278317b11dd79e6e1b4319536", "index": 7586, "step-1": "<mask token>\n", "step-2": "FILE = 'Luke'\nNAME = 'Luke Walker'\nNATIONALITY = 'American'\nCLASS = 'Manipulator'\nWEAPON = ''\nBIRTH = ''\nBIRTH_LOCATION = ''\nLETTER = 'W'\nRECRUITMENT_ORDER = 10\nSUMMARY = ''\nABILITIES = ''\nB...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def less(i1, i2): return i1[0] * i2[1] < i2[0] * i1[1] def equal(i1, i2): return i1[0] * i2[1] == i2[0] * i1[1] def more(i1, i2): return i1[0] * i2[1] > i2[0] * i1[1] def partition(x, l, r, pivot): il = l ...
flexible
{ "blob_id": "a5e693a79211570f2d27575657496992f8fee164", "index": 9075, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef less(i1, i2):\n return i1[0] * i2[1] < i2[0] * i1[1]\n\n\ndef equal(i1, i2):\n return i1[0] * i2[1] == i2[0] * i1[1]\n\n\ndef more(i1, i2):\n return i1[0] * i2[1] > i2[0]...
[ 0, 5, 7, 8, 9 ]
<|reserved_special_token_0|> class PrescriptionForm(forms.ModelForm): class Meta: model = Prescription exclude = ['doctor'] widgets = {'prescription': forms.Textarea(attrs={'rows': 4})} def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.field...
flexible
{ "blob_id": "d3425017d4e604a8940997afd0c35a4f7eac1170", "index": 6944, "step-1": "<mask token>\n\n\nclass PrescriptionForm(forms.ModelForm):\n\n\n class Meta:\n model = Prescription\n exclude = ['doctor']\n widgets = {'prescription': forms.Textarea(attrs={'rows': 4})}\n\n def __init__(...
[ 2, 3, 4, 5, 6 ]
v1 = 3 + 4 * 2 print(v1) v2 = (2 + 6) * 2 print(v2) v3 = 2 ** 3 ** 2 print(v3) v4 = 20 + 80 / 2 print(v4)
normal
{ "blob_id": "e6694403eecf2c4511c1fce959b5939f5f457bb8", "index": 9384, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(v1)\n<mask token>\nprint(v2)\n<mask token>\nprint(v3)\n<mask token>\nprint(v4)\n", "step-3": "v1 = 3 + 4 * 2\nprint(v1)\nv2 = (2 + 6) * 2\nprint(v2)\nv3 = 2 ** 3 ** 2\nprint(v3)\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> BINDINGS_DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__) ), 'bindings') TMUX_CONFIG_DIRECTORY = os.path.join(BINDINGS_DIRECTORY, 'tmux') DEFAULT_SYSTEM_CONFIG_DIR = None <|reserved_special_token_1|> from ...
flexible
{ "blob_id": "c435b0f162512bb2bc0c35e1817f64c5ef9ff7bc", "index": 1871, "step-1": "<mask token>\n", "step-2": "<mask token>\nBINDINGS_DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__)\n ), 'bindings')\nTMUX_CONFIG_DIRECTORY = os.path.join(BINDINGS_DIRECTORY, 'tmux')\nDEFAULT_SYSTEM_CONFIG_DI...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Video_Server(threading.Thread): <|reserved_special_token_0|> <|reserved_special_token_0|> def run(self): detector, predictor = face_capture_edit.face_init(self. face_shape_predictor) print('face_capture_init is ready') print('VIDEO se...
flexible
{ "blob_id": "6b138dabf57166ec971052fff7df89ae0346e083", "index": 1582, "step-1": "<mask token>\n\n\nclass Video_Server(threading.Thread):\n <mask token>\n <mask token>\n\n def run(self):\n detector, predictor = face_capture_edit.face_init(self.\n face_shape_predictor)\n print('f...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def __prepare_train_data(df, feature): groups = df.groupby(['event', 'start']) data = [] labels = [] for id, group in groups: values = group['CylinderBorePressure'].values data.append(np.reshape(values, (len(values), 1))) labels.append(id[0]) re...
flexible
{ "blob_id": "55030648a6b76636e456990c1d2b02baa35a695d", "index": 9221, "step-1": "<mask token>\n\n\ndef __prepare_train_data(df, feature):\n groups = df.groupby(['event', 'start'])\n data = []\n labels = []\n for id, group in groups:\n values = group['CylinderBorePressure'].values\n dat...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class QuadraticEquationsSolverConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class QuadraticEquationsSolverConfig(AppConfig): name = 'quadratic_equations_so...
flexible
{ "blob_id": "730fc527f3d2805559e8917e846b0b13f4a9f6ee", "index": 2316, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass QuadraticEquationsSolverConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass QuadraticEquationsSolverConfig(AppConfig):\n name = 'quadratic_equations...
[ 0, 1, 2, 3 ]
""" 问题描述 玛莎(Marsha)和比尔(Bill)拥有一系列大理石。他们希望将藏品分开,以使两者获得相等的份额。如果所有的大理石都具有相同的价值,这将很容易,因为那样他们就可以将收藏品分成两半。 但不幸的是,有些大理石比其他大理石更大或更漂亮。因此,玛莎(Marsha)和比尔(Bill)首先为每个大理石分配一个值,即一个介于1到6之间的自然数。 现在,他们希望对大理石进行分割,以使每个大理石都获得相同的总价值。不幸的是,他们意识到以这种方式分割大理石可能是不可能的(即使所有大理石的总价值是均匀的)。 例如,如果存在一个值为1的大理石,值为3的一个,值为4的两个,则不能将它们拆分为相等值的集合。因此,他们要求您编写一个程序来检查...
normal
{ "blob_id": "0d20b75bcc87db8f3e4bdd9d6448cc44c979de1d", "index": 137, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('输入:')\nwhile True:\n s = input()\n if s == '0 0 0 0 0 0':\n break\n S.append(s)\nprint('\\n输出:')\n<mask token>\nfor k in range(len(S)):\n p = [int(i) for i in S[k...
[ 0, 1, 2, 3 ]
import random def patternToNumber(pattern): if len(pattern) == 0: return 0 return 4 * patternToNumber(pattern[0:-1]) + symbolToNumber(pattern[-1:]) def symbolToNumber(symbol): if symbol == "A": return 0 if symbol == "C": return 1 if symbol == "G": return 2 if sy...
normal
{ "blob_id": "51848a64102f7fe8272fcf56a9792ed50c430538", "index": 9115, "step-1": "<mask token>\n\n\ndef patternToNumber(pattern):\n if len(pattern) == 0:\n return 0\n return 4 * patternToNumber(pattern[0:-1]) + symbolToNumber(pattern[-1:])\n\n\ndef symbolToNumber(symbol):\n if symbol == 'A':\n ...
[ 8, 9, 11, 13, 15 ]
<|reserved_special_token_0|> class CampaignPerformance: <|reserved_special_token_0|> def __init__(self, campaign, start): self.campaign = campaign self.start = start self.BUDGETS_NAME = 'Budgets' self.required_ran = False <|reserved_special_token_0|> def _get_start_da...
flexible
{ "blob_id": "a860e6670719a733e75c7580cf2e07765b0777eb", "index": 2806, "step-1": "<mask token>\n\n\nclass CampaignPerformance:\n <mask token>\n\n def __init__(self, campaign, start):\n self.campaign = campaign\n self.start = start\n self.BUDGETS_NAME = 'Budgets'\n self.required_...
[ 9, 12, 13, 15, 16 ]
<|reserved_special_token_0|> class TicketshopATLayer(PloneSandboxLayer): defaultBases = PLONE_FIXTURE, def setUpZope(self, app, configurationContext): import Products.ATContentTypes self.loadZCML(package=Products.ATContentTypes, context= configurationContext) import bda.pl...
flexible
{ "blob_id": "5d7080f2778133d1938853512ca038edcf7c0dc4", "index": 1002, "step-1": "<mask token>\n\n\nclass TicketshopATLayer(PloneSandboxLayer):\n defaultBases = PLONE_FIXTURE,\n\n def setUpZope(self, app, configurationContext):\n import Products.ATContentTypes\n self.loadZCML(package=Products...
[ 4, 7, 10, 11, 14 ]
# Mostra entre as 7 pessoas, quantas pessoas são maiores de idade. num1 = 0 for c in range(0,7): pe1 = int(input('Digite o ano de nascimento: ')) pe1 = 2019 - pe1 if pe1 >= 21: num1 = num1 + 1 print(f'Entre as 7 pessoas, {num1} pessoas são maiores de idade.')
normal
{ "blob_id": "251d589a5815d77d2bc375d8d4a7d41e79a2a5cd", "index": 5303, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(0, 7):\n pe1 = int(input('Digite o ano de nascimento: '))\n pe1 = 2019 - pe1\n if pe1 >= 21:\n num1 = num1 + 1\nprint(f'Entre as 7 pessoas, {num1} pessoas s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def partition3(array, left, right): pivot = array[right] begin = left - 1 end = left - 1 for j in range(left, right): if array[j] < pivot: begin += 1 array[begin], array[j] = array...
flexible
{ "blob_id": "a2fc9d947c75eaaaeafcd92750c99f4cfcdb9d7d", "index": 4517, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef partition3(array, left, right):\n pivot = array[right]\n begin = left - 1\n end = left - 1\n for j in range(left, right):\n if array[j] < pivot:\n be...
[ 0, 2, 3, 4, 5 ]
def summation(numbers): positive_numbers = [] normalized_numbers = [] numbers_list = numbers.split() for idx, arg in enumerate(numbers_list): int_arg = int(arg) if int_arg < 0: new_arg = abs(int_arg) * 2 else: new_arg = int_arg positive_numbers.app...
normal
{ "blob_id": "791df87235f5da634fc62ebc3a3741cea6e2deca", "index": 3841, "step-1": "<mask token>\n", "step-2": "def summation(numbers):\n positive_numbers = []\n normalized_numbers = []\n numbers_list = numbers.split()\n for idx, arg in enumerate(numbers_list):\n int_arg = int(arg)\n if...
[ 0, 1 ]
# Generated by Django 3.2.6 on 2021-08-15 05:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('website', '0001_initial'), ] operations = [ migrations.AlterField( model_name='tasks', name='cleanlinessLevel', ...
normal
{ "blob_id": "6f9f204cbd6817d5e40f57e71614ad03b64d9003", "index": 3152, "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 = [('website', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @attach_common class TalkBotThread(QThread): <|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 run(self): self.start_databas...
flexible
{ "blob_id": "77763f501c6776969d2594f987e5d7ab7d4377fb", "index": 317, "step-1": "<mask token>\n\n\n@attach_common\nclass TalkBotThread(QThread):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def run(self):\n self.start_database()\n ...
[ 6, 7, 9, 11, 12 ]
<|reserved_special_token_0|> class SpeciesSerializer(TranslatedModelSerializer, PictogramSerializerMixin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = sensitivity_models.Species fields = ['id', 'name', 'practices', 'url',...
flexible
{ "blob_id": "dfd5915428dc8f15fb61c5d81f22dfecfe29af15", "index": 6409, "step-1": "<mask token>\n\n\nclass SpeciesSerializer(TranslatedModelSerializer, PictogramSerializerMixin):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = sensitivity_models.Species\n fields ...
[ 10, 11, 12, 13, 16 ]
from abc import ABCMeta, abstractmethod __author__ = 'Alexiy' class Protocol: """base protocol class""" __metaclass__ = ABCMeta FAIL = 'Failed' @abstractmethod def execute(self, command): """"execute command method""" class LocalProtocol(Protocol): """simple protocol for using bots ...
normal
{ "blob_id": "8d1067a9bb0629276ef27de91f63cf2370a44e24", "index": 1369, "step-1": "<mask token>\n\n\nclass Protocol:\n <mask token>\n <mask token>\n <mask token>\n\n @abstractmethod\n def execute(self, command):\n \"\"\"\"execute command method\"\"\"\n\n\nclass LocalProtocol(Protocol):\n ...
[ 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): if len(sys.argv) < 3: sys.stderr.write( 'Usage: %s CONFIG_URI {bootstrap | ALEMBIC_OPTS}\n' % sys.argv[0]) sys.exit(1) config_uri = sys.argv.pop(1) if sys.argv[1] == 'bootstrap...
flexible
{ "blob_id": "7b459cf321f351e1485a9aef0ca23067f411e430", "index": 7446, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 3:\n sys.stderr.write(\n 'Usage: %s CONFIG_URI {bootstrap | ALEMBIC_OPTS}\\n' % sys.argv[0])\n sys.exit(1)\n config_uri...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def parseSeq(lines, seqName): """splits each column""" data = [] for line in lines: data.append(line.split(' ')) """removes any spaces""" for i in range(len(data)): for j in range(data[i].count('')): data[i].remove('') """deletes the num...
flexible
{ "blob_id": "19e387cb731dad21e5ee50b0a9812df984c13f3b", "index": 7890, "step-1": "<mask token>\n\n\ndef parseSeq(lines, seqName):\n \"\"\"splits each column\"\"\"\n data = []\n for line in lines:\n data.append(line.split(' '))\n \"\"\"removes any spaces\"\"\"\n for i in range(len(data)):\n ...
[ 1, 2, 3, 4, 5 ]
''' Created on 3 Jul 2009 @author: charanpal An abstract base class which represents a graph generator. The graph generator takes an existing empty graph and produces edges over it. ''' from apgl.util.Util import Util class AbstractGraphGenerator(object): def generate(self, graph): Util.abst...
normal
{ "blob_id": "e37e468d8a41b8711fb0eb4ddec7db67691f9156", "index": 488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AbstractGraphGenerator(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AbstractGraphGenerator(object):\n\n def generate(self, graph):\n Util.abstrac...
[ 0, 1, 2, 3, 4 ]
#配置我们文件所在目录的搜寻环境 import os,sys #第一步先拿到当前文件的路径 file_path = os.path.abspath(__file__) #第二步 根据这个路径去拿到这个文件所在目录的路径 dir_path = os.path.dirname(file_path) #第三步:讲这个目录的路径添加到我们的搜寻环境当中 sys.path.append(dir_path) #第四步,动态设置我们的setting文件 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gulishop.settings") #第五步,让设置好的环境初始化生效 ...
normal
{ "blob_id": "35ae9c86594b50bbe4a67d2cc6b20efc6f6fdc64", "index": 295, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(dir_path)\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gulishop.settings')\n<mask token>\ndjango.setup()\n<mask token>\nfor lev1 in row_data:\n cat1 = GoodsCategory...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(arguments): docker = [('Dockerfile.ubuntu1804', 'ubuntu1804_ansible_testinfra'), ( 'Dockerfile.ubuntu1604', 'ubuntu1604_ansible_testinfra')] docker_username = os.environ.get('DOCKER_USERNAME', None) if docker_username is None: docker_username = input('...
flexible
{ "blob_id": "1ad40ef3aa7c81b6eee4fe0b98bcdd2f1110ef8d", "index": 5990, "step-1": "<mask token>\n\n\ndef main(arguments):\n docker = [('Dockerfile.ubuntu1804', 'ubuntu1804_ansible_testinfra'), (\n 'Dockerfile.ubuntu1604', 'ubuntu1604_ansible_testinfra')]\n docker_username = os.environ.get('DOCKER_USE...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- """ Created on Tue Sep 4 15:19:49 2018 @author: haoyu """ import numpy as np def train_test_split(X, y, test_ratio = 0.2, seed = None): '''将数据X和y按照test_ratio分割成X_train,X_test,y_train,y_test''' assert X.shape[0] == y.shape[0], \ 'the size of X must be equal to the size of y' ...
normal
{ "blob_id": "beda3d13e3dc12f7527f5c5ba8a0eb05c2734fd9", "index": 6133, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train_test_split(X, y, test_ratio=0.2, seed=None):\n \"\"\"将数据X和y按照test_ratio分割成X_train,X_test,y_train,y_test\"\"\"\n assert X.shape[0] == y.shape[0\n ], 'the size of...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class recommendationsys: def __init__(self, nyear): self.activityyear = 10 self.debug = 0 self.nremd = 3 PROJECT_DIRECTORY = 'output/project/' + project_name self.f_titles = PROJECT_DIRECTORY + '/cleantitles_target.txt' self.f_authors =...
flexible
{ "blob_id": "4a8a733a965e25ad7ef53600fad6dd47343655b0", "index": 8677, "step-1": "<mask token>\n\n\nclass recommendationsys:\n\n def __init__(self, nyear):\n self.activityyear = 10\n self.debug = 0\n self.nremd = 3\n PROJECT_DIRECTORY = 'output/project/' + project_name\n sel...
[ 21, 25, 35, 43, 47 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Массив случайных чисел:\n', array) <|reserved_special_token_0|> for el in range(SIZE): if array[el] > max_el: max_el = array[el] max_el_inx = el if array[el] < min_el: min_el = array[el] ...
flexible
{ "blob_id": "6027836b1b5d3cb8b842b1a1b77f5c9777269896", "index": 7177, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Массив случайных чисел:\\n', array)\n<mask token>\nfor el in range(SIZE):\n if array[el] > max_el:\n max_el = array[el]\n max_el_inx = el\n if array[el] < min_e...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'day66.settings') import django django.setup() from applistions.models import MyClass, Student, Teacher, Employee from django.db.models...
flexible
{ "blob_id": "ee72262fb29b46784fb357269dd5160192968c1b", "index": 1713, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'day66.settings')\n import django\n django.setup()\n from applistions.models import MyClass, Stude...
[ 0, 1, 2, 3 ]
from collections import defaultdict from django.shortcuts import render from django.views.decorators.cache import cache_control from peterbecom.plog.models import BlogItem, Category from peterbecom.plog.utils import utc_now from peterbecom.plog.views import json_view ONE_MONTH = 60 * 60 * 24 * 30 @cache_control(pu...
normal
{ "blob_id": "e90fb3b6009dd4fb780649c04398b361fa1ae195", "index": 8489, "step-1": "<mask token>\n\n\n@cache_control(public=True, max_age=ONE_MONTH)\ndef index(request):\n return render(request, 'ajaxornot/index.html')\n\n\n<mask token>\n\n\n@cache_control(public=True, max_age=ONE_MONTH)\ndef view1(request):\n ...
[ 7, 9, 14, 15, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Course(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Course(models.Model): cid = ...
flexible
{ "blob_id": "226fc85dc8b6d549fddef0ca43ad629875ac0717", "index": 3080, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Course(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Course(models.Model):\n cid = models.CharField(max_length...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def check(t, d, c): if t == 1: if m1[2] != m2[-2] and not c: check(t + 1, d * -1, 1) if d == 1: m1.appendleft(m1.pop()) else: m1.append(m1.popleft()) elif t == 4: if m4[-2] != m3[2] and not c: check(t ...
flexible
{ "blob_id": "7e3a5e1f19683b1716f3c988dcc1e65fee1cae13", "index": 8956, "step-1": "<mask token>\n\n\ndef check(t, d, c):\n if t == 1:\n if m1[2] != m2[-2] and not c:\n check(t + 1, d * -1, 1)\n if d == 1:\n m1.appendleft(m1.pop())\n else:\n m1.append(m1.pop...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def load_data(): """ Helper function for loading in the data ------ # of training samples: 419 # of testing samples: 150 ------ """ df = pd.read_csv('../../Data/breast_cancer_data/data.csv') cols = df.columns X = df[cols[2:-1]].to_numpy() y = d...
flexible
{ "blob_id": "cf65966f5daf88bdefc7a8aa2ff80835cff0d0b6", "index": 4627, "step-1": "<mask token>\n\n\ndef load_data():\n \"\"\"\n Helper function for loading in the data\n\n ------\n # of training samples: 419\n # of testing samples: 150\n ------\n \"\"\"\n df = pd.read_csv('../../Data/brea...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python import sys class Generator: def __init__(self, seed, factor, multiple): self.value = seed self.factor = factor self.multiple = multiple def iterate(self): self.value = ( self.value * self.factor ) % 2147483647 # Repeat if this isn't an exact multiple ...
normal
{ "blob_id": "4bb006e2e457f5b11157dacb43fe94c8b400f146", "index": 5105, "step-1": "#!/usr/bin/python\n\nimport sys\n\nclass Generator:\n def __init__(self, seed, factor, multiple):\n self.value = seed\n self.factor = factor\n self.multiple = multiple\n\n def iterate(self):\n self...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def visualize_batch(pointclouds, pred_labels, labels, categories): batch_size = len(pointclouds) fig = plt.figure(figsize=(8, batch_size / 2)) ncols = 5 nrows = max(1, batch_size // 5) for idx, pc in enumerat...
flexible
{ "blob_id": "0ced42c8bfaad32fc2b397326150e6c7bc5cedab", "index": 4991, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef visualize_batch(pointclouds, pred_labels, labels, categories):\n batch_size = len(pointclouds)\n fig = plt.figure(figsize=(8, batch_size / 2))\n ncols = 5\n nrows = ma...
[ 0, 1, 2, 3, 4 ]
def climb_ways(n, k):
normal
{ "blob_id": "05144338cc9c0c65010e0b8a3dd6fb50f6343214", "index": 6641, "step-1": "def climb_ways(n, k):", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# Copyright (c) 2019 NVIDIA Corporation from nemo.backends.pytorch.nm import DataLayerNM from nemo.core.neural_types import * from nemo.core import DeviceType import torch from .datasets import BertPretrainingDataset class BertPretrainingDataLayer(DataLayerNM): @staticmethod def create_ports(): input...
normal
{ "blob_id": "a47ffd5df49ec627442a491f81a117b3e68ff50b", "index": 2326, "step-1": "<mask token>\n\n\nclass BertPretrainingDataLayer(DataLayerNM):\n <mask token>\n\n def __init__(self, *, tokenizer, dataset, name, max_seq_length,\n sentence_indices_filename=None, mask_probability=0.15, **kwargs):\n ...
[ 4, 5, 6, 7, 8 ]
import tensorflow as tf from vgg16 import vgg16 def content_loss(content_layer, generated_layer): # sess.run(vgg_net.image.assign(generated_image)) # now we define the loss as the difference between the reference activations and # the generated image activations in the specified layer # return 1/2 * ...
normal
{ "blob_id": "f92b939bf9813e5c78bc450ff270d5fb6171792a", "index": 4810, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef content_loss(content_layer, generated_layer):\n return tf.scalar_mul(0.5, tf.nn.l2_loss(content_layer - generated_layer))\n\n\n<mask token>\n\n\ndef get_gram_matrix(matrix, num...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def clearConsole(): os.system('cls' if os.name == 'nt' else 'clear') def main(): checkArgs() rfile = open(sys.argv[1], 'r') wfile = open(output_name, 'w') parseAndStrip(rfile, wfile) rfile.close() wfile.close() def checkArgs(): if len(sys.argv) < 2 or l...
flexible
{ "blob_id": "9c09309d23510aee4409a6d9021c2991afd2d349", "index": 521, "step-1": "<mask token>\n\n\ndef clearConsole():\n os.system('cls' if os.name == 'nt' else 'clear')\n\n\ndef main():\n checkArgs()\n rfile = open(sys.argv[1], 'r')\n wfile = open(output_name, 'w')\n parseAndStrip(rfile, wfile)\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @jit def resolve(): N = int(input()) ans = 0 for n in range(1, N + 1): for m in range(n, N + 1, n): ans += m print(ans) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "8d8df517ca5486e62cc1b5ac23bbcfa65ed9c1ff", "index": 6611, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@jit\ndef resolve():\n N = int(input())\n ans = 0\n for n in range(1, N + 1):\n for m in range(n, N + 1, n):\n ans += m\n print(ans)\n\n\n<mask token>\n"...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(12): col = [] for j in range(12): col.append(float(input())) v.append(col) <|reserved_special_token_0|> for i in range(1, 12): for j in range(a): s += v[i][j] a += 1 if o == 'S': ...
flexible
{ "blob_id": "0df20722fba6223c9d4fc9f72bfb399b479db6ac", "index": 7917, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n col = []\n for j in range(12):\n col.append(float(input()))\n v.append(col)\n<mask token>\nfor i in range(1, 12):\n for j in range(a):\n s ...
[ 0, 1, 2, 3 ]
import user # or from user import User from post import Post app_user_one = user.User("rr@gg.com", "Riks R", "ppp1", "student") app_user_one.get_user_info() app_user_one.change_status("in job market") app_user_one.get_user_info() app_user_two = user.User("z43@gg.com", "Bobby L", "zz1", "student") app_user_two.get_us...
normal
{ "blob_id": "f59db28b669a41051cc6d0d4b8e14d1c7b0edd11", "index": 2555, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_user_one.get_user_info()\napp_user_one.change_status('in job market')\napp_user_one.get_user_info()\n<mask token>\napp_user_two.get_user_info()\n<mask token>\nnew_post.get_post_info()...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(sum([int(d) for d in str(pow(2, 1000))]))
flexible
{ "blob_id": "fc0c8deb3a5a57934c9e707911c352af55100c3c", "index": 3533, "step-1": "<mask token>\n", "step-2": "print(sum([int(d) for d in str(pow(2, 1000))]))\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import random def Fun_hiraganas(): hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'ho'] print("escriba el hiragana", hiraganas[random.randint(0, len(hiraganas)-1)]) print("Hell...
normal
{ "blob_id": "1fe7d5db1b47ba082301d07d010c6796fbd7edb7", "index": 6859, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Fun_hiraganas():\n hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko',\n 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na',\n 'n...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Message(models.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|> <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "1476d4f488e6c55234a34dc5b6182e3b8ad4f702", "index": 6201, "step-1": "<mask token>\n\n\nclass Message(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Message(models.Mo...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Entity_list_user(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|> <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "6928ff58ddb97883a43dfd867ff9a89db72ae348", "index": 6567, "step-1": "<mask token>\n\n\nclass Entity_list_user(db.Model):\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 <mask token>\n <mask token>...
[ 3, 4, 5, 6, 7 ]
# module: order functionality # HW2: complete this func def process_option(food, option): # print(food.keys()) food_name = list(food.keys())[option-1] food_price = food[food_name] print(food_price) print("You have chosen: ", option, food_name, "!", " For unit price: ", food_price) ...
normal
{ "blob_id": "07bd3c7cacbf8d0e39d06b21456258ad92cb2294", "index": 676, "step-1": "<mask token>\n", "step-2": "def process_option(food, option):\n food_name = list(food.keys())[option - 1]\n food_price = food[food_name]\n print(food_price)\n print('You have chosen: ', option, food_name, '!', ' For u...
[ 0, 1, 2, 3, 4 ]
from flask import Flask, render_template, send_from_directory from flask import request, send_file from flask_cors import CORS import os import json from crossdomain import crossdomain import constants import generation_tools from music_theory import name_chords_in_tracks import midi_tools from client_logging import Cl...
normal
{ "blob_id": "471cab65aac29f5b47de0ffef8f032dbbadf8dd0", "index": 1877, "step-1": "<mask token>\n\n\ndef add_logs_to_response(response):\n response['logs'] = ClientLogger.get_logs()\n ClientLogger.clear_logs()\n return response\n\n\n@app.route('/generate/melody', methods=['POST', 'OPTIONS'])\n@crossdomai...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def backup_cron(): if settings.DBBACKUP_STORAGE is not '': management.call_command('dbbackup') <|reserved_special_token_1|> from django.core import management from django.conf import settings def backup_cron(): ...
flexible
{ "blob_id": "ae9f1c4f70801dace0455c051ba4d4bfb7f3fe67", "index": 4813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef backup_cron():\n if settings.DBBACKUP_STORAGE is not '':\n management.call_command('dbbackup')\n", "step-3": "from django.core import management\nfrom django.conf impo...
[ 0, 1, 2 ]
from typing import Tuple #Creating a trie structure and it's node class TrieNode(object): def __init__(self, char: str): self.char = char self.children = [] #the last character of the word.` self.word_finished = False #counter for this character self.counter = 1 ...
normal
{ "blob_id": "dcda8f26a06145579a9be6e5fbfdaed83d4908da", "index": 2459, "step-1": "<mask token>\n\n\nclass TrieNode(object):\n\n def __init__(self, char: str):\n self.char = char\n self.children = []\n self.word_finished = False\n self.counter = 1\n self.OccurrenceList = {}\n...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(drugs) <|reserved_special_token_0|> for drug in drugs: with open('/Users/sandeep.dey/Downloads/2020-02-06_scrape/%s' % drug ) as json_file: for record in json.load(json_file): output_records.a...
flexible
{ "blob_id": "e7f511b97f316157a768203afe9f36ea834ebb6c", "index": 5493, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(drugs)\n<mask token>\nfor drug in drugs:\n with open('/Users/sandeep.dey/Downloads/2020-02-06_scrape/%s' % drug\n ) as json_file:\n for record in json.load(json_fil...
[ 0, 1, 2, 3, 4 ]
import torch import numpy as np from torch.autograd import Variable from util import helpers from util.metrics import ECELoss, ece_score import sklearn.metrics as skm import os import pandas as pd import pickle def eval(path_in, path_out, net, testloader, oodloader, use_cuda=True, save_dir=None): f1 = open(path_...
normal
{ "blob_id": "edd2b7b453d7fa33e6cca3b5dbc895f034a9e22a", "index": 2746, "step-1": "<mask token>\n\n\ndef eval_cifar10(path_in, path_out, net, testloader, oodloader, use_cuda=\n True, save_dir=None):\n f1 = open(path_in, 'w')\n f2 = open(path_out, 'w')\n ece_criterion = ECELoss().cuda()\n net.eval()...
[ 1, 2, 3, 4, 5 ]
# -*- python -*- # ex: set syntax=python: # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # See master.experimental/slaves.cfg for documentation. slaves = [ #########################################...
normal
{ "blob_id": "e807cef534226f3efb4a8df471598727fa068f02", "index": 3805, "step-1": "<mask token>\n", "step-2": "slaves = []\n", "step-3": "# -*- python -*-\n# ex: set syntax=python:\n\n# Copyright (c) 2012 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license ...
[ 0, 1, 2 ]
# Generated by Django 2.2.1 on 2019-05-23 14:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('presentes', '0015_caso_lugar_del_hecho'), ] operations = [ migrations.AddField( model_name='organizacion', name='des...
normal
{ "blob_id": "5cd767564e8a261561e141abeebb5221cb3ef2c2", "index": 6919, "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 = [('presentes',...
[ 0, 1, 2, 3, 4 ]
"""Write a program that asks the user to enter a word and then capitalizes every other letter of that word. So if the user enters "rhinoceros", the program should print "rHiNoCeRoS""" word=str(input("please enter the word\n")) count=0 for char in word: if count==0: print(char.upper(),end="") count=1 ...
normal
{ "blob_id": "bc837d95ef22bd376f8b095e7aeb1f7d15c0e22e", "index": 941, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor char in word:\n if count == 0:\n print(char.upper(), end='')\n count = 1\n else:\n print(char.lower(), end='')\n count = 0\n", "step-3": "<mask toke...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestAccountRequests(TestCase): def setUp(self): self.client = Client() self.superuser = Account.objects.create_superuser(**account) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> c...
flexible
{ "blob_id": "3d43bf0d0ca1df06b3647a33f88cee067eeff9f4", "index": 2605, "step-1": "<mask token>\n\n\nclass TestAccountRequests(TestCase):\n\n def setUp(self):\n self.client = Client()\n self.superuser = Account.objects.create_superuser(**account)\n <mask token>\n <mask token>\n", "step-2"...
[ 2, 3, 4, 5, 6 ]
#(C)Inspire Search 2020/5/31 Coded by Tsubasa Kato (@_stingraze) #Last edited on 2020/6/1 11:36AM JST import sys import spacy import re #gets query from argv[1] text = sys.argv[1] nlp = spacy.load('en_core_web_sm') doc = nlp(text) ahref = "<a href=\"" ahref2 = "\"\>" #arrays for storing subject and object types sub...
normal
{ "blob_id": "ecc001394c1f3bba78559cba7eeb216dd3a942d8", "index": 4711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor d in doc:\n word = d.text\n pos = d.pos_\n dep = d.dep_\n if re.search('subj', dep):\n word2 = (ahref + 'http://www.superai.online/solr/search.php?query=' +\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): x = rng.integers(low=0, high=1920) y = rng.integers(low=0, high=1080) if i == 0: flock.append(Boid(x, y, width, height, infected=True, curado=False, alive=True)) else: ...
flexible
{ "blob_id": "78c4e14e5afdf857082b60bf4020f0f785d93a0d", "index": 9704, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n x = rng.integers(low=0, high=1920)\n y = rng.integers(low=0, high=1080)\n if i == 0:\n flock.append(Boid(x, y, width, height, infected=True, curado=Fa...
[ 0, 3, 4, 5, 6 ]
import re def find_all_links(text): result = [] iterator = re.finditer(r"https?\:\/\/(www)?\.?\w+\.\w+", text) for match in iterator: result.append(match.group()) return result
normal
{ "blob_id": "b8c7aa5ff7387eacb45d996fa47186d193b44782", "index": 4823, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_all_links(text):\n result = []\n iterator = re.finditer('https?\\\\:\\\\/\\\\/(www)?\\\\.?\\\\w+\\\\.\\\\w+', text)\n for match in iterator:\n result.append(m...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """The app module, containing the app factory function.""" from flask import Flask, render_template from flask_cors import CORS from flask_misaka import Misaka from flask_mailman import Mail from flask_talisman import Talisman from werkzeug.middleware.proxy_fix import ProxyFix from micawber.pro...
normal
{ "blob_id": "2257f73a290dfd428a874e963c26e51f1c1f1efa", "index": 927, "step-1": "<mask token>\n\n\ndef register_extensions(app):\n \"\"\"Register Flask extensions.\"\"\"\n assets.init_app(app)\n hashing.init_app(app)\n cache.init_app(app)\n db.init_app(app)\n login_manager.init_app(app)\n mi...
[ 5, 9, 10, 12, 14 ]
<|reserved_special_token_0|> class TCRPowerCalculator: <|reserved_special_token_0|> def predict_detection_probability_2step(self, tcr_frequency, num_reads, num_cells, detect_thresh=1): """ 2-step detection probability model where 1) Num_cells_TCR is sampled first from the blood (Poiss...
flexible
{ "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 ]
""" Simulator contains the tools needed to set up a multilayer antireflection coating simulation. Based on transfer matrix method outlined in Hou, H.S. 1974. """ # Author: Andrew Nadolski (with lots of help from previous work by Colin Merkel, # Steve Byrnes, and Aritoki Suzuki) # Filename: simulator.py impo...
normal
{ "blob_id": "a2292bc9cee57c5d4a7d36c66510ce4b4f3e20da", "index": 3687, "step-1": "<mask token>\n\n\nclass SubstrateLayer(Layer):\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '{} (substrate)'.format(self.name)\n\n\nclass TerminatorLayer(Layer):\n \"\"\"A special case of ``Laye...
[ 45, 51, 53, 54, 60 ]
import requests import json r = requests.get('http://pythonspot.com/') jsondata = str(r.headers).replace("'", '"') print(jsondata) #headerObj = json.loads(jsondata) #ERROR >> json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 556 (char 555) #print(headerObj)["server"] #print(headerObj)['content-leng...
normal
{ "blob_id": "7404dd324d54bb072e56985716bbae746b4dd219", "index": 1395, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(jsondata)\n", "step-3": "<mask token>\nr = requests.get('http://pythonspot.com/')\njsondata = str(r.headers).replace(\"'\", '\"')\nprint(jsondata)\n", "step-4": "import requests...
[ 0, 1, 2, 3, 4 ]
def fibonacci(n): '''returns the nth number of the Fibonacci sequence. where the first position is indexed at 0. n must be an iteger greater than or equal to 0''' #these are the first two numbers in the sequence. fib = [0,1] #If the users enters a number less than 2 then just get that number fr...
normal
{ "blob_id": "ca75e23d91eef8a5c5b78c0ea7c903b80640af25", "index": 7957, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sum_series(n, x=0, y=1):\n \"\"\"sum_series returns the nth number of the Fibonacci, the Lucas sequence\n or the Foo sequence where the first position is indexed at 0. ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def times2(x): return x * 2 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(df.head()) <|reserved_special_token_0|> print('========================') print(newdf) def times2(x): return x * 2 print('========================') pr...
flexible
{ "blob_id": "422a4945ebf453d3e09e9e7e76dd32b30488680e", "index": 3011, "step-1": "<mask token>\n\n\ndef times2(x):\n return x * 2\n\n\n<mask token>\n", "step-2": "<mask token>\nprint(df.head())\n<mask token>\nprint('========================')\nprint(newdf)\n\n\ndef times2(x):\n return x * 2\n\n\nprint('=...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def min_hacks(d, p): shots = [0] damage = 0 for c in p: if c == 'S': shots[-1] += 1 damage += 2 ** (len(shots) - 1) else: shots.append(0) hacks = 0 while damage > d: hacked = Fals...
flexible
{ "blob_id": "607700faebc2018327d66939419cc24a563c3900", "index": 6515, "step-1": "<mask token>\n", "step-2": "def min_hacks(d, p):\n shots = [0]\n damage = 0\n for c in p:\n if c == 'S':\n shots[-1] += 1\n damage += 2 ** (len(shots) - 1)\n else:\n shots.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Resource: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Resource: def __init__(self, row: tuple): self.video_path = row[0] self.pic_path = row[1]...
flexible
{ "blob_id": "65aa27addaec6014fe5fd66df2c0d3632231a314", "index": 3124, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Resource:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Resource:\n\n def __init__(self, row: tuple):\n self.video_path = row[0]\n self.pic_path = ...
[ 0, 1, 2, 3, 4 ]
import unittest import sys from tests.jep_pipe import jep_pipe from tests.jep_pipe import build_java_process_cmd import jep @unittest.skipIf(sys.platform.startswith("win"), "subprocess complications on Windows") class TestSharedModules(unittest.TestCase): def setUp(self): pass def test_shared_module...
normal
{ "blob_id": "39bc90f34cccebe9a8b1475e396caa1c14f6b2df", "index": 9004, "step-1": "<mask token>\n\n\n@unittest.skipIf(sys.platform.startswith('win'),\n 'subprocess complications on Windows')\nclass TestSharedModules(unittest.TestCase):\n\n def setUp(self):\n pass\n\n def test_shared_modules(self):...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # DATE 2018-08-21 # AUTHER = tongzz # import MySQLdb from Elements.LoginElements import * import datetime import sys class Tradepasswd(): def __init__(self): self.db_config={ 'host': '172.28.38.59', 'usr': 'mysqladmin', 'passwd': '12...
normal
{ "blob_id": "ed66e8028d653cf6b7ea4703fef5a658665c48db", "index": 1034, "step-1": "# -*- coding: utf-8 -*-\r\n# DATE 2018-08-21\r\n# AUTHER = tongzz\r\n#\r\n\r\nimport MySQLdb\r\nfrom Elements.LoginElements import *\r\nimport datetime\r\nimport sys\r\nclass Tradepasswd():\r\n def __init__(self):\r\n sel...
[ 0 ]
<|reserved_special_token_0|> def home(request): return render(request, 'home.html') <|reserved_special_token_0|> def docs(request): return render(request, 'docs.html') <|reserved_special_token_0|> def publications(request): return render(request, 'publications.html') <|reserved_special_token_0|>...
flexible
{ "blob_id": "f7a493ab8e9845d0e9da33a0ee45d7c3ef66deb5", "index": 7507, "step-1": "<mask token>\n\n\ndef home(request):\n return render(request, 'home.html')\n\n\n<mask token>\n\n\ndef docs(request):\n return render(request, 'docs.html')\n\n\n<mask token>\n\n\ndef publications(request):\n return render(r...
[ 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from Get2Gether.api_routes.schedule import schedule_router from Get2Gether.api_routes.auth import auth_router from Get2Gether.api_routes.event import event_router
flexible
{ "blob_id": "cd9d10a3ee3956762d88e76a951023dd77023942", "index": 6411, "step-1": "<mask token>\n", "step-2": "from Get2Gether.api_routes.schedule import schedule_router\nfrom Get2Gether.api_routes.auth import auth_router\nfrom Get2Gether.api_routes.event import event_router\n", "step-3": null, "step-4": nu...
[ 0, 1 ]
from MultisizerReader import MultiSizerReader import os import matplotlib.pyplot as plt #Get all spread sheet files in fodler and create multisizer files for each folder = "./Data_Organised/DilutionTestingLowOD" allFiles = os.listdir(folder) multiSizerFiles = [allFiles[i] for i in range(len(allFiles)) if allFiles[i].e...
normal
{ "blob_id": "2f0aa1f294f34a4f3ffb47c15ab74fc792765f10", "index": 9195, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor files in multiSizerFiles:\n data.append(MultiSizerReader(path=os.path.join(folder, files)))\n<mask token>\nfor d in data:\n OD = d.name.split('_')[4] + '.' + d.name.split('_')[5...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals from eight import * from whoosh.fields import TEXT, ID, Schema bw2_schema = Schema( name=TEXT(stored=True, sortable=True), comment=TEXT(stored=True), product=TEXT(stored=True, sortable=True), categories=TEXT(stored=True), ...
normal
{ "blob_id": "07aafcb3db9c57ad09a29a827d72744ef0d22247", "index": 3319, "step-1": "<mask token>\n", "step-2": "<mask token>\nbw2_schema = Schema(name=TEXT(stored=True, sortable=True), comment=TEXT(\n stored=True), product=TEXT(stored=True, sortable=True), categories=TEXT\n (stored=True), location=TEXT(sto...
[ 0, 1, 2, 3 ]
x = int(input("Enter number:")) y = x/2 print(y) for i in
normal
{ "blob_id": "79c6b7c3d23248f249b55af1d097a66a78a2c22f", "index": 9164, "step-1": "x = int(input(\"Enter number:\"))\ny = x/2\nprint(y)\n\nfor i in \n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# -*- coding: utf-8 -*- """ A customised logger for this project for logging to the file and console Created on 29/07/2022 @author: PNimbhore """ # imports import os import logging class Logger: """ A custom logger which will take care of logging to console and file. """ def __init__(self, filepat...
normal
{ "blob_id": "45d57f8392b89776f9349c32b4bb2fa71a4aaa83", "index": 8610, "step-1": "<mask token>\n\n\nclass Logger:\n <mask token>\n\n def __init__(self, filepath):\n \"\"\"\n Constructor\n :param filepath:\n \"\"\"\n self.filepath = filepath\n self.logger = logging....
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in f: line = line.rstrip('\n') line = line.replace('[', '') splitted = line.split(']') stringTime = splitted[0] stringTask = splitted[1] datetimeTime = datetime.strptime(stringTime, '%Y-%m-%d %H:%M...
flexible
{ "blob_id": "293533d07b530be9e8f97f1720619bf6c3113cca", "index": 9447, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f:\n line = line.rstrip('\\n')\n line = line.replace('[', '')\n splitted = line.split(']')\n stringTime = splitted[0]\n stringTask = splitted[1]\n datetimeTi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestFabric(unittest.TestCase): def setUp(self): env.test_home = os.path.join(env.localroot, 'deploy', 'test') user_config = yaml.load(open(os.path.join(env.localroot, 'deploy', 'test', 'machines_user.yml'))) env.update(user_config['default'])...
flexible
{ "blob_id": "7700e3c4061f0e81a1dea8fa8b27a0380fc26e71", "index": 7171, "step-1": "<mask token>\n\n\nclass TestFabric(unittest.TestCase):\n\n def setUp(self):\n env.test_home = os.path.join(env.localroot, 'deploy', 'test')\n user_config = yaml.load(open(os.path.join(env.localroot, 'deploy',\n ...
[ 12, 14, 16, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> capture.release() cv2.destroyAllWindows() <|reserved_special_token_0|> if len(faces) >= 1: sys.stdout.write('1') else: sys.stdout.write('0') <|reserved_special_token_1|> <|reserved_special_token_0|> face_cascade = cv2.C...
flexible
{ "blob_id": "4d707e23f66e8b6bea05a5901d3d8e459247c6c1", "index": 3840, "step-1": "<mask token>\n", "step-2": "<mask token>\ncapture.release()\ncv2.destroyAllWindows()\n<mask token>\nif len(faces) >= 1:\n sys.stdout.write('1')\nelse:\n sys.stdout.write('0')\n", "step-3": "<mask token>\nface_cascade = cv...
[ 0, 1, 2, 3, 4 ]
n,k = map(int,raw_input().split()) nums = list(map(int,raw_input().split())) if k==1: print min(nums) elif k==2: print max(nums[0],nums[-1]) else: print max(nums)
normal
{ "blob_id": "041a5bf205c1b3b3029623aa93835e99104464b2", "index": 2361, "step-1": "n,k = map(int,raw_input().split())\nnums = list(map(int,raw_input().split()))\nif k==1:\n print min(nums)\nelif k==2:\n print max(nums[0],nums[-1])\nelse:\n print max(nums)\n", "step-2": null, "step-3": null, "step-4": nul...
[ 0 ]
<|reserved_special_token_0|> class Euler(BaseEuler): def solve(self): fp = path.join(getcwd(), 'euler/resources/names.txt') with open(fp, 'r') as f: names = sorted([name for name in f.read().replace('"', ''). split(',')]) return sum([get_name_score(names, name)...
flexible
{ "blob_id": "40d08bfa3286aa30b612ed83b5e9c7a29e9de809", "index": 6540, "step-1": "<mask token>\n\n\nclass Euler(BaseEuler):\n\n def solve(self):\n fp = path.join(getcwd(), 'euler/resources/names.txt')\n with open(fp, 'r') as f:\n names = sorted([name for name in f.read().replace('\"',...
[ 3, 4, 5, 6, 7 ]
# Example 15-5. Using a BookDict, but not quite as intended >>> from books import BookDict >>> pp = BookDict(title='Programming Pearls', ... authors='Jon Bentley', ... isbn='0201657880', ... pagecount=256) >>> pp {'title': 'Programming Pearls', 'authors': 'Jon Bentley', 'isbn'...
normal
{ "blob_id": "ab9d8e36518c4d42f1e29fbc5552078a5a338508", "index": 7010, "step-1": "# Example 15-5. Using a BookDict, but not quite as intended\n\n>>> from books import BookDict\n>>> pp = BookDict(title='Programming Pearls',\n... authors='Jon Bentley',\n... isbn='0201657880',\n... ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): a = int(input( 'Informe a sua opção (Aleatório = 0, Você escolhe = outro numero): ')) if a != 0: linhas = int(input('Informe o número de linhas da matriz: ')) colunas = int(input('Info...
flexible
{ "blob_id": "c80ecb97c8863b724169715b766024ce824b9225", "index": 5572, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n a = int(input(\n 'Informe a sua opção (Aleatório = 0, Você escolhe = outro numero): '))\n if a != 0:\n linhas = int(input('Informe o número de linhas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(studentMarks[3]) studentMarks.append(95) for i in studentMarks: print(i) <|reserved_special_token_0|> while i < len(studentMarks): print(studentMarks[i]) i += 1 <|reserved_special_token_1|> <|reserved_special_...
flexible
{ "blob_id": "d442d5c7afd32dd149bb47fc9c4355409c53dab8", "index": 6719, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(studentMarks[3])\nstudentMarks.append(95)\nfor i in studentMarks:\n print(i)\n<mask token>\nwhile i < len(studentMarks):\n print(studentMarks[i])\n i += 1\n", "step-3": "...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def drawing_plt(): thisImg = os.listdir(caltech_dir) row = 4 cols = int(math.ceil(len(thisImg) / 4)) fig = plt.figure() i = 1 for image in glob.glob('C:/cnnTest/*.jpg'): img = cv2.imread(image) subplot = fig.add_subplot(row, cols, i) subplot...
flexible
{ "blob_id": "1255a9df2fbe11d92991f3f0f7054b92cb017628", "index": 2941, "step-1": "<mask token>\n\n\ndef drawing_plt():\n thisImg = os.listdir(caltech_dir)\n row = 4\n cols = int(math.ceil(len(thisImg) / 4))\n fig = plt.figure()\n i = 1\n for image in glob.glob('C:/cnnTest/*.jpg'):\n img ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while i == 0: try: print("Let's divide some numbers!") a1 = input('Enter numerator: ') b1 = input('Enter denominator: ') a = int(a1) b = int(b1) print(a1 + ' divied by ' + b1 + '...
flexible
{ "blob_id": "dcc1b0decf2fca6309dbb60faebd3f0a6944cd7d", "index": 9130, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i == 0:\n try:\n print(\"Let's divide some numbers!\")\n a1 = input('Enter numerator: ')\n b1 = input('Enter denominator: ')\n a = int(a1)\n b ...
[ 0, 1, 2, 3 ]
"""empty message Revision ID: 6374505f9e6e Revises: 9dc91bb7d2ba Create Date: 2016-11-14 10:55:08.418923 """ # revision identifiers, used by Alembic. revision = '6374505f9e6e' down_revision = '9dc91bb7d2ba' from alembic import op import sqlalchemy as sa import sqlalchemy.types as ty def upgrade(): ### command...
normal
{ "blob_id": "7badb7c9f1e00dfc379468b7bd73a3f09bffe6de", "index": 1191, "step-1": "<mask token>\n\n\ndef downgrade():\n op.alter_column('run', 'polarion_id', type_=ty.String(1024))\n op.alter_column('auto_result', 'skip', type_=ty.String(65535))\n op.alter_column('auto_result', 'failure', type_=ty.String...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestDataEmptyArray(object): @staticmethod def get_array(): return [] class TestDataUniqueValues(object): @staticmethod def get_array(): return [5, 3, 2] @staticmethod def get_expected_result(): return 2 class TestDataExactlyTwoD...
flexible
{ "blob_id": "8fdc9a52b00686e10c97fa61e43ddbbccb64741b", "index": 8946, "step-1": "<mask token>\n\n\nclass TestDataEmptyArray(object):\n\n @staticmethod\n def get_array():\n return []\n\n\nclass TestDataUniqueValues(object):\n\n @staticmethod\n def get_array():\n return [5, 3, 2]\n\n ...
[ 9, 10, 11, 13, 14 ]
"Unit tests for reverse URL lookup" from django.core.urlresolvers import reverse_helper, NoReverseMatch import re, unittest test_data = ( ('^places/(\d+)/$', 'places/3/', [3], {}), ('^places/(\d+)/$', 'places/3/', ['3'], {}), ('^places/(\d+)/$', NoReverseMatch, ['a'], {}), ('^places/(\d+)/$', NoRevers...
normal
{ "blob_id": "b7ccb41c43a0db6f1bf9e6ba5cef1b9b1417e297", "index": 633, "step-1": "\"Unit tests for reverse URL lookup\"\n\nfrom django.core.urlresolvers import reverse_helper, NoReverseMatch\nimport re, unittest\n\ntest_data = (\n ('^places/(\\d+)/$', 'places/3/', [3], {}),\n ('^places/(\\d+)/$', 'places/3/...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--header-mutate-level', type=int, choices=range(11 ), nargs='?', help= 'Set the mutation level for the headers (0-10). Defa...
flexible
{ "blob_id": "350a79d6cead6814ad48292b14a204e753dc938c", "index": 4363, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--header-mutate-level', type=int, choices=range(11\n ), nargs='?', help=\n 'Set ...
[ 0, 1, 2, 3, 4 ]
import numpy as np import cv2 FRAME_WIDTH = 320 FRAME_HEIGHT = 240 cv2.namedWindow('Measure Angle with centerline') # WebCam Initialize vidCapture = cv2.VideoCapture(1) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('webcam_record.avi', fourcc, 20.0, (640, 480)) while True: # ke...
normal
{ "blob_id": "500d6f473f07b35bf2d075d3061ac2e54eab702a", "index": 4156, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.namedWindow('Measure Angle with centerline')\n<mask token>\nwhile True:\n ret, frame = vidCapture.read()\n if ret == True:\n out.write(frame)\n cv2.imshow('frame',...
[ 0, 1, 2, 3, 4 ]
import urllib.request import urllib.parse import json content = input("请输入需要翻译的内容:") url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' data = {} data['action'] = 'FY_BY_CLICKBUTTION' data['bv'] = '1ca13a5465c2ab126e616ee8d6720cc3' data['client'] = 'fanyideskweb' data['doctype'] = 'json' dat...
normal
{ "blob_id": "e01b1f57a572571619d6c0981370030dc6105fd2", "index": 8636, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('翻译结果:%s' % target['translateResult'][0][0]['tgt'])\n", "step-3": "<mask token>\ncontent = input('请输入需要翻译的内容:')\nurl = 'http://fanyi.youdao.com/translate?smartresult=dict&smartres...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 4 20:28:44 2019 @author: nicholustintzaw """ #################################################################################################### ####################################################################################################...
normal
{ "blob_id": "5a2716fc7b4c0a56fbd0de5d45d71fb33320adf0", "index": 2889, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(masterdir)\nexec(open('01_newqs_directory.py', 'r', encoding='utf8').read())\nexec(open('02_new_register.py', 'r', encoding='utf8').read())\nexec(open('03_moved_in.py', 'r', enco...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestDocument(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_get_texts(self): texts = self.doc.get_texts() self.assertEqual(2, len(texts)) def test_get_term_data(self): term_data = self.doc.get_term_dat...
flexible
{ "blob_id": "f86d01c4b980ac44dcdb1b0008493e1dbda25971", "index": 4544, "step-1": "<mask token>\n\n\nclass TestDocument(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_get_texts(self):\n texts = self.doc.get_texts()\n self.assertEqual(2, len(texts))\n\n def test_get_term_d...
[ 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ Package for haasplugin. """
flexible
{ "blob_id": "20518302b6a67f8f1ac01f1adf4fe06ab2eaf280", "index": 3098, "step-1": "<mask token>\n", "step-2": "\"\"\"\nPackage for haasplugin.\n\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
'''Lab01 ex4 E/16/319 Rathnayake R.P.V.N''' from dataclasses import asdict from json import dumps from dataclasses import dataclass from typing import List, Dict import json import ex1 #import the ex1 to get the lord_course_registraion function s1=ex1.load_course_registrations("data.txt") #lord the list of Student ...
normal
{ "blob_id": "8a5ade450485f9114fa91c00c7588535ccbaf0e6", "index": 1923, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('student_registrations.json', 'w') as f:\n f.write(e)\n", "step-3": "<mask token>\ns1 = ex1.load_course_registrations('data.txt')\ns1 = map(asdict, s1)\ne = json.dumps(list...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .net import *
flexible
{ "blob_id": "73337246bd54df53842360510148f3a6f4763ace", "index": 6251, "step-1": "<mask token>\n", "step-2": "from .net import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from packer.utils import hello_world
flexible
{ "blob_id": "d549303228e860ae278a5a9497a4a3a68989aeca", "index": 6097, "step-1": "<mask token>\n", "step-2": "from packer.utils import hello_world\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class YumiConstants: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|res...
flexible
{ "blob_id": "34c81b9318d978305748d413c869a86ee6709e2c", "index": 996, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass YumiConstants:\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 <mask token>\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for letter in input_string: if letter in input_string: output_string += ALPHABET[(ALPHABET.index(letter) + key) % 26] else: output_string += letter print(f'Encoded String is {output_string}') <|reserved_s...
flexible
{ "blob_id": "b2db622596d0dff970e44759d25360a62f5fea83", "index": 4725, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor letter in input_string:\n if letter in input_string:\n output_string += ALPHABET[(ALPHABET.index(letter) + key) % 26]\n else:\n output_string += letter\nprint(f'En...
[ 0, 1, 2, 3 ]