code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ranked(country, variety, price, num): data = pd.read_csv('wine_final.csv') if num == 0: return None if country != '': data = data.query('country=="{}"'.format(country)) if variety != '': ...
flexible
{ "blob_id": "d983cb4ae79d8370ed0809b86762c1e2ea125320", "index": 6614, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ranked(country, variety, price, num):\n data = pd.read_csv('wine_final.csv')\n if num == 0:\n return None\n if country != '':\n data = data.query('country==...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python #coding:utf-8 import jieba.analyse as analyse from collections import Counter import time from os import path import jieba import importlib, sys importlib.reload(sys) import csv import pandas as pd from pandas import DataFrame jieba.load_userdict("newdict.txt") d = path.dirname(__fi...
normal
{ "blob_id": "6f3aa4e1309745265bb9d79df5f5a352e54493f9", "index": 6313, "step-1": "<mask token>\n\n\ndef removdup():\n train = pd.read_csv('C:\\\\Users\\\\Lenovo\\\\zqrbtest\\\\data.csv')\n train = train['titlec']\n train = set(train)\n data = pd.DataFrame(list(train), columns=['titlec'])\n data.to...
[ 1, 2, 3, 4, 5 ]
processed_lines = [] for line in open('9.in'): if line: processing_pattern = False new_line = '' for idx, char in enumerate(line): pattern_found = False if line[idx] == '(' and line[idx + 1].isnumeric() and line[idx + 2 ] == 'x' and line[idx + 3].isnum...
normal
{ "blob_id": "3605f46da25eb98767ca8d7248beaa07572d3171", "index": 644, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in open('9.in'):\n if line:\n processing_pattern = False\n new_line = ''\n for idx, char in enumerate(line):\n pattern_found = False\n ...
[ 0, 1, 2 ]
from django import forms from django.core.exceptions import ValidationError from django.db import connection from customer.helper_funcs import dictfetchall class OrderForm(forms.Form): item_id = forms.IntegerField(required=True) quantity = forms.IntegerField(required=True) def clean(self): cleane...
normal
{ "blob_id": "b32784bf398a58ba4b6e86fedcdc3ac9de0e8d51", "index": 3137, "step-1": "<mask token>\n\n\nclass OrderForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass OrderForm(forms.Form):\n <mask token>\n <mask token>\n\n def clean(self):\n ...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 3.2.3 on 2021-05-16 07:56 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('problem', '0002_problem_...
normal
{ "blob_id": "7040db119f8fd6da78499fc732e291280228ca10", "index": 1852, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def countKDifference(self, nums: List[int], k: int) ->int: def abs(x, y): if x - y >= 0: return x - y else: ...
flexible
{ "blob_id": "351b2c2a18473e6ac541a96165c69c836ea101de", "index": 846, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def countKDifference(self, nums: List[int], k: int) ->int:\n\n def abs(x, y):\n if x - y >= 0:\n ...
[ 0, 1, 2, 3 ]
import ftplib def ftp_download(): file_remote = 'ftp_upload.jpg' file_local = '/home/pi/Desktop/Camera-Rasp-Arduino-sensors/test_download.jpg' bufsize = 1024 fp = open(file_local, 'wb') f.retrbinary('RETR ' + file_remote, fp.write, bufsize) fp.close() def ftp_upload(): file_remote = '...
normal
{ "blob_id": "a1b85d140c45f082ceac54ad8aa9aa5c3659d5cf", "index": 9661, "step-1": "<mask token>\n\n\ndef ftp_download():\n file_remote = 'ftp_upload.jpg'\n file_local = (\n '/home/pi/Desktop/Camera-Rasp-Arduino-sensors/test_download.jpg')\n bufsize = 1024\n fp = open(file_local, 'wb')\n f.re...
[ 1, 2, 3, 4, 5 ]
import sys, os, json sys.path.append(os.path.join(os.path.dirname(__file__), "requests")) import requests def findNonPrefixes(prefix, array): result = [] prefixLength = len(prefix) for string in array: if string[0:prefixLength] != prefix: result.append(string) return result def run (): r = requests.post("...
normal
{ "blob_id": "8419aee5dbc64b51f3c0f364716aad1630f00fe9", "index": 7173, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findNonPrefixes(prefix, array):\n result = []\n prefixLength = len(prefix)\n for string in array:\n if string[0:prefixLength] != prefix:\n result.append...
[ 0, 2, 3, 4, 5 ]
import pandas as pd import numpy as np import pyten.tenclass import pyten.method import pyten.tools def scalable(file_name=None, function_name=None, recover=None, omega=None, r=2, tol=1e-8, maxiter=100, init='random', printitn=0): """ Helios1 API returns CP_ALS, TUCKER_ALS, or NNCP decomposition or...
normal
{ "blob_id": "39fdb9c586c3cf92d493269ceac419e0058a763a", "index": 380, "step-1": "import pandas as pd\nimport numpy as np\n\nimport pyten.tenclass\nimport pyten.method\nimport pyten.tools\n\n\ndef scalable(file_name=None, function_name=None, recover=None, omega=None, r=2, tol=1e-8, maxiter=100, init='random',\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def count_words(words, chars): ans = 0 alphabet = {} for char in chars: if char not in alphabet: alphabet[char] = 1 else: alphabet[char] += 1 print(f'Montamos o alfabeto: {...
flexible
{ "blob_id": "bf7e3ddaf66f4c325d3f36c6b912b47f4ae22cba", "index": 4779, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef count_words(words, chars):\n ans = 0\n alphabet = {}\n for char in chars:\n if char not in alphabet:\n alphabet[char] = 1\n else:\n al...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DataRoutes(CommonRouteExchangeService): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def change_status_in_route(self, tree_route, status): """Замена статуса маршрута в маршруте :param tree_route: Маршрут в фо...
flexible
{ "blob_id": "63069f03d17862b8ea6aa74d0acd1370bbea0dcb", "index": 836, "step-1": "<mask token>\n\n\nclass DataRoutes(CommonRouteExchangeService):\n <mask token>\n <mask token>\n <mask token>\n\n def change_status_in_route(self, tree_route, status):\n \"\"\"Замена статуса маршрута в маршруте\n ...
[ 3, 5, 7, 8 ]
""" Forms and validation code for user registration. Note that all of these forms assume your user model is similar in structure to Django's default User class. If your user model is significantly different, you may need to write your own form class; see the documentation for notes on custom user models with django-re...
normal
{ "blob_id": "3b959481f7c818ec35b8af174b1982954b4c72eb", "index": 1208, "step-1": "<mask token>\n\n\nclass RegistrationFormCaseInsensitive(RegistrationForm):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.fields[User.USERNAME_FIELD].validator...
[ 8, 12, 14, 15, 16 ]
''' Twitter settings Input your app credentials below https://apps.twitter.com ''' # consumer key CONSUMER_KEY = '' # consumer secret CONSUMER_SECRET = '' ''' App settings ''' # Where to save tokens (JSON) TOKENS_PATH = '/tmp/twitter-tokens.json' # Redirect-back to URL after authenticated (optional) REDIRECT_TO = ''...
normal
{ "blob_id": "9cc64edc81ab39b0ab2cd47661c9809545b03ac6", "index": 3230, "step-1": "<mask token>\n", "step-2": "<mask token>\nCONSUMER_KEY = ''\nCONSUMER_SECRET = ''\n<mask token>\nTOKENS_PATH = '/tmp/twitter-tokens.json'\nREDIRECT_TO = ''\nFLASK_SECRET = 'S$2[ShC-=BKKOQ.Z-|fa 6f;,5 <[QngmG)}5,s%0vX>B}?o-0X9PM;....
[ 0, 1, 2 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @File : corr2d.py @Author : jeffsheng @Date : 2020/1/3 @Desc : 卷积层中的互相关(cross-correlation)运算 卷积层需要学习的参数是:卷积核和偏置大小 """ import tensorflow as tf def corr2d(X, K): """ 定义二维互相关运算函数 :param X:输入数组 :param K: 核数组 :return:二维互相关的运算结果 """ h, w = K.sh...
normal
{ "blob_id": "3f473701b186b5287258ba74e478cccdad0f29bf", "index": 2463, "step-1": "<mask token>\n\n\ndef corr2d(X, K):\n \"\"\"\n 定义二维互相关运算函数\n :param X:输入数组\n :param K: 核数组\n :return:二维互相关的运算结果\n \"\"\"\n h, w = K.shape\n Y = tf.Variable(tf.zeros((X.shape[0] - h + 1, X.shape[1] - w + 1)))...
[ 1, 2, 3, 4, 5 ]
import os import numpy as np from . import tmp_dir_fixture from . import TEST_SAMPLE_DATA def test_tensor_dataset_functional(): from dtoolai.data import TensorDataSet tds_uri = os.path.join(TEST_SAMPLE_DATA, "example_tensor_dataset") tds = TensorDataSet(tds_uri) assert tds.name == "example_tenso...
normal
{ "blob_id": "97dfcce6e82ef33334b49de72bb126150dfef196", "index": 2844, "step-1": "<mask token>\n\n\ndef test_create_tensor_dataset_from_arrays(tmp_dir_fixture):\n pass\n", "step-2": "<mask token>\n\n\ndef test_image_dataset_functional():\n from dtoolai.data import ImageDataSet\n ids_uri = 'http://bit....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def treasure(update, context): msg1 = """ 欢迎来到寻宝游戏!这是一场惊悚又危险追逐战,智慧,运气和勇气都是成功的关键!记得要避开海盗!读一读规则吧! 1. 系统会自动给你分配即将要发生的事,做好心理准备! 2. 好的外表不一定有好的结果... 3. 点击按钮开始寻宝! ----------------------- 请开始你的航海之旅吧!祝你玩的开心! """ update.message.reply_text(msg1, reply_markup=kb2)...
flexible
{ "blob_id": "bc3e94c3fb8e563f62fcf0ca628d4aa73c668612", "index": 7097, "step-1": "<mask token>\n\n\ndef treasure(update, context):\n msg1 = \"\"\"\n 欢迎来到寻宝游戏!这是一场惊悚又危险追逐战,智慧,运气和勇气都是成功的关键!记得要避开海盗!读一读规则吧!\n 1. 系统会自动给你分配即将要发生的事,做好心理准备!\n 2. 好的外表不一定有好的结果...\n 3. 点击按钮开始寻宝!\n -----------------------\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> enquiryUrlPattern = [url('daily-rate-enquiry', views. daily_rate_enquiry_form), re_path('^contact-us-landing-page/$', views. contact_us_landing_page)] <|reserved_special_token_1|> from . import views from django.conf.ur...
flexible
{ "blob_id": "ccf1710cff972eaa06e1ccb5ebedc70d946e3215", "index": 4906, "step-1": "<mask token>\n", "step-2": "<mask token>\nenquiryUrlPattern = [url('daily-rate-enquiry', views.\n daily_rate_enquiry_form), re_path('^contact-us-landing-page/$', views.\n contact_us_landing_page)]\n", "step-3": "from . im...
[ 0, 1, 2, 3 ]
import sys import os from configparser import ConfigParser import logging from mod_argparse import setup_cli from checkers.IndexFile import DocumentIndex, ProgressNoteIndex from checkers import source_files from utilities import write_to_file, strip # , write_to_db_isok # import pandas as pd logger = logging.getLogger...
normal
{ "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 ]
#!/usr/local/bin/python import requests as rq import sqlite3 as sq from dateutil import parser import datetime import pytz import json from os.path import expanduser import shutil from os.path import isfile import time #FRED Config urls = {'FRED':"http://api.stlouisfed.org/fred"} urls['FRED_SER'] = urls['FRED'] + "/se...
normal
{ "blob_id": "8dfb1312d82bb10f2376eb726f75a4a596319acb", "index": 3143, "step-1": "#!/usr/local/bin/python\nimport requests as rq\nimport sqlite3 as sq\nfrom dateutil import parser\nimport datetime\nimport pytz\nimport json\nfrom os.path import expanduser\nimport shutil\nfrom os.path import isfile\nimport time\n#...
[ 0 ]
<|reserved_special_token_0|> @app.route('/api/orders/update/<int:orderID>', methods=['GET', 'PUT', 'POST', 'DELETE']) def update_ticket(orderID): try: if request.method != 'PUT': abort(405) logger.error( f'ConnectionError issue while fetching tickets{request.met...
flexible
{ "blob_id": "bb58b4384eaeec45be1af865012c618af05f5a0a", "index": 9667, "step-1": "<mask token>\n\n\n@app.route('/api/orders/update/<int:orderID>', methods=['GET', 'PUT',\n 'POST', 'DELETE'])\ndef update_ticket(orderID):\n try:\n if request.method != 'PUT':\n abort(405)\n logger...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> def test_notExisting_channel(): db.reset_DB() auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith') realtoken = Token.generateToken('testmail@gmail.com') fake_channel = 70 with pytest.raises(ValueError): standup_start(realtoken, fake_channel, 5) <|...
flexible
{ "blob_id": "b6715ad42d59720eb021973394a0b7bfd540181b", "index": 4338, "step-1": "<mask token>\n\n\ndef test_notExisting_channel():\n db.reset_DB()\n auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith')\n realtoken = Token.generateToken('testmail@gmail.com')\n fake_channel = 70\n with ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def register_user(): try: email = request.json['email'] password = request.json['password'] except KeyError: status = constants.statuses['user']['missingData'] body = create_error_with_sta...
flexible
{ "blob_id": "73a4b3497952f90029ba24b73b835de53fc687ec", "index": 3349, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_user():\n try:\n email = request.json['email']\n password = request.json['password']\n except KeyError:\n status = constants.statuses['user']['...
[ 0, 1, 2, 3 ]
from tkinter import * janela = Tk() janela.title("Teste de frame") janela.geometry("800x600") frame = Frame(janela, width = 300, height = 300, bg = 'red').grid(row = 0, column = 0) #frames servem para caso queira colocar labels e butoes dentro de uma area especifica #assim deve se declarar o frame como pai no inicio ...
normal
{ "blob_id": "4ae24d1e39bdcde3313a8a0c8029a331864ba40e", "index": 6985, "step-1": "<mask token>\n", "step-2": "<mask token>\njanela.title('Teste de frame')\njanela.geometry('800x600')\n<mask token>\nLabel(frame, text='lsdakçasd').grid(row=0, column=0)\njanela.mainloop()\n", "step-3": "<mask token>\njanela = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def makeAnagram(a, b): ct_a = Counter(a) ct_b = Counter(b) ct_a.subtract(ct_b) return sum(abs(i) for i in ct_a.values()) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "3b15767988f1d958fc456f7966f425f93deb9017", "index": 8302, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef makeAnagram(a, b):\n ct_a = Counter(a)\n ct_b = Counter(b)\n ct_a.subtract(ct_b)\n return sum(abs(i) for i in ct_a.values())\n\n\n<mask token>\n", "step-3": "<mask t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): cv2.namedWindow('image') cv2.setMouseCallback('image', movemouse) cv2.waitKey() cv2.destroyAllWindows() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def movemouse(event, x, y, flags, param): global img im...
flexible
{ "blob_id": "cae0aeea2ebd0a429cf6ecc9acab8f5f103e9669", "index": 1989, "step-1": "<mask token>\n\n\ndef main():\n cv2.namedWindow('image')\n cv2.setMouseCallback('image', movemouse)\n cv2.waitKey()\n cv2.destroyAllWindows()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef movemouse(event, x, ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def validator(pattern, promt): text = input(promt) while not bool(pattern.match(text)): text = input(promt) return text def number_validator(promt): number = float(validator(re_number, promt)) return number def len_line(x, y): length = (x ** 2 + y ** 2)...
flexible
{ "blob_id": "2d5993489ff3120d980d29edbb53422110a5c039", "index": 3561, "step-1": "<mask token>\n\n\ndef validator(pattern, promt):\n text = input(promt)\n while not bool(pattern.match(text)):\n text = input(promt)\n return text\n\n\ndef number_validator(promt):\n number = float(validator(re_nu...
[ 3, 4, 5, 6, 7 ]
import urlparse import twitter import oauth2 as oauth import re import urllib url_checker = dict() def twitter_auth(): consumer_key = 'IqsuEo5xfTdWwjD1GZNSA' consumer_secret = 'dtYmqEekw53kia3MJhvDagdByWGxuTiqJfcdGkXw8A' request_token_url = 'https://api.twitter.com/oauth/request_token' access_token_...
normal
{ "blob_id": "afa20d7e9c7843a03090c00cc888d44a77fc29f3", "index": 9205, "step-1": "<mask token>\n\n\ndef twitter_auth():\n consumer_key = 'IqsuEo5xfTdWwjD1GZNSA'\n consumer_secret = 'dtYmqEekw53kia3MJhvDagdByWGxuTiqJfcdGkXw8A'\n request_token_url = 'https://api.twitter.com/oauth/request_token'\n acces...
[ 4, 6, 8, 10, 11 ]
''' Code for mmDGM Author: Chongxuan Li (chongxuanli1991@gmail.com) Version = '1.0' ''' import gpulearn_mm_z_x import sys, os import time import color n_hidden = (500,500) if len(sys.argv) > 2: n_hidden = tuple([int(x) for x in sys.argv[2:]]) nz=500 if os.environ.has_key('nz'): nz = int(os.environ['nz']) if os.en...
normal
{ "blob_id": "40158bbfd9c95a8344f34431d0b0e98c4a1bf6ed", "index": 476, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) > 2:\n n_hidden = tuple([int(x) for x in sys.argv[2:]])\n<mask token>\nif os.environ.has_key('nz'):\n nz = int(os.environ['nz'])\nif os.environ.has_key('stepsize'):\...
[ 0, 1, 2, 3, 4 ]
#1. Create a greeting for your program. print("Welcome to the Band Name Generator") #2. Ask the user for the city that they grew up in. city = input("Which city did you grew up in?\n") #3. Ask the user for the name of a pet. pet = input("What is the name of the pet?\n") #4. Combine the name of their city and pet an...
normal
{ "blob_id": "19962e94afdd3edf298b28b9954f479fefa3bba8", "index": 8656, "step-1": "<mask token>\n", "step-2": "print('Welcome to the Band Name Generator')\n<mask token>\nprint('Your band name could be ', Band_name)\n", "step-3": "print('Welcome to the Band Name Generator')\ncity = input('Which city did you ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> init() <|reserved_special_token_1|> <|reserved_special_token_0|> lib = ctypes.CDLL('/home/ubuntu/workspace/35SmartPy/CAN/brain/CANlib.so') init = lib.init read = lib.readGun read.restype = ctypes.POINTER(ctypes.c_ubyte * 8) sen...
flexible
{ "blob_id": "866571341a587c8b1b25437f5815429875bbe5ad", "index": 9285, "step-1": "<mask token>\n", "step-2": "<mask token>\ninit()\n", "step-3": "<mask token>\nlib = ctypes.CDLL('/home/ubuntu/workspace/35SmartPy/CAN/brain/CANlib.so')\ninit = lib.init\nread = lib.readGun\nread.restype = ctypes.POINTER(ctypes....
[ 0, 1, 2, 3 ]
import os print(os.name) #print(os.environ) print(os.environ.get('PATH')) print(os.path.abspath('.')) os.path.join(os.path.abspath('.'),'testdir') os.mkdir(os.path.abspath('.'))
normal
{ "blob_id": "fd059ae6e5eb3f7dc18dff6f9ed206002cea5fb2", "index": 9788, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(os.name)\nprint(os.environ.get('PATH'))\nprint(os.path.abspath('.'))\nos.path.join(os.path.abspath('.'), 'testdir')\nos.mkdir(os.path.abspath('.'))\n", "step-3": "import os\nprint...
[ 0, 1, 2, 3 ]
from django.db import models # Create your models here. class Position(models.Model): title = models.CharField(max_length=50) def __str__(self): return self.title class Employee(models.Model): nom = models.CharField(max_length=100) prenom = models.CharField(max_length=100) age= models.Cha...
normal
{ "blob_id": "5ab20c1cd2dc0d0ad881ee52008d00c2317084f9", "index": 5308, "step-1": "<mask token>\n\n\nclass Position(models.Model):\n <mask token>\n <mask token>\n\n\nclass Employee(models.Model):\n nom = models.CharField(max_length=100)\n prenom = models.CharField(max_length=100)\n age = models.Cha...
[ 5, 6, 7, 8, 9 ]
def solution(record): answer = [] db = {} chatting = [] for log in record: log_list = log.split() if log_list[0] == 'Enter': db[log_list[1]] = log_list[2] chatting.append([True, log_list[1]]) elif log_list[0] == 'Leave': chatting.append([Fals...
normal
{ "blob_id": "3ffe16494eb45896563a2952f3bcf80fc19b2750", "index": 1226, "step-1": "<mask token>\n", "step-2": "def solution(record):\n answer = []\n db = {}\n chatting = []\n for log in record:\n log_list = log.split()\n if log_list[0] == 'Enter':\n db[log_list[1]] = log_lis...
[ 0, 1, 2, 3 ]
from django.contrib import admin from .models import TutorialsReview, TutorialsReviewComment admin.site.register(TutorialsReview) admin.site.register(TutorialsReviewComment)
normal
{ "blob_id": "fea0619263b081f60ed0a4e178ef777a8d5dc988", "index": 6500, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(TutorialsReview)\nadmin.site.register(TutorialsReviewComment)\n", "step-3": "from django.contrib import admin\nfrom .models import TutorialsReview, TutorialsReviewCo...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class product_product(orm.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _get_sale_quotation_qty(self, cr, uid, product_id, context=None): """get all qty of the product in all sale quotations (draft, sent)""" ...
flexible
{ "blob_id": "19d86c64876575ed9b3f5e33dd44e7633c96e696", "index": 2401, "step-1": "<mask token>\n\n\nclass product_product(orm.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def _get_sale_quotation_qty(self, cr, uid, product_id, context=None):\n \"\"\"get all qty of the product in all...
[ 2, 6, 8, 9, 10 ]
from sqlalchemy import create_engine from sqlalchemy import Table,Column,Integer,String,MetaData,ForeignKey from sqlalchemy.sql import select from sqlalchemy import text #Creating a database 'college.db' engine = create_engine('sqlite:///college.db', echo=True) meta = MetaData() #Creating a Students table s...
normal
{ "blob_id": "7ea6fefa75d36ff45dcea49919fdc632e378a73f", "index": 9113, "step-1": "<mask token>\n", "step-2": "<mask token>\nmeta.create_all(engine)\n<mask token>\nconn.execute(students.insert(), [{'name': 'Rajiv', 'lastname': 'Khanna'}, {\n 'name': 'Komal', 'lastname': 'Bhandari'}, {'name': 'Abdul', 'lastna...
[ 0, 1, 2, 3, 4 ]
import sys, time from machine import Pin print('LOAD: blinker.py') def blink_connected_to_wifi(pin=23): _blink_pattern(pin, [[3, 0.5, 0.5], [4, 0.2, 0.2]]) def blink_not_connected_to_wifi(pin=23): _blink_pattern(pin, [[2, 0.2, 0.2], [1, 0.5, 0.5], [2, 0.2, 0.2], [1, 0.5, 0.5]]) # pin - the pin, connected ...
normal
{ "blob_id": "c0bd060990d00ab50c9f2d3060b7f975ff16e1ab", "index": 4105, "step-1": "<mask token>\n\n\ndef blink_connected_to_wifi(pin=23):\n _blink_pattern(pin, [[3, 0.5, 0.5], [4, 0.2, 0.2]])\n\n\n<mask token>\n\n\ndef _blink_pattern(pin, pattern):\n p = Pin(pin, Pin.OUT)\n try:\n for item in patt...
[ 2, 3, 4, 5, 6 ]
""" This file is part of GALE, Copyright Joe Krall, 2014. GALE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version...
normal
{ "blob_id": "957545649e9bf1eaabe42a1caa627d544e68f108", "index": 5490, "step-1": "\"\"\"\n This file is part of GALE,\n Copyright Joe Krall, 2014.\n\n GALE is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Fr...
[ 0 ]
from concurrent.futures import ProcessPoolExecutor from nltk import PorterStemmer, RegexpTokenizer from stop_words import get_stop_words class Preprocessor(object): def __init__(self, max_workers=4): self.max_workers = max_workers self.tokenizer = RegexpTokenizer(r"\w+") self.en_stopwords...
normal
{ "blob_id": "8cd50e1f0e0feb4d753443220f9fa9065e80e0ef", "index": 6358, "step-1": "<mask token>\n\n\nclass Preprocessor(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass WithUrlPreprocessor(Preprocessor):\n\n def __init__(self, max_workers=4):\n ...
[ 4, 6, 7, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> torch.nn.functional.adaptive_avg_pool3d(**data) <|reserved_special_token_1|> <|reserved_special_token_0|> data = pickle.load(open('dd0eb7901523d494d4aa324f474c782063e9e231.p', 'rb')) torch.nn.functional.adaptive_avg_pool3d(**da...
flexible
{ "blob_id": "20d09a616133295a6162a7ab1d7970ccbaf6de95", "index": 1331, "step-1": "<mask token>\n", "step-2": "<mask token>\ntorch.nn.functional.adaptive_avg_pool3d(**data)\n", "step-3": "<mask token>\ndata = pickle.load(open('dd0eb7901523d494d4aa324f474c782063e9e231.p', 'rb'))\ntorch.nn.functional.adaptive_a...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(M): temp = list(map(int, input().split())) k = temp[0] switches = temp[1:] for j in range(k): lights[i][switches[j] - 1] = 1 <|reserved_special_token_0|> for i in range(2 ** N): flag = Tr...
flexible
{ "blob_id": "c4ac7ff5d45af9d325f65b4d454a48ca0d8f86df", "index": 8808, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(M):\n temp = list(map(int, input().split()))\n k = temp[0]\n switches = temp[1:]\n for j in range(k):\n lights[i][switches[j] - 1] = 1\n<mask token>\nfor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> source_root_dir = '/home/songsong/image_transport_ws/src' whitelisted_packages = ''.split(';') if '' != '' else [] blacklisted_packages = ''.split(';') if '' != '' else [] underlay_workspaces = ( '/home/songsong/image_transport_ws/devel;/home/songsong/pib...
flexible
{ "blob_id": "86ca94820c05b3f63f4a733b6d1fa7eb9dea6a5d", "index": 325, "step-1": "<mask token>\n", "step-2": "source_root_dir = '/home/songsong/image_transport_ws/src'\nwhitelisted_packages = ''.split(';') if '' != '' else []\nblacklisted_packages = ''.split(';') if '' != '' else []\nunderlay_workspaces = (\n ...
[ 0, 1, 2 ]
from keras.layers import Dense, Activation, Dropout from keras.utils.visualize_util import plot from keras.models import Sequential from emotions import FER2013Dataset _deep_models = {} def deep_model(model_name): def wrapper(cls): _deep_models[model_name] = cls return cls return wrapper ...
normal
{ "blob_id": "36257340ebbc6bd2c7fa5995511b2c859f58f8e5", "index": 3232, "step-1": "<mask token>\n\n\nclass DeepModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n@deep_model('trivial')\nclass DummyModel(DeepModel):\n\n def b...
[ 7, 12, 13, 14, 18 ]
<|reserved_special_token_0|> class CatalogService(BaseService): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CatalogService(BaseService): name = 'catalog' <|reserved_special_token_1|> <|reserved_special_token_0|> class Catalog(BaseJsonEncodableObject):...
flexible
{ "blob_id": "37feeba8ff682e5998fde4bcba8c37043cb593f2", "index": 5195, "step-1": "<mask token>\n\n\nclass CatalogService(BaseService):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CatalogService(BaseService):\n name = 'catalog'\n", "step-3": "<mask token>\n\n\nclass Catalog(BaseJsonEncodableOb...
[ 1, 2, 3, 5, 6 ]
import os import base64 from urllib.parse import urlencode import json from flask import Blueprint, request, redirect, jsonify, make_response import requests spotify = Blueprint('spotify', __name__) # Client Keys SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID') SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY...
normal
{ "blob_id": "f080191fec4e56adc4013da74c840817e88caf56", "index": 869, "step-1": "<mask token>\n\n\n@spotify.route('/callback')\ndef callback():\n auth_code = request.args['code']\n code_payload = {'grant_type': 'authorization_code', 'code': str(\n auth_code), 'redirect_uri': REDIRECT_URI}\n base6...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='pass-manager', version='1.2.0', author='petitviolet', author_email='violethero0820@gmail.com', packages=find_packages(), description='Simple CLI Password Manager', long_description= 'Please show help (pass-...
flexible
{ "blob_id": "31664f1cc808ccc0dad230e2b955692c7ae12db1", "index": 1792, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='pass-manager', version='1.2.0', author='petitviolet',\n author_email='violethero0820@gmail.com', packages=find_packages(),\n description='Simple CLI Password Manager', l...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT ) <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('admin/', admin.site.urls), path('accoun...
flexible
{ "blob_id": "bf1221bc9768cff2edb67e0e5f5cea0ee2dd64e5", "index": 7740, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT\n )\n", "step-3": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls...
[ 0, 1, 2, 3, 4 ]
class TestRawJob: def __init__(self, parsedRow): values = [string.strip().lower() for string in parsedRow] keys = ["Id", "Title", "Description", "Raw Location", "Normalized Location", "Contract Type", "Contract Time", "Company", "Category", "Source"] self.data = dict(zip(keys, values))
normal
{ "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 ]
<|reserved_special_token_0|> class EHRdataFromPickles(Dataset): def __init__(self, root_dir, file=None, transform=None, sort=True, model='RNN', test_ratio=0, valid_ratio=0): """ Args: 1) root_dir (string): Path to pickled file(s). The directory c...
flexible
{ "blob_id": "0cef70b8d661fe01ef4a1eda83a21e1186419a0d", "index": 5038, "step-1": "<mask token>\n\n\nclass EHRdataFromPickles(Dataset):\n\n def __init__(self, root_dir, file=None, transform=None, sort=True,\n model='RNN', test_ratio=0, valid_ratio=0):\n \"\"\"\n Args:\n 1) root_...
[ 15, 16, 17, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test(conf): device = conf['device'] dataset = conf['test_dataset'] classes = conf['data']['classes'] weights_path = conf['weights_path'] results_dir = conf['results_dir'] model = conf['model'] mod...
flexible
{ "blob_id": "b57b6df1b7e551f64033a0c47e5a22eab9fd5fd4", "index": 7616, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test(conf):\n device = conf['device']\n dataset = conf['test_dataset']\n classes = conf['data']['classes']\n weights_path = conf['weights_path']\n results_dir = con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('estafilococo: ', round(r[0], 1)) print('salmonela: ', round(r[1], 1)) print('coli: ', round(r[2], 1)) if r[0] == min(r): print('estafilococo') elif r[1] == min(r): print('salmonela') elif r[2] == min(r): print('...
flexible
{ "blob_id": "0f3e12f35cc29a71be5b8e6d367908e31c200c38", "index": 3896, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('estafilococo: ', round(r[0], 1))\nprint('salmonela: ', round(r[1], 1))\nprint('coli: ', round(r[2], 1))\nif r[0] == min(r):\n print('estafilococo')\nelif r[1] == min(r):\n pr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Tabuleiro: def __init__(self): self.jogo = classejogo.Jogo() self.window = tk.Tk() self.window.title('Jogo da Velha') self.window.geometry('300x360+100+100') self.window.rowconfigure(0, minsize=30, weight=1) self.window.rowconfigu...
flexible
{ "blob_id": "9cff227eeeaffda777668aa3b90e3839426da811", "index": 6683, "step-1": "<mask token>\n\n\nclass Tabuleiro:\n\n def __init__(self):\n self.jogo = classejogo.Jogo()\n self.window = tk.Tk()\n self.window.title('Jogo da Velha')\n self.window.geometry('300x360+100+100')\n ...
[ 9, 12, 15, 16, 18 ]
<|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": "049d83bc1a31ef170654fda47d1f58e024befb44", "index": 8220, "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 = [('electra', '...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import random import helper as hp def insertion_sort(items, start, end): """ Arguments: - `items`: """ n = end - start + 1 for i in range(start+1, end+1): for j in range(i, start, -1): if items[j] < items[j-1]: ...
normal
{ "blob_id": "e2e34db52e17c188cab63a870f0bc77cbc9ef922", "index": 3355, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport sys\nimport random\n\nimport helper as hp\n\ndef insertion_sort(items, start, end):\n \"\"\"\n\n Arguments:\n - `items`:\n \"\"\"\n n = end - start + 1\n for ...
[ 0 ]
from UI.Window import Window class PolygonApplication: def __init__(self): self.window = Window( "Détermination des périmètre, surface et centre de gravité d'un polygone" ) self.window.addMouseClickListener(self.window.onClick) def start(self): self.window.sho...
normal
{ "blob_id": "795bd22fb805069b342915638c52900ea52a4939", "index": 9321, "step-1": "<mask token>\n\n\nclass PolygonApplication:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PolygonApplication:\n <mask token>\n\n def start(self):\n self.window.show()\n", "step-3": "<ma...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): import pytest errcode = pytest.main(self.test_args) sys.exit(errcode) <|res...
flexible
{ "blob_id": "bd2a5c2dd3eef5979c87a488fb584dce740ccb05", "index": 3870, "step-1": "<mask token>\n\n\nclass PyTest(TestCommand):\n\n def finalize_options(self):\n TestCommand.finalize_options(self)\n self.test_args = []\n self.test_suite = True\n\n def run_tests(self):\n import py...
[ 3, 4, 5, 6, 7 ]
from recipes.almahelpers import fixsyscaltimes # SACM/JAO - Fixes __rethrow_casa_exceptions = True context = h_init() context.set_state('ProjectSummary', 'proposal_code', '2017.1.01355.L') context.set_state('ProjectSummary', 'piname', 'unknown') context.set_state('ProjectSummary', 'proposal_title', 'unknown') context.s...
normal
{ "blob_id": "290811317ddb49a7d2a9f44ab7e0b6d201db12e1", "index": 7532, "step-1": "<mask token>\n", "step-2": "<mask token>\ncontext.set_state('ProjectSummary', 'proposal_code', '2017.1.01355.L')\ncontext.set_state('ProjectSummary', 'piname', 'unknown')\ncontext.set_state('ProjectSummary', 'proposal_title', 'un...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_find_current_start_state(): assert 'In-Progress' == Story.find_current_state_name({'Backlog', 'To-Do', 'In-Progress', 'Completed', 'Ready For Prod', 'Deployed'}, {'In-Progress', 'Development'}) <|reserved_special_token_1|> <|reserved_special_token_0|> @py...
flexible
{ "blob_id": "d10c74338ea18ef3e5fb6a4dd2224faa4f94aa62", "index": 9950, "step-1": "<mask token>\n\n\ndef test_find_current_start_state():\n assert 'In-Progress' == Story.find_current_state_name({'Backlog',\n 'To-Do', 'In-Progress', 'Completed', 'Ready For Prod', 'Deployed'},\n {'In-Progress', 'De...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MonteCarloAgent(Agent): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _find_move_from_new_board_state(self, old, new): """ Making a move in Connect Four makes exactly one change to the board. Searc...
flexible
{ "blob_id": "e99cf5a7058db984b323af1375003e4e21e36612", "index": 9305, "step-1": "<mask token>\n\n\nclass MonteCarloAgent(Agent):\n <mask token>\n <mask token>\n <mask token>\n\n def _find_move_from_new_board_state(self, old, new):\n \"\"\"\n Making a move in Connect Four makes exactly ...
[ 5, 8, 9, 10, 11 ]
<|reserved_special_token_0|> def makePDF(filename): file = open(filename, 'r') title = file.readline() pars = [] for line in file: pars.append(line) file.close() pdf = FPDF(unit='pt') pdf.add_page() pdf.set_font('Helvetica', 'U', 16) pdf.cell(595, 16, txt=title, ln=1, align...
flexible
{ "blob_id": "58fb2676b599b5f7fb9041cfae113a9d428d8ef8", "index": 4503, "step-1": "<mask token>\n\n\ndef makePDF(filename):\n file = open(filename, 'r')\n title = file.readline()\n pars = []\n for line in file:\n pars.append(line)\n file.close()\n pdf = FPDF(unit='pt')\n pdf.add_page()...
[ 2, 3, 4, 5, 6 ]
import unittest import sys import matplotlib.pyplot as plotter import numpy sys.path.append("/home/adityas/UGA/SensorWeb/scripts/Summer2018/code") from simulator.component import CPU, DiskIO, Network class TestComponents(unittest.TestCase): def setUp(self): self.cpu = CPU(cycles=5) self.disk = ...
normal
{ "blob_id": "4f54f3e306df3b861124adb4fe544089446e8021", "index": 3453, "step-1": "<mask token>\n\n\nclass TestComponents(unittest.TestCase):\n\n def setUp(self):\n self.cpu = CPU(cycles=5)\n self.disk = DiskIO(cycles=5)\n self.network = Network(cycles=5)\n\n def test_cpu_length(self):\...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', views.view_basket, name='basket'), url( '^add/(?P<product_pk>\\d+)$', views.add_to_basket, name='add_to_basket' ), url('^remove/(?P<basketitem_pk>\\d+)$', views.remove_from_basket, name='remove...
flexible
{ "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|> 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 Mor...
flexible
{ "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|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(numero_uno) print(numero_dos) <|reserved_special_token_0|> print('el total de la suma de : ' + str(numero_uno) + ' + ' + str( numero_dos) + ' es = a ' + str(total)) <|reserved_special_token_1|> numero_uno = int(input...
flexible
{ "blob_id": "5685befae923fc336a2a5e0eb5e382c2e7d82d04", "index": 9613, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(numero_uno)\nprint(numero_dos)\n<mask token>\nprint('el total de la suma de : ' + str(numero_uno) + ' + ' + str(\n numero_dos) + ' es = a ' + str(total))\n", "step-3": "numero...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def counseling(pay, row): global max_sum if row == N - 1: if arr[row][0] == 1: pay += arr[row][1] max_sum = max(pay, max_sum) return if row == N: max_sum = max(pay, max_sum) return if row > N - 1: return couns...
flexible
{ "blob_id": "9db2377f15aaf28373959dad88c6ec7b6dacffd2", "index": 9512, "step-1": "<mask token>\n\n\ndef counseling(pay, row):\n global max_sum\n if row == N - 1:\n if arr[row][0] == 1:\n pay += arr[row][1]\n max_sum = max(pay, max_sum)\n return\n if row == N:\n max...
[ 1, 2, 3, 4, 5 ]
from django.db import models class Brokerage(models.Model): BrokerageName = models.CharField(max_length=500) #To-Do Fix additional settings for ImagesFields/FileFields #BrokerageLogo = ImageField ReviewLink = models.CharField(max_length=1000) ContactLink = models.CharField(max_length=1000) TotalAgents = models.I...
normal
{ "blob_id": "174f744b641ee20272713fa2fe1991cb2c76830a", "index": 99, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Brokerage(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...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python #encoding:utf8 import sys from collections import defaultdict def transform_word(word): ''' 将低频词转为四种形式之一。 ''' if any(c.isdigit() for c in word): return '_NUMERIC_' if word.isupper(): return '_ALL_CAP_' if word[-1].isupper(): return '_LAST_CAP_' ...
normal
{ "blob_id": "92a1f86ce8cc9563d455f9b1336dbcd298f01b6d", "index": 1747, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef transform_word(word):\n \"\"\"\n 将低频词转为四种形式之一。\n \"\"\"\n if any(c.isdigit() for c in word):\n return '_NUMERIC_'\n if word.isupper():\n return '_ALL_...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @implementer(IForm) class Form(Container): """A Form.""" <|reserved_special_token_1|> <|reserved_special_token_0|> class IForm(IBriefyContent): <|reserved_special_token_0|> @implementer(IForm) class Form(Container): """A Form.""" <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "6e3de57f7c65e9f6195dabc3326b05744249cefe", "index": 7991, "step-1": "<mask token>\n\n\n@implementer(IForm)\nclass Form(Container):\n \"\"\"A Form.\"\"\"\n", "step-2": "<mask token>\n\n\nclass IForm(IBriefyContent):\n <mask token>\n\n\n@implementer(IForm)\nclass Form(Container):\n \"\"\"A ...
[ 2, 3, 4, 5, 6 ]
import gc import network import lib.gate as gate import time from micropython import const from ubluetooth import BLE import lib.webserver as webserver bt = BLE() bt.active(True) _IRQ_SCAN_RESULT = const(5) _IRQ_SCAN_DONE = const(6) def byteToMac(addr): m = memoryview(addr) a = "{:0>2X}:{:0>2...
normal
{ "blob_id": "99c60befed32a9aa80b6e66b682d9f475e05a8d1", "index": 2562, "step-1": "<mask token>\n\n\ndef handler(event, data):\n if event == _IRQ_SCAN_RESULT:\n addr_type, addr, adv_type, rssi, adv_data = data\n print(addr_type, memoryview(addr), adv_type, rssi, memoryview(adv_data)\n ...
[ 2, 5, 6, 7, 8 ]
import os import time #if __name__ == "__main__": # os.system('xterm -e "pwd ; cd ~ ; torcs -r ~/quickrace.xml ; echo press RETURN to close this window ; read" &') # delete the echo and the read to don't stop the process and make it run quickly # os.system('xterm -e "pwd ; ./start.sh ; echo press RETURN to close...
normal
{ "blob_id": "c2cf74893c7f7515a95141bb10be6a446b45a0cc", "index": 1447, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train_once():\n os.system('xterm -e \"pwd ; cd ~ ; torcs -r ~/quickrace.xml \" &')\n os.system('xterm -e \"pwd ; ./start.sh \" &')\n return True\n", "step-3": "import...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class OracleParam: force_bytes: Any = ... input_size: Any = ... def __init__(self, param: Any, cursor: Any, strings_only: bool=...) ->None: ... class VariableWrapper: var: Any = ... def __init__(self, var: Any) ->None: ... def bind_parameter(se...
flexible
{ "blob_id": "829b8cd0b648d39c07c20fd1c401bf717ed5b9c4", "index": 9682, "step-1": "<mask token>\n\n\nclass OracleParam:\n force_bytes: Any = ...\n input_size: Any = ...\n\n def __init__(self, param: Any, cursor: Any, strings_only: bool=...) ->None:\n ...\n\n\nclass VariableWrapper:\n var: Any =...
[ 16, 20, 25, 27, 31 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('cross-vali score is: {}'.format(score.mean())) <|reserved_special_token_0|> for train_index, test_index in kfold.split(iris.data, iris.target): print(train_index, test_index) <|reserved_special_token_0|> def simple_gr...
flexible
{ "blob_id": "aaa0ac5e31e2c10b5baba6077e952fff1a92ef82", "index": 882, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('cross-vali score is: {}'.format(score.mean()))\n<mask token>\nfor train_index, test_index in kfold.split(iris.data, iris.target):\n print(train_index, test_index)\n<mask token>\n...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/env python ''' Created on 2011-08-27 @author: xion Setup script for the seejoo project. ''' import ast import os from setuptools import find_packages, setup def read_tags(filename): """Reads values of "magic tags" defined in the given Python file. :param filename: Python filename to read the tag...
normal
{ "blob_id": "9d1b795b561a26ae28e82833485ca6034438e78b", "index": 8491, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef read_tags(filename):\n \"\"\"Reads values of \"magic tags\" defined in the given Python file.\n\n :param filename: Python filename to read the tags from\n :return: Dictio...
[ 0, 2, 3, 4, 5 ]
def memo(fn): cache = {} missed = object() def query(*args): result = cache.get(args, missed) if result is missed: result = cache[args] = fn(*args) return result return query @memo def cal_edit_distance(ori, tar): def edit_tuple(old, distance, path): r...
normal
{ "blob_id": "88390f411af90d494284617ef8f5fb0e9bb8890e", "index": 8039, "step-1": "def memo(fn):\n cache = {}\n missed = object()\n\n def query(*args):\n result = cache.get(args, missed)\n if result is missed:\n result = cache[args] = fn(*args)\n return result\n return ...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('levantamiento', '0001_initial'), ] operations = [ migrations.CreateModel( name='FichaTecnica', field...
normal
{ "blob_id": "1049a7d2cdc54c489af6246ec014deb63a98f96d", "index": 3951, "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 = [('levantamien...
[ 0, 1, 2, 3, 4 ]
n=int(input("val : ")) def fact(n): c=1; for i in range(1,n+1): c*=i; return c; print(fact(n));
normal
{ "blob_id": "1f4d9f5406b91fd687c0ace8ed29e3c4dfb4d3d2", "index": 8748, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fact(n):\n c = 1\n for i in range(1, n + 1):\n c *= i\n return c\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef fact(n):\n c = 1\n for i in range(1...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def createMatchFeed(request, teamwedstrijd=None): cal = EventFeed(teamwedstrijd) return cal.__call__(request) @login_required def viewMatch(request, match): try: m = Match.objects.get(id=match) except Match.DoesNotExist: raise Http404 teams = m.getHer...
flexible
{ "blob_id": "480787d7bc0e87df7c59c4deb402eea76643680c", "index": 7529, "step-1": "<mask token>\n\n\ndef createMatchFeed(request, teamwedstrijd=None):\n cal = EventFeed(teamwedstrijd)\n return cal.__call__(request)\n\n\n@login_required\ndef viewMatch(request, match):\n try:\n m = Match.objects.get...
[ 6, 8, 9, 11, 13 ]
<|reserved_special_token_0|> class TipoUsuarios(db.Model): id = db.Column(db.Integer, primary_key=True, nullable=False) texto = db.Column(db.String(50)) usuarios = db.relationship('Usuarios', backref='tipo', lazy='dynamic') def __init__(self, texto): self.texto = texto class Usuarios(db.Mod...
flexible
{ "blob_id": "d7240703bc4cf9b566e7b50a536c83497cd8c6d7", "index": 7116, "step-1": "<mask token>\n\n\nclass TipoUsuarios(db.Model):\n id = db.Column(db.Integer, primary_key=True, nullable=False)\n texto = db.Column(db.String(50))\n usuarios = db.relationship('Usuarios', backref='tipo', lazy='dynamic')\n\n...
[ 7, 8, 10, 11, 12 ]
class Solution(object): def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ ln=len(nums) k=k%ln nums[:]=nums+nums[:ln-k] del nums[0:ln-k] #menthod 2自己输入[1,2],k=...
normal
{ "blob_id": "a3ccd526b70db2061566274852a7fc0c249c165a", "index": 6931, "step-1": "class Solution(object):\n def rotate(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: void Do not return anything, modify nums in-place instead.\n \"\"\"\n ln=le...
[ 0 ]
<|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": "d5beff74e3746c77cbaf6b8233b822ed1a86701e", "index": 316, "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 = [('task', '0022...
[ 0, 1, 2, 3, 4 ]
import pygame as pg screen = pg.display.set_mode((640, 380))
normal
{ "blob_id": "c1374a048187807deac5d28dda4fbc7beeccf8f5", "index": 5221, "step-1": "<mask token>\n", "step-2": "<mask token>\nscreen = pg.display.set_mode((640, 380))\n", "step-3": "import pygame as pg\nscreen = pg.display.set_mode((640, 380))\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
array_length = int(input()) source = [int(x) for x in input().split()] def find_neighbors(): previous_zero_index = -1 count = 0 result = [] for index, value in enumerate(source): count += 1 if value == 0: if index == 0: previous_zero_index = 0 ...
normal
{ "blob_id": "6d362b87b595fc59df31d1f0bb561dc83633a2ac", "index": 9216, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_neighbors():\n previous_zero_index = -1\n count = 0\n result = []\n for index, value in enumerate(source):\n count += 1\n if value == 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for match in matcher: print(match.start()) print(match.group()) <|reserved_special_token_1|> <|reserved_special_token_0|> x = '[a-zA-Z]' matcher = re.finditer(x, 'abtABIkz') for match in matcher: print(match.start()...
flexible
{ "blob_id": "1ddc261cf174c109583fd0ead1f537673d29090a", "index": 1433, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor match in matcher:\n print(match.start())\n print(match.group())\n", "step-3": "<mask token>\nx = '[a-zA-Z]'\nmatcher = re.finditer(x, 'abtABIkz')\nfor match in matcher:\n p...
[ 0, 1, 2, 3, 4 ]
import os from flask import Flask from flask import request result="" app = Flask(__name__) @app.route('/postjson', methods = ['POST']) def postJsonHandler(): global result #print (request.is_json) content = request.get_json() #print (content) #print ("true") #print (content["encode"]) #p...
normal
{ "blob_id": "607fc97c4520c7f54ee44e768776ceae2b70c378", "index": 190, "step-1": "import os\nfrom flask import Flask\nfrom flask import request\nresult=\"\" \napp = Flask(__name__)\n \n@app.route('/postjson', methods = ['POST'])\ndef postJsonHandler():\n global result\n #print (request.is_json)\n content...
[ 0 ]
<|reserved_special_token_0|> class Program(ProgramTemplate): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def validate(self): print('Validating inputs', file=self.logger) self.data_manager.has_models(raise_sorry=True, expected_n=1, ...
flexible
{ "blob_id": "e1228f5e17bae6632f8decd114f72723dbbce944", "index": 6186, "step-1": "<mask token>\n\n\nclass Program(ProgramTemplate):\n <mask token>\n <mask token>\n <mask token>\n\n def validate(self):\n print('Validating inputs', file=self.logger)\n self.data_manager.has_models(raise_so...
[ 3, 5, 6, 7, 8 ]
from datetime import datetime start = datetime.now() # Poker Hand Analyser Library for Project Euler: Problem 54 from collections import namedtuple # import pe_lib def character_frequency(s): freq = {} for i in s: if i in freq: freq[i] += 1 else: freq[i] = 1 return freq suits = "HDCS".split() faces = "2...
normal
{ "blob_id": "561763d4d7b613446f2890ef629b631542f2f472", "index": 2776, "step-1": "<mask token>\n\n\nclass Card(namedtuple('Card', 'face, suit')):\n\n def __repr__(self):\n return ''.join(self)\n\n\ndef royal_flush(hand):\n royalface = 'TJQKA'\n ordered = sorted(hand, key=lambda card: (faces.index...
[ 7, 8, 10, 17, 19 ]
<|reserved_special_token_0|> class GoogleSheet(GoogleDrive): <|reserved_special_token_0|> <|reserved_special_token_0|> def create_spreadsheet(self, spreadsheet_name: str): """ Creates a spreadsheet, returning the newly created spreadsheet's ID. Official API guide: ...
flexible
{ "blob_id": "9e793bd0faef65dfe8ac4b722e50d2055837449f", "index": 4701, "step-1": "<mask token>\n\n\nclass GoogleSheet(GoogleDrive):\n <mask token>\n <mask token>\n\n def create_spreadsheet(self, spreadsheet_name: str):\n \"\"\"\n Creates a spreadsheet, returning the newly created spreadshe...
[ 4, 8, 10, 12, 13 ]
# -*- encoding: utf-8 -*- from django.contrib import admin from finish.wall.models import (Autor, Category, Announcement, Banner, Caricatura, Video, TypePost, Post, Phrase, TypeGalery, ImageGalery, Sponsor) class AutorAdmin(admin.ModelAdmin): pass ...
normal
{ "blob_id": "3c9302b5cb92e5103ed16ec56e1b349f0662950c", "index": 154, "step-1": "<mask token>\n\n\nclass CaricaturaAdmin(admin.ModelAdmin):\n pass\n\n\nclass VideoAdmin(admin.ModelAdmin):\n pass\n\n\nclass TypePostAdmin(admin.ModelAdmin):\n pass\n\n\nclass PostAdmin(admin.ModelAdmin):\n\n\n class Med...
[ 8, 9, 10, 11, 15 ]
import pygame from random import randint, choice BLACK = (0,0,0) #---------------------------------------------------------- class Ball(pygame.sprite.Sprite): #------------------------------------------------------ def __init__(self, color, width, height): # Initialize as a Sprite super(...
normal
{ "blob_id": "6f216420f641c042bb2772b79c10f904ffa21938", "index": 8733, "step-1": "<mask token>\n\n\nclass Ball(pygame.sprite.Sprite):\n\n def __init__(self, color, width, height):\n super().__init__()\n self.image = pygame.Surface([width, height])\n self.image.fill(BLACK)\n self.im...
[ 2, 4, 6, 7, 8 ]
__author__ = 'jjpr' import pyrr import barleycorn as bc def test_xyz123(): cone_x = bc.primitives.Cone(1.0, 1.0)
normal
{ "blob_id": "e6af221f1d6397d0fc52671cdd27d43549d0aecb", "index": 513, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_xyz123():\n cone_x = bc.primitives.Cone(1.0, 1.0)\n", "step-3": "__author__ = 'jjpr'\n<mask token>\n\n\ndef test_xyz123():\n cone_x = bc.primitives.Cone(1.0, 1.0)\n", ...
[ 0, 1, 2, 3 ]
import logging import os import textwrap from urllib.request import urlopen from bs4 import BeautifulSoup from tqdm import tqdm from doc_curation import book_data from doc_curation.md import get_md_with_pandoc from doc_curation.md.file import MdFile from doc_curation.scraping.misc_sites import iitk from doc_curation....
normal
{ "blob_id": "f3a63a22f8746d4a1f127bfe9e8c9d822109ab3c", "index": 463, "step-1": "<mask token>\n\n\ndef dump_all_sargas(base_dir):\n for kaanda_index in book_data.get_subunit_list(file_path=unit_info_file,\n unit_path_list=[]):\n if kaanda_index >= 6:\n continue\n sarga_list = b...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Servo_node: def __init__(self): rospy.init_node('servo_node', anonymous=False) GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) motor_x = 13 motor_y = 12 motor_z = 20 GPIO.setup(motor_x, GPIO.OUT) GPIO.setup(motor_y,...
flexible
{ "blob_id": "95845aeb47e0d2c579739767ece35f4134564d98", "index": 7717, "step-1": "<mask token>\n\n\nclass Servo_node:\n\n def __init__(self):\n rospy.init_node('servo_node', anonymous=False)\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BCM)\n motor_x = 13\n motor_y = 12\n ...
[ 7, 8, 10, 11, 12 ]
# Generated by Django 3.1.3 on 2020-11-27 02:17 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('foodBookApp', '0027_remove_post_total_comments'), ] ...
normal
{ "blob_id": "84d9400dc4ee0bebce3f5f7da0bd77a280bb54a9", "index": 8503, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
n = int(input()) lista = [] for i in range(n): inp = int(input()) lista.append(inp) lista.sort(reverse=True) print(lista[0]) print(lista[1])
normal
{ "blob_id": "b03960999fa30a55932ada7fbf731a3861b840ae", "index": 3496, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n inp = int(input())\n lista.append(inp)\nlista.sort(reverse=True)\nprint(lista[0])\nprint(lista[1])\n", "step-3": "n = int(input())\nlista = []\nfor i in range...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class LunchWizard(models.TransientModel): <|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 LunchWizard(m...
flexible
{ "blob_id": "85e5bf57f7eba2cbee0fbb8a4d37b5180208f9b7", "index": 3830, "step-1": "<mask token>\n\n\nclass LunchWizard(models.TransientModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass LunchWizard(models.TransientModel):\n ...
[ 1, 2, 3, 4, 5 ]
# -*- coding:utf-8 -*- import time import random import numpy as np from collections import defaultdict class Simulator(object): ALLOCATION_INTERVAL_MEAN = 150 ALLOCATION_INTERVAL_STDEV = 30 AFTER_ALLOCATION_INTERVAL_MEAN = 150 AFTER_ALLOCATION_INTERVAL_STDEV = 30 CLICK_INTERVAL_MEAN = 30 CLICK_INTERVAL_STDEV = ...
normal
{ "blob_id": "7378f76b4c1f67d8a549aa2a88db8caa9b05338e", "index": 4441, "step-1": "# -*- coding:utf-8 -*-\nimport time\nimport random\nimport numpy as np\nfrom collections import defaultdict\n\nclass Simulator(object):\n\tALLOCATION_INTERVAL_MEAN = 150\n\tALLOCATION_INTERVAL_STDEV = 30\n\tAFTER_ALLOCATION_INTERVA...
[ 0 ]
"""Tests for flatten_me.flatten_me.""" import pytest ASSERTIONS = [ [[1, [2, 3], 4], [1, 2, 3, 4]], [[['a', 'b'], 'c', ['d']], ['a', 'b', 'c', 'd']], [['!', '?'], ['!', '?']], [[[True, False], ['!'], ['?'], [71, '@']], [True, False, '!', '?', 71, '@']] ] @pytest.mark.parametrize("n, result", ASSERTI...
normal
{ "blob_id": "c233ce4e14e9a59a9fb0f29589ced947efeb73a9", "index": 3120, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize('n, result', ASSERTIONS)\ndef test_flatten_me(n, result):\n \"\"\"Test flatten_me() for proper output in test cases.\"\"\"\n from flatten_me import flat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> img.itemset((100, 100, 2), 99) <|reserved_special_token_1|> <|reserved_special_token_0|> img = cv2.imread('imgs/1.png') pixel = img[100, 100] img[100, 100] = [57, 63, 99] b = img[100, 100, 0] g = img[100, 100, 1] r = img[100, 1...
flexible
{ "blob_id": "d13f06afeac938fc2cf4d3506b3f68c6de9de210", "index": 6596, "step-1": "<mask token>\n", "step-2": "<mask token>\nimg.itemset((100, 100, 2), 99)\n", "step-3": "<mask token>\nimg = cv2.imread('imgs/1.png')\npixel = img[100, 100]\nimg[100, 100] = [57, 63, 99]\nb = img[100, 100, 0]\ng = img[100, 100, ...
[ 0, 1, 2, 3, 4 ]
''' Run from the command line with arguments of the CSV files you wish to convert. There is no error handling so things will break if you do not give it a well formatted CSV most likely. USAGE: python mycsvtomd.py [first_file.csv] [second_file.csv] ... OUTPUT: first_file.md second_file.md ... ''' import sys import cs...
normal
{ "blob_id": "28851979c8f09f3cd1c0f4507eeb5ac2e2022ea0", "index": 8362, "step-1": "'''\nRun from the command line with arguments of the CSV files you wish to convert.\nThere is no error handling so things will break if you do not give it a well\nformatted CSV most likely.\n\nUSAGE: python mycsvtomd.py [first_file...
[ 0 ]
import numpy as np class SampleMemory(object): def __init__(self, item_shape, max_size): self.memory = np.zeros((max_size,) + item_shape) self.item_shape = item_shape self.num_stored = 0 self.max_size = max_size self.tail_index = 0 def sample(self, num_sampl...
normal
{ "blob_id": "89dfd9a32b008307eb4c456f2324804c29f3b68f", "index": 6510, "step-1": "<mask token>\n\n\nclass SampleMemory(object):\n <mask token>\n <mask token>\n <mask token>\n\n def append(self, item):\n self.memory[self.tail_index, :] = item\n self.tail_index = (self.tail_index + 1) % s...
[ 3, 7, 9, 10, 11 ]