code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> class View: <|reserved_special_token_0|> def __init__(self, pygame, master): """ Set up and initialise the view. Does not start the display. """ self._pygame = pygame self._master = master self._display = self._pygame.display self._interfac...
flexible
{ "blob_id": "2168d10a1b4796576cc7ebb6893e0dc8b58085ca", "index": 4435, "step-1": "<mask token>\n\n\nclass View:\n <mask token>\n\n def __init__(self, pygame, master):\n \"\"\" Set up and initialise the view. Does not start the display. \"\"\"\n self._pygame = pygame\n self._master = ma...
[ 2, 5, 6, 7, 8 ]
import socket import struct def parsing_ethernet_header(data): ethernet_header=struct.unpack("!6c6c2s",data) ether_dest = convert_ethernet_address(ethernet_header[0:6]) ether_src = convert_ethernet_address(ethernet_header[6:12]) ip_header="0x"+ethernet_header[12].hex() print("=========ethernet hea...
normal
{ "blob_id": "9b715fb95e89804a57ea77a98face673b57220c6", "index": 4494, "step-1": "<mask token>\n\n\ndef parsing_ethernet_header(data):\n ethernet_header = struct.unpack('!6c6c2s', data)\n ether_dest = convert_ethernet_address(ethernet_header[0:6])\n ether_src = convert_ethernet_address(ethernet_header[6...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class FoodCategory(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: db_table = 'kitchenrock_category' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FoodCategory(models.Model):...
flexible
{ "blob_id": "9bb1fc4df80d183c70d70653faa3428964b93a94", "index": 9494, "step-1": "<mask token>\n\n\nclass FoodCategory(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'kitchenrock_category'\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FoodCategory(models....
[ 1, 2, 3, 4 ]
import os import pprint import math import sys import datetime as dt from pathlib import Path import RotateCipher import ShiftCipher import TranspositionCipher def process_textfile( string_path: str, encryption_algorithm: str, algorithm_key: float, output_folderpath: str = str( ...
normal
{ "blob_id": "5dccd015a90927e8d2a9c0ea4b11b24bfd4bb65e", "index": 5690, "step-1": "<mask token>\n\n\ndef manual_test():\n dict_processedtext = process_textfile(string_path=\n 'C:\\\\Users\\\\Rives\\\\Downloads\\\\Quizzes\\\\Quiz 0 Overwrite Number 1.txt',\n encryption_algorithm='rotate', algorith...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def findKeyInFile(word, filepath): with open(filepath) as f: for line in f.readlines(): if line.count(word) > 0: return line return None <|reserved_special_token_1|> ''' check if wo...
flexible
{ "blob_id": "97fb2388777bcb459b9818495121fdf8318095ca", "index": 8881, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findKeyInFile(word, filepath):\n with open(filepath) as f:\n for line in f.readlines():\n if line.count(word) > 0:\n return line\n return No...
[ 0, 1, 2 ]
from distutils.core import setup, Extension setup(name='supermodule', version='1.0', \ ext_modules=[Extension('supermodule', ['main.c'])])
normal
{ "blob_id": "78c8f953b924f3e664570b844bf736a788e9cfb7", "index": 3607, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='supermodule', version='1.0', ext_modules=[Extension(\n 'supermodule', ['main.c'])])\n", "step-3": "from distutils.core import setup, Extension\nsetup(name='supermodule', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def optional_argument_func(arg1='', arg2=''): """ Function with two optional arguments """ print('arg1:{0}'.format(arg1)) print('arg2:{0}'.format(arg2)) <|reserved_special_token_0|> <|reserved_special_tok...
flexible
{ "blob_id": "061a78650e2abf6a9d1e4796dd349174a8df5cb8", "index": 8747, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef optional_argument_func(arg1='', arg2=''):\n \"\"\"\n Function with two optional arguments\n \"\"\"\n print('arg1:{0}'.format(arg1))\n print('arg2:{0}'.format(arg2))...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': API = management.ManagementApi('https://rmq.amqpstorm.io:15671', 'guest', 'guest', verify=True) try: result = API.aliveness_test('/') if result['status'] == 'ok': ...
flexible
{ "blob_id": "0279057b3962e4b9839a86fc2e2683ac1da11b1a", "index": 8665, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n API = management.ManagementApi('https://rmq.amqpstorm.io:15671',\n 'guest', 'guest', verify=True)\n try:\n result = API.aliveness_test('/'...
[ 0, 1, 2, 3 ]
import tensorflow as tf optimizer = tf.train.GradientDescentOptimizer(0.001).minimize(loss) _, l = sess.run([optimizer, loss], feed_dict={X:x, Y:y}) Session looks at all trainable variables that loss depends on and update them tf.Variable(initializer=None, trainable=True, collections=None, validate_shape=True, caching...
normal
{ "blob_id": "edb206a8cd5bc48e831142d5632fd7eb90abd209", "index": 72, "step-1": "import tensorflow as tf\noptimizer = tf.train.GradientDescentOptimizer(0.001).minimize(loss)\n_, l = sess.run([optimizer, loss], feed_dict={X:x, Y:y})\n\nSession looks at all trainable variables that loss depends on and update them\n...
[ 0 ]
<|reserved_special_token_0|> class Connection: def __init__(self): self.connection = pymssql.connect(server='gditsn033\\SQLPROD', database='ProdigiousDB', user='sa', password='sgrh@2016') def __enter__(self): self.cursor = self.connection.cursor() return self.cursor <...
flexible
{ "blob_id": "12dc248a95a84603065e23ce8fd33163bfcd2d3e", "index": 9295, "step-1": "<mask token>\n\n\nclass Connection:\n\n def __init__(self):\n self.connection = pymssql.connect(server='gditsn033\\\\SQLPROD',\n database='ProdigiousDB', user='sa', password='sgrh@2016')\n\n def __enter__(se...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/2/18 22:27 # @Author : name # @File : 01.requests第一血.py import requests if __name__ == "__main__": # step1:指定url url = r'https://www.sogou.com/' # step2:发起请求 reponse = requests.get(url = url) # setp3:获取响应数据 text返回的是字...
normal
{ "blob_id": "7ae6ed8797d6ee02effd04750e243c5a59840177", "index": 8444, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url = 'https://www.sogou.com/'\n reponse = requests.get(url=url)\n page_text = reponse.text\n print(page_text)\n with open('./sogou.html', 'w',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def login(): while True: name = input('请输入昵称(不能重复)') msg = 'LOGIN' + '##' + name udp_socket.sendto(msg.encode(), ADDR) data, addr = udp_socket.recvfrom(1024) if data.decode() == '0': print('昵称已存在,请重新输入') continue ...
flexible
{ "blob_id": "fd6cf903490ff4352e4721282354a68437ecb1e0", "index": 8314, "step-1": "<mask token>\n\n\ndef login():\n while True:\n name = input('请输入昵称(不能重复)')\n msg = 'LOGIN' + '##' + name\n udp_socket.sendto(msg.encode(), ADDR)\n data, addr = udp_socket.recvfrom(1024)\n if da...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_version(): ver_file = None try: ver_file, pathname, description = imp.find_module('__version__', [ 'cmakelint']) vermod = imp.load_module('__version__', ver_file, pathname, description...
flexible
{ "blob_id": "b3d9013ab6facb8dd9361e2a0715a8ed0cdfeaba", "index": 342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_version():\n ver_file = None\n try:\n ver_file, pathname, description = imp.find_module('__version__', [\n 'cmakelint'])\n vermod = imp.load_modu...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class View1(LoginRequiredMixin, View): <|reserved_special_token_0|> <|reserved_special_token_0|> class View2(LoginRequiredMixin, View): def dispatch(self, request, *args, **kwargs): response = super().dispatch(request, *args, **kwargs) if not request.user.ha...
flexible
{ "blob_id": "826abb18b11afd7a010e2bfc5a29ba068218c23a", "index": 7550, "step-1": "<mask token>\n\n\nclass View1(LoginRequiredMixin, View):\n <mask token>\n <mask token>\n\n\nclass View2(LoginRequiredMixin, View):\n\n def dispatch(self, request, *args, **kwargs):\n response = super().dispatch(requ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> def metas_to_json(req, q): def flatten(arr): if len(arr) == 1: return arr[0] else: return arr for page, metas in iter_metas(req, q): flattened = [(key, flatten(val)) for key, val in metas.items()] yield json.dumps(dict(flatt...
flexible
{ "blob_id": "c67cd3c16c15d6aab02a07736c83bbdd5bd98514", "index": 1839, "step-1": "<mask token>\n\n\ndef metas_to_json(req, q):\n\n def flatten(arr):\n if len(arr) == 1:\n return arr[0]\n else:\n return arr\n for page, metas in iter_metas(req, q):\n flattened = [(k...
[ 5, 6, 7, 8, 9 ]
import numpy as np #read data from file #read data from file theFile = open('datapri.txt','r') temp = [] #n la so phan tu cua mang mau n = int(theFile.readline().format()) for val in theFile.read().split(): temp.append(int(val)) theFile.close() arr = np.random.rand(n,n) k = 0 for i in range(n): for j in range...
normal
{ "blob_id": "aa801bc8398cdf69a15d04188dd8429e4624150e", "index": 5574, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor val in theFile.read().split():\n temp.append(int(val))\ntheFile.close()\n<mask token>\nfor i in range(n):\n for j in range(n):\n arr[i, j] = temp[k]\n k = k + 1\n<...
[ 0, 1, 2, 3, 4 ]
from django.apps import AppConfig class LaughsappConfig(AppConfig): name = 'laughsApp'
normal
{ "blob_id": "6b785502e8a8983c164ebdffdd304da47c926acb", "index": 774, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n name = 'laughsApp'\n", "step-4": "from django.apps impor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df.to_csv('linkedin_jobs.csv', index=False) <|reserved_special_token_1|> <|reserved_special_token_0|> chrome_driver_path = os.path.join(os.path.abspath(os.getcwd()), 'chromedriver') df = get_jobs('Data Scientist', 40, False, ch...
flexible
{ "blob_id": "6ae529a5e5658ba409ec3e7284d8b2911c60dd00", "index": 906, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.to_csv('linkedin_jobs.csv', index=False)\n", "step-3": "<mask token>\nchrome_driver_path = os.path.join(os.path.abspath(os.getcwd()), 'chromedriver')\ndf = get_jobs('Data Scientist', ...
[ 0, 1, 2, 3 ]
'''引入数据,并对数据进行预处理''' # step 1 引入数据 import pandas as pd with open('D:\\Desktop\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj: df = pd.read_csv(data_obj) # Step 2 对数据进行预处理 # 对离散属性进行独热编码,定性转为定量,使每一个特征的取值作为一个新的特征 # 增加特征量 Catagorical Variable -> Dummy Variable # 两种方法:Dummy Encoding VS One Hot Encoding # 相同点:将Cat...
normal
{ "blob_id": "682b3e1d6d40f4b279052ac27df19268d227fef8", "index": 6899, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('D:\\\\Desktop\\\\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj:\n df = pd.read_csv(data_obj)\n<mask token>\npd.set_option('display.max_columns', 1000)\n<mask token>\nfor...
[ 0, 1, 2, 3, 4 ]
import numpy as np from Ejercicio1 import norma_l2 def sorting_l2(mat): mat_l2 = norma_l2(mat) mat_sort_index = np.argsort(mat_l2) mat_sort_l2 = mat[mat_sort_index, :] return mat_sort_l2[::-1]
normal
{ "blob_id": "e280b003c95681ed4a887b0939077efeac9deefe", "index": 1377, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sorting_l2(mat):\n mat_l2 = norma_l2(mat)\n mat_sort_index = np.argsort(mat_l2)\n mat_sort_l2 = mat[mat_sort_index, :]\n return mat_sort_l2[::-1]\n", "step-3": "impo...
[ 0, 1, 2 ]
#!/usr/bin/env python """ Use version of DriverSlave that has pixmap and pixheights """ import threading # import base classes and driver from bibliopixel import LEDStrip, LEDMatrix # from bibliopixel.drivers.LPD8806 import DriverLPD8806, ChannelOrder from bibliopixel.drivers.visualizer import DriverVisualizer, Channel...
normal
{ "blob_id": "307e7a059f9b0b1131f8a57d0f55cf0ee05173e8", "index": 9822, "step-1": "#!/usr/bin/env python\n\"\"\"\nUse version of DriverSlave that has pixmap and pixheights\n\"\"\"\nimport threading\n# import base classes and driver\nfrom bibliopixel import LEDStrip, LEDMatrix\n# from bibliopixel.drivers.LPD8806 i...
[ 0 ]
def even(n): if n == 0 or n == 1: return elif n == 2: return 2 else: for i in reversed(range(n + 1)): if 2 ** i < n: return 2 ** i <|reserved_special_token_0|> <|reserved_special_token_1|> def even(n): if n == 0 or n == 1: return elif ...
flexible
{ "blob_id": "358fd8efd5c3823255ab64d5f8b88b343415ed0e", "index": 2708, "step-1": "def even(n):\n if n == 0 or n == 1:\n return\n elif n == 2:\n return 2\n else:\n for i in reversed(range(n + 1)):\n if 2 ** i < n:\n return 2 ** i\n\n\n<mask token>\n", "ste...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> rc.write_network() <|reserved_special_token_0|> comp.set_solar_like() rc.plot(outfile='cno_extras.png', rho=1000000.0, T=100000000.0, comp=comp, Z_range=[1, 13], N_range=[1, 13]) rc.plot(outfile='cno_extras_hide_alpha.png', rh...
flexible
{ "blob_id": "39b07f1a515787e80a1fb822e67e19e2301b894a", "index": 3285, "step-1": "<mask token>\n", "step-2": "<mask token>\nrc.write_network()\n<mask token>\ncomp.set_solar_like()\nrc.plot(outfile='cno_extras.png', rho=1000000.0, T=100000000.0, comp=comp,\n Z_range=[1, 13], N_range=[1, 13])\nrc.plot(outfile...
[ 0, 1, 2, 3, 4 ]
from ..translators.translator import Translator
normal
{ "blob_id": "ab844143ceddf32982682f5092762af0c97db577", "index": 391, "step-1": "<mask token>\n", "step-2": "from ..translators.translator import Translator\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
class Area: <|reserved_special_token_0|> def square(self): side = int(input('Enter the length of a side:')) area = side ** 2 print('Area is :', area, 'cm square') def rect(self): print('Enter length and breadth of rectangle:') le = int(input()) br = int(inpu...
flexible
{ "blob_id": "4f36c7e98c54d38aaef9f2ebdafd0c34a157fcd7", "index": 8268, "step-1": "class Area:\n <mask token>\n\n def square(self):\n side = int(input('Enter the length of a side:'))\n area = side ** 2\n print('Area is :', area, 'cm square')\n\n def rect(self):\n print('Enter ...
[ 4, 5, 6, 8, 10 ]
"""Seed file to make sample data for pets db.""" from models import db, User, Feedback from app import app # Create all tables db.drop_all() db.create_all() # If table isn't empty, empty it User.query.delete() Feedback.query.delete() # Add users and posts john = User(username="John",password="123",email="24",first...
normal
{ "blob_id": "d520f9d681125937fbd9dff316bdc5f922f25ff3", "index": 8050, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.drop_all()\ndb.create_all()\nUser.query.delete()\nFeedback.query.delete()\n<mask token>\ndb.session.add(john)\ndb.session.commit()\n<mask token>\ndb.session.add(feed)\ndb.session.commi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_info(): init_file = 'PIKACHU/__init__.py' with open(init_file, 'r') as f: for line in f.readlines(): if '=' in line: exec(compile(line, '', 'exec')) return locals()['name'], locals()['author'], locals()['version'] <|reserved_specia...
flexible
{ "blob_id": "f14ff29a1a76c2916cb211c476a56aaa5061bf71", "index": 8837, "step-1": "<mask token>\n\n\ndef get_info():\n init_file = 'PIKACHU/__init__.py'\n with open(init_file, 'r') as f:\n for line in f.readlines():\n if '=' in line:\n exec(compile(line, '', 'exec'))\n re...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class AccountNotificationView(BaseView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AccountNotificationView(BaseView): <|reserved_special_token_0|> @method_decorator(never_cache) @meth...
flexible
{ "blob_id": "46f218829e1bf324d4c50ea0ff7003bc48b64e2a", "index": 4258, "step-1": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n\n @method_decorator(never_cache)\n ...
[ 1, 2, 3, 4, 5 ]
version https://git-lfs.github.com/spec/v1 oid sha256:839b1a9cc0c676f388ebfe8d8f2e89ad7c39a6f0aa50fa76b2236703bf1a8264 size 62
normal
{ "blob_id": "23150f359db97e1e0ce3f12a173cd7015ad22cd4", "index": 2220, "step-1": "version https://git-lfs.github.com/spec/v1\noid sha256:839b1a9cc0c676f388ebfe8d8f2e89ad7c39a6f0aa50fa76b2236703bf1a8264\nsize 62\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] ...
[ 0 ]
import os # __file__: 当前文件 # os.path.dirname(): 所在目录 # os.path.abspath(): 当前文件/目录的绝对路径 # os.path.join(): 路径连接 # 项目路径 BASEDIR = os.path.abspath( os.path.dirname( os.path.dirname( __file__))) # 数据文件目录 DATA_DIR = os.path.join(BASEDIR, "data") DATA_FILE = os.path.join(DATA_DIR, 'data.yaml')
normal
{ "blob_id": "7a793c2081032745ae58f92a4572954333742dfd", "index": 3943, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASEDIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))\nDATA_DIR = os.path.join(BASEDIR, 'data')\nDATA_FILE = os.path.join(DATA_DIR, 'data.yaml')\n", "step-3": "import os...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def detect_lines_hough(img): lines = cv2.HoughLinesP(cv2.bitwise_not(opening), rho=1, theta=np.pi / 2, threshold=50, minLineLength=120, maxLineGap=10) return [line[0] for line in lines] <|reserved_special_token_0|> def detect_lines(img, min_line_length): """ ...
flexible
{ "blob_id": "bb5bea4ea100950b59fb2b168b75dec349938aac", "index": 7195, "step-1": "<mask token>\n\n\ndef detect_lines_hough(img):\n lines = cv2.HoughLinesP(cv2.bitwise_not(opening), rho=1, theta=np.pi / \n 2, threshold=50, minLineLength=120, maxLineGap=10)\n return [line[0] for line in lines]\n\n\n<m...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def grab_a_ticker(symbol='MSFT', apiKey=None): if apiKey is None: apiKey = os.environ.get('API_KEY') if not check_ticker_exists(symbol) and not check_blacklisted(symbol): requestUrl = ( 'https...
flexible
{ "blob_id": "3c8e6a93c4d5616b9199cf473d298bfa2dc191af", "index": 9971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef grab_a_ticker(symbol='MSFT', apiKey=None):\n if apiKey is None:\n apiKey = os.environ.get('API_KEY')\n if not check_ticker_exists(symbol) and not check_blacklisted(sy...
[ 0, 1, 2, 3, 4 ]
from svjesus.ffz import genContent from svjesus.elements.Base import Element class Descriptive(Element): def __init__(self): self.allowedChildren = () # TODO: Check what's allowed # Descriptive elements class Desc(Descriptive): name = "desc" attrs = () class Metadata(Descriptive): name = "metadata" attrs = ()...
normal
{ "blob_id": "178570047458eb3eeda00f9153ef2159eb4cbef3", "index": 9188, "step-1": "<mask token>\n\n\nclass Desc(Descriptive):\n name = 'desc'\n attrs = ()\n\n\nclass Metadata(Descriptive):\n name = 'metadata'\n attrs = ()\n\n\nclass Title(Descriptive):\n name = 'title'\n attrs = ()\n", "step-2...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def submitAction(): for i in userDict: print(f'{userDict.get(i).get()}') exit() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> win.title('Loop') <|reserved_special_token_0|> for i in range(len(labels)): currentLabel = ttk.La...
flexible
{ "blob_id": "2eb49d08136c3540e1305310f03255e2ecbf0c40", "index": 3175, "step-1": "<mask token>\n\n\ndef submitAction():\n for i in userDict:\n print(f'{userDict.get(i).get()}')\n exit()\n\n\n<mask token>\n", "step-2": "<mask token>\nwin.title('Loop')\n<mask token>\nfor i in range(len(labels)):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python #Autor: Jesus Fabian Cubas <jfabian@computer.org> #if sesion = 2 if sesion == 1 : print 'estamos en la sesion 01' elif sesion == 2 : print 'estamos en la sesion 02' else : print 'no estamos en la sesion 01' #while edad = 0 while edad < 18 : edad = edad + 1 print edad #for lista = ["a", "b", "c"...
normal
{ "blob_id": "64c4b64b6fb0cfa25c17f66243c60a5dc0166017", "index": 7698, "step-1": "#!/usr/bin/python\n#Autor: Jesus Fabian Cubas <jfabian@computer.org>\n\n#if\nsesion = 2\nif sesion == 1 :\n\tprint 'estamos en la sesion 01'\nelif sesion == 2 :\n\tprint 'estamos en la sesion 02'\nelse :\n\tprint 'no estamos en la ...
[ 0 ]
"""After seeing how great the lmfit package, I was inspired to create my own object using it. This acts as a fitting template. """ ##-------------------------------PREAMBLE-----------------------------------## import numpy as np import matplotlib.pyplot as plt from lmfit import minimize, Parameters, fit_report impo...
normal
{ "blob_id": "9e16921d83a5f62aad694b26a92b57b97ccda461", "index": 1651, "step-1": "<mask token>\n\n\nclass FitTemplate:\n\n def __init__(self, fit_function, log_dir=None):\n self.fit_function = fit_function\n self.parameters = Parameters()\n self.fit_result = None\n if log_dir is no...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Client(OpenApiClient): <|reserved_special_token_0|> <|reserved_special_token_0|> def get_endpoint(self, product_id: str, region_id: str, endpoint_rule: str, network: str, suffix: str, endpoint_map: Dict[str, str], endpoint: str) ->str: if not Uti...
flexible
{ "blob_id": "2e5d66033c2a049ba2423d01792a629bf4b8176d", "index": 8728, "step-1": "<mask token>\n\n\nclass Client(OpenApiClient):\n <mask token>\n <mask token>\n\n def get_endpoint(self, product_id: str, region_id: str, endpoint_rule:\n str, network: str, suffix: str, endpoint_map: Dict[str, str],...
[ 8, 10, 11, 12, 14 ]
from sys import stdin last_emp = emp_id = '' for line in stdin: data = line.strip().split(',') if last_emp != '' and last_emp != emp_id: print(f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},{dep_id},{dep_name},{num_of_emp},{head}') if len(data) == 5: last_emp = emp_id em...
normal
{ "blob_id": "3a2b1ddab422d450ad3b5684cbed1847d31fb8e6", "index": 2839, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in stdin:\n data = line.strip().split(',')\n if last_emp != '' and last_emp != emp_id:\n print(\n f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('# Print whole tree') print(chunks.pprint()) print(""" # Print noun phrases only""") for subtree in chunks.subtrees(): if subtree.label() == 'NP': print(' '.join(e[0] for e in list(subtree))) print(subtre...
flexible
{ "blob_id": "6b647dc2775f54706a6c18ee91145ba60d70be21", "index": 4453, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('# Print whole tree')\nprint(chunks.pprint())\nprint(\"\"\"\n# Print noun phrases only\"\"\")\nfor subtree in chunks.subtrees():\n if subtree.label() == 'NP':\n print(' '....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_memoize_insert_sort_key(con, snapshot): table = con.table('airlines') t = table['arrdelay', 'dest'] expr = t.group_by('dest').mutate(dest_avg=t.arrdelay.mean(), dev=t. arrdelay - t.arrdelay.mean()) worst = expr[expr.dev.notnull()].order_by(ibis.desc('dev')...
flexible
{ "blob_id": "97ff8dae060475b0efbc8d39e9fc251be8ac091b", "index": 6264, "step-1": "<mask token>\n\n\ndef test_memoize_insert_sort_key(con, snapshot):\n table = con.table('airlines')\n t = table['arrdelay', 'dest']\n expr = t.group_by('dest').mutate(dest_avg=t.arrdelay.mean(), dev=t.\n arrdelay - t...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_emotion_label(emotion): return LABELS['emotion'][emotion] def _load_meta_from_csv(csv_meta, output_dict): data = readcsv(csv_meta) for row in data: output_dict[row[0]]['gender'] = row[1] output_dict[row[0]]['age_group'] = row[2] output_dict[ro...
flexible
{ "blob_id": "0b7d1564ecbd78086d59629a2058716f41b4b8c8", "index": 9686, "step-1": "<mask token>\n\n\ndef get_emotion_label(emotion):\n return LABELS['emotion'][emotion]\n\n\ndef _load_meta_from_csv(csv_meta, output_dict):\n data = readcsv(csv_meta)\n for row in data:\n output_dict[row[0]]['gender'...
[ 9, 12, 13, 18, 19 ]
class Customer: def __init__(self, name, phoneno, address, pin, accno, balance): self._name = name self._pno = phoneno self._add = address self._pin = pin self._acc = accno self._bal = balance <|reserved_special_token_0|> <|reserved_special_token_0|> <|re...
flexible
{ "blob_id": "cf5a9b8dad5a02610fa5ce2a849b6f9fc50a0aa8", "index": 1872, "step-1": "class Customer:\n\n def __init__(self, name, phoneno, address, pin, accno, balance):\n self._name = name\n self._pno = phoneno\n self._add = address\n self._pin = pin\n self._acc = accno\n ...
[ 5, 6, 7, 8, 9 ]
from django.contrib import admin from get_my_tweets.models import username admin.site.register(username)
normal
{ "blob_id": "84ece5d1a9e38b83a5b60052fc3ab089c498d2fc", "index": 9147, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(username)\n", "step-3": "from django.contrib import admin\nfrom get_my_tweets.models import username\nadmin.site.register(username)\n", "step-4": null, "step-5":...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class MyThread(threading.Thread): def __init__(self, filenum): threading.Thread.__init__(self) self.filenum = filenum print('Inicio del thread:', str(self.filenum)) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "9150eb53d309e75299775cd9524a688e8dc2ff76", "index": 4210, "step-1": "<mask token>\n\n\nclass MyThread(threading.Thread):\n\n def __init__(self, filenum):\n threading.Thread.__init__(self)\n self.filenum = filenum\n print('Inicio del thread:', str(self.filenum))\n <mask tok...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GetCommunitiesByOffsetService(IService): <|reserved_special_token_0|> def run(self): return DBService(self.core).getNextFields('Communities', self. parameters['start'], self.parameters['offset'...
flexible
{ "blob_id": "051bd11c42815ec8f8ece8eae9d33890da77129c", "index": 148, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GetCommunitiesByOffsetService(IService):\n <mask token>\n\n def run(self):\n return DBService(self.core).getNextFields('Communities', self.\n parameters['...
[ 0, 2, 3, 4, 5 ]
from utils import * from Dataset.input_pipe import * from Learning.tf_multipath_classifier import * def config_graph(): paths = [] path = {} path['input_dim'] = 4116 path['name'] = 'shared1' path['computation'] = construct_path(path['name'], [512, 512], batch_norm=False, dropout=True, dropout_rate=0.5, noise=Fa...
normal
{ "blob_id": "8039430f1b65cc76f9a78b1094f110de29f0f965", "index": 4885, "step-1": "<mask token>\n\n\ndef config_graph():\n paths = []\n path = {}\n path['input_dim'] = 4116\n path['name'] = 'shared1'\n path['computation'] = construct_path(path['name'], [512, 512],\n batch_norm=False, dropout...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def simulate(): env = gym.make('CartPole-v0') for episode in range(NUM_EPISODES): done = False obv = env.reset() initial_action = 0 total_reward = 0 steps = 0 while done != True: env.render() if episode == 0: ...
flexible
{ "blob_id": "3c79c528cc19380af8f2883b9e35855e29b151a3", "index": 7975, "step-1": "<mask token>\n\n\ndef simulate():\n env = gym.make('CartPole-v0')\n for episode in range(NUM_EPISODES):\n done = False\n obv = env.reset()\n initial_action = 0\n total_reward = 0\n steps = 0...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestSunlumoProjectPrinter(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestSunlumoProjectPrinter(TestCase): def test_printer(self): sl_prj = Printer('./sunlumo_mapserver...
flexible
{ "blob_id": "5e0cba6952cdc677c640a0df325426ffc89189cd", "index": 658, "step-1": "<mask token>\n\n\nclass TestSunlumoProjectPrinter(TestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestSunlumoProjectPrinter(TestCase):\n\n def test_printer(self):\n sl_prj = Printer(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestOutwardCounterClockwise(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_traverse_single_element(self): matrix = [[1]] actual = [i for i in SpiralMatrix(matrix, clockwise=False, inward= False)] self.as...
flexible
{ "blob_id": "84f6336261e1c276f029822754842514715791df", "index": 3604, "step-1": "<mask token>\n\n\nclass TestOutwardCounterClockwise(TestCase):\n <mask token>\n <mask token>\n\n def test_traverse_single_element(self):\n matrix = [[1]]\n actual = [i for i in SpiralMatrix(matrix, clockwise=...
[ 5, 7, 11, 14, 15 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Oct 7 07:51:26 2017 @author: hcorrada """ from plagiarism_lib.article_db import ArticleDB from plagiarism_lib.minhash import MinHash from plagiarism_lib.lsh import LSH import pandas as pd import numpy as np def _read_truthfile(filepath): with op...
normal
{ "blob_id": "18b73a06c80272aff5c0e4b10473e95bd58466f3", "index": 1197, "step-1": "<mask token>\n\n\ndef _get_stats(candidate_pairs, truth_pairs):\n tp = len(candidate_pairs.intersection(truth_pairs))\n prec = 1.0 * tp / len(candidate_pairs)\n rec = 1.0 * tp / len(truth_pairs)\n print(' returned: %d,...
[ 1, 2, 3, 4, 5 ]
dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태 print(dic['name'])
normal
{ "blob_id": "09c3a10230e7d0b3b893ccf236c39fc2dc12b2c6", "index": 1097, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dic['name'])\n", "step-3": "dic = {'name': 'Eric', 'age': '25'}\nprint(dic['name'])\n", "step-4": "dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태\n\n\nprint(dic['name'])\n", ...
[ 0, 1, 2, 3 ]
import argparse import tensorboardX as tb import torch as th import torch.nn.functional as F import torch.optim as optim import torch.utils.data as D import data import mlp import resnet import utils parser = argparse.ArgumentParser() parser.add_argument('--bst', nargs='+', type=int, help='Batch Size for Training') pa...
normal
{ "blob_id": "92bcfff733e5f305ad1276ceb39a72a8f0fcb214", "index": 8038, "step-1": "<mask token>\n\n\ndef log(model, i):\n mmm = []\n for loader in (train_loader, val_loader, test_loader):\n y, y_bar = infer(loader, model)\n a = th.sum(y == y_bar).item() / len(y)\n fnfn = utils.fn_mc(y, ...
[ 1, 3, 4, 5, 6 ]
# import the necessary packages from .pigear import PiGear from .camgear import CamGear from .videogear import VideoGear __all__ = ["PiGear", "CamGear", "VideoGear"]
normal
{ "blob_id": "3431e342c940b0d91f817c3e583728e55e305210", "index": 8940, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['PiGear', 'CamGear', 'VideoGear']\n", "step-3": "from .pigear import PiGear\nfrom .camgear import CamGear\nfrom .videogear import VideoGear\n__all__ = ['PiGear', 'CamGear', '...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> model.fit(X_train, y_train) <|reserved_special_token_0|> print(predictions) <|reserved_special_token_0|> print(score) <|reserved_special_token_1|> <|reserved_special_token_0|> music_data = pd.read_csv( 'C:\\Users\\junha\\Py...
flexible
{ "blob_id": "8dbcd7bba09f8acff860890d8201e016b587796d", "index": 6149, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.fit(X_train, y_train)\n<mask token>\nprint(predictions)\n<mask token>\nprint(score)\n", "step-3": "<mask token>\nmusic_data = pd.read_csv(\n 'C:\\\\Users\\\\junha\\\\PythonProj...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' Various tools for cleaning out nulls and imputing '''
flexible
{ "blob_id": "bd310ab0bc193410b8f93ad5516b0731d2eba54f", "index": 6268, "step-1": "<mask token>\n", "step-2": "'''\nVarious tools for cleaning out nulls and imputing \n'''\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.conf.urls import url from django.contrib.auth import views as auth_views from django.contrib.auth.forms import SetPasswordForm from . import views urlpatterns = [ url(regex=r'^(?P<pk>\d+)$', view=views.UserDetailView.as_view(), name='user_detail'), url(regex=r'^update/(?P<pk>\d+)$', view=views.UserUpd...
normal
{ "blob_id": "1ac0f5c62ee3cb60d4443b65d429f4f0e6815100", "index": 5488, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url(regex='^(?P<pk>\\\\d+)$', view=views.UserDetailView.\n as_view(), name='user_detail'), url(regex='^update/(?P<pk>\\\\d+)$', view\n =views.UserUpdateView.as_view()...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print("The sum of 'numbers' is:", sum(numbers)) print("The largest of 'numbers' is:", max(numbers)) print("The smallest of 'numbers' is:", min(numbers)) for i in numbers: if i % 2 == 0: print(i, 'is even.') for i in nu...
flexible
{ "blob_id": "ce8879dae6c7585a727e35f588722bc28045256a", "index": 8569, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"The sum of 'numbers' is:\", sum(numbers))\nprint(\"The largest of 'numbers' is:\", max(numbers))\nprint(\"The smallest of 'numbers' is:\", min(numbers))\nfor i in numbers:\n if...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def firstDuplicate(array): """ Time O(n) | Space O(n) """ dic = {} for num in array: if num in dic: return num else: dic[num] = True return -1 <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "47259844f76f12060f0cf52f1086c05b9f300175", "index": 8581, "step-1": "<mask token>\n", "step-2": "def firstDuplicate(array):\n \"\"\"\n Time O(n) | Space O(n)\n \"\"\"\n dic = {}\n for num in array:\n if num in dic:\n return num\n else:\n dic[num] ...
[ 0, 1, 2 ]
# %matplotlib inline import tensorflow as tf #import tensorflow.keras as K import numpy as np import math import matplotlib matplotlib.use('GTKAgg') import matplotlib.pyplot as plt # from keras import backend as K from keras.models import Sequential, load_model # from K.models import Sequential, load_model from keras....
normal
{ "blob_id": "db9068e54607e9df48328435ef07f15b4c25a6db", "index": 7412, "step-1": "<mask token>\n\n\ndef log_dir_name(learning_rate, dense_layers, nodes, activation):\n \"\"\"\n\tCreates a directory named after the set of hyperparameters that was recently selected. A helper function\n\tto log the results of tr...
[ 3, 4, 5, 6, 7 ]
{"filter":false,"title":"settings.py","tooltip":"/mysite/settings.py","undoManager":{"mark":53,"position":53,"stack":[[{"start":{"row":107,"column":13},"end":{"row":107,"column":16},"action":"remove","lines":["UTC"],"id":2},{"start":{"row":107,"column":13},"end":{"row":107,"column":23},"action":"insert","lines":["Asia/...
normal
{ "blob_id": "f6b38698dbed6c1a48faa86183b601f855a7f737", "index": 5728, "step-1": "<mask token>\n", "step-2": "{'filter': false, 'title': 'settings.py', 'tooltip': '/mysite/settings.py',\n 'undoManager': {'mark': 53, 'position': 53, 'stack': [[{'start': {'row':\n 107, 'column': 13}, 'end': {'row': 107, 'c...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Search_record(models.Model): title = models.CharField(max_length=100) url = models.CharField(max_length=100) searchCount = models.IntegerField(blank=True) zhihu_type = models.IntegerField(blank=True, null=True) def __unicode__(self): return self.title ...
flexible
{ "blob_id": "0bc53130a4248178f4c3fabbae7d2546f0d5b8fd", "index": 5996, "step-1": "<mask token>\n\n\nclass Search_record(models.Model):\n title = models.CharField(max_length=100)\n url = models.CharField(max_length=100)\n searchCount = models.IntegerField(blank=True)\n zhihu_type = models.IntegerField...
[ 18, 24, 25, 27, 29 ]
<|reserved_special_token_0|> class Ui_MainWindow(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_MainWindow(object): <|reserved_special_token_0|> def retranslateUi(self, MainWindow): _translate = QtCore...
flexible
{ "blob_id": "2d503c93160b6f44fba2495f0ae0cf9ba0eaf9d6", "index": 8930, "step-1": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n\n def retranslateUi(self, MainWindow):\n _translate = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Trie: def __init__(self, me, parent=None): self.me = me self.parent = parent self.children = {} <|reserved_special_token_0|> def main(): trie_dict = {} for i in range(int(read())): data = read().split() if data[1] not in trie_...
flexible
{ "blob_id": "c5605f4770d61d435cc1817bad4d5cbe0aaf1d18", "index": 8824, "step-1": "<mask token>\n\n\nclass Trie:\n\n def __init__(self, me, parent=None):\n self.me = me\n self.parent = parent\n self.children = {}\n\n\n<mask token>\n\n\ndef main():\n trie_dict = {}\n for i in range(in...
[ 3, 5, 6, 7, 8 ]
#Copyright [2017] [Mauro Riva <lemariva@mail.com> <lemariva.com>] #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at #http://www.apache.org/licenses/LICENSE-2.0 #Unless required by applicable law ...
normal
{ "blob_id": "894d8d00fd05bf8648f1b95ecf30b70e7b4e841b", "index": 8640, "step-1": "<mask token>\n\n\nclass vu_meter:\n <mask token>\n <mask token>\n\n def init_adc(self):\n self.adc = ADC(0)\n self.adcUnit = self.adc.channel(pin=self.adcPin)\n self.adcMean = 0\n\n def init_leds(se...
[ 7, 11, 12, 14, 15 ]
<|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": "43ae01ffe35c6c4491f3f7e480dd6f5c1be86eb2", "index": 2475, "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 = [('element', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def _create_connection(db_file): """ Create a database connection to the SQLite database """ try: conn = sqlite3.connect(db_file) cur = conn.cursor() cur.execute('CREATE TABLE {tn} ({r1}, {r2}, {time} {ft})'.format(tn =TABLE_NAME, r1=INPUT_COLUM...
flexible
{ "blob_id": "2b8b5b893d61d11d2795f5be96fde759256a15e8", "index": 9741, "step-1": "<mask token>\n\n\ndef _create_connection(db_file):\n \"\"\" Create a database connection to the SQLite database \"\"\"\n try:\n conn = sqlite3.connect(db_file)\n cur = conn.cursor()\n cur.execute('CREATE ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Queue: def __init__(self): self.items = deque() def enQueue(self, i): self.items.append(i) def deQueue(self): return self.items.popleft() def isEmpty(self): return len(self.items) == 0 <|reserved_special_token_0|> <|reserved_...
flexible
{ "blob_id": "c96a64573fc6cc207ee09be4f4b183d065736ff6", "index": 5442, "step-1": "<mask token>\n\n\nclass Queue:\n\n def __init__(self):\n self.items = deque()\n\n def enQueue(self, i):\n self.items.append(i)\n\n def deQueue(self):\n return self.items.popleft()\n\n def isEmpty(se...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def print_pin_status(pin_number): GPIO.setup(pin_number, GPIO.IN) value = GPIO.input(pin_number) print(f'Current Value of {pin_number} is {value}') GPIO.setup(pin_number, GPIO.OUT) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "492c416becc44deaafef519eae8c9a82ac00cc0e", "index": 8632, "step-1": "<mask token>\n\n\ndef print_pin_status(pin_number):\n GPIO.setup(pin_number, GPIO.IN)\n value = GPIO.input(pin_number)\n print(f'Current Value of {pin_number} is {value}')\n GPIO.setup(pin_number, GPIO.OUT)\n\n\n<mask t...
[ 1, 2, 3, 4, 5 ]
from django.contrib import admin from .models import Advert, Category, ImageAd @admin.register(Advert) class AdminAdvert(admin.ModelAdmin): filter_horizontal = "categories", @admin.register(Category) class AdminCategory(admin.ModelAdmin): pass @admin.register(ImageAd) class AdminImageAd(admin.ModelAdmin)...
normal
{ "blob_id": "fdcee5b3f6b3ec170c9ef3017e0cc6c4b28cf22d", "index": 454, "step-1": "<mask token>\n\n\n@admin.register(ImageAd)\nclass AdminImageAd(admin.ModelAdmin):\n pass\n", "step-2": "<mask token>\n\n\n@admin.register(Advert)\nclass AdminAdvert(admin.ModelAdmin):\n <mask token>\n\n\n@admin.register(Cate...
[ 1, 3, 4, 5, 6 ]
print("Convertidor de pies y pulgadas a centímetros") pies = float(input("Escriba una cantidad de pies: ")) pulgadas = float(input("Escriba una cantidad de pulgadas: ")) cm = (pies * 12 + pulgadas) * 2.54; print("{} pies y {} pulgadas son {} cm".format(pies, pulgadas, cm))
normal
{ "blob_id": "b0ab97f5c05cdeee4c01460109a76cef75ac72ce", "index": 5342, "step-1": "<mask token>\n", "step-2": "print('Convertidor de pies y pulgadas a centímetros')\n<mask token>\nprint('{} pies y {} pulgadas son {} cm'.format(pies, pulgadas, cm))\n", "step-3": "print('Convertidor de pies y pulgadas a centíme...
[ 0, 1, 2, 3 ]
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) IS_TESTING = False FOLDER_TO_ORGANIZE = '' FOLDER_FOR_OTHERS = '' FOLDER_TO_ORGANIZE_TEST = '' LOG_FILE = '' IGNORE_HIDDEN_FILES = True FILES_DESTINATION = { 'images': ['.jpg', '.jpeg', '.png'], 'documents': ['.pdf', '.xlsx', '....
normal
{ "blob_id": "83e2f9c56c45a288aabd777fb244089367649258", "index": 1165, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nIS_TESTING = False\nFOLDER_TO_ORGANIZE = ''\nFOLDER_FOR_OTHERS = ''\nFOLDER_TO_ORGANIZE_TEST = ''\nLOG_FILE = ''\nI...
[ 0, 1, 2, 3 ]
from flask_socketio import SocketIO socket = SocketIO() @socket.on('test') def on_test(msg): print 'got message'
normal
{ "blob_id": "7435aa6cd4eec5582be9f4a1dd75b0dfcadc4409", "index": 5137, "step-1": "from flask_socketio import SocketIO\n\nsocket = SocketIO()\n\n@socket.on('test')\ndef on_test(msg):\n print 'got message'\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
from django import forms class CommentForm(forms.Form): name = forms.CharField(label='称呼') email = forms.EmailField(label='邮箱') content = forms.CharField(label='内容')
normal
{ "blob_id": "c2ff3c5e44fa361671a3fdb38060517bcc4bc82c", "index": 2778, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CommentForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CommentForm(forms.Form):\n name = forms.CharField(labe...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def profile_page_view(request, username): current_user = request.user user = CustomUser.objects.get(username=username) profile = Profile.objects.get(user=user) if current_user in profile.followers.all(): ...
flexible
{ "blob_id": "3caaa455cda0567b79ae063c777846157839d64f", "index": 8548, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef profile_page_view(request, username):\n current_user = request.user\n user = CustomUser.objects.get(username=username)\n profile = Profile.objects.get(user=user)\n if ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AsistenteDetailView(LoginRequiredMixin, DetailView): """ Detalle de Asistente """ model = Asistente template_name = 'carga_horaria/asistente/detalle_asistente.html' class AsistenteCreateView(LoginRequiredMixin, CreateView): model = Asistente form_cl...
flexible
{ "blob_id": "d0d86d8b5b276218add6dd11a44d5c3951cc4e14", "index": 3846, "step-1": "<mask token>\n\n\nclass AsistenteDetailView(LoginRequiredMixin, DetailView):\n \"\"\"\n Detalle de Asistente\n \"\"\"\n model = Asistente\n template_name = 'carga_horaria/asistente/detalle_asistente.html'\n\n\ncl...
[ 52, 53, 56, 73, 85 ]
<|reserved_special_token_0|> def inv_list(l, start=0): d = {} for i in range(len(l)): d[l[i]] = i + start return d <|reserved_special_token_0|> def read_dataset(d): ts = [] pbar = tqdm(os.listdir(raw_data_path + '/set-' + d), desc= 'Reading time series set ' + d) for f in p...
flexible
{ "blob_id": "3e07a2a2d0a810c016720fa41d71d0771cbccfef", "index": 626, "step-1": "<mask token>\n\n\ndef inv_list(l, start=0):\n d = {}\n for i in range(len(l)):\n d[l[i]] = i + start\n return d\n\n\n<mask token>\n\n\ndef read_dataset(d):\n ts = []\n pbar = tqdm(os.listdir(raw_data_path + '/s...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Boundary: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Boundary: <|reserved_special_token_0|> def show(self): self.py5.stroke(255) self.py5.line(self.a.x, self.a.y, self...
flexible
{ "blob_id": "df00cc501b7b682cc1f4fbc9ae87a27984e6b5ef", "index": 5424, "step-1": "<mask token>\n", "step-2": "class Boundary:\n <mask token>\n <mask token>\n", "step-3": "class Boundary:\n <mask token>\n\n def show(self):\n self.py5.stroke(255)\n self.py5.line(self.a.x, self.a.y, se...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def is_prime(n): if n == 1: return False if n < 4: return True if n % 2 == 0: return False if n < 9: return True if n % 3 == 0: return False root = math.sqrt(n) f = 5 while f <= root: if n % f == 0: ...
flexible
{ "blob_id": "3970c7768e892ad217c193b1d967c1203b7e9a25", "index": 6512, "step-1": "<mask token>\n\n\ndef is_prime(n):\n if n == 1:\n return False\n if n < 4:\n return True\n if n % 2 == 0:\n return False\n if n < 9:\n return True\n if n % 3 == 0:\n return False\n ...
[ 1, 2, 3, 4, 5 ]
import socket def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = ('localhost', 8886) sock.connect(server_address) data = "TCP" length = len(data) ret = bytearray([]) for byte in data.encode("utf-8"): ret.append(byte) sock.sendall(ret) if __na...
normal
{ "blob_id": "c6fd848bb3d845a50b928c18a51f296a500e7746", "index": 2922, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n server_address = 'localhost', 8886\n sock.connect(server_address)\n data = 'TCP'\n length = len...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_sample_input(): map_template = """..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# .#........# #.##...#... #...##....# .#..#...#.#""" logger.info(traverse_map(map_template)) def test_sample_input_custom_slope(): map_template = """....
flexible
{ "blob_id": "7599f13d1cabe73d876ff97722962f2fcf9a9940", "index": 2269, "step-1": "<mask token>\n\n\ndef test_sample_input():\n map_template = \"\"\"..##.......\n#...#...#..\n.#....#..#.\n..#.#...#.#\n.#...##..#.\n..#.##.....\n.#.#.#....#\n.#........#\n#.##...#...\n#...##....#\n.#..#...#.#\"\"\"\n logger.in...
[ 5, 6, 7, 8, 9 ]
from selenium import webdriver import math import time browser = webdriver.Chrome() website = 'http://suninjuly.github.io/find_link_text' link_text = str(math.ceil(math.pow(math.pi, math.e) * 10000)) browser.get(website) find_link = browser.find_element_by_link_text(link_text) find_link.click() input_first_name = brows...
normal
{ "blob_id": "aa17e22bc13436333b1db4aee41eeced373119a8", "index": 5704, "step-1": "<mask token>\n", "step-2": "<mask token>\nbrowser.get(website)\n<mask token>\nfind_link.click()\n<mask token>\ninput_first_name.send_keys('Timur')\n<mask token>\ninput_last_name.send_keys('Atabaev')\n<mask token>\ninput_city.send...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for k in range(grid): for j in range(grid): for i in range(grid): x = (i / grid + 0.25) * tau y = (j / grid + 0.25) * tau z = (k / grid + 0.25) * tau u = cos(x) * sin(y) ...
flexible
{ "blob_id": "d70986b016e58877c39bfbb76c5bd622c44cbca9", "index": 9273, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in range(grid):\n for j in range(grid):\n for i in range(grid):\n x = (i / grid + 0.25) * tau\n y = (j / grid + 0.25) * tau\n z = (k / gri...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import numpy.random as nr import math import os from datetime import datetime from sklearn.linear_model import LinearRegression, SGDRegressor import sys import time import imp from sklearn.ensemble import ExtraTreesRegressor fr...
normal
{ "blob_id": "ee49ce63951721458cb98b370285d04231bb2c20", "index": 7438, "step-1": "<mask token>\n\n\nclass predict(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def trainExtraTreeRegressor(self):\n self.__tree_reg.fit(self.train_...
[ 4, 8, 14, 17, 18 ]
<|reserved_special_token_0|> class TwoStage(BayesianModel): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TwoStageBF(BayesianModel): """ Two Stage Inference. First stage: Bootstrapped ElasticNet Second stage: Use loci that were learned in t...
flexible
{ "blob_id": "057140ef1b8db340656b75b3a06cea481e3f20af", "index": 1689, "step-1": "<mask token>\n\n\nclass TwoStage(BayesianModel):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TwoStageBF(BayesianModel):\n \"\"\"\n Two Stage Inference.\n\n First stage: Bootstrapped ElasticNet\n Sec...
[ 28, 29, 46, 49, 55 ]
# file = open('suifeng.txt') # # text = file.read() # # print(text) # # file.close() # with open('suifeng.txt') as f: # print(f.read()) newList=[] for i in range(11): newList.append(i*2) print(newList) newList2=[i*2 for i in range(11)] print(newList2) list = ["小米","王银龙","王思"] emptyList=[] for name in list...
normal
{ "blob_id": "3752b68e151379c57e1494715a45172607f4aead", "index": 8090, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(11):\n newList.append(i * 2)\nprint(newList)\n<mask token>\nprint(newList2)\n<mask token>\nfor name in list:\n if name.startswith('王'):\n emptyList.append(name...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name=NAME, packages=['compoelem', 'compoelem.generate', 'compoelem.compare', 'compoelem.visualize', 'compoelem.detect', 'compoelem.detect.openpose', 'compoelem.detect.openpose.lib'], include_package_data=True, ve...
flexible
{ "blob_id": "4f81eb7218fa1341bd7f025a34ec0677d46151b0", "index": 6542, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name=NAME, packages=['compoelem', 'compoelem.generate',\n 'compoelem.compare', 'compoelem.visualize', 'compoelem.detect',\n 'compoelem.detect.openpose', 'compoelem.detect.open...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import datetime as dt def sum_unique(x): return np.unique(x).shape[0] def analyze_count(data): """real time, vk, itemid, action""" dsct_vk = pd.unique(data['vk']) dsct_itemid = pd.unique(data['itemid']) print 'number of user:', dsct_vk.shape print ...
normal
{ "blob_id": "1db16ae1fc6546575150187432265ac1cf834ec2", "index": 1809, "step-1": "import pandas as pd\nimport numpy as np\nimport datetime as dt\n\ndef sum_unique(x):\n return np.unique(x).shape[0]\n\ndef analyze_count(data):\n \n \"\"\"real time, vk, itemid, action\"\"\"\n\n dsct_vk = pd.unique(data...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('apps.profiles.views', url('^$', 'index', name= 'profiles'), url('^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile', name='profiles_view'), url('^edit/$', 'edit_profile', name= 'profile_edit'...
flexible
{ "blob_id": "5707e24596dfe2d85e9a7caa93aa3e253a41ae40", "index": 6620, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('apps.profiles.views', url('^$', 'index', name=\n 'profiles'), url('^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile',\n name='profiles_view'), url('^edit...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> bar = aws.elasticache.get_replication_group(replication_group_id='example') <|reserved_special_token_1|> import pulumi import pulumi_aws as aws bar = aws.elasticache.get_replication_group(replication_group_id='example') <|res...
flexible
{ "blob_id": "4bf140ae01f2eaa0c67f667766c3ec921d552066", "index": 6073, "step-1": "<mask token>\n", "step-2": "<mask token>\nbar = aws.elasticache.get_replication_group(replication_group_id='example')\n", "step-3": "import pulumi\nimport pulumi_aws as aws\nbar = aws.elasticache.get_replication_group(replicati...
[ 0, 1, 2, 3 ]
''' check if word appear in file ''' # easier solution : def findKeyInFile(word, filepath): with open(filepath) as f: for line in f.readlines(): if line.count(word) > 0: return line return None
normal
{ "blob_id": "97fb2388777bcb459b9818495121fdf8318095ca", "index": 8881, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findKeyInFile(word, filepath):\n with open(filepath) as f:\n for line in f.readlines():\n if line.count(word) > 0:\n return line\n return No...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class TriviaTestCase(unittest.TestCase): <|reserved_special_token_0|> def setUp(self): """Define test variables and initialize app.""" self.app = create_app() self.client = self.app.test_client self.database_path = DB_PATH setup_db(self.app...
flexible
{ "blob_id": "364ac79e0f885c67f2fff57dfe3ddde63f0c269e", "index": 995, "step-1": "<mask token>\n\n\nclass TriviaTestCase(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Define test variables and initialize app.\"\"\"\n self.app = create_app()\n self.client = self.app.tes...
[ 15, 16, 18, 19, 23 ]
''' # AWS::Chatbot Construct Library AWS Chatbot is an AWS service that enables DevOps and software development teams to use Slack chat rooms to monitor and respond to operational events in their AWS Cloud. AWS Chatbot processes AWS service notifications from Amazon Simple Notification Service (Amazon SNS), and forwar...
normal
{ "blob_id": "937fd6aa7bd21258bd6e0f592d94a966519ef885", "index": 9458, "step-1": "<mask token>\n\n\n@jsii.interface(jsii_type='aws-cdk-lib.aws_chatbot.ISlackChannelConfiguration')\nclass ISlackChannelConfiguration(_IResource_c80c4260, _IGrantable_71c4f5de,\n _INotificationRuleTarget_faa3b79b, typing_extension...
[ 39, 61, 66, 75, 85 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-31 07:54 from __future__ import unicode_literals import codenerix.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('codenerix_products', '0005_remove_p...
normal
{ "blob_id": "0aed35827e6579f7a9434d252d0b9150ab24adf9", "index": 4573, "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 = [('codenerix_p...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BrandReg(BrandRegBasic): def __init__(self, base_folder, log_instance, input_lst=None): super(BrandReg, self).__init__(base_folder, log_instance) input_file = base_folder + '/dp_brands_result.txt' if not os.path.exists(input_file): raise Exce...
flexible
{ "blob_id": "845d1251497df61dd2c23241016a049c695ad940", "index": 9193, "step-1": "<mask token>\n\n\nclass BrandReg(BrandRegBasic):\n\n def __init__(self, base_folder, log_instance, input_lst=None):\n super(BrandReg, self).__init__(base_folder, log_instance)\n input_file = base_folder + '/dp_bran...
[ 6, 9, 12, 13, 15 ]
""" -*- coding:utf-8 -*- @ Time : 14:05 @ Name : handle_ini_file.py @ Author : xiaoyin_ing @ Email : 2455899418@qq.com @ Software : PyCharm ... """ from configparser import ConfigParser from Common.handle_path import conf_dir import os class HandleConfig(ConfigParser): def __init__(self, ini_...
normal
{ "blob_id": "01e60123ad87d9ff49812fe3a6f5d55bc85921c5", "index": 4071, "step-1": "<mask token>\n\n\nclass HandleConfig(ConfigParser):\n\n def __init__(self, ini_file_neme):\n super().__init__()\n self.ini_file_neme = ini_file_neme\n\n def red_conf__(self):\n file_path = os.path.join(co...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> url = ( 'https://archive.fantasysports.yahoo.com/nfl/2017/189499?lhst=sched#lhstsched' ) html = requests.get(url).content df_list = pandas.read_html(html) <|reserved_special_token_1|> import pandas import requests impor...
flexible
{ "blob_id": "d46035699bee1ad9a75ea251c2c3ab8817d6a740", "index": 4343, "step-1": "<mask token>\n", "step-2": "<mask token>\nurl = (\n 'https://archive.fantasysports.yahoo.com/nfl/2017/189499?lhst=sched#lhstsched'\n )\nhtml = requests.get(url).content\ndf_list = pandas.read_html(html)\n", "step-3": "imp...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CurationLists(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def pseudo_tree(self, gids, out_tree): """Create pseudo-tree with the specified genome IDs.""" pseudo_tree = '(' pseudo_tree += ','.join(gids) pseudo_tree +=...
flexible
{ "blob_id": "53909b750f259b67b061ba26d604e0c2556376df", "index": 9560, "step-1": "<mask token>\n\n\nclass CurationLists(object):\n <mask token>\n <mask token>\n\n def pseudo_tree(self, gids, out_tree):\n \"\"\"Create pseudo-tree with the specified genome IDs.\"\"\"\n pseudo_tree = '('\n ...
[ 4, 5, 6, 9, 10 ]
#basic API start from flask import Flask, jsonify, abort, request from cruiseItem import cruiseItem from sqlalchemy import create_engine from json import dumps db_connect = create_engine('sqlite:///Carnivorecruise.sqlite') app = Flask(__name__) app.json_encoder.default = lambda self, o: o.to_joson() app.app_c...
normal
{ "blob_id": "65bfb59a255b42854eec8b55b28711737cfc46c2", "index": 9325, "step-1": "<mask token>\n\n\ndef get_cruiseitemArr():\n conn = db_connect.connect()\n query = conn.execute('select * from CruiseItem')\n InventoryArr = query.cursor.fetchall()\n print(InventoryArr)\n return jsonify(InventoryArr...
[ 4, 5, 6, 8, 9 ]
import os import pathlib import enum import warnings import colorama import requests with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) import invoke class MoleculeDriver(enum.Enum): docker = 1 lxd = 2 vagrant = 3 class TestPlatform(enum.Enum): linux...
normal
{ "blob_id": "5bdc08b66916959d462314b8a6e5794e5fa12b55", "index": 7986, "step-1": "<mask token>\n\n\nclass MoleculeDriver(enum.Enum):\n docker = 1\n lxd = 2\n vagrant = 3\n\n\nclass TestPlatform(enum.Enum):\n linux = 1\n ubuntu = 2\n centos = 3\n\n\n<mask token>\n\n\ndef print_sub_header(sub_hea...
[ 10, 11, 13, 14, 16 ]
import unittest import numpy import pandas as pd import fixtures.examples_validate as examples from cellxgene_schema.validate import Validator from cellxgene_schema.write_labels import AnnDataLabelAppender # Tests for schema compliance of an AnnData object class TestValidAnndata(unittest.TestCase): """ T...
normal
{ "blob_id": "f4306f80330850415b74d729384f360489644e39", "index": 354, "step-1": "<mask token>\n\n\nclass TestObs(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n self.validator = Validator()\n self.validator.adata = examples.adata.copy()\n <mask token>\n <mask token>\n <mask...
[ 43, 45, 50, 57, 75 ]