code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def getmessage(request): if request.method == 'POST': data = json.loads(request.body) uid = data.get('userid') msglist = [] mres = Message.objects.filter(tuid_id=uid).all() for res in mres: record = {'messageid': res.id, 'userid': re...
flexible
{ "blob_id": "f25db7d797f1f88bd0374d540adcb396e16740a0", "index": 8953, "step-1": "<mask token>\n\n\ndef getmessage(request):\n if request.method == 'POST':\n data = json.loads(request.body)\n uid = data.get('userid')\n msglist = []\n mres = Message.objects.filter(tuid_id=uid).all()...
[ 1, 2, 3, 4, 5 ]
dic = {"city": "Moscow", "temperature": 20} # print(dic["city"]) # dic["temperature"] -= 5 # print(dic) print(dic.get("country", "Russia")) dic["date"] = "27.05.2019" print(dic)
normal
{ "blob_id": "f145274c8caa1e725d12003874eb54a580a6e35e", "index": 784, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dic.get('country', 'Russia'))\n<mask token>\nprint(dic)\n", "step-3": "dic = {'city': 'Moscow', 'temperature': 20}\nprint(dic.get('country', 'Russia'))\ndic['date'] = '27.05.2019'\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def logPrint(logstr): pyfileName = str(__file__).split('.py')[0].split('/')[-1] filepath = '.\\log\\' + pyfileName + '-runlog.log' now = str(datetime.datetime.now()) logstr = now + ' ' + logstr with open(filepath, 'a', encoding='utf-8') as f: print(logstr) ...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class sys_ping: <|reserved_special_token_0|> <|reserved_special_token_0|> class last: """This class stores data from last sys_ping.ping()""" min_time, avg_time, max_time, mdev_time = 0, 0, 0, 0 ...
flexible
{ "blob_id": "44dee207ffa4f78293484126234a3b606e79915b", "index": 5056, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass sys_ping:\n <mask token>\n <mask token>\n\n\n class last:\n \"\"\"This class stores data from last sys_ping.ping()\"\"\"\n min_time, avg_time, max_time, m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PassportQt(QDialog): def __init__(self): super(PassportQt, self).__init__() self.passport_rep = PassportRepository() self.initUI() <|reserved_special_token_0|> def click_add(self): p_dict = {'id': -1, 'serial': '', 'number': ''} ...
flexible
{ "blob_id": "3f1715763a066fb337b3ff3d03e3736d0fb36b3f", "index": 7325, "step-1": "<mask token>\n\n\nclass PassportQt(QDialog):\n\n def __init__(self):\n super(PassportQt, self).__init__()\n self.passport_rep = PassportRepository()\n self.initUI()\n <mask token>\n\n def click_add(sel...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Video(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_0|...
flexible
{ "blob_id": "9c98ecde2e8aac00a33da7db6e5e6023519e4b84", "index": 7731, "step-1": "<mask token>\n\n\nclass Video(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\n ...
[ 8, 14, 15, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(x, ' ' * 3, '5') print('{:20d}'.format(x)) <|reserved_special_token_1|> x = 5 print(x, ' ' * 3, '5') print('{:20d}'.format(x)) <|reserved_special_token_1|> x = 5 print(x , " "*3 , "5") print("{:20d}".format(x))
flexible
{ "blob_id": "88542a18d98a215f58333f5dd2bf5c4b0d37f32f", "index": 5539, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x, ' ' * 3, '5')\nprint('{:20d}'.format(x))\n", "step-3": "x = 5\nprint(x, ' ' * 3, '5')\nprint('{:20d}'.format(x))\n", "step-4": "x = 5\nprint(x , \" \"*3 , \"5\")\nprint(\"{:2...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Triangle Project Code. # Triangle analyzes the lengths of the sides of a triangle # (represented by a, b and c) and returns the type of triangle. # # It returns: # 'equilateral' if all sides are equal # 'isosceles' if exactly 2 sides are equal # 'scalene' ...
normal
{ "blob_id": "5c8628e41c0dd544ade330fdd37841beca6c0c91", "index": 3986, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TriangleError(Exception):\n pass\n", "step-3": "def triangle(a, b, c):\n \"\"\"\n Determines the number of non-matching sides using len(set()). Then uses dictiona...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def parse_args(): parser = argparse.ArgumentParser(description='Network speaker device.') parser.add_argument('-d', '--debug', action='store_true', help= 'enable debugging messages') parser.add_argument('--ho...
flexible
{ "blob_id": "bb173d8869039f8bbd3e35529cf2d99b26d2b8ff", "index": 7130, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(description='Network speaker device.')\n parser.add_argument('-d', '--debug', action='store_true', help=\n 'enable de...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'cae_web_audio_visual' urlpatterns = [] <|reserved_special_token_1|> <|reserved_special_token_0|> from django.conf.urls import url from . import views app_name = 'cae_web_audio_visual' urlpatterns = [] <|reserved_s...
flexible
{ "blob_id": "5debc97e99bbd78b17e545896d718d4b0eac8519", "index": 2430, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'cae_web_audio_visual'\nurlpatterns = []\n", "step-3": "<mask token>\nfrom django.conf.urls import url\nfrom . import views\napp_name = 'cae_web_audio_visual'\nurlpatterns = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Post(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def publish(self): self.published_date = timezone.now() self.save() <|res...
flexible
{ "blob_id": "fe5398b03d2f0cfc7c972677faa0ea3ec701469e", "index": 7858, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def publish(self):\n self.published_date = timezone.now()\n self.save()\n ...
[ 2, 3, 4, 5, 6 ]
from django.contrib import admin from django.urls import path from . import views from .views import index from .views import Login , logout from .views import CheckOut urlpatterns = [ path("",views.index, name="index"), path('login', Login.as_view(), name='login'), path('logout',...
normal
{ "blob_id": "c8aa93a33a6513129b4980180c4eb8d5d5eb3b5b", "index": 2592, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('login', Login.\n as_view(), name='login'), path('logout', logout, name='logout'), path(\n 'cart/', views.cart, name='cart')...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_comports_list(): ports = list(lp.comports(include_links=False)) for p in ports: print(p.device) return ports def read_while_LF(com, timeout_ms=500): read_data = '' delay_ms = 10 attempts = int(timeout_ms / delay_ms) for i in range(attempts): ...
flexible
{ "blob_id": "e08fddefabf1b92aa97b939e05bb31d888df4e6a", "index": 2241, "step-1": "<mask token>\n\n\ndef get_comports_list():\n ports = list(lp.comports(include_links=False))\n for p in ports:\n print(p.device)\n return ports\n\n\ndef read_while_LF(com, timeout_ms=500):\n read_data = ''\n de...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(resp) <|reserved_special_token_0|> print(resp2) <|reserved_special_token_1|> <|reserved_special_token_0|> url = 'https://www.python.org/' resp = requests.get(url) print(resp) url2 = 'https://www.python.org/1' resp2 = requ...
flexible
{ "blob_id": "1af73c0ca38ea32119f622dc14741c0bb0aa08fd", "index": 6344, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(resp)\n<mask token>\nprint(resp2)\n", "step-3": "<mask token>\nurl = 'https://www.python.org/'\nresp = requests.get(url)\nprint(resp)\nurl2 = 'https://www.python.org/1'\nresp2 = r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Event(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_0|...
flexible
{ "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 ]
from bs4 import BeautifulSoup import requests import pandas as pd import json cmc = requests.get('https://coinmarketcap.com/') soup = BeautifulSoup(cmc.content, 'html.parser') data = soup.find('script', id="__NEXT_DATA__", type="application/json") coins = {} slugs = {} coin_data = json.loads(data.contents[0]) listin...
normal
{ "blob_id": "925e1a1a99b70a8d56289b72fa0e16997e12d854", "index": 4038, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in listings:\n coins[str(i['id'])] = i['slug']\n slugs[i['slug']] = str(i['id'])\nfor i in coins:\n page = requests.get(\n f'https://coinmarketcap.com/currencies/{co...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def parse_json(text): start = text.find('{') end = text.find('}') + 1 try: data = json.loads(text[start:end]) return data except Exception: logger.error('json解析失败:%s' % text) <|reserved_...
flexible
{ "blob_id": "9f8fbfb8a9c849ca0e8881c479800c8e190e4a1c", "index": 6485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_json(text):\n start = text.find('{')\n end = text.find('}') + 1\n try:\n data = json.loads(text[start:end])\n return data\n except Exception:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Setting_GUI(Toplevel): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Setting_GUI(Toplevel): def __init__(self, parent): super().__init__() self.parent = parent key =...
flexible
{ "blob_id": "9340c9055a7e0d74d232d878b43d91a3e6cd32e5", "index": 5785, "step-1": "<mask token>\n\n\nclass Setting_GUI(Toplevel):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Setting_GUI(Toplevel):\n\n def __init__(self, parent):\n super().__init__()\n self.parent ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class UpdateCartView(View): <|reserved_special_token_0|> def post(self, request): user = request.user if not user.is_authenticated: return JsonResponse({'res': 0, 'errmsg': '请先登录'}) sku_id = request.POST.get('sku_id') count = request.PO...
flexible
{ "blob_id": "5feea24d269409306338f772f01b0ee1d2736e2e", "index": 9246, "step-1": "<mask token>\n\n\nclass UpdateCartView(View):\n <mask token>\n\n def post(self, request):\n user = request.user\n if not user.is_authenticated:\n return JsonResponse({'res': 0, 'errmsg': '请先登录'})\n ...
[ 11, 14, 17, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, 'main') <|reserved_special_token_0|> main.hammer(workspace) <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, 'main') <|reserved_special_token_0|> workspace = os.path.abspath(sys.ar...
flexible
{ "blob_id": "4e1f7fddb6bd3413dd6a8ca21520d309af75c811", "index": 931, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, 'main')\n<mask token>\nmain.hammer(workspace)\n", "step-3": "<mask token>\nsys.path.insert(0, 'main')\n<mask token>\nworkspace = os.path.abspath(sys.argv[1])\nmain.ham...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_files(directory_path): dirpath = directory_path files = [f for f in listdir(dirpath) if isfile(join(dirpath, f)) and '.npy' in f] files = sorted(files) n_files = len(files) print('number of files=' + str(n_files)) return files, n_files <|reserved...
flexible
{ "blob_id": "b240e328ee6c5677991d3166c7b00f1b3a51787e", "index": 4765, "step-1": "<mask token>\n\n\ndef get_files(directory_path):\n dirpath = directory_path\n files = [f for f in listdir(dirpath) if isfile(join(dirpath, f)) and \n '.npy' in f]\n files = sorted(files)\n n_files = len(files)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class RealWorldFeatures(Features): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RealWorldFeatures(Features): def __init__(self): super().__init__('tsagkias/real_world_features') <|re...
flexible
{ "blob_id": "f6b2e66379b483c6a573d34d73ae0d10de7315a3", "index": 6815, "step-1": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n\n def __init__(self):\n super().__init__('tsagkias/real_worl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class User(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|> class Product(Model): __tablename__ = 'products' id = Column(I...
flexible
{ "blob_id": "e73c4a99c421b3eca08c941ff1f83cb03faee97d", "index": 2558, "step-1": "<mask token>\n\n\nclass User(Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Product(Model):\n __tablename__ = 'products'\n id = Column(Integer, p...
[ 7, 8, 9, 10, 12 ]
import bpy class TILA_Config_LogElement(bpy.types.PropertyGroup): name: bpy.props.StringProperty(default='') icon: bpy.props.StringProperty(default='BLANK1') class TILA_Config_LogList(bpy.types.UIList): bl_idname = "TILA_UL_Config_log_list" def draw_item(self, context, layout, data, item, icon, active_data, ac...
normal
{ "blob_id": "7fa7a632078ce4f0052e3cadf11d5efd47a1fad5", "index": 831, "step-1": "<mask token>\n\n\nclass TILA_Config_LogList(bpy.types.UIList):\n <mask token>\n <mask token>\n\n\nclass TILA_Config_SatusList(bpy.types.UIList):\n bl_idname = 'TILA_UL_Config_status_list'\n\n def draw_item(self, context,...
[ 12, 13, 14, 15, 17 ]
# -*- coding: utf-8 -*- __all__ = "corner" import logging import numpy as np from corner.core import corner_impl try: from corner.arviz_corner import arviz_corner except ImportError: arviz_corner = None def corner( data, bins=20, *, # Original corner parameters range=None, axes_sc...
normal
{ "blob_id": "ae998fb17b8d6f4f5c8871a0ebe86a039501ec99", "index": 5959, "step-1": "<mask token>\n\n\ndef corner(data, bins=20, *, range=None, axes_scale='linear', weights=None,\n color=None, hist_bin_factor=1, smooth=None, smooth1d=None, labels=None,\n label_kwargs=None, titles=None, show_titles=False, titl...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 16 20:47:28 2019 @author: jaco """
normal
{ "blob_id": "d806d1b31712e3d8d60f4bfbc60c6939dfeeb357", "index": 9579, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Dec 16 20:47:28 2019\n\n@author: jaco\n\"\"\"\n\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if download_dir != '': os.chdir(download_dir) response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') soup.findAll('a') one_a_tag = soup.findAll('a')[startindex:] links = [one_a_tag[...
flexible
{ "blob_id": "ff0495ee1f4aa1f243c82b709a974d3d7c37e8bd", "index": 2425, "step-1": "<mask token>\n", "step-2": "<mask token>\nif download_dir != '':\n os.chdir(download_dir)\n response = requests.get(url)\n soup = BeautifulSoup(response.text, 'html.parser')\n soup.findAll('a')\n one_a_tag = soup.f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class TestRawJob: <|reserved_special_token_0|> <|reserved_special_token_1|> class TestRawJob: def __init__(self, parsedRow): values = [string.strip().lower() for string in parsedRow] keys = ['Id', 'Title', 'Description', 'Raw Locat...
flexible
{ "blob_id": "4eac468db955ca5ef5d2ec6ba67bd6c7f4d865f4", "index": 2050, "step-1": "<mask token>\n", "step-2": "class TestRawJob:\n <mask token>\n", "step-3": "class TestRawJob:\n\n def __init__(self, parsedRow):\n values = [string.strip().lower() for string in parsedRow]\n keys = ['Id', 'T...
[ 0, 1, 2, 3 ]
print('\n') # Первый вариант def fn1(): print("One") def fn2(): print("Two") def fn3(): print("Three") fndict = {"A": fn1, "B": fn2, "C": fn3} keynames = ["A", "B", "C"] fndict[keynames[1]]() fndict['C']() # Второй вариант def add(one,two): c = one+two print(c) print(type(c)) def sub(one,two...
normal
{ "blob_id": "dc226a646af32d052c6d51832b95a340d6986e08", "index": 489, "step-1": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')\n\n\ndef fn3():\n print('Three')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> class TextColors: BUY = '\x1b[92m' WARNING = '\x1b[93m' SELL_LOSS = '\x1b[91m' SELL_PROFIT = '\x1b[32m' DIM = '\x1b[2m\x1b[35m' DEFAULT = '\x1b[39m' YELLOW = '\x1b[33m' TURQUOISE = '\x1b[36m' UNDERLINE = '\x1b[4m' END = '\x1b[0m' ITALICS = '\x1b...
flexible
{ "blob_id": "77f94ecd205ae9f240f25d959a6d5cd9cf844d86", "index": 844, "step-1": "<mask token>\n\n\nclass TextColors:\n BUY = '\\x1b[92m'\n WARNING = '\\x1b[93m'\n SELL_LOSS = '\\x1b[91m'\n SELL_PROFIT = '\\x1b[32m'\n DIM = '\\x1b[2m\\x1b[35m'\n DEFAULT = '\\x1b[39m'\n YELLOW = '\\x1b[33m'\n ...
[ 5, 7, 8, 9, 10 ]
# Global version information __version__ = "0.6.1"
normal
{ "blob_id": "8aeb7786984f27fabdcaffa54f52eb868c277fdb", "index": 7707, "step-1": "<mask token>\n", "step-2": "__version__ = '0.6.1'\n", "step-3": "# Global version information\n__version__ = \"0.6.1\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: import DMP except ImportError: sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) <|reserved_special_token_0|> if __name__ == '__main__': file_dict = {KEY_TOTAL: SAVE_FILE_TOTAL, KEY_TRAIN: SAVE_F...
flexible
{ "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 -*- serviceType = "server" serviceDesc = _({"en": "Icecream Daemon", "tr": "Icecream Servisi"}) from comar.service import * @synchronized def start(): startService(command="/opt/icecream/sbin/iceccd", args="-d -m 5 > /dev/null", pidfile="/var/...
normal
{ "blob_id": "e3603d90bd5aa5de40baa27b62acf6f71eff9f6c", "index": 6827, "step-1": "<mask token>\n\n\n@synchronized\ndef start():\n startService(command='/opt/icecream/sbin/iceccd', args=\n '-d -m 5 > /dev/null', pidfile='/var/run/iceccd.pid', donotify=True)\n\n\n<mask token>\n\n\ndef status():\n retu...
[ 2, 3, 4, 5, 6 ]
from selenium import selenium class SharedSeleniumExecutionContext: host =None port =None browserStartCommand =None url = None seleniumInstance=None isInitialized=False lastVisitedLocation=None optionBeingHandled=None itemToDrag=None def __init__(self, host, port, brow...
normal
{ "blob_id": "e75fb023e2e3d3fd258a316a6827b2601c9f4b2d", "index": 3762, "step-1": "<mask token>\n\n\nclass SharedSeleniumExecutionContext:\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 to...
[ 9, 12, 13, 14, 16 ]
<|reserved_special_token_0|> def click(valor): global i screen.insert(i, valor) i += 1 <|reserved_special_token_0|> def hacer_operacion(): ecuacion = screen.get() try: result = eval(ecuacion) screen.delete(0, END) screen.insert(0, result) i = 0 except: ...
flexible
{ "blob_id": "1a42892095d820f1e91ba5e7f2804b5a21e39676", "index": 2107, "step-1": "<mask token>\n\n\ndef click(valor):\n global i\n screen.insert(i, valor)\n i += 1\n\n\n<mask token>\n\n\ndef hacer_operacion():\n ecuacion = screen.get()\n try:\n result = eval(ecuacion)\n screen.delete...
[ 2, 4, 5, 6, 7 ]
""" Neuraxle Tensorflow V1 Utility classes ========================================= Neuraxle utility classes for tensorflow v1. .. Copyright 2019, Neuraxio Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obta...
normal
{ "blob_id": "76a22408bb423d9a5bc5bc007decdbc7c6cc98f7", "index": 8397, "step-1": "<mask token>\n\n\nclass TensorflowV1ModelStep(BaseTensorflowModelStep):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, create_graph, create_loss, create_optimizer,\n create_feed_dict=None, da...
[ 13, 15, 16, 19, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mask(image): green_frame = image[50:350, 50:350] cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0) hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV) lower_skin = np.array([0, 20, 70], dtype=np.uint8...
flexible
{ "blob_id": "2286aa1581ca7d6282b35847505a904980da275e", "index": 8659, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mask(image):\n green_frame = image[50:350, 50:350]\n cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0)\n hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = []...
flexible
{ "blob_id": "6bc400896c004f0fdddbbd3dd73ef9aaa19eb4db", "index": 1053, "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 = []\n operat...
[ 0, 1, 2, 3, 4 ]
""" bets.models Models relating to bets placed """ import datetime from mongoengine import * from decimal import Decimal from app.groups.models import Group from app.users.models import User from app.matches.models import Match from app.project.config import CURRENCIES class GroupMatch(Document): """Associate ea...
normal
{ "blob_id": "0e8a11c5b5a95929c533597d79ee4f3d037c13e0", "index": 4961, "step-1": "<mask token>\n\n\nclass Bet(Document):\n \"\"\"Bet that a user has placed\"\"\"\n OUTCOME = (-1, 'Team 2 wins'), (0, 'Draw'), (1, 'Team 1 wins')\n group_match = ReferenceField(GroupMatch)\n user = ReferenceField(User)\n...
[ 9, 10, 15, 16, 17 ]
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np x = 2 y = 3 add_op = tf.add(x, y) mul_op = tf.multiply(x, y) output_1 = tf.multiply(x, add_op) output_2 = tf.pow(add_op, mul_op) with tf.Session() as sess: output_1, output_2 = sess.run([output_1, output_2]) print(output_1...
normal
{ "blob_id": "da2e388c64bbf65bcef7d09d7596c2869f51524a", "index": 4025, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n output_1, output_2 = sess.run([output_1, output_2])\nprint(output_1, output_2)\n", "step-3": "<mask token>\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n<ma...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MainPage(PageObject): <|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|> def __init__(self, webdri...
flexible
{ "blob_id": "c6cf085330f47ffb139c5acc91d91e9758f5396a", "index": 274, "step-1": "<mask token>\n\n\nclass MainPage(PageObject):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, webdriver, root_uri=None):\n ...
[ 6, 7, 10, 11, 12 ]
import re from xml.etree import ElementTree def get_namespace(xml_path): with open(xml_path) as f: namespaces = re.findall(r"xmlns:(.*?)=\"(.*?)\"", f.read()) return dict(namespaces) def get_comic_data(item, ns): return { "title": item.find("title").text, "post_date": item.find("...
normal
{ "blob_id": "86a15bb2e4d59fb5c8763fa2de31164beb327685", "index": 7928, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_namespace(xml_path):\n with open(xml_path) as f:\n namespaces = re.findall('xmlns:(.*?)=\\\\\"(.*?)\\\\\"', f.read())\n return dict(namespaces)\n\n\ndef get_comic...
[ 0, 2, 3, 4, 5 ]
correction_list = {} correction_list["Legend of Zelda, The - Majora's Mask"] = "The Legend of Zelda - Majora's Mask" correction_list["Legend of Zelda, The - Ocarina of Time"] = "The Legend of Zelda - Ocarina of Time" correction_list["Doubutsu no Mori"] = "Animal Forest" correction_list["Bomberman 64 - The Second Attac...
normal
{ "blob_id": "c4dcb94b7d6e45b875dccde752d3621e491f1076", "index": 6382, "step-1": "<mask token>\n", "step-2": "correction_list = {}\ncorrection_list[\"Legend of Zelda, The - Majora's Mask\"\n ] = \"The Legend of Zelda - Majora's Mask\"\ncorrection_list['Legend of Zelda, The - Ocarina of Time'\n ] = 'The L...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def main(): args = parser.parse_args() quiet = False if args.quiet: quiet = True tempo2 = True ptoa = False if args.print_toas: ptoa = True if not quiet: print('Loading the archive files for DM estimation') archives = [] for file...
flexible
{ "blob_id": "e464b465c4bc90c250c0ea02c17b7398d975964b", "index": 1163, "step-1": "<mask token>\n\n\ndef main():\n args = parser.parse_args()\n quiet = False\n if args.quiet:\n quiet = True\n tempo2 = True\n ptoa = False\n if args.print_toas:\n ptoa = True\n if not quiet:\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def subtract_moving_average(df, n=50): k = n bgnorm = pd.DataFrame(np.zeros((len(df), len(df.columns)))) for j in range(0, len(df)): for i in range(0, len(df.columns)): indices = range(max(1, i - k), min(i + k, len(df.columns))) avg = df.iloc[j,...
flexible
{ "blob_id": "54d714d1e4d52911bcadf3800e7afcc2c9a615a5", "index": 6743, "step-1": "<mask token>\n\n\ndef subtract_moving_average(df, n=50):\n k = n\n bgnorm = pd.DataFrame(np.zeros((len(df), len(df.columns))))\n for j in range(0, len(df)):\n for i in range(0, len(df.columns)):\n indices...
[ 2, 4, 5, 6, 7 ]
from django.conf.urls import url from price_App import views from rest_framework.urlpatterns import format_suffix_patterns urlpatterns = [ url(r'^api/price/(?P<pk>[0-9]+)$', views.product_price), url(r'^api/price_history/(?P<pk>[0-9]+)$', views.product_history),] urlpatterns = format_suffix...
normal
{ "blob_id": "9816a8265bcdb8c099f599efbe1cfe1a554e71f5", "index": 8396, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^api/price/(?P<pk>[0-9]+)$', views.product_price), url(\n '^api/price_history/(?P<pk>[0-9]+)$', views.product_history)]\nurlpatterns = format_suffix_patterns(urlpat...
[ 0, 1, 2, 3 ]
class SensorReadings: def __init__(self, sense_hat): self.temprerature_humidity_sensor = sense_hat.get_temperature_from_humidity() self.temperature_pressure_sensor = sense_hat.get_temperature_from_pressure() self.humidity = sense_hat.get_humidity() self.pressure = sense_hat.get_pressure() def prin...
normal
{ "blob_id": "f680503488a2780624b28e49b045aad75506d8c5", "index": 3248, "step-1": "class SensorReadings:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class SensorReadings:\n <mask token>\n\n def printReadings(self):\n print('temperature from humidity sensor...
[ 1, 2, 3, 4, 6 ]
<|reserved_special_token_0|> @attr.s class GPTools: <|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 parse(self): if self.input_file is None: ...
flexible
{ "blob_id": "c6821cb8dd6f8d74ca20c03f87dae321eb869c32", "index": 2454, "step-1": "<mask token>\n\n\n@attr.s\nclass GPTools:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self):\n if self.input_file is None:\n self.in...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(save_rate): rdataname = readpath + dataname rlabelname = readpath + labelname wdataname = writepath + dataname wlabelname = writepath + labelname ordata = [] all_user = set() all_time = set() ...
flexible
{ "blob_id": "4bd6a7c7fc6a788b2cb010f6513872bd3e0d396c", "index": 5011, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(save_rate):\n rdataname = readpath + dataname\n rlabelname = readpath + labelname\n wdataname = writepath + dataname\n wlabelname = writepath + labelname\n orda...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getEC2FilteredRegionalInstanceInfo(region): ec2RegionalClient = boto3.client('ec2', region_name=region) paginator = ec2RegionalClient.get_paginator('describe_instances') page_iterator = paginator.paginate() allEC2Instances = [] for result in page_iterator: ...
flexible
{ "blob_id": "d5f1601d11eb54e6c3dafab0137ec8f2358bb568", "index": 4101, "step-1": "<mask token>\n\n\ndef getEC2FilteredRegionalInstanceInfo(region):\n ec2RegionalClient = boto3.client('ec2', region_name=region)\n paginator = ec2RegionalClient.get_paginator('describe_instances')\n page_iterator = paginato...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class DeebotVacuum(DeebotEntity, StateVacuumEntity): <|reserved_special_token_0|> def __init__(self, vacuum_bot: VacuumBot): """Initialize the Deebot Vacuum.""" device_info = vacuum_bot.device_info if device_info.nick is not None: name: str = d...
flexible
{ "blob_id": "1ab690b0f9c34b1886320e1dfe8b54a5ec6cd4d1", "index": 8712, "step-1": "<mask token>\n\n\nclass DeebotVacuum(DeebotEntity, StateVacuumEntity):\n <mask token>\n\n def __init__(self, vacuum_bot: VacuumBot):\n \"\"\"Initialize the Deebot Vacuum.\"\"\"\n device_info = vacuum_bot.device_...
[ 5, 6, 9, 10, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> '''import pyttsx3 #engine = pyttsx3.init() #Conficuração das vozes #voices = engine.getProperty('voices') #engine.setProperty('voice', voices[2].id) engine=pyttsx3.init() voices=engine.getProperty('voices') engine.setProperty('voice',voices[3].id) #Falar...
flexible
{ "blob_id": "d9bf58dc76d4e8d7146fac3bb2bdfb538ebf78a5", "index": 7102, "step-1": "<mask token>\n", "step-2": "'''import pyttsx3\n\n#engine = pyttsx3.init()\n\n#Conficuração das vozes\n#voices = engine.getProperty('voices')\n#engine.setProperty('voice', voices[2].id)\n\nengine=pyttsx3.init()\n\nvoices=engine.ge...
[ 0, 1 ]
<|reserved_special_token_0|> class UserinfoTest(TestInterfaceCase): def setUp(self): login = req.reqData(req) self.infoma = {} self.response = '' self.infoma['id'] = x['testinfo'][0]['id'] self.infoma['module'] = x['testinfo'][0]['module'] self.infoma['intr'] = x['...
flexible
{ "blob_id": "aea196566bbbe9d37bf03b9b17a4062659a27bb6", "index": 1446, "step-1": "<mask token>\n\n\nclass UserinfoTest(TestInterfaceCase):\n\n def setUp(self):\n login = req.reqData(req)\n self.infoma = {}\n self.response = ''\n self.infoma['id'] = x['testinfo'][0]['id']\n s...
[ 10, 11, 13, 15, 17 ]
<|reserved_special_token_0|> class Source(object): <|reserved_special_token_0|> def __init__(self, handler): self.handler = handler def get_activities(self, user_id=None, group_id=None, app_id=None, activity_id=None, start_index=0, count=0): """Return a total count and list of Ac...
flexible
{ "blob_id": "29428e9ca4373c9f19d1412046ebe4fc3b1c48e3", "index": 6300, "step-1": "<mask token>\n\n\nclass Source(object):\n <mask token>\n\n def __init__(self, handler):\n self.handler = handler\n\n def get_activities(self, user_id=None, group_id=None, app_id=None,\n activity_id=None, star...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @with_app(buildername='html', srcdir= 'doc_test/doc_role_need_max_title_length_unlimited') def test_max_title_length_unlimited(app, status, warning): os.environ['MAX_TITLE_LENGTH'] = '-1' app.build() html = Path(...
flexible
{ "blob_id": "3346ca7cdcfe9d9627bfe08be2b282897b3c319c", "index": 6943, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@with_app(buildername='html', srcdir=\n 'doc_test/doc_role_need_max_title_length_unlimited')\ndef test_max_title_length_unlimited(app, status, warning):\n os.environ['MAX_TITLE_...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Wed May 15 17:05:30 2019 @author: qinzhen """ import numpy as np # ============================================================================= # Q5 # ============================================================================= #### Part 1 计算MLE File = "ner_proc.counts" q2 = ...
normal
{ "blob_id": "9683c7df01eda0d97615fb3e8f9496ecc95d1d32", "index": 8494, "step-1": "<mask token>\n\n\ndef Viterbi(sentence, q, e):\n K = list(Count_y.keys())\n Pi = {}\n bp = {}\n n = len(sentence)\n for i in range(n + 1):\n Pi[i - 1] = {}\n bp[i - 1] = {}\n Pi[-1]['*', '*'] = 1\n ...
[ 1, 2, 3, 4, 5 ]
from typing import List import glm import pxng import OpenGL.GL as gl class VertexArrayObject: def __init__(self, primitive): self._primitive = primitive self._buffers: List[pxng.BufferObject] = [] self._indices = pxng.BufferObject(data_type=self.index_data_type, ...
normal
{ "blob_id": "7530c2c85f83d1714840ba97c1ec702f063658c5", "index": 379, "step-1": "<mask token>\n\n\nclass VertexArrayObject:\n\n def __init__(self, primitive):\n self._primitive = primitive\n self._buffers: List[pxng.BufferObject] = []\n self._indices = pxng.BufferObject(data_type=self.ind...
[ 9, 11, 12, 13, 17 ]
from flask import Flask, render_template, url_for, request, jsonify from model.model import load_site_config, load_hero_mapping, load_pretrained_model, valid_input, data_to_feature from model.model import combine_list, hero_ids from itertools import product import numpy as np app = Flask(__name__,static_folder='./stat...
normal
{ "blob_id": "06605bbd91c62a02a66770ca3f37a9d2d1401ccb", "index": 9929, "step-1": "<mask token>\n\n\n@app.route('/')\ndef demo():\n return render_template('home.html', hero_mapping=hero_mapping)\n\n\n@app.route('/predict', methods=['POST'])\ndef predict():\n valid, res = valid_input(list(request.json))\n ...
[ 3, 4, 5, 6, 7 ]
import requests import json class Parser: init_url = r'https://www.joom.com/tokens/init' products_url = r'https://api.joom.com/1.1/search/products?language=ru-RU&currency=RUB' def __init__(self, links_list): self.links = links_list self.product_info_dict = {} access_token = json.l...
normal
{ "blob_id": "00c6899b9d49cbbd0f1980eada77ad91562211a0", "index": 4471, "step-1": "<mask token>\n\n\nclass Parser:\n <mask token>\n <mask token>\n <mask token>\n\n def get_description(self, id_str, headers):\n link = ('https://api.joom.com/1.1/products/' + id_str +\n '?language=ru-RU...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import sys import random def apply(mine, target, diff): if mine == [1, 1, 1, 1] or target == [1, 1, 1, 1]: return -1 if diff < 0: for i in range(0, 4): if i - diff < 4: mine[i] = mine[i - diff] else: mine[i] = 0 elif diff > 0: for i in range(3, -1, -1): if i - diff > -1...
normal
{ "blob_id": "44d1412d48886eb9126a895d61004e6ccbd4850b", "index": 7636, "step-1": "#!/usr/bin/env python\nimport sys\nimport random\n\ndef apply(mine, target, diff):\n\tif mine == [1, 1, 1, 1] or target == [1, 1, 1, 1]:\n\t\treturn -1\n\n\tif diff < 0:\n\t\tfor i in range(0, 4):\n\t\t\tif i - diff < 4:\n\t\t\t\tm...
[ 0 ]
<|reserved_special_token_0|> def folders_with_documents(pat_ids, main_dir_name, doc_prog_folder): str_pat_ids = [str(pat_id) for pat_id in pat_ids] str_pat_folder_names = [os.path.join(main_dir_name, os.path.join( str_pat_id, doc_prog_folder)) for str_pat_id in str_pat_ids] for pid, folder in zip(...
flexible
{ "blob_id": "e38ae7f91deed1be00e60b7516210ea1feefe23e", "index": 285, "step-1": "<mask token>\n\n\ndef folders_with_documents(pat_ids, main_dir_name, doc_prog_folder):\n str_pat_ids = [str(pat_id) for pat_id in pat_ids]\n str_pat_folder_names = [os.path.join(main_dir_name, os.path.join(\n str_pat_id...
[ 4, 5, 6, 7, 8 ]
from django.shortcuts import render import requests from bs4 import BeautifulSoup import json from rest_framework.response import Response from rest_framework.decorators import api_view,authentication_classes,permission_classes from rest_framework import status from django.contrib.staticfiles.storage import staticfiles...
normal
{ "blob_id": "ed80f5f898548ca012779543051ccff5b34e4fcc", "index": 730, "step-1": "<mask token>\n\n\ndef getdata(url):\n data = requests.get(url)\n return data.text\n\n\ndef get_json():\n file_path = staticfiles_storage.path('coordinates.json')\n with open(file_path, 'r') as f:\n data = json.loa...
[ 2, 3, 4, 5, 6 ]
from django.contrib.auth.forms import UserChangeForm from django.contrib.auth.models import User from django import forms class editForm(forms.ModelForm): username = forms.CharField(max_length=100, widget= forms.TextInput(attrs={'class': 'form-control'})) first_name = forms.CharField(max_length=100, widget= fo...
normal
{ "blob_id": "ae8add3adc336c9404cd2aeab4aff81c94c8884e", "index": 7174, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass editForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'username', 'firs...
[ 0, 1, 2, 3, 4 ]
import threading import time # import numpy as np import pickle from utils.ret_utils import error_info from nodule_class.isnodule import LungIsncls from preprocessing.location import lobe_locate_gmm from detection.lung_detection import LungDetection from func_timeout import FunctionTimedOut from func_timeout import fu...
normal
{ "blob_id": "8035f195cd01dc50691cd93ea91a6377b1d83f24", "index": 1166, "step-1": "<mask token>\n\n\nclass GpuThread(threading.Thread):\n <mask token>\n\n def run(self):\n i = 0\n while True:\n result_dict = self.que_det.get(block=True)\n try:\n print(time....
[ 2, 3, 4, 5, 6 ]
#Homework 09 #Raymond Guevara #018504731 #Algorithm Workbench #Question 1 print("Question 1") height = int(input("Please enter your height: ")) print() #Question 2 print("Question 2") color = input("please enter your favorite color: ") print() #Question 3 print("Question 3") a = -8/3 #Solved for variable "a" usin...
normal
{ "blob_id": "82c426836fee0560e917848084af4ca124e74dff", "index": 7043, "step-1": "<mask token>\n", "step-2": "print('Question 1')\n<mask token>\nprint()\nprint('Question 2')\n<mask token>\nprint()\nprint('Question 3')\n<mask token>\nprint('%.2f' % b)\n<mask token>\nprint('%.2f' % a)\n<mask token>\nprint('%.2f'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class addUserForm(forms.Form): <|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_...
flexible
{ "blob_id": "39b6ca21b8d4856e2b2edfcbd00b75fbce6dfff7", "index": 1407, "step-1": "<mask token>\n\n\nclass addUserForm(forms.Form):\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 addUserForm(for...
[ 1, 2, 3, 4, 5 ]
import csv, requests from bs4 import BeautifulSoup items = [] # chooseKey, count, grade, keyType, mainCategory, mainKey, # name, pricePerOne, subCategory, subKey, totalTradeCount, # mainLabel, subLabel, description mpItems = [] # chooseKey, count, grade, keyType, mainCategory, mainKey, ...
normal
{ "blob_id": "47ad08bb153801f592d90c48d62338d0f7703899", "index": 2788, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef openCsv():\n \"\"\"Open csv file.\"\"\"\n csvFile = 'BDO_app/modules/priceCheck/itemID.csv'\n return csvFile\n\n\ndef importAll():\n \"\"\"Import all the items from cs...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class TableGenerator: """Generates table from data.""" def __init__(self, f_cell, dim_rows, dim_cols, headerRowNames, title='', color_scheme=None, table_postprocessor=None, vertical_border=1, table_variants=None, default_color_thresholds=None, layered_head...
flexible
{ "blob_id": "b3cb94a44f64091714650efb81c4cad27b211cef", "index": 8804, "step-1": "<mask token>\n\n\nclass TableGenerator:\n \"\"\"Generates table from data.\"\"\"\n\n def __init__(self, f_cell, dim_rows, dim_cols, headerRowNames, title='',\n color_scheme=None, table_postprocessor=None, vertical_bord...
[ 22, 30, 37, 44, 48 ]
<|reserved_special_token_0|> class SubstrateLayer(Layer): <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self): return '{} (substrate)'.format(self.name) class TerminatorLayer(Layer): """A special case of ``Layer``; represents the layer upon which the simulated wave ...
flexible
{ "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 pytesseract from PIL import Image import tensorflow as tf from keras.models import load_model from tensorflow import Graph import os import json import cv2 import numpy as np global class_graph def classify(img, c_model): #global class_graph """ classifies images in a given folder using the 'model...
normal
{ "blob_id": "c7d51f6448400af5630bdc0c29493320af88288e", "index": 7424, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef classify(img, c_model):\n \"\"\" classifies images in a given folder using the 'model'\"\"\"\n im_size = 128\n img = cv2.resize(img, (im_size, im_size))\n img = img.as...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> providers = {'provider-1': {'name': 'provider-1', 'roles': ['licensor', 'producer'], 'description': 'This is a full description of the provider', 'url': 'https://www.provider.com'}, 'provider-2': {'name': 'provider-2', 'roles': ['licensor'], '...
flexible
{ "blob_id": "7801676df91a7ded6f123113acc62f3955dfe6cb", "index": 7113, "step-1": "<mask token>\n", "step-2": "providers = {'provider-1': {'name': 'provider-1', 'roles': ['licensor',\n 'producer'], 'description':\n 'This is a full description of the provider', 'url':\n 'https://www.provider.com'}, 'pro...
[ 0, 1, 2 ]
#!/usr/bin/env python # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import subprocess import sys import os def main(): parser = argparse.ArgumentParser( description='Create the s...
normal
{ "blob_id": "d5c6582547df540ffc9c73d10a3405ec97487bba", "index": 4513, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(description=\n 'Create the symbol specifying the location of test fixtures.')\n parser.add_argument('--fixtures_location_fi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @core.route('/post') @core.route('/categorie') @core.route('/tag') def returnToHome(): return redirect(url_for('home')) <|reserved_special_token_1|> from flask import render_template, url_for, escape, redirect, abort from...
flexible
{ "blob_id": "c27d6279d1ea84bab3c0abd4ca9a08de202219da", "index": 1748, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@core.route('/post')\n@core.route('/categorie')\n@core.route('/tag')\ndef returnToHome():\n return redirect(url_for('home'))\n", "step-3": "from flask import render_template, url...
[ 0, 1, 2 ]
#!/usr/bin/env python from django.http import HttpResponse try: import simplejson as json except ImportError: import json from api import * def index(request): data = parse_signed_request(request) if not data.has_key('user_id'): request_url = oauth_request_url() ...
normal
{ "blob_id": "17f76c2b53b36c81cea7f7616859f5257790cd73", "index": 9298, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n data = parse_signed_request(request)\n if not data.has_key('user_id'):\n request_url = oauth_request_url()\n return HttpResponse(\"<script>to...
[ 0, 1, 2, 3, 4 ]
from app.View.view import View class GameController: instance = None @staticmethod def get_instance(): if GameController.instance is None: GameController() return GameController.instance def __init__(self): if GameController.instance is not None: raise...
normal
{ "blob_id": "d9b405d5159a153fb8d2f1991ceb3dc47f98bcbc", "index": 9192, "step-1": "<mask token>\n\n\nclass GameController:\n <mask token>\n\n @staticmethod\n def get_instance():\n if GameController.instance is None:\n GameController()\n return GameController.instance\n <mask t...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> def upgrade(): op.drop_column('lis_result_sourcedid', 'tool_consumer_info_product_family_code') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def upgrade(): op.drop_column('lis_result_sourcedid', 'tool_consumer_info_p...
flexible
{ "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|> pr.enable() <|reserved_special_token_0|> for k in range(all_models[1,].size - 1): colstr = str(0.75 - k / 2 / all_models[1,].size) plt.plot(all_models[:, k], all_models[:, 0], '-', linewidth=1, color=colstr ) ax1.i...
flexible
{ "blob_id": "cfe5d013c968afdbf1fc80e3c8c3233a3678450b", "index": 9848, "step-1": "<mask token>\n", "step-2": "<mask token>\npr.enable()\n<mask token>\nfor k in range(all_models[1,].size - 1):\n colstr = str(0.75 - k / 2 / all_models[1,].size)\n plt.plot(all_models[:, k], all_models[:, 0], '-', linewidth=...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sns.set(style='whitegrid', color_codes=True) sns.set(font_scale=1) <|reserved_special_token_0|> wines.columns wines.drop(columns='Unnamed: 0', inplace=True) wines.dropna(axis='index', subset=['price'], inplace=True) wines.drop_dup...
flexible
{ "blob_id": "79e8ed64058dda6c8d7bacc08727bc978088ad2d", "index": 4963, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.set(style='whitegrid', color_codes=True)\nsns.set(font_scale=1)\n<mask token>\nwines.columns\nwines.drop(columns='Unnamed: 0', inplace=True)\nwines.dropna(axis='index', subset=['price...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def wifiConnect(): wlan = WLAN(mode=WLAN.STA) pycom.heartbeat(False) wlan.connect(ssid='telenet-4D87F74', auth=(WLAN.WPA2, 'x2UcakjTsryz')) while not wlan.isconnected(): time.sleep(1) print('WiFi ...
flexible
{ "blob_id": "099396a75060ad0388f5a852c4c3cb148febd8a3", "index": 4048, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef wifiConnect():\n wlan = WLAN(mode=WLAN.STA)\n pycom.heartbeat(False)\n wlan.connect(ssid='telenet-4D87F74', auth=(WLAN.WPA2, 'x2UcakjTsryz'))\n while not wlan.isconnec...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __all__ = ['loading'] <|reserved_special_token_0|> <|reserved_special_token_1|> __all__ = ['loading'] from . import loading <|reserved_special_token_1|> __all__ = ["loading"] from . import loading
flexible
{ "blob_id": "f633496f1a7cd562fd41d697a2e26831ceaef479", "index": 8047, "step-1": "<mask token>\n", "step-2": "__all__ = ['loading']\n<mask token>\n", "step-3": "__all__ = ['loading']\nfrom . import loading\n", "step-4": "__all__ = [\"loading\"]\n\nfrom . import loading\n", "step-5": null, "step-ids": [...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def check_date(): global results global date_post current_datetime = datetime.datetime.now() current_date = current_datetime.date() if date_post is not None: if date_post < current_date: results = None date_post = None else: ...
flexible
{ "blob_id": "c4720eb5a42267970d3a98517dce7857c0ba8450", "index": 8938, "step-1": "<mask token>\n\n\ndef check_date():\n global results\n global date_post\n current_datetime = datetime.datetime.now()\n current_date = current_datetime.date()\n if date_post is not None:\n if date_post < curren...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> @app.route('/') def index(): return render_template('index.html') @app.route('/process', methods=['POST']) def process(): if len(request.form['email']) < 1: flash('Email cannot be blank!') return redirect('/') elif not EMAIL_REGEX.match(request.form['email'])...
flexible
{ "blob_id": "187cf160b520001b6fe3a8d343391de1c04b3acd", "index": 1754, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/process', methods=['POST'])\ndef process():\n if len(request.form['email']) < 1:\n flash('Email cannot be blank!'...
[ 4, 5, 6, 7, 8 ]
<|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": "a3239bbe4f85c9f0e1bc845245f024c3feb64923", "index": 7476, "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 = [('info', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def readContinuous(): while True: readBNO() time.sleep(0.1) <|reserved_special_token_0|> def get_heading(): return compass_heading <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def readBNO(): global compass_he...
flexible
{ "blob_id": "63a7225abc511b239a69f625b12c1458c75b4090", "index": 8904, "step-1": "<mask token>\n\n\ndef readContinuous():\n while True:\n readBNO()\n time.sleep(0.1)\n\n\n<mask token>\n\n\ndef get_heading():\n return compass_heading\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef rea...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> class NumpyRecipe(CompiledComponentsPythonRecipe): <|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 build_compiled_components(self,...
flexible
{ "blob_id": "610610e7e49fc98927a4894efe62686e26e0cb83", "index": 3502, "step-1": "<mask token>\n\n\nclass NumpyRecipe(CompiledComponentsPythonRecipe):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build_compiled_components(self, arch):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def get_markdown_result(matches): entry_fmt = '| {} | {} | {} |\n' md_text = """# YARA - Scan results | Rule Name | Function | Strings offsets | |-----------|----------|-----------------| """ for m in matches: rule = m['rule'] func = '-' if 'funcs' in ...
flexible
{ "blob_id": "56d4532b633242f34f7a6ed86a35290836861f67", "index": 4201, "step-1": "<mask token>\n\n\ndef get_markdown_result(matches):\n entry_fmt = '| {} | {} | {} |\\n'\n md_text = \"\"\"# YARA - Scan results\n\n| Rule Name | Function | Strings offsets |\n|-----------|----------|-----------------|\n\"\"\"...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': cases = sys.stdin.readline() for i in range(int(cases)): sys.stdin.readline() lineas, columnas = sys.stdin.readline().strip().split(' ') lineas = int(lineas) colum...
flexible
{ "blob_id": "22909e41e4f9ad0280c22ec11ecfbccff87efae1", "index": 1402, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n cases = sys.stdin.readline()\n for i in range(int(cases)):\n sys.stdin.readline()\n lineas, columnas = sys.stdin.readline().strip().split(...
[ 0, 1, 2, 3 ]
import numpy as np import tensorflow as tf def mfcc(data): pass def cut_frames(data): pass
normal
{ "blob_id": "8411acf6b27425357d212f5e220314daa019e023", "index": 9669, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cut_frames(data):\n pass\n", "step-3": "<mask token>\n\n\ndef mfcc(data):\n pass\n\n\ndef cut_frames(data):\n pass\n", "step-4": "import numpy as np\nimport tensorflo...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from basket import views urlpatterns = [ url(r'^$', views.view_basket, name='basket'), url(r'^add/(?P<product_pk>\d+)$', views.add_to_basket, name='add_to_basket'), url(r'^remove/(?P<basketitem_pk>\d+)$', views.remove_from_basket, name='remove_from_basket'), ]
normal
{ "blob_id": "19d5e9db142237d1cb2276ccaf083ca4a96109fc", "index": 3670, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.view_basket, name='basket'), url(\n '^add/(?P<product_pk>\\\\d+)$', views.add_to_basket, name='add_to_basket'\n ), url('^remove/(?P<basketitem_pk>\\\\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.asyncio @pytest.mark.core async def test_async_executor(executor): def func(): pass result = await executor.run(func) assert result is None def func(): return 1 result = await e...
flexible
{ "blob_id": "67b483d9d002cc66dd368cf53fdc49ebb7b4f4d4", "index": 9556, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.asyncio\n@pytest.mark.core\nasync def test_async_executor(executor):\n\n def func():\n pass\n result = await executor.run(func)\n assert result is None\n\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def encode_video_file(src_filname, dst_filename, file_type): logger.info('Source file: %s, Destination file: %s, File Type: %s', src_filname, dst_filename, file_type) try: cmd = codecs[file_type] except IndexError: raise WrongVideoTypeError('Wrong video...
flexible
{ "blob_id": "163475bbe8a5b6eb161e2bb7e9b9a9a3ea0879d2", "index": 8138, "step-1": "<mask token>\n\n\ndef encode_video_file(src_filname, dst_filename, file_type):\n logger.info('Source file: %s, Destination file: %s, File Type: %s',\n src_filname, dst_filename, file_type)\n try:\n cmd = codecs[...
[ 1, 2, 3, 4, 5 ]
# coding=UTF-8 from unittest import TestCase from fwk.util.rect import Rect class RectSizeTest(TestCase): def test_sizes_from_coords(self): rect = Rect(top=33,bottom=22,left=10,right=20) self.assertEqual(rect.width,10) self.assertEqual(rect.height,11) def test_sizes_from_sizes(self): rect = Rect(top=23,hei...
normal
{ "blob_id": "ff65e92699c6c9379ac40397b3318c3f6bf7d49a", "index": 3720, "step-1": "<mask token>\n\n\nclass RectInsetTest(TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass RectCloneAndMagic(TestCase):\n\n def test_clone_and_compare(self):\n rect1 = Rect(left=10...
[ 4, 15, 19, 20, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fonkString(text, string): if string in text: print('TRUE') print(text.index(string), '. sirada ilk', string, 'bulundu') print(text.count(string), 'tane', string, 'var') liste = [] ...
flexible
{ "blob_id": "0d3cc85cd18ee197b24c8b01b71afe82110bfad2", "index": 3487, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fonkString(text, string):\n if string in text:\n print('TRUE')\n print(text.index(string), '. sirada ilk', string, 'bulundu')\n print(text.count(string), '...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> mdfile.write('# Tables with references\n') for i, row in df.iterrows(): t = '\n```\n{% raw %}\n' + str(row['table']) + '\n{% endraw %}\n```\n' r = '\n```\n{% raw %}\n' + str(row['refs']) + '\n{% endraw %}\n```\n' mdfil...
flexible
{ "blob_id": "8de6877f040a7234da73b55c8b7fdefe20bc0d6e", "index": 9538, "step-1": "<mask token>\n", "step-2": "<mask token>\nmdfile.write('# Tables with references\\n')\nfor i, row in df.iterrows():\n t = '\\n```\\n{% raw %}\\n' + str(row['table']) + '\\n{% endraw %}\\n```\\n'\n r = '\\n```\\n{% raw %}\\n...
[ 0, 1, 2, 3 ]
from typing import List from pydantic import BaseModel class BinBase(BaseModel): name: str = None title: str = None class BinCreate(BinBase): owner_id: int password: str class Bin(BinBase): id: int # TODO: token? class Config(): orm_mode = True class UserBase(BaseModel): ...
normal
{ "blob_id": "1c0f194bbdc6f7e3e4feb114e521aa958f11e83e", "index": 3263, "step-1": "<mask token>\n\n\nclass UserCreate(UserBase):\n password: str\n\n\nclass User(UserBase):\n id: int\n\n\n class Config:\n orm_mode = True\n", "step-2": "<mask token>\n\n\nclass BinCreate(BinBase):\n owner_id: in...
[ 2, 5, 6, 7, 8 ]
class person(object): <|reserved_special_token_0|> def __init__(self, name, age): self.name = name self.age = age @classmethod def getpopulation(cls): return cls.population @staticmethod def isadult(age=17): return age >= 18 def display(self): prin...
flexible
{ "blob_id": "a21942a835f7b2ea70e9dd7b26285ea2dd411750", "index": 1205, "step-1": "class person(object):\n <mask token>\n\n def __init__(self, name, age):\n self.name = name\n self.age = age\n\n @classmethod\n def getpopulation(cls):\n return cls.population\n\n @staticmethod\n ...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> class AnyDevice(gatt.Device): <|reserved_special_token_0|> def connect_failed(self, error): super().connect_failed(error) print('[%s] Connection failed: %s' % (self.mac_address, str(error))) <|reserved_special_token_0|> <|reserved_special_token_0|> class...
flexible
{ "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 ]
from django.contrib.auth.models import User from rt.models import Movie_Suggestion, MovieDB, ActorDB, TVDB def user_present(username): if User.objects.filter(username=username).count(): return True return False #Takes in a list of MovieDB/TVDB objects #Outputs a list of sorted titles def sort_title(movies): ti...
normal
{ "blob_id": "1e84b28580b97e77394be0490f3d8db3d62a2ccb", "index": 1213, "step-1": "<mask token>\n\n\ndef sort_id(movies, titles):\n ids = []\n for i in titles:\n try:\n movie_id = MovieDB.objects.get(title=i).id\n ids.append((i, movie_id))\n except MovieDB.DoesNotExist:\n...
[ 3, 5, 6, 7, 8 ]
# Generated by Django 4.1.9 on 2023-06-29 16:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("search", "0003_auto_20230209_1441"), ] operations = [ migrations.CreateModel( name="SearchSettings", fields=[ ...
normal
{ "blob_id": "45969b346d6d5cbdef2f5d2f74270cf12024072d", "index": 3, "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 = [('search', '0003...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CitizenSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CitizenSpider(scrap...
flexible
{ "blob_id": "d307c3479e34a12971f62a765aca2ba0850d80d1", "index": 5660, "step-1": "<mask token>\n\n\nclass CitizenSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CitizenSpider(scrapy.Spider):\n <mask token...
[ 1, 3, 4, 5, 6 ]