code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import dash import dash_core_components as dcc import dash_html_components as html app = dash.Dash() app.layout = html.Div( children=[ html.Label('Dropdowm'), dcc.Dropdown( id='my-dropdown', options=[ {'label': 'İstanbul', 'value': 34}, # seçeneleri dict tu...
normal
{ "blob_id": "443bf59bc3c5ed2114f0c276aa7134ff5bf7fb64", "index": 7264, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run_server()\n", "step-3": "<mask token>\napp = dash.Dash()\napp.layout = html.Div(children=[html.Label('Dropdowm'), dcc.Dropdown(id=\n 'my-dropdo...
[ 0, 1, 2, 3, 4 ]
import nltk class Text(object): def __init__(self, text): self.text = text self.words = nltk.word_tokenize(text) self.sents = nltk.sent_tokenize(text) class Passage(Text): def __init__(self, title, story, questions): Text.__init__(self,story) self.title = title ...
normal
{ "blob_id": "5830a6001d7db50002c44aede6fb10938fa01dd1", "index": 320, "step-1": "import nltk\n\nclass Text(object):\n \n def __init__(self, text):\n self.text = text\n self.words = nltk.word_tokenize(text)\n self.sents = nltk.sent_tokenize(text)\n\nclass Passage(Text):\n\n def __ini...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solveCoarse(world, aFine, MbFine, AbFine, boundaryConditions): NWorldCoarse = world.NWorldCoarse NWorldFine = world.NWorldCoarse * world.NCoarseElement NCoarseElement = world.NCoarseElement NpFine = np.prod(N...
flexible
{ "blob_id": "1b3493322fa85c2fe26a7f308466c4a1c72d5b35", "index": 4637, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solveCoarse(world, aFine, MbFine, AbFine, boundaryConditions):\n NWorldCoarse = world.NWorldCoarse\n NWorldFine = world.NWorldCoarse * world.NCoarseElement\n NCoarseEleme...
[ 0, 1, 2, 3 ]
import time import os import random def generate_sequence(difficulty): print("Try to remember the numbers! : ") random_list = random.sample(range(1, 101), difficulty) time.sleep(2) print(random_list) time.sleep(0.7) os.system('cls') time.sleep(3) return random_list def get_list_from_...
normal
{ "blob_id": "bff9fb50f1901094c9ab3d61566509835c774f21", "index": 6776, "step-1": "<mask token>\n\n\ndef is_list_equal(a, b):\n if a == b:\n print('CORRECT answer! :) ')\n time.sleep(2)\n print('See you next time !')\n time.sleep(3)\n return True\n else:\n print('Th...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def equals(left, right, tol=0.001): """ Tests equality of left and right Rosalind allows for a default [absolute] error of 0.001 in decimal answers unless otherwise stated. """ try: left = left.strip() right = right.st...
flexible
{ "blob_id": "b137fc40a5b2dec63c7abb6953664a969f5c126f", "index": 8022, "step-1": "<mask token>\n", "step-2": "def equals(left, right, tol=0.001):\n \"\"\"\n Tests equality of left and right\n\n Rosalind allows for a default [absolute] error of 0.001 in decimal\n answers unless otherwise stated.\n ...
[ 0, 1, 2 ]
from package import * class mysql(MakePackage): dependencies = ["cmake"] fetch="http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/" config='cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=%(prefix)s -DWITH_READLINE=1'
normal
{ "blob_id": "ec90c731a0e546d9d399cbb68c92be1acca8cbe0", "index": 518, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass mysql(MakePackage):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass mysql(MakePackage):\n dependencies = ['cmake']\n fetch = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "38c21fb959d8b98b616006ea48bd720cc6f9995c", "index": 1462, "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 = [('digressions...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def reset(request): request.session['count'] = 0 return redirect('/') <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): if not 'word' in request.session: request.session['word...
flexible
{ "blob_id": "2ec5e43860a1d248a2f5cd1abc26676342275425", "index": 8589, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef reset(request):\n request.session['count'] = 0\n return redirect('/')\n", "step-3": "<mask token>\n\n\ndef index(request):\n if not 'word' in request.session:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> botName = 'firstBot' username = 'mrthemafia' password = 'oblivion' client_id = 'Y3LQwponbEp07w' client_secret = 'R4oyCEj6hSTJWHfWMwb-DGUOBm8' <|reserved_special_token_1|> botName = "firstBot" username = "mrthemafia" password = "oblivion" client_id = "Y3LQw...
flexible
{ "blob_id": "3031f695d57492cf3b29694fecd0a41c469a3e00", "index": 7481, "step-1": "<mask token>\n", "step-2": "botName = 'firstBot'\nusername = 'mrthemafia'\npassword = 'oblivion'\nclient_id = 'Y3LQwponbEp07w'\nclient_secret = 'R4oyCEj6hSTJWHfWMwb-DGUOBm8'\n", "step-3": "botName = \"firstBot\"\nusername = \"m...
[ 0, 1, 2 ]
import re class Zout: def __init__(self, aline): self.Str = aline self.Var = '' self.StN = '' self.ZN = '' self.ZName = '' self.Motion = '' self.Ztype = '' self.tozout(aline) def tozout(self, aline): """transform station sta...
normal
{ "blob_id": "71ebc6e9218085e887eda7843b5489837ed45c97", "index": 880, "step-1": "<mask token>\n\n\nclass Zouts:\n <mask token>\n\n def search(self, StN, ZN, Motion):\n for elem in self.elements:\n print('elem:')\n print(str(type(elem.StN)) + str(type(StN)))\n print(e...
[ 3, 6, 7, 10, 11 ]
#!/usr/bin/python import os, sys # Assuming /tmp/foo.txt exists and has read/write permissions. ret = os.access("/tmp/foo.txt", os.F_OK) print "F_OK - return value %s"% ret ret = os.access("/tmp/foo.txt", os.R_OK) print "R_OK - return value %s"% ret ret = os.access("/tmp/foo.txt", os.W_OK) print "W_OK -...
normal
{ "blob_id": "c9b76fed088b85cf68e96778016d8974fea84933", "index": 4050, "step-1": "#!/usr/bin/python\r\nimport os, sys\r\n\r\n# Assuming /tmp/foo.txt exists and has read/write permissions.\r\n\r\nret = os.access(\"/tmp/foo.txt\", os.F_OK)\r\nprint \"F_OK - return value %s\"% ret\r\n\r\nret = os.access(\"/tmp/foo....
[ 0 ]
## More Review + More Linked Lists ## ##Given a pointer to the head node of a linked list whose data elements are in non-decreasing order, you must delete any duplicate nodes and print the updated list. ##Code handling I/O is provided in the editor. Complete the removeDuplicates(Node) function. ##Note: The head poi...
normal
{ "blob_id": "75990147e4a3dae1b590729ed659e2ddcbfb295d", "index": 1636, "step-1": "## More Review + More Linked Lists ##\n\n##Given a pointer to the head node of a linked list whose data elements are in non-decreasing order, you must delete any duplicate nodes and print the updated list.\n##Code handling I/O is...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: myfile = open('mydata.txt', encoding='utf-8') except FileNotFoundError as ex: print('file is not found') print(ex.args) else: print('file :', myfile.read()) myfile.close() finally: print('finished wor...
flexible
{ "blob_id": "8bf75bf3b16296c36c34e8c4c50149259d792af7", "index": 4319, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n myfile = open('mydata.txt', encoding='utf-8')\nexcept FileNotFoundError as ex:\n print('file is not found')\n print(ex.args)\nelse:\n print('file :', myfile.read())\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_encoding_type(file): with open(file, 'rb') as f: rawdata = f.read() return detect(rawdata)['encoding'] def item_change_location(item, location, call): """Change location and remove holdinds infos Arguments: item {str} -- xml response of get i...
flexible
{ "blob_id": "1f94ef0aae1128089b34fc952766cc3927677cdf", "index": 5698, "step-1": "<mask token>\n\n\ndef get_encoding_type(file):\n with open(file, 'rb') as f:\n rawdata = f.read()\n return detect(rawdata)['encoding']\n\n\ndef item_change_location(item, location, call):\n \"\"\"Change location and...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class OneCase(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, case_path, *args, **kwargs): self._case_path = str(case_path) self._case_dict = {} self._step_result = [] self....
flexible
{ "blob_id": "f658959bf7fa5e02a577119930c9b9c1ef59f432", "index": 2845, "step-1": "<mask token>\n\n\nclass OneCase(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, case_path, *args, **kwargs):\n self._case_path = str(case_path)\n self._case_dict = {}\n ...
[ 7, 9, 10, 13, 14 ]
<|reserved_special_token_0|> class AuditMiddleware(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def process_response(self, request, response): signals.audit_presave.disconnect(dispatch_uid=(settings. DISPATCH_UID, request)) return response <|reserved_...
flexible
{ "blob_id": "0e03a3b3401075384e580bc2bb8af1a106f1d238", "index": 2141, "step-1": "<mask token>\n\n\nclass AuditMiddleware(object):\n <mask token>\n <mask token>\n\n def process_response(self, request, response):\n signals.audit_presave.disconnect(dispatch_uid=(settings.\n DISPATCH_UID,...
[ 2, 4, 5, 6, 7 ]
import datetime import traceback import sys import os def getErrorReport(): errorReport = ErrorReport() return errorReport class ErrorReport(): def __init__(self): return def startLog(self): timestamp = str(datetime.datetime.now()) fileName = 'Log_'+timestamp+'.txt....
normal
{ "blob_id": "6abc8b97117257e16da1f7b730b09ee0f7bd4c6e", "index": 4715, "step-1": "<mask token>\n\n\nclass ErrorReport:\n <mask token>\n\n def startLog(self):\n timestamp = str(datetime.datetime.now())\n fileName = 'Log_' + timestamp + '.txt.'\n self.logFile = open(fileName, 'w')\n\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(N): a, b, c, d = map(int, input().split()) A.append(a) B.append(b) C.append(c) D.append(d) <|reserved_special_token_0|> for i in range(N): for j in range(N): AB.append(A[i] + B[j]) ...
flexible
{ "blob_id": "2a9426653146603d9aa79a59ce181d97aa3c551c", "index": 8525, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n a, b, c, d = map(int, input().split())\n A.append(a)\n B.append(b)\n C.append(c)\n D.append(d)\n<mask token>\nfor i in range(N):\n for j in range(N)...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def compile_data(city_labels=None): """Compile all data into common structure """ pass def compile_and_save_data(f_out, city_labels=None): """Compile and save all data """ pass <|reserved_special_token_1|> <|reserved_special_token_0|> bikerawdata.add_system(...
flexible
{ "blob_id": "53bf97d66d0b26c6b5639acd0261604082474e7b", "index": 8163, "step-1": "<mask token>\n\n\ndef compile_data(city_labels=None):\n \"\"\"Compile all data into common structure\n\n \"\"\"\n pass\n\n\ndef compile_and_save_data(f_out, city_labels=None):\n \"\"\"Compile and save all data\n\n \"...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ClientInline(admin.StackedInline): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class ClientAdmin(admin.ModelAdmin): inlines = [ClientInline] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special...
flexible
{ "blob_id": "ffd7aef2e72e64ac5b9f85b9d12845479187d89b", "index": 2010, "step-1": "<mask token>\n\n\nclass ClientInline(admin.StackedInline):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ClientAdmin(admin.ModelAdmin):\n inlines = [ClientInline]\n\n\n<mask token>\n", "step-2": "<mask token...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 2.1.5 on 2019-03-12 18:07 from django.db import migrations def associate_experiments_to_organisms(apps, schema_editor): """Creates missing associations between experiments and organisms. Based off of: https://simpleisbetterthancomplex.com/tutorial/2017/09/26/how-to-create-django-da...
normal
{ "blob_id": "b4b2307897f64bb30cad2fbaaa1b320ae2aa7456", "index": 8553, "step-1": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('data_refinery_common', '0015_dataset_emai...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> REDIRECT_MAP = {'90': '19904201', '91': '19903329', '92': '19899125', '93': '19901043', '94': '19903192', '95': '19899788', '97': '19904423', '98': '19906163', '99': '19905540', '100': '19907871', '101': '19908147', '102': '19910103', '103': '1990...
flexible
{ "blob_id": "fb92912e1a752f3766f9439f75ca28379e23823f", "index": 3600, "step-1": "<mask token>\n", "step-2": "REDIRECT_MAP = {'90': '19904201', '91': '19903329', '92': '19899125', '93':\n '19901043', '94': '19903192', '95': '19899788', '97': '19904423', '98':\n '19906163', '99': '19905540', '100': '19907...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class AudioPopupNotifier(Notifier): <|reserved_special_token_0|> <|reserved_special_token_0|> def notify(self): display(Audio(self.audio, autoplay=True)) time.sleep(3) display(HTML(self.template.format(self.message))) <|reserved_special_token_1|> <|...
flexible
{ "blob_id": "94a3a74260fac58b4cad7422608f91ae3a1a0272", "index": 6247, "step-1": "<mask token>\n\n\nclass AudioPopupNotifier(Notifier):\n <mask token>\n <mask token>\n\n def notify(self):\n display(Audio(self.audio, autoplay=True))\n time.sleep(3)\n display(HTML(self.template.format...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # author : rovo98 # date: 2018.3.19 # this is a demo for test calling functions. n1 = 255 n2 = 1000 print(hex(n1)) print(hex(n2)) print(abs(-119999))
normal
{ "blob_id": "31064145ae2702f93a475d0957395c62a6b320ee", "index": 1741, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(hex(n1))\nprint(hex(n2))\nprint(abs(-119999))\n", "step-3": "n1 = 255\nn2 = 1000\nprint(hex(n1))\nprint(hex(n2))\nprint(abs(-119999))\n", "step-4": "# -*- coding: utf-8 -*-\r\n#...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def run(address): ths = [] with grpc.insecure_channel(address) as channel: for i in range(1): th = threading.Thread(target=send, args=(channel,)) ths.append(th) st = int(time.time()) for th in ths: th.start() for ...
flexible
{ "blob_id": "5430e1861a6244c25c00699323efa0921a5af940", "index": 3709, "step-1": "<mask token>\n\n\ndef run(address):\n ths = []\n with grpc.insecure_channel(address) as channel:\n for i in range(1):\n th = threading.Thread(target=send, args=(channel,))\n ths.append(th)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class FeatureExtractor: <|reserved_special_token_0|> <|reserved_special_token_0|> def encode(self): """ encodes the text in the Document object, and then adds it to the encoding attribute """ text_lines = [line.text for line in self._document.lines] en...
flexible
{ "blob_id": "882d265f14c04b2f2f626504d18e2cd07dcc8637", "index": 3042, "step-1": "<mask token>\n\n\nclass FeatureExtractor:\n <mask token>\n <mask token>\n\n def encode(self):\n \"\"\" encodes the text in the Document object, and then adds it to the encoding attribute \"\"\"\n text_lines =...
[ 3, 4, 5, 6, 7 ]
''' Faraday Penetration Test IDE Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) See the file 'doc/LICENSE' for the license information ''' """ This module contains some useful functions to embedd an IPython shell. This allows to interactively test things. TODO: create a QT Widget capable of running the...
normal
{ "blob_id": "3eb071fa826c838d847e3f97abe3b706760a1336", "index": 1309, "step-1": "'''\nFaraday Penetration Test IDE\nCopyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)\nSee the file 'doc/LICENSE' for the license information\n\n'''\n\"\"\"\nThis module contains some useful functions to embedd an IPyth...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def gen_metadata(fn): metadata = {} lines = open(fn, 'r').readlines() for line in lines: line = line.rstrip() if len(line) == 0: continue elif line.startswith('#'): continue elif line.startsw...
flexible
{ "blob_id": "5066c2a5219cf1b233b4985efc7a4eb494b784ca", "index": 7363, "step-1": "<mask token>\n", "step-2": "def gen_metadata(fn):\n metadata = {}\n lines = open(fn, 'r').readlines()\n for line in lines:\n line = line.rstrip()\n if len(line) == 0:\n continue\n elif lin...
[ 0, 1, 2, 3 ]
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('accounts.views', url(r'^$', 'home', name='home'), url(r'^login/$', 'login', name='login'), url(r'^logout/$', 'logout', n...
normal
{ "blob_id": "798ddd4a6e4febb4664bf1c973877628d1a45c71", "index": 368, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('accounts.views', url('^$', 'home', name='home'),\n url('^login/$', 'login', name='login'), url('^logout/$', 'logout', name\n ='logout'), url('^register/$', 'r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def sift_up(heap: List, pos: int=None): if pos is None: pos = len(heap) - 1 current, parent = pos, (pos - 1) // 2 while current > 0: if heap[current] > heap[parent]: heap[current], heap[parent] = heap[parent], heap[current] else: ...
flexible
{ "blob_id": "9cc6700ab14bed9d69d90c1540f6d42186033a19", "index": 5052, "step-1": "<mask token>\n\n\ndef sift_up(heap: List, pos: int=None):\n if pos is None:\n pos = len(heap) - 1\n current, parent = pos, (pos - 1) // 2\n while current > 0:\n if heap[current] > heap[parent]:\n h...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class AdmLicenseBc(AdmLicense): def bc_judge(self): global com_id, com_name alb = AdmLicenseBc() count_bc = 0 count = 0 while count_bc == 0: result = alb.adm_license_judge() com_id = result[0] com_name = resu...
flexible
{ "blob_id": "63822d60ef9dcc1e123a3d20874e9f492b439c6d", "index": 3313, "step-1": "<mask token>\n\n\nclass AdmLicenseBc(AdmLicense):\n\n def bc_judge(self):\n global com_id, com_name\n alb = AdmLicenseBc()\n count_bc = 0\n count = 0\n while count_bc == 0:\n result ...
[ 7, 9, 10, 11, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> matplotlib.style.use('ggplot') <|reserved_special_token_0|> sys.path.append('masterThesisPack/') <|reserved_special_token_0|> raw.wind_along.plot(ax=ax) ax.axhline(y=3 * std, c='k', ls='dashed') ax.axhline(y=-3 * std, c='k', ls='d...
flexible
{ "blob_id": "4c1fea4dcf143ec976d3956039616963760d5af6", "index": 5030, "step-1": "<mask token>\n", "step-2": "<mask token>\nmatplotlib.style.use('ggplot')\n<mask token>\nsys.path.append('masterThesisPack/')\n<mask token>\nraw.wind_along.plot(ax=ax)\nax.axhline(y=3 * std, c='k', ls='dashed')\nax.axhline(y=-3 * ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> load_dotenv(dotenv_path=env_path) <|reserved_special_token_0|> @botCommand.event async def on_ready(): print(f'{client.user} is connected to the following guild:\n') @botCommand.command(pass_context=True, aliases=['y']) as...
flexible
{ "blob_id": "94ca18088664393fdfdc68bfb8bcad8b78e9e36a", "index": 7887, "step-1": "<mask token>\n", "step-2": "<mask token>\nload_dotenv(dotenv_path=env_path)\n<mask token>\n\n\n@botCommand.event\nasync def on_ready():\n print(f'{client.user} is connected to the following guild:\\n')\n\n\n@botCommand.command...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(20): print('The ' + str(i) + '-th graph.') Ground_sample = np.load(Ground_FOLDER + 'Ground-True-' + str(i) + '.npy') CGRNN_sample = np.load(CGRNN_FOLDER + 'CGRNN-' + str(i) + '.npy') SRNN_sample = np...
flexible
{ "blob_id": "af152e0b739305866902ee141f94641b17ff03ea", "index": 6496, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(20):\n print('The ' + str(i) + '-th graph.')\n Ground_sample = np.load(Ground_FOLDER + 'Ground-True-' + str(i) + '.npy')\n CGRNN_sample = np.load(CGRNN_FOLDER + 'C...
[ 0, 1, 2, 3, 4 ]
""" Remove tool_consumer_info_product_family_code from GradingInfo. Revision ID: 106d94be7705 Revises: 973c9358b616 Create Date: 2023-07-06 11:23:10.850486 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "106d94be7705" down_revision = "973c9358b616" def upgrad...
normal
{ "blob_id": "46d85a3babab4b18f4e0e0384f254f6105cf691d", "index": 1490, "step-1": "<mask token>\n\n\ndef upgrade():\n op.drop_column('lis_result_sourcedid',\n 'tool_consumer_info_product_family_code')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef upgrade():\n op.drop_column('lis_result_sou...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ModelSpellVariantPair(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "4958d6d88b762e6fbe860123b7274c16b6452605", "index": 7674, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ModelSpellVariantPair(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ModelSpellVariantPair(Base):\n _...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def load_clusters(file_name): if file_name not in load_clusters._cache: cluster_data = ClusterData() cluster_data.load_file(file_name) else: cluster_data = load_clusters._cache[file_name] return cluster_data <|reserved_special_token_0|> def get_ngal...
flexible
{ "blob_id": "3acbb37809462ee69ff8792b4ad86b31dba5d630", "index": 3821, "step-1": "<mask token>\n\n\ndef load_clusters(file_name):\n if file_name not in load_clusters._cache:\n cluster_data = ClusterData()\n cluster_data.load_file(file_name)\n else:\n cluster_data = load_clusters._cache...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def get_sma(stock_code, ndays): stock_data = st.get_csv_data(stock_code, 'price') sma_data = SMA(stock_data, ndays) sma_data = sma_data.dropna() return sma_data['SMA'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def SMA(dat...
flexible
{ "blob_id": "4c9f2b6fd119daa58b7f1dd7153c90df747e62cb", "index": 1249, "step-1": "<mask token>\n\n\ndef get_sma(stock_code, ndays):\n stock_data = st.get_csv_data(stock_code, 'price')\n sma_data = SMA(stock_data, ndays)\n sma_data = sma_data.dropna()\n return sma_data['SMA']\n\n\n<mask token>\n", "...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def patch_rom(rom_path, payload_path, c_code_path, entry_code_path, out_path): rom = list(Path(rom_path).read_bytes()) payload = list(Path(payload_path).read_bytes()) c_code = list(Path(c_code_path).read_bytes()) entry_code = list(Path(entry_code_path).read_bytes()) ju...
flexible
{ "blob_id": "f566c42674728f1874d89b15102627c3b404c9a0", "index": 3534, "step-1": "<mask token>\n\n\ndef patch_rom(rom_path, payload_path, c_code_path, entry_code_path, out_path):\n rom = list(Path(rom_path).read_bytes())\n payload = list(Path(payload_path).read_bytes())\n c_code = list(Path(c_code_path)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @application.route('/') def index(): return make_response(render_template('index.html')) @application.route('/getGraph', methods=['POST', 'GET']) def getgraph(): if request.method == 'POST': if 'data' in request.form: if path.exists('static/jsons/' + request....
flexible
{ "blob_id": "14b9927435536a4b29b0930791ab4525acd80bc9", "index": 5783, "step-1": "<mask token>\n\n\n@application.route('/')\ndef index():\n return make_response(render_template('index.html'))\n\n\n@application.route('/getGraph', methods=['POST', 'GET'])\ndef getgraph():\n if request.method == 'POST':\n ...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> def fSet_BillDate(pMonth): if pMonth == 13: pMonth = 12 logging.debug('- change bill date: ' + str(pMonth) + '/27/' + Settings. dataYear) time.sleep(1) myTools.getFocus() type('b', KeyModifier.ALT) type('d') time.sleep(2) type('t') type(...
flexible
{ "blob_id": "69721dca0f5d8396e330696cde52bfabad33c895", "index": 3242, "step-1": "<mask token>\n\n\ndef fSet_BillDate(pMonth):\n if pMonth == 13:\n pMonth = 12\n logging.debug('- change bill date: ' + str(pMonth) + '/27/' + Settings.\n dataYear)\n time.sleep(1)\n myTools.getFocus()\n ...
[ 2, 3, 4, 5, 6 ]
fahrenheit = float(input("Enter a fahrenheit degree: ")) celcius = ((fahrenheit - 32) * 5) / 9 print("From fahrenheit to celcius", celcius)
normal
{ "blob_id": "2f2030107f3a23c0d2f404a838eaccc8b35ac410", "index": 1086, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('From fahrenheit to celcius', celcius)\n", "step-3": "fahrenheit = float(input('Enter a fahrenheit degree: '))\ncelcius = (fahrenheit - 32) * 5 / 9\nprint('From fahrenheit to celc...
[ 0, 1, 2, 3 ]
from django.db.models import Count from django.utils.text import slugify from rest_framework.serializers import ModelSerializer, SerializerMethodField, Serializer from rest_framework import serializers from category.models import Category from product.models import Product, GalleryProduct, Stone, Color, Size ...
normal
{ "blob_id": "8be6031caad26ec6b6b99b8d8b8f80d16ad243d4", "index": 7706, "step-1": "<mask token>\n\n\nclass ProductsOrderCartSerializer(ModelSerializer):\n\n\n class Meta:\n model = Product\n fields = ['id', 'title', 'slug', 'image']\n\n\nclass ProductDetailSerializer(TaggitSerializer, ModelSerial...
[ 9, 15, 16, 17, 21 ]
from django.shortcuts import render from rest_framework import generics from rest_framework import mixins from django.contrib.auth.models import User from rest_framework import permissions from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.request import Req...
normal
{ "blob_id": "4c43c181dbba1680e036750a2a2ea1185bbe91da", "index": 3218, "step-1": "<mask token>\n\n\nclass InstitutionViewSet(viewsets.ModelViewSet):\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\n def get_permi...
[ 5, 8, 10, 11, 13 ]
import tensorflow as tf from sklearn.cluster import KMeans import tensorflow.keras as keras from copy import deepcopy import numpy as np import h5py from collections import defaultdict, namedtuple from heapq import heappush, heappop, heapify import struct tf.enable_eager_execution() mnist = tf.keras.datasets.mnist (x...
normal
{ "blob_id": "086aefaad7a4b743e5a05b3a44db971dbdbf16b6", "index": 8299, "step-1": "<mask token>\n\n\ndef prune_weights(weight):\n for i in range(weight.shape[-1]):\n tmp = deepcopy(weight[..., i])\n tmp = np.abs(tmp)\n tmp = np.sort(np.array(tmp))\n threshold = tmp[int(tmp.shape[0] ...
[ 2, 4, 5, 6, 10 ]
from django.db.models import Model, CharField, IntegerField, ManyToManyField, ForeignKey, PROTECT from django.core.validators import MaxValueValidator, MinValueValidator from polymorphic.models import PolymorphicModel from model_utils import Choices class Tendencia(Model): valor = CharField(max_length=16, unique=...
normal
{ "blob_id": "c07454dfb9dabb89c86f63063231ae9cf915aa38", "index": 4116, "step-1": "<mask token>\n\n\nclass Classe(PolymorphicModel):\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>\n...
[ 15, 20, 23, 25, 35 ]
<|reserved_special_token_0|> def loadData(fileDj): data = [] fid = open(fileDj) for line in fid: line = line.strip() m = [float(x) for x in line.split(' ')] data.append(m) return data def getInitialCentroids(X, k): initialCentroids = [] for i in range(k): inde...
flexible
{ "blob_id": "000dd63089fd0c6184fd032fe75ccc920beee7a8", "index": 127, "step-1": "<mask token>\n\n\ndef loadData(fileDj):\n data = []\n fid = open(fileDj)\n for line in fid:\n line = line.strip()\n m = [float(x) for x in line.split(' ')]\n data.append(m)\n return data\n\n\ndef get...
[ 9, 10, 12, 13, 14 ]
# -*- coding: utf-8 -*- import sys from os import path try: import DMP except ImportError: sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from DMP.modeling.vectorMaker import VectorMaker from DMP.modeling.variables import KEY_TOTAL, KEY_TRAIN, KEY_VALID, KEY_TEST from DMP.dataset.dataHan...
normal
{ "blob_id": "ca25739583d3b7ff449fbd2f56a96631981c815d", "index": 5986, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n import DMP\nexcept ImportError:\n sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))\n<mask token>\nif __name__ == '__main__':\n file_dict = {KEY_TOTAL: S...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render import urllib from django.http import HttpResponse, Http404 from django.utils.dateparse import parse_datetime from urllib.parse import urlencode from matplotlib import pyplot from decimal import Decimal fr...
normal
{ "blob_id": "1a46752a2d1c72ec6084e7af3694a3969e2d1b4c", "index": 1772, "step-1": "<mask token>\n\n\ndef estacionamiento_reserva(request, _id):\n _id = int(_id)\n try:\n estacionamiento = Estacionamiento.objects.get(id=_id)\n except ObjectDoesNotExist:\n raise Http404\n if estacionamient...
[ 5, 7, 9, 10, 11 ]
import cv2 import glob import numpy as np import csv import matplotlib.pyplot as plt from pydarknet import Detector,Image """ Calculates the average precision based on the precision and recall values, which are essentially the output of getPrecisionRecall Returns the 101pt interpolation curve and a single av...
normal
{ "blob_id": "f8a31cdf5f55b5aed33a407d2c008ba9b969d655", "index": 9493, "step-1": "<mask token>\n\n\ndef getIntersection(a, b):\n intersection = [0, 0, 0, 0]\n if b[0] <= a[0] and a[0] <= b[2]:\n intersection[0] = a[0]\n elif a[0] <= b[0] and b[0] <= a[2]:\n intersection[0] = b[0]\n else...
[ 3, 5, 6, 7, 8 ]
from app import create_app __author__ = '七月' app = create_app() if __name__ == '__main__': app.run(debug=app.config['DEBUG'])
normal
{ "blob_id": "9a6d6637cd4ecf2f6e9c8eb8e702be06e83beea4", "index": 998, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run(debug=app.config['DEBUG'])\n", "step-3": "<mask token>\n__author__ = '七月'\napp = create_app()\nif __name__ == '__main__':\n app.run(debug=app.c...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def make_model(): corpus = open(corpusFile).read() text_model = markovify.Text(corpus, state_size=4) model_json = text_model.to_json() f = open(modelFile, mode='w') f.write(model_json) f.close() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reser...
flexible
{ "blob_id": "cc71c0cc1ec21dc465486fb5894c4d389c39bd62", "index": 8164, "step-1": "<mask token>\n\n\ndef make_model():\n corpus = open(corpusFile).read()\n text_model = markovify.Text(corpus, state_size=4)\n model_json = text_model.to_json()\n f = open(modelFile, mode='w')\n f.write(model_json)\n ...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "30986eb0a6cd82f837dd14fb383529a6a41def9a", "index": 8338, "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 = [('auth', '000...
[ 0, 1, 2, 3, 4 ]
import ConfigParser ''' Merge as many as ConfigParser as you want''' def Config_Append(SRC_Config ,DST_Config): import tempfile temp_src = tempfile.NamedTemporaryFile(delete=True) temp_dst = tempfile.NamedTemporaryFile(delete=True) with open(temp_src.name,'wb') as src, open(temp_dst.name,'wb') as dst: ...
normal
{ "blob_id": "d17f1176ac60a3f6836c706883ab1847b61f50bf", "index": 1857, "step-1": "import ConfigParser\n''' Merge as many as ConfigParser as you want'''\n\ndef Config_Append(SRC_Config ,DST_Config):\n import tempfile\n temp_src = tempfile.NamedTemporaryFile(delete=True)\n temp_dst = tempfile.NamedTempora...
[ 0 ]
"""Test the init file of Mailgun.""" import hashlib import hmac import pytest from homeassistant import config_entries, data_entry_flow from homeassistant.components import mailgun, webhook from homeassistant.config import async_process_ha_core_config from homeassistant.const import CONF_API_KEY, CONF_DOMAIN from hom...
normal
{ "blob_id": "a55024f0e5edec22125ce53ef54ee364be185cb8", "index": 1099, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture\nasync def http_client(hass, hass_client_no_auth):\n \"\"\"Initialize a Home Assistant Server for testing this module.\"\"\"\n await async_setup_component(hass, ...
[ 0, 1, 2, 3, 4 ]
#!/user/bin/env python # -*- coding: utf-8 -*- # @Author : XordenLee # @Time : 2019/2/1 18:51 import itchat import requests import sys default_api_key = 'bb495c529b0e4efebd5d2632ecac5fb8' def send(user_id, input_text, api_key=None): if not api_key: api_key = default_api_key msg = { ...
normal
{ "blob_id": "15539d824490b7ae4724e7c11949aa1db25ecab2", "index": 5112, "step-1": "<mask token>\n\n\ndef send(user_id, input_text, api_key=None):\n if not api_key:\n api_key = default_api_key\n msg = {'reqType': 0, 'perception': {'inputText': {'text': input_text},\n 'selfInfo': {'location': {'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(lista) <|reserved_special_token_0|> print(listasemana[0]) <|reserved_special_token_0|> print(listasemana[-1]) <|reserved_special_token_0|> print(listasemana[0, 3]) <|reserved_special_token_0|> print(conjunto) <|reserved_spec...
flexible
{ "blob_id": "37b23dc520abc7cbb6798f41063696916065626f", "index": 2203, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(lista)\n<mask token>\nprint(listasemana[0])\n<mask token>\nprint(listasemana[-1])\n<mask token>\nprint(listasemana[0, 3])\n<mask token>\nprint(conjunto)\n<mask token>\nprint(lista1p...
[ 0, 1, 2, 3 ]
import sys character_dict = {} f = open(sys.argv[1], 'r') while True: pinyin = f.readline().strip() character = f.readline().strip() if not character: break character_dict[pinyin] = character import time fout = open(sys.argv[1][:-3] + "_guess_char.out", 'w') fout.write("-----------------------------") fout.write(...
normal
{ "blob_id": "226bb323597100b57ef83eb0d5e4a9b894b77fd2", "index": 9830, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n pinyin = f.readline().strip()\n character = f.readline().strip()\n if not character:\n break\n character_dict[pinyin] = character\n<mask token>\nfout.writ...
[ 0, 1, 2, 3, 4 ]
from typing import * class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: cells = {} for i in range(9): for j in range(9): if board[i][j] != ".": val = board[i][j] # is unique in r...
normal
{ "blob_id": "57c911c9a10f9d116f1b7099c5202377e16050f1", "index": 7871, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def isValidSudoku(self, board: List[List[str]]) ->bool:\n cells = {}\n for i ...
[ 0, 1, 2, 3, 4 ]
from typing import List import uvicorn from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() def get_db(): db = SessionLocal() try: ...
normal
{ "blob_id": "5961c593b46a8d3a0f7c62d862cce9a2814e42f4", "index": 9019, "step-1": "<mask token>\n\n\ndef get_db():\n db = SessionLocal()\n try:\n yield db\n finally:\n db.close()\n\n\n@app.post('/users/', response_model=schemas.UserCreate)\ndef create_user(user: schemas.UserCreate, db: Sess...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> z1.write('file05.txt') z1.write('file03.txt') z1.close() <|reserved_special_token_0|> z2.extractall('电影') z2.close() <|reserved_special_token_1|> <|reserved_special_token_0|> z1 = zipfile.ZipFile('a.zip', 'w') z1.write('file05....
flexible
{ "blob_id": "81f5753e8d0004244b4ee8e26895cb2b38fbb8b6", "index": 751, "step-1": "<mask token>\n", "step-2": "<mask token>\nz1.write('file05.txt')\nz1.write('file03.txt')\nz1.close()\n<mask token>\nz2.extractall('电影')\nz2.close()\n", "step-3": "<mask token>\nz1 = zipfile.ZipFile('a.zip', 'w')\nz1.write('file0...
[ 0, 1, 2, 3, 4 ]
num = 15850 base = 16 # Primera división residuo = num % base cociente = num // base bit1 = str(residuo) bit1 = bit1.replace("10","a") bit1 = bit1.replace("11","b") bit1 = bit1.replace("12","c") bit1 = bit1.replace("13","d") bit1 = bit1.replace("14","e") bit1 = bit1.replace("15","f") # Segunda división residuo = co...
normal
{ "blob_id": "2d72f063362aaefdc236e1240020c71bacaf51cf", "index": 8057, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('{} = {}{}{}{}'.format(num, bit4, bit3, bit2, bit1))\n", "step-3": "num = 15850\nbase = 16\nresiduo = num % base\ncociente = num // base\nbit1 = str(residuo)\nbit1 = bit1.replace(...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.1 on 2020-10-29 13:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registered_user', '0005_auto_20201029_1710'), ] operations = [ migrations.AlterField( model_name='user_details', nam...
normal
{ "blob_id": "f2c96b3133137019dc6bd462f096f3b4c5f12648", "index": 6635, "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 = [('registered_...
[ 0, 1, 2, 3, 4 ]
import http.client from urllib.parse import urlencode client = http.client.HTTPConnection("127.0.0.1:9000") post_data = { "usertag": "test", "password": '123456', 'code': "print('Hello Web')" } head_dict = {'Content-Type': 'application/x-www-form-urlencoded'} post_data = urlencode(post_data) client.request(...
normal
{ "blob_id": "ee1ce3ea4b31246703530478d6550b0c8866197e", "index": 1190, "step-1": "<mask token>\n", "step-2": "<mask token>\nclient.request(method='POST', url='/', body=post_data.encode('utf-8'),\n headers=head_dict)\n<mask token>\nclient.close()\nprint(content)\n", "step-3": "<mask token>\nclient = http.c...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('>>>> Connecting with the UAV <<<<') <|reserved_special_token_0|> vehicle.wait_ready('autopilot_version') print('ready') <|reserved_special_token_0|> if cap.isOpened() == False: print('Unable to read camera feed') <|rese...
flexible
{ "blob_id": "8c11463e35fb32949abbb163a89f874040a33ad0", "index": 5415, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('>>>> Connecting with the UAV <<<<')\n<mask token>\nvehicle.wait_ready('autopilot_version')\nprint('ready')\n<mask token>\nif cap.isOpened() == False:\n print('Unable to read cam...
[ 0, 1, 2, 3, 4 ]
#Eyal Reis - 203249354 from view import View def main(): """ primary game method """ view = View() view.root.mainloop() if __name__ == "__main__": main()
normal
{ "blob_id": "640eae824e43e394bf0624dd4cf7dcec78f43604", "index": 4947, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"\n primary game method\n \"\"\"\n view = View()\n view.root.mainloop()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n \"\"\"\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def read_video(filename): """ 将视频每秒的内容提取出来 :param filename: 视频文件路径 :return: 视频文件名,用来拼接 """ cap = cv2.VideoCapture(filename) rate = cap.get(cv2.CAP_PROP_FPS) count = 0 success, frame = cap.read() imageCount = 0 while success: success, fra...
flexible
{ "blob_id": "a8506420b1bc558fa953f0cec3f8c16beaf44909", "index": 9886, "step-1": "<mask token>\n\n\ndef read_video(filename):\n \"\"\"\n 将视频每秒的内容提取出来\n :param filename: 视频文件路径\n :return: 视频文件名,用来拼接\n \"\"\"\n cap = cv2.VideoCapture(filename)\n rate = cap.get(cv2.CAP_PROP_FPS)\n count = 0\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Encoder(Protocol): <|reserved_special_token_0|> class Decoder(Protocol): def __call__(self, packed: EncodedData, **kwargs) ->Dict[Any, Any]: ... class DataClassYAMLMixin(DataClassDictMixin): def to_yaml(self: T, encoder: Encoder=yaml.dump, dict_params: Mapp...
flexible
{ "blob_id": "15edb1c051ccbc6f927c0a859288511f94a3d853", "index": 986, "step-1": "<mask token>\n\n\nclass Encoder(Protocol):\n <mask token>\n\n\nclass Decoder(Protocol):\n\n def __call__(self, packed: EncodedData, **kwargs) ->Dict[Any, Any]:\n ...\n\n\nclass DataClassYAMLMixin(DataClassDictMixin):\n\...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> l.sort() print('+'.join(l)) <|reserved_special_token_1|> l = input().split('+') l.sort() print('+'.join(l)) <|reserved_special_token_1|> l = input().split("+") l.sort() print('+'.join(l))
flexible
{ "blob_id": "30d891c18f3635b7419fa0d0539b2665ad60b22c", "index": 4748, "step-1": "<mask token>\n", "step-2": "<mask token>\nl.sort()\nprint('+'.join(l))\n", "step-3": "l = input().split('+')\nl.sort()\nprint('+'.join(l))\n", "step-4": "l = input().split(\"+\")\r\r\nl.sort()\r\r\nprint('+'.join(l))\r\r\n", ...
[ 0, 1, 2, 3 ]
import socket import threading #WebSocket Server Address WS_ADDR = ("127.0.0.1",9876) def ws_handler(sock,addr): print 'ws handshaking...' print 'connected...' print 'closing...' def websocket_server(): print 'listening for a WS connection... ' svSock = socket.socket() svSock.setsockopt(soc...
normal
{ "blob_id": "668fe3d561d94be73f2f721fac89e9e25005769b", "index": 2652, "step-1": "import socket\nimport threading\n\n#WebSocket Server Address\nWS_ADDR = (\"127.0.0.1\",9876)\n\n\ndef ws_handler(sock,addr):\n print 'ws handshaking...'\n print 'connected...'\n print 'closing...'\n\n\ndef websocket_server...
[ 0 ]
import datetime import shutil from pathlib import Path from jinja2 import Environment, FileSystemLoader from dataclasses import dataclass PATH_TO_TEMPLATES = Path('TEMPLATES/') PATH_TO_RESOURCES = Path('RESOURCES/') PATH_TO_OUTPUT = Path('../docs/') URL_ROOT = "https://katys.cz/" link_to_homepage = "/" # TODO: alwa...
normal
{ "blob_id": "5cc18af40befab444df44bf3da1f0175e5d18983", "index": 8206, "step-1": "<mask token>\n\n\n@dataclass()\nclass Page(object):\n title: str\n keywords: str\n description: str\n content_file: str\n url: str\n language: str\n last_mod: datetime.datetime\n phone: str = '+420 603 217 8...
[ 3, 5, 6, 9, 10 ]
<|reserved_special_token_0|> class LocationDetail(generics.RetrieveUpdateDestroyAPIView): queryset = Location.objects.all() serializer_class = LocationSerializer name = 'location' <|reserved_special_token_1|> <|reserved_special_token_0|> class LocationList(generics.ListCreateAPIView): <|reserved_...
flexible
{ "blob_id": "245e407c9e92b3ac34389a48fcef4fc1b349ea18", "index": 8252, "step-1": "<mask token>\n\n\nclass LocationDetail(generics.RetrieveUpdateDestroyAPIView):\n queryset = Location.objects.all()\n serializer_class = LocationSerializer\n name = 'location'\n", "step-2": "<mask token>\n\n\nclass Locati...
[ 2, 3, 4, 5 ]
# coding: utf-8 from datetime import datetime #from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils import timezone from persol_users.models import PersolUser from django.db.models import Q, Count # アンケート from questions.m...
normal
{ "blob_id": "ca0bca24509df2bf0bd07fb2f31d3e7909957405", "index": 3483, "step-1": "<mask token>\n\n\nclass Event(models.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>\n <...
[ 11, 13, 15, 16, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UserTests(APITestCase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UserTests(APITestCase): def test_user_list(self): response = self.client.get('/api/...
flexible
{ "blob_id": "ca7b0553e55e1c5e6cd23139a158101e72456a50", "index": 8844, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserTests(APITestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UserTests(APITestCase):\n\n def test_user_list(self):\n response = self.client.get('...
[ 0, 1, 2, 3, 4 ]
from csv import writer with open("movies.csv","w") as file: csv_writer=writer(file) csv_writer.writerow(['Name','Year']) csv_writer.writerow(['Ratchasan',2018]) csv_writer.writerow(['Vadachennai',2018]) csv_writer.writerow(['Naran',2007])
normal
{ "blob_id": "83e231480c618d290089340c642313bbba4f1070", "index": 2035, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('movies.csv', 'w') as file:\n csv_writer = writer(file)\n csv_writer.writerow(['Name', 'Year'])\n csv_writer.writerow(['Ratchasan', 2018])\n csv_writer.writerow(['Va...
[ 0, 1, 2, 3 ]
# 8-7. Album: Write a function called make_album() that builds a dictionary # describing a music album. The function should take in an artist name and an # album title, and it should return a dictionary containing these two pieces # of information. Use the function to make three dictionaries representing # di...
normal
{ "blob_id": "19888c998e8787533e84413272da1183f16fcdb1", "index": 2974, "step-1": "<mask token>\n\n\ndef make_album_two(artist_name, album_title, number_of_songs=None):\n \"\"\"Build a dictionary describing a music album\"\"\"\n music_album = {'Artist': artist_name.title(), 'Album': album_title.title()}\n ...
[ 1, 2, 3, 4, 5 ]
file = open('thegazelle.wordpress.2016-06-22.xml', 'r') text = file.read() authors = [] start = text.find("<wp:author_display_name>") length = len("<wp:author_display_name>") end = text.find("</wp:author_display_name") authors.append(text[start+length+len("<![CDATA["):end-len("]]>")]) while text.find("<wp:author_displa...
normal
{ "blob_id": "cf5062c999c6c29f103428c247d8d1a4550f9d75", "index": 8086, "step-1": "<mask token>\n", "step-2": "<mask token>\nauthors.append(text[start + length + len('<![CDATA['):end - len(']]>')])\nwhile text.find('<wp:author_display_name>', start + 1) != -1:\n start = text.find('<wp:author_display_name>', ...
[ 0, 1, 2, 3 ]
#Pràctica 9 Condicionals, Exercici 2: print("Introduce un valor par:") numpar=int(input()) print("Introduce un valor impar:") numimp=int(input()) if numpar==numimp*2: print(numpar," es el doble que ",numimp,".") else: print(numpar," no es el doble que ",numimp,".")
normal
{ "blob_id": "8ad5f3e5f73eae191a3fe9bc20f73b4bfcfedc8c", "index": 4884, "step-1": "<mask token>\n", "step-2": "print('Introduce un valor par:')\n<mask token>\nprint('Introduce un valor impar:')\n<mask token>\nif numpar == numimp * 2:\n print(numpar, ' es el doble que ', numimp, '.')\nelse:\n print(numpar,...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import gatt class AnyDevice(gatt.Device): def connect_succeeded(self): super().connect_succeeded() print("[%s] Connected" % (self.mac_address)) def connect_failed(self, error): super().connect_failed(error) print("[%s] Connection failed: %s" % (self.mac_a...
normal
{ "blob_id": "480e636cfe28f2509d8ecf1e6e89924e994f100d", "index": 4888, "step-1": "<mask token>\n\n\nclass AnyDevice(gatt.Device):\n <mask token>\n\n def connect_failed(self, error):\n super().connect_failed(error)\n print('[%s] Connection failed: %s' % (self.mac_address, str(error)))\n <ma...
[ 5, 7, 9, 11, 12 ]
# coding: utf-8 from django.test.client import Client from django.contrib.contenttypes.models import ContentType from main.models import Descriptor, ResourceThematic, ThematicArea from utils.tests import BaseTestCase from models import * def minimal_form_data(): ''' Define a minimal fields for submit a medi...
normal
{ "blob_id": "a253ab5ef80a61c3784862625cde81de4c4ef984", "index": 2094, "step-1": "<mask token>\n\n\nclass MultimediaTest(BaseTestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_add_media(self):\n \"\"\"\n Tests create media\n \"\"\"\n self.login_editor()\n...
[ 8, 9, 12, 14, 16 ]
# vim: set et ts=4 sw=4 fileencoding=utf-8: ''' tests.integration.test_pipeline =============================== ''' import unittest import yaml import subprocess import time import pickle from datetime import datetime from amqp.exceptions import ChannelError from yalp.config import settings @unittest.skip('need to...
normal
{ "blob_id": "c945dc4df68fe110e8b38713fb77e2dce9efad8d", "index": 8418, "step-1": "<mask token>\n\n\n@unittest.skip('need to make this less brittle')\nclass TestSerialization(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_default_serializer(self):\n from yalp.pipe...
[ 2, 4, 5, 6, 7 ]
import os import numpy as np import warnings import soundfile as sf def load_path(): path = os.path.join(os.path.dirname(__file__)) if path == "": path = "." return path def create_folder(directory): try: if not os.path.exists(directory): os.makedirs(directory) except...
normal
{ "blob_id": "cab233976653b8135276ff849955f32766833354", "index": 7555, "step-1": "<mask token>\n\n\ndef load_path():\n path = os.path.join(os.path.dirname(__file__))\n if path == '':\n path = '.'\n return path\n\n\ndef create_folder(directory):\n try:\n if not os.path.exists(directory):...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Get_res_DataFrame: <|reserved_special_token_0|> def __init__(self, lr, df, df_bin, df_woe, use_lst, woe_dic, type_train ='type_train', y='is_7_p'): self.df = df self.df_bin = df_bin self.df_woe = df_woe self.use_lst = use_lst ...
flexible
{ "blob_id": "6336b31e51f0565c6b34ab5148645748fe899541", "index": 3829, "step-1": "<mask token>\n\n\nclass Get_res_DataFrame:\n <mask token>\n\n def __init__(self, lr, df, df_bin, df_woe, use_lst, woe_dic, type_train\n ='type_train', y='is_7_p'):\n self.df = df\n self.df_bin = df_bin\n ...
[ 11, 12, 13, 14, 15 ]
<|reserved_special_token_0|> class DeviceShadowHandler: def status_post(self, status, state=None): """Post status message and device state to AWSIoT and LOGGER :param status: status string :param state: optional dictionary to add to shadow reported state :return: """ ...
flexible
{ "blob_id": "a6d409b806dbd1e174cac65a26c5e8106a8b93ea", "index": 3760, "step-1": "<mask token>\n\n\nclass DeviceShadowHandler:\n\n def status_post(self, status, state=None):\n \"\"\"Post status message and device state to AWSIoT and LOGGER\n\n :param status: status string\n :param state: ...
[ 6, 8, 9, 10, 12 ]
import xdrlib,sys import xlrd def open_excel(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx'): try: data=xlrd.open_workbook('D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx') return data except Exception as e: print (str(e)) def excel_table_byindex(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx',colnameindex=0,by_inde...
normal
{ "blob_id": "d211594a034489d36a5648bf0b926fbd734fd0df", "index": 6928, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef excel_table_byindex(file='D:\\\\基金公司\\\\数据库-制表符\\\\资产组合-基金公司维度.xlsx',\n colnameindex=0, by_index=0):\n data = open_excel(file='D:\\\\基金公司\\\\数据库-制表符\\\\资产组合-基金公司维度.xlsx')\n ...
[ 0, 1, 2, 3, 4 ]
from practice.demo4 import paixu if __name__ == '__main__': n=int(input("请输入最大的数字范围:")) paixu(n)
normal
{ "blob_id": "a777c6d76ef2ae15544a91bcfba0dbeabce0470a", "index": 5377, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:'))\n paixu(n)\n", "step-3": "from practice.demo4 import paixu\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:')...
[ 0, 1, 2, 3 ]
car_state = False u_input = input(f'>') if car_state == True: print('Car is stopped!') if u_input == 'start': car_state = True print('Car has started!') elif u_input == 'stop': car_state == False print('Car has stopped!') else: print('''I don''t understand that...''')
normal
{ "blob_id": "2766339632200c26a8c6cd3abff28b1495870b9a", "index": 9207, "step-1": "<mask token>\n", "step-2": "<mask token>\nif car_state == True:\n print('Car is stopped!')\nif u_input == 'start':\n car_state = True\n print('Car has started!')\nelif u_input == 'stop':\n car_state == False\n prin...
[ 0, 1, 2, 3 ]
def contador_notas(multiplo, numero): if(numero % multiplo == 0): notas = numero / multiplo return notas else: return -1 entrada = int(input()) resultado = contador_notas(100, entrada) if (resultado != -1): print("{} nota(s) de R$ {}".format(resultado, 100))
normal
{ "blob_id": "a5c19ad60ac6312631273858cebaae944a2008ec", "index": 8876, "step-1": "<mask token>\n", "step-2": "def contador_notas(multiplo, numero):\n if numero % multiplo == 0:\n notas = numero / multiplo\n return notas\n else:\n return -1\n\n\n<mask token>\n", "step-3": "def conta...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class User(UserMixin, db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) email = db.Column(db.String(64), unique=True, index=True) username = db.Column(db.String(64), unique=True, index=True) password_has...
flexible
{ "blob_id": "6ff4aff5811d2bd7ad150d7e8f925308d120ef74", "index": 2566, "step-1": "<mask token>\n\n\nclass User(UserMixin, db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String(64))\n email = db.Column(db.String(64), unique=True, index=True)\n...
[ 23, 24, 26, 27, 32 ]
from BeautifulSoup import BeautifulSoup, NavigableString from urllib2 import urlopen from time import ctime import sys import os import re restaurants = ["http://finweb.rit.edu/diningservices/brickcity", "http://finweb.rit.edu/diningservices/commons", "http://finweb.rit.edu/diningservices/crossroads", "http://finweb.r...
normal
{ "blob_id": "02e40e051c19116c9cb3a903e738232dc8f5d026", "index": 9522, "step-1": "\nfrom BeautifulSoup import BeautifulSoup, NavigableString\nfrom urllib2 import urlopen\nfrom time import ctime\nimport sys\nimport os\nimport re\nrestaurants = [\"http://finweb.rit.edu/diningservices/brickcity\",\n\"http://finweb....
[ 0 ]
""" The epitome package is a set of command-line tools for analyzing MRI data, and a set of scriptuit modules for stitching them (and others) together. """ from . import utilities from . import stats from . import signal from . import plot from . import docopt
normal
{ "blob_id": "4d58926e812789768fdf5be59bd54f9b66850e57", "index": 2554, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom . import utilities\nfrom . import stats\nfrom . import signal\nfrom . import plot\nfrom . import docopt\n", "step-3": "\"\"\"\nThe epitome package is a set of command-line tools fo...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def gradient_descent(f: Callable[[np.ndarray], float], f_grad: Callable[[np .ndarray], np.ndarray], start: np.ndarray, step_strategy: st. StepStrategy, stop_criteria: sc.StopCriteria, eps_strategy: float= DEFAULT_EPSILON, eps_stop_criteria: float=DEFAULT_EPSILON, max_itera...
flexible
{ "blob_id": "919e1f8a4b021d75496f3bcff369261a09362a65", "index": 3645, "step-1": "<mask token>\n\n\ndef gradient_descent(f: Callable[[np.ndarray], float], f_grad: Callable[[np\n .ndarray], np.ndarray], start: np.ndarray, step_strategy: st.\n StepStrategy, stop_criteria: sc.StopCriteria, eps_strategy: float...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def block(request, limit=None): try: links = cache.get_cache('sape', expire=3600).get(key='links', createfunc=load_links) except: links = cache.get_cache('sape', expire=300).get(key='links', ...
flexible
{ "blob_id": "6d5acaa4a60b646432feb59f4d8eb9c9d0dceb0f", "index": 1151, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef block(request, limit=None):\n try:\n links = cache.get_cache('sape', expire=3600).get(key='links',\n createfunc=load_links)\n except:\n links = cach...
[ 0, 1, 2, 3, 4 ]
""" Created on 02.09.2013 @author: Paul Schweizer @email: paulschweizer@gmx.net @brief: Holds all the namingconventions for pandora's box """ import os import json class NamingConvention(): """Imports naming conventions from the respective .json file and puts them into class variables. """ def __init...
normal
{ "blob_id": "d2a153fffccd4b681eebce823e641e195197cde7", "index": 54, "step-1": "<mask token>\n\n\nclass NamingConvention:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass NamingConvention:\n <mask token>\n\n def __init__(self):\n namingconventions = os.path.join(os.path.d...
[ 1, 2, 3, 4, 5 ]
""" Flask app for testing the OpenID Connect extension. """ import json from unittest.mock import MagicMock, Mock from flask import Flask, g import flask_oidc from tests.json_snippets import * oidc = None def index(): return "too many secrets", 200, { 'Content-Type': 'text/plain; charset=utf-8' } ...
normal
{ "blob_id": "ef3fa538828315845de5e2f7d4949f690e44276e", "index": 6009, "step-1": "<mask token>\n\n\ndef index():\n return 'too many secrets', 200, {'Content-Type':\n 'text/plain; charset=utf-8'}\n\n\ndef get_at():\n return oidc.get_access_token(), 200, {'Content-Type':\n 'text/plain; charset=...
[ 10, 11, 13, 15, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @dataclass class Music(object): url: str title: Optional[str] = None <|reserved_special_token_1|> from dataclasses import dataclass from typing import Optional @dataclass class Music(object): url: str title:...
flexible
{ "blob_id": "2506c5b042f04d1490ba2199a71e38829d4a0adc", "index": 5738, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclass\nclass Music(object):\n url: str\n title: Optional[str] = None\n", "step-3": "from dataclasses import dataclass\nfrom typing import Optional\n\n\n@dataclass\nclass ...
[ 0, 1, 2 ]
# Generated by Django 3.1.4 on 2021-01-11 16:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tutorials', '0003_auto_20210111_1705'), ] operations = [ migrations.AlterField( model_name='tutorial', name='upload'...
normal
{ "blob_id": "ac664cd7d62f89399e37f74e0234b3ad244fe460", "index": 6158, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('tutorials',...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.0.5 on 2020-04-25 12:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0006_order_date'), ] operations = [ migrations.RemoveField( model_name='order', name='product', ), ...
normal
{ "blob_id": "4cc138016cb1f82e12c76c185be19188d3e38bf9", "index": 2186, "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 = [('api', '0006...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from . import views app_name = 'orders' urlpatterns = [ path('checkout' , views.order_checkout_view , name='orders-checkout') , ]
normal
{ "blob_id": "031f668fbf75b54ec874a59f53c60ceca53779cf", "index": 8942, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'orders'\nurlpatterns = [path('checkout', views.order_checkout_view, name=\n 'orders-checkout')]\n", "step-3": "from django.urls import path\nfrom . import views\napp_name...
[ 0, 1, 2, 3 ]
# -*- coding:utf-8 -*- import datetime import json import os import urllib import requests from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import properties from time import sleep from appium import we...
normal
{ "blob_id": "2465a73d958d88dcd27cfac75a4e7b1fcd6a884e", "index": 3389, "step-1": "<mask token>\n\n\ndef logPrint(logstr):\n pyfileName = str(__file__).split('.py')[0].split('/')[-1]\n filepath = '.\\\\log\\\\' + pyfileName + '-runlog.log'\n now = str(datetime.datetime.now())\n logstr = now + ' ' + lo...
[ 4, 5, 7, 8, 9 ]