code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
def f(p_arg, *s_args, **kw_args): return (s_args[0] + kw_args['py'])+p_arg r = f(3, 2, py = 1) ## value r => 6
normal
{ "blob_id": "4a913cfdbddb2f6b5098395814f5fc1203192b9a", "index": 4847, "step-1": "<mask token>\n", "step-2": "def f(p_arg, *s_args, **kw_args):\n return s_args[0] + kw_args['py'] + p_arg\n\n\n<mask token>\n", "step-3": "def f(p_arg, *s_args, **kw_args):\n return s_args[0] + kw_args['py'] + p_arg\n\n\nr...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python from taskHandler import Location, Task, TaskFactory import roslib; roslib.load_manifest('smart_stool') import rospy from geometry_msgs.msg import PoseStamped, Twist, Vector3 from nav_msgs.msg import Odometry from kobuki_msgs.msg import BumperEvent from move_base_msgs.msg import MoveBaseActionRes...
normal
{ "blob_id": "234112ec16af39b79849dd08769597771fa2c38f", "index": 3425, "step-1": "#! /usr/bin/env python\n\nfrom taskHandler import Location, Task, TaskFactory\nimport roslib; roslib.load_manifest('smart_stool')\nimport rospy\nfrom geometry_msgs.msg import PoseStamped, Twist, Vector3\nfrom nav_msgs.msg import Od...
[ 0 ]
<|reserved_special_token_0|> def SetCu2Wave(): """Set the parameters to the two-line Cu K alpha 1+2 spectrum """ parmDict['wave'] = {i: v for i, v in enumerate((1.540596, 1.544493))} parmDict['int'] = {i: v for i, v in enumerate((0.653817, 0.346183))} parmDict['lwidth'] = {i: v for i, v in enumera...
flexible
{ "blob_id": "3b1426e0f29093e1e462765bcf1d351a064b9639", "index": 142, "step-1": "<mask token>\n\n\ndef SetCu2Wave():\n \"\"\"Set the parameters to the two-line Cu K alpha 1+2 spectrum\n \"\"\"\n parmDict['wave'] = {i: v for i, v in enumerate((1.540596, 1.544493))}\n parmDict['int'] = {i: v for i, v i...
[ 7, 8, 9, 10, 11 ]
import random firstNames = ("Thomas", "Daniel", "James", "Aaron", "Tommy", "Terrell", "Jack", "Joseph", "Samuel", "Quinn", "Hunter", "Vince", "Young", "Ian", "Erving", "Leo") lastNames = ("Smith", "Johnson", "Williams", "Kline","Brown", "Garcia", "Jones", "Miller", "Davis","Williams", "Alves", "Sobronsky", "Hall"...
normal
{ "blob_id": "5607d4fea315fa7bf87337453fbef90a93a66516", "index": 3968, "step-1": "<mask token>\n\n\nclass profile:\n\n def __init__(self):\n self.name = firstNames[random.randrange(0, len(firstNames))\n ] + ' ' + lastNames[random.randrange(0, len(lastNames))]\n self.years = 2020\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(owog.find('e')) print(owog.count('e')) print(owog[2:10]) <|reserved_special_token_0|> if a > b: print('a too ih') elif a == b: print('tentsuu') else: print('b too ih') <|reserved_special_token_0|> for i in range(...
flexible
{ "blob_id": "c4ca4b5c77c3c912b44a4853be30298ec845c4fd", "index": 243, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(owog.find('e'))\nprint(owog.count('e'))\nprint(owog[2:10])\n<mask token>\nif a > b:\n print('a too ih')\nelif a == b:\n print('tentsuu')\nelse:\n print('b too ih')\n<mask to...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def sample_1(N): numeros = np.array([-10, -5, 3, 9]) return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3]) def sample_2(N): return np.random.exponential(0.5, N) def get_mean(sampling_fun, N, M): medias = np.zeros(M) for i in range(M): medias[i] = np.m...
flexible
{ "blob_id": "d2d04686b3d7f8d01ca195750ca625baa06ed098", "index": 2835, "step-1": "<mask token>\n\n\ndef sample_1(N):\n numeros = np.array([-10, -5, 3, 9])\n return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3])\n\n\ndef sample_2(N):\n return np.random.exponential(0.5, N)\n\n\ndef get_mean(sampling...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "016255d74ccf4ac547e4b212d33bb9a39295c830", "index": 2715, "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 = [('khovan', '0...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 def main(): A1, A2, A3 = map(int, input().split()) A=A1+A2+A3 if A >=22: ans='bust' else: ans='win' print(ans) if __name__ == "__main__": main()
normal
{ "blob_id": "753e062940e0580d7d33c88c1165977142dcd202", "index": 8060, "step-1": "<mask token>\n", "step-2": "def main():\n A1, A2, A3 = map(int, input().split())\n A = A1 + A2 + A3\n if A >= 22:\n ans = 'bust'\n else:\n ans = 'win'\n print(ans)\n\n\n<mask token>\n", "step-3": "d...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(len(ss) - ss.count(' ')) <|reserved_special_token_1|> ss = str(input()) print(len(ss) - ss.count(' '))
flexible
{ "blob_id": "7f72f6a2ff0c7ceacb0f893d04c20402e850421a", "index": 1840, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(ss) - ss.count(' '))\n", "step-3": "ss = str(input())\nprint(len(ss) - ss.count(' '))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
class thrs: def __init__(self, input_wave): from numpy import mod, array, sqrt, dot,median,convolve self.D0 = 20 self.last_det = 0 self.mu = 0.6 self.a_up = 0.2 self.a_down = 0.6 self.z_cumulative = 10 self.n_max = max(input_wave[:1000]) self...
normal
{ "blob_id": "2cdee8799678e8ead21a0f81c42eb7ce209cfec7", "index": 7289, "step-1": "class thrs:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class thrs:\n <mask token>\n <mask token>\n\n def getThrs(self, pos):\n if pos - self.last_det < self.D0:\n return self.n...
[ 1, 2, 3, 4, 5 ]
from os import listdir import re import numpy as np from sklearn.metrics import f1_score from sklearn.naive_bayes import MultinomialNB from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import LeaveOneOut import matplotlib.pyplot as plt n_gram_range = (1, 1) alpha_smoothing = 1e-1...
normal
{ "blob_id": "8bb67317ede277e03e8cbdefefeffa3d206ece65", "index": 9434, "step-1": "<mask token>\n\n\ndef parse_doc_line(line):\n parsed = re.search('\\\\d[\\\\d\\\\s]+\\\\d', line)\n return 'empty' if parsed is None else parsed[0]\n\n\ndef get_roc_point(clf, x_set, y_set, threshold):\n loo = LeaveOneOut(...
[ 3, 4, 5, 6, 7 ]
# # struct_test.py # Nazareno Bruschi <nazareno.bruschi@unibo.it> # # Copyright (C) 2019-2020 University of Bologna # # 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.o...
normal
{ "blob_id": "d8d0c181fcfc9e0692369cc7a65259c43a68e931", "index": 5688, "step-1": "<mask token>\n", "step-2": "<mask token>\nPULPNNInstallPath = cwd = os.getcwd() + '/../'\nPULPNNSrcDirs = {'script': PULPNNInstallPath + 'scripts/'}\nPULPNNInstallPath32bit = cwd = os.getcwd() + '/../32bit/'\nPULPNNInstallPath64b...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for case in range(1, cases + 1): digits = [False] * 10 n = int(rf.readline()) if n == 0: wf.write('Case #%s: INSOMNIA\n' % case) continue for i in range(1, 999999): cur = n * i for c...
flexible
{ "blob_id": "0074b0cd1e4317e36ef4a41f8179464c2ec6c197", "index": 8250, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor case in range(1, cases + 1):\n digits = [False] * 10\n n = int(rf.readline())\n if n == 0:\n wf.write('Case #%s: INSOMNIA\\n' % case)\n continue\n for i in r...
[ 0, 1, 2 ]
from sqlalchemy import literal, Column, String, Integer, ForeignKey from sqlalchemy.orm import relationship from common.db import Base class Airplane(Base): __tablename__ = 'airplanes' id = Column(Integer, primary_key=True) icao_code = Column(String(6), unique=True, nullable=False) # ICAO 24-bit identifi...
normal
{ "blob_id": "98dac1ea372f16ecdb818fbe3287ab7e51a0d67c", "index": 7916, "step-1": "<mask token>\n\n\nclass Airplane(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, icao_code, airline, manufacturer=None, ...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def steps_in_tower_of_hanoi(no_of_disks): res = towers_of_hanoi(no_of_disks, 'A', 'C', 'B', []) return res <|reserved_special_token_0|> <|reserved_special_token_1|> def towers_of_hanoi(n, src, dest, temp, res): ...
flexible
{ "blob_id": "f23bfef2daf8fda4249435821dbc2e0b1846e3d6", "index": 9842, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef steps_in_tower_of_hanoi(no_of_disks):\n res = towers_of_hanoi(no_of_disks, 'A', 'C', 'B', [])\n return res\n\n\n<mask token>\n", "step-3": "def towers_of_hanoi(n, src, des...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestCadastro(BaseTest): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestCadastro(BaseTest): def test_cadastro_com_sucesso(self): self.campoDeTreinament...
flexible
{ "blob_id": "4e50a7a757bacb04dc8f292bdaafb03c86042e6c", "index": 1633, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestCadastro(BaseTest):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestCadastro(BaseTest):\n\n def test_cadastro_com_sucesso(self):\n self.campoDeTrein...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SampleAdmin(admin.ModelAdmin): inlines = [MultipleFileInline] prepopulated_fields = {'slug': ('heading',)} <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MultipleFileInline(admin.TabularInline): model = SampleMultipleF...
flexible
{ "blob_id": "d18c45c08face08ce8f7dad915f1896c24c95cbf", "index": 2991, "step-1": "<mask token>\n\n\nclass SampleAdmin(admin.ModelAdmin):\n inlines = [MultipleFileInline]\n prepopulated_fields = {'slug': ('heading',)}\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MultipleFileInline(admin.Tabula...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class director(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <...
flexible
{ "blob_id": "006f499eed7cd5d73bb0cb9b242c90726fff35c1", "index": 3185, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass director(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass director(models.Model)...
[ 0, 1, 2, 3, 4 ]
from typing import * class Solution: def isMonotonic(self, A: List[int]) ->bool: flag = 0 for i in range(1, len(A)): diff = A[i] - A[i - 1] if diff * flag < 0: return False if flag == 0: flag = diff return True sl = Sol...
normal
{ "blob_id": "a55d1286485e66a64aa78259ad1b1922c5c4c831", "index": 4385, "step-1": "<mask token>\n\n\nclass Solution:\n\n def isMonotonic(self, A: List[int]) ->bool:\n flag = 0\n for i in range(1, len(A)):\n diff = A[i] - A[i - 1]\n if diff * flag < 0:\n return...
[ 2, 3, 4, 5 ]
from django.apps import AppConfig class ShortenConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'shorten'
normal
{ "blob_id": "8c2920db7fc49d56aa8da6289cd22272ed3e3283", "index": 4402, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ShortenConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ShortenConfig(AppConfig):\n default_auto_field = 'django.db.models.BigA...
[ 0, 1, 2, 3 ]
import functools import re from pprint import pprint def heading(*, marker=''): ''' Add a new line with the same number of heading markers as the characters in the title Need to specify marker to one of the valid rst line markups ''' def wrapper_heading(func): @functools.wraps(func) ...
normal
{ "blob_id": "d1b2420778e788d78be2a12a27c80f5fa1b15a0f", "index": 465, "step-1": "<mask token>\n\n\ndef code_pre_block(func):\n \"\"\"\n formats a code block according to rst format\n \"\"\"\n\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n block = func(*args, **kwargs)\n n...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with tf.Session() as sess: output = sess.run(z, feed_dict={x: 10, y: 2}) print(output) <|reserved_special_token_1|> <|reserved_special_token_0|> x = tf.placeholder(tf.int32) y = tf.placeholder(tf.int32) u = tf.divide(x,...
flexible
{ "blob_id": "ca91052072d7b2da5729cf55f7f4ba4b54608017", "index": 3477, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n output = sess.run(z, feed_dict={x: 10, y: 2})\n print(output)\n", "step-3": "<mask token>\nx = tf.placeholder(tf.int32)\ny = tf.placeholder(tf.int32)\...
[ 0, 1, 2, 3, 4 ]
from flask import Flask from flask_sqlalchemy import SQLAlchemy from subprocess import call app = Flask(__name__) app.config['SECRET_KEY'] = "SuperSecretKey" #app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql://fmnibhaashbxuy:73b8e2e2485adfd45f57da653d63950b88fdcae12202a84f80c7f4c297e9e30a@ec2-23-23-222-184.compute-...
normal
{ "blob_id": "7b45c9e31bfb868b1abde6af0d8579b52f86d9c3", "index": 5689, "step-1": "<mask token>\n", "step-2": "<mask token>\napp = Flask(__name__)\napp.config['SECRET_KEY'] = 'SuperSecretKey'\napp.config['SQLALCHEMY_DATABASE_URI'\n ] = 'postgresql://info2180-project1:password123@localhost/profilebook'\napp.c...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from .local_settings import * except Exception as e: pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> DATABASES = {'default': dj_database_url.config()} SECURE_PROXY_SSL_HE...
flexible
{ "blob_id": "8bb86cae3387a0d4ce5987f3e3c458c8298174e0", "index": 7342, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from .local_settings import *\nexcept Exception as e:\n pass\n<mask token>\n", "step-3": "<mask token>\nDATABASES = {'default': dj_database_url.config()}\nSECURE_PROXY_SSL_...
[ 0, 1, 2, 3, 4 ]
a=list(input("enter the string or sentence to perform caesar cipher : ")) b=int(input('enter the frequency to perform ceasar cipher ')) e=[] #print(a) #print (a[4]) c=len(a) #print(c) for i in range (0,c): d=ord(a[i]) #print(d) if b> 0: for j in range (1,b+1): if a[i] >='a' ...
normal
{ "blob_id": "287d4c2d490c9dcdd7be7e86fe577139a3d30f54", "index": 6676, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, c):\n d = ord(a[i])\n if b > 0:\n for j in range(1, b + 1):\n if a[i] >= 'a' and a[i] <= 'z' or a[i] >= 'A' and a[i] <= 'Z':\n if ...
[ 0, 1, 2, 3 ]
class Member: not_allowed_name = ["Shit", "Hell", "Baloot"] users_num = 0 def __init__(self, first_name, middle_name, last_name, gender): self.fname = first_name self.mname = middle_name self.lname = last_name self.gender = gender Member.users_num += 1 @classm...
normal
{ "blob_id": "f276e33cde2e043fc8f81403e499544aa816a639", "index": 9316, "step-1": "class Member:\n <mask token>\n <mask token>\n\n def __init__(self, first_name, middle_name, last_name, gender):\n self.fname = first_name\n self.mname = middle_name\n self.lname = last_name\n se...
[ 7, 8, 10, 11, 12 ]
""" .. currentmodule:: jotting .. automodule:: jotting.book :members: .. automodule:: jotting.to :members: .. automodule:: jotting.read :members: .. automodule:: jotting.style :members: """ from .book import book from . import style, to, read, dist
normal
{ "blob_id": "ce6dba2f682b091249f3bbf362bead4b95fee1f4", "index": 292, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .book import book\nfrom . import style, to, read, dist\n", "step-3": "\"\"\"\n.. currentmodule:: jotting\n\n.. automodule:: jotting.book\n :members:\n\n.. automodule:: jotting.to...
[ 0, 1, 2 ]
#! /usr/bin/env python # # Copyright (c) 2015 Jason Ish # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this li...
normal
{ "blob_id": "41889456fbb56d263e0039716519e8959316b67e", "index": 3473, "step-1": "<mask token>\n\n\ndef render_timestamp(sec, usec):\n tt = time.localtime(sec)\n return '%04d-%02d-%02dT%02d:%02d:%02d.%06d%s' % (tt.tm_year, tt.tm_mon,\n tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, usec, get_tzoffset...
[ 12, 15, 16, 17, 19 ]
# Python library import import asyncio, asyncssh, logging # Module logging logger log = logging.getLogger(__package__) # Debug level # logging.basicConfig(level=logging.WARNING) # logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.DEBUG) asyncssh.set_debug_level(2) # Declaration of constant v...
normal
{ "blob_id": "87baaf4a1b48fa248c65d26cc44e819a2ede1140", "index": 3736, "step-1": "<mask token>\n\n\nclass NetworkDevice:\n <mask token>\n\n def __init__(self, **kwargs):\n log.info('__init__')\n self.ip = ''\n self.username = ''\n self.password = ''\n self.device_type = '...
[ 9, 10, 12, 14, 15 ]
<|reserved_special_token_0|> def _unique_predict(solve_list): valid_solve_list = filter(lambda x: x[0] is not None, solve_list) valid_solve_list = sorted(valid_solve_list, key=lambda x: x[0]) unique_solve_list = list() current_no = -1 for e in valid_solve_list: if current_no != e[0]: ...
flexible
{ "blob_id": "00a1b5f20f15994a659eda56201ba7c45d49a4db", "index": 4186, "step-1": "<mask token>\n\n\ndef _unique_predict(solve_list):\n valid_solve_list = filter(lambda x: x[0] is not None, solve_list)\n valid_solve_list = sorted(valid_solve_list, key=lambda x: x[0])\n unique_solve_list = list()\n cur...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_mapped_sku(sku): try: cursor = connect(aws_access_key_id=config2['aws_access_key_id'], aws_secret_access_key=config2['aws_secret_access_key'], s3_staging_dir=config2['s3_staging_dir'],...
flexible
{ "blob_id": "6add599035573842475c7f9155c5dbbea6c96a8a", "index": 3618, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_mapped_sku(sku):\n try:\n cursor = connect(aws_access_key_id=config2['aws_access_key_id'],\n aws_secret_access_key=config2['aws_secret_access_key'],\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.autodiscover() <|reserved_special_token_0|> urlpatterns += patterns('piston.authentication', url( '^oauth/request_token/$', 'oauth_request_token'), url( '^oauth/authorize/$', 'oauth_user_auth'), url('^oauth/access_to...
flexible
{ "blob_id": "266ce1aaa3283cf2aaa271a317a80c3860880a49", "index": 4901, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\nurlpatterns += patterns('piston.authentication', url(\n '^oauth/request_token/$', 'oauth_request_token'), url(\n '^oauth/authorize/$', 'oauth_use...
[ 0, 1, 2, 3, 4 ]
import httplib def get_status_code(host, path="/"): try: connect = httplib.HTTPConnection(host) connect.request("HEAD", path) return connect.getresponse().status except StandardError: return None if __name__ == '__main__': print get_status_code("google.com")
normal
{ "blob_id": "891a490410fd8c7b8879f1e71f24df2db62ff85d", "index": 7748, "step-1": "import httplib\n\ndef get_status_code(host, path=\"/\"):\n try:\n connect = httplib.HTTPConnection(host)\n connect.request(\"HEAD\", path)\n return connect.getresponse().status\n except StandardError:\n ...
[ 0 ]
import os import shutil # root_path = '../from_1691' root_path = 'C:/Users/koyou/Desktop/test' # 실수할 수도 있으므로 dry_run 을 설정해서 로그만 찍을 것인지 # 실제 작동도 진행할 것인지 결정한다. # dry_run = True dry_run = False def move_directory(input_directory_path, output_directory_path): print("moving %s to %s" % (input_directory_path, output_d...
normal
{ "blob_id": "7de19a85a6a05bd2972b11571d5f05219c6beb1a", "index": 916, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef move_directory(input_directory_path, output_directory_path):\n print('moving %s to %s' % (input_directory_path, output_directory_path))\n if not dry_run:\n shutil.move...
[ 0, 1, 2, 3, 5 ]
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import base64 import configobj import datetime import os config = configobj.ConfigObj('.env') port = 2525 smtp_server = "smtp.mailtrap.io" login = config['SMTP_USERNAME'] password = config['SMTP_PASSWORD'] sender_email...
normal
{ "blob_id": "a21ac29911931bb71460175cba584e0011fa2ece", "index": 1055, "step-1": "<mask token>\n\n\ndef send():\n global last_index_sent\n global last_sent\n DIR = './videos'\n videosToSend = len([name for name in os.listdir(DIR) if os.path.isfile(\n os.path.join(DIR, name))])\n for i in ra...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(25000): pval, costval = train(inputs, outputs) print(costval) val1.append(pval) cost1.append(costval) print('the final outputs are:') for i in range(len(inputs)): print('the output of x1=%d | x2=...
flexible
{ "blob_id": "adec7efceb038c0ecb23c256c23c2ea212752d64", "index": 4010, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(25000):\n pval, costval = train(inputs, outputs)\n print(costval)\n val1.append(pval)\n cost1.append(costval)\nprint('the final outputs are:')\nfor i in range(l...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> command('strip', '-S', '-x', input_file( 'bin/darwin-4.2.1/release/target-os-darwin/test')) main() <|reserved_special_token_1|> from MockProgram import * command('strip', '-S', '-x', input_file( 'bin/darwin-4.2.1/releas...
flexible
{ "blob_id": "d2f77afd0d282b1fa4859c5368c9d2c745a5625e", "index": 3293, "step-1": "<mask token>\n", "step-2": "<mask token>\ncommand('strip', '-S', '-x', input_file(\n 'bin/darwin-4.2.1/release/target-os-darwin/test'))\nmain()\n", "step-3": "from MockProgram import *\ncommand('strip', '-S', '-x', input_fil...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def login_required(f): """ Decorate routes to require login. http://flask.pocoo.org/docs/1.0/patterns/viewdecorators/ """ @wraps(f) def decorated_function(*args, **kwargs): if session.get('user_id') is None: return redirect('/sign_in') ...
flexible
{ "blob_id": "1a4da621add157fa6d1f578370d64594b102eeb5", "index": 4245, "step-1": "<mask token>\n\n\ndef login_required(f):\n \"\"\"\n Decorate routes to require login.\n\n http://flask.pocoo.org/docs/1.0/patterns/viewdecorators/\n \"\"\"\n\n @wraps(f)\n def decorated_function(*args, **kwargs):\...
[ 3, 4, 5, 6, 7 ]
# SPDX-FileCopyrightText: 2021 John Park for Adafruit Industries # SPDX-License-Identifier: MIT import time import random import board import audiomp3 import audiopwmio from adafruit_crickit import crickit ss = crickit.seesaw # Crickit seesaw setup button = crickit.SIGNAL1 # momentary switch to trigger animation ss...
normal
{ "blob_id": "608c116cd42132bd63be5056f0aaf5c78933886e", "index": 7536, "step-1": "<mask token>\n\n\ndef open_lid():\n motor_lid.throttle = 1\n time.sleep(0.25)\n motor_lid.throttle = 0\n\n\ndef close_lid():\n motor_lid.throttle = -1\n time.sleep(0.25)\n motor_lid.throttle = 0\n\n\ndef blink(tim...
[ 3, 5, 6, 7, 8 ]
#!usr/bin/python # -*- coding:utf8 -*- import time import random import asyncio async def consumer(queue, name): while True: val = await queue.get() print(f'{name} get a val: {val} at {time.strftime("%X")}') await asyncio.sleep(1) async def producer(queue, name): for i in range(20): ...
normal
{ "blob_id": "e1172e2d9f20e56241829b3e4ccb4bcf6b5440be", "index": 9233, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def consumer(queue, name):\n while True:\n val = await queue.get()\n print(f\"{name} get a val: {val} at {time.strftime('%X')}\")\n await asyncio.sleep(1...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestHand(unittest.TestCase): def test_max_straight(self): cards = map(makeCard, ['10S', '6S', '9S', '8S', '7S']) straight = max_straight(cards) self.assertEqual(straight, sorted(map(makeCard, ['10S', '6S', '9S', '8S', '7S']), reverse=True)) ...
flexible
{ "blob_id": "5b8d1bd026e97bb7508a500048f940abf0253471", "index": 9698, "step-1": "<mask token>\n\n\nclass TestHand(unittest.TestCase):\n\n def test_max_straight(self):\n cards = map(makeCard, ['10S', '6S', '9S', '8S', '7S'])\n straight = max_straight(cards)\n self.assertEqual(straight, so...
[ 5, 6, 7, 8, 9 ]
''' 使用random模块,如何产生 50~150之间的数? ''' import random num1 = random.randint(50,151) print(num1)
normal
{ "blob_id": "7d3355ee775f759412308ab68a7aa409b9c74b20", "index": 708, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num1)\n", "step-3": "<mask token>\nnum1 = random.randint(50, 151)\nprint(num1)\n", "step-4": "<mask token>\nimport random\nnum1 = random.randint(50, 151)\nprint(num1)\n", "step...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(packages=find_packages(), setup_requires=['flask'], name='mith1') <|reserved_special_token_1|> from setuptools import setup, find_packages setup(packages=find_packages(), setup_requires=['flask'], name='mith1') <|reserv...
flexible
{ "blob_id": "a5a7cd112faad1096ce4c6f04b2179fbdf732702", "index": 1479, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(packages=find_packages(), setup_requires=['flask'], name='mith1')\n", "step-3": "from setuptools import setup, find_packages\nsetup(packages=find_packages(), setup_requires=['flas...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Sender: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def send_frame(self, frame): self.receiver.receiver_frame(frame)...
flexible
{ "blob_id": "ecbcd023b8fec5763c6ff7f4cd0999426fae4a50", "index": 9093, "step-1": "<mask token>\n\n\nclass Sender:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def send_frame(self, frame):\n self.receiver.receiver_frame(frame)\n p...
[ 5, 7, 8, 10, 11 ]
from .Buzzer import BuzzerController from .Card import CardScanner from .RFID import RFIDController from .Servo import ServoController __all__ = ["BuzzerController", "CardScanner", "RFIDController", "ServoController"]
normal
{ "blob_id": "8fa78824a38a3b0c1f51aceacab671f987ea2705", "index": 9635, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['BuzzerController', 'CardScanner', 'RFIDController',\n 'ServoController']\n", "step-3": "from .Buzzer import BuzzerController\nfrom .Card import CardScanner\nfrom .RFID im...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solution(X, Y, D): xy = Y - X if xy == 0: return 0 jumps = math.ceil(xy / D) return jumps <|reserved_special_token_1|> import math def solution(X, Y, D): xy = Y - X if xy == 0: re...
flexible
{ "blob_id": "bdf819d8a5bc3906febced785c6d95db7dc3a603", "index": 2376, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(X, Y, D):\n xy = Y - X\n if xy == 0:\n return 0\n jumps = math.ceil(xy / D)\n return jumps\n", "step-3": "import math\n\n\ndef solution(X, Y, D):\n ...
[ 0, 1, 2, 3 ]
# This implementation of EPG takes data as XML and produces corresponding pseudonymized data from lxml import etree from utils import generalize_or_supress from hashlib import sha256 from count import getLast, saveCount import pickle from hmac import new from random import random from json import loads from bigchain i...
normal
{ "blob_id": "8f554166c28fe4c9a093568a97d39b6ba515241b", "index": 3196, "step-1": "<mask token>\n\n\ndef EPGAD(ReportPath, Hi=None, GUi=None):\n if Hi == None:\n Hi = sha256(str(random()).encode()).hexdigest()\n jsn = open(ReportPath, 'rt').read()\n jsnld = loads(jsn)\n print('Report Loaded')\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def train_model_snapshot(model, criterion, lr, dataloaders, dataset_sizes, device, num_cycles, num_epochs_per_cycle): since = time.time() best_model_wts = copy.deepcopy(model.state_dict()) best_acc = 0.0 best_loss = 1000000.0 model_w_arr = [] prob = torch.zeros...
flexible
{ "blob_id": "d807a363c08d117c848ffdc0a768c696ea7746bd", "index": 1787, "step-1": "<mask token>\n\n\ndef train_model_snapshot(model, criterion, lr, dataloaders, dataset_sizes,\n device, num_cycles, num_epochs_per_cycle):\n since = time.time()\n best_model_wts = copy.deepcopy(model.state_dict())\n best...
[ 2, 3, 4, 5, 6 ]
# Standard library # Third party library # Local library from warehouse.server import run_server from warehouse.server.config import log if __name__ == "__main__": log.initialize_logs() run_server()
normal
{ "blob_id": "8c8b5c1ff749a8563788b8d5be5332e273275be3", "index": 6450, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n log.initialize_logs()\n run_server()\n", "step-3": "from warehouse.server import run_server\nfrom warehouse.server.config import log\nif __name__ == '...
[ 0, 1, 2, 3 ]
n = int(input()) if n % 10 == 1 and (n < 11 or n > 20): print(n, "korova") elif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20): print(n, "korovy") else: print(n, "korov")
normal
{ "blob_id": "78037d936ee5f9b31bf00263885fbec225a4f8f2", "index": 2191, "step-1": "<mask token>\n", "step-2": "<mask token>\nif n % 10 == 1 and (n < 11 or n > 20):\n print(n, 'korova')\nelif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20):\n print(n, 'korovy')\nelse:\n print(n, 'korov')\n", "step-3"...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> [print(i) for i in sentence if len(i) < 5] <|reserved_special_token_1|> sentence = 'Practice Problems to Drill List Comprehension in Your Head.' sentence = sentence.split() sentence = [i.replace('.', '') for i in sentence] [pri...
flexible
{ "blob_id": "c0e349be45cd964e8e398baaed64eae792189dd1", "index": 5723, "step-1": "<mask token>\n", "step-2": "<mask token>\n[print(i) for i in sentence if len(i) < 5]\n", "step-3": "sentence = 'Practice Problems to Drill List Comprehension in Your Head.'\nsentence = sentence.split()\nsentence = [i.replace('....
[ 0, 1, 2, 3 ]
############################################################################### # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by ...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> model.fit <|reserved_special_token_0|> model.save('./T_100_Modelo_C64k33_C128k33_d025_D256_d05_D5.h5') plt.plot(history.history['accuracy'], label='accuracy') plt.plot(history.history['val_accuracy'], label='validation accuracy') ...
flexible
{ "blob_id": "d2f760b821fc5c599cda1091334364e18234ab06", "index": 4222, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.fit\n<mask token>\nmodel.save('./T_100_Modelo_C64k33_C128k33_d025_D256_d05_D5.h5')\nplt.plot(history.history['accuracy'], label='accuracy')\nplt.plot(history.history['val_accuracy']...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Student: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Student: def __init__(self, name, rollno): self.name = name self.rollno = rollno <|reserved_special_token_0|> <|reser...
flexible
{ "blob_id": "97656bca3ce0085fb2f1167d37485fb7ee812730", "index": 4825, "step-1": "<mask token>\n", "step-2": "class Student:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Student:\n\n def __init__(self, name, rollno):\n self.name = name\n self.rollno = rollno\n\n\n<mask token>\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "c0bf146ebfdb54cce80ef85c4c7f4a61632e67d4", "index": 3371, "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 = [('myapp', '00...
[ 0, 1, 2, 3, 4 ]
import os def savelesson(text): os.path.expanduser("~/.buzzers/lessons") def getlessonlist(): path = os.path.expanduser("~/.buzzers") dirs = os.walk(os.path.expanduser("~/.buzzers/lessons")) #"/home/loadquo/files/lhsgghc/Programs/PCSoftware/src/admin/lessons") lessons = [] for root, d, fs in dirs: ...
normal
{ "blob_id": "de003440be513d53b87f526ea95c0fbbc4a9f66f", "index": 2584, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getlessonlist():\n path = os.path.expanduser('~/.buzzers')\n dirs = os.walk(os.path.expanduser('~/.buzzers/lessons'))\n lessons = []\n for root, d, fs in dirs:\n ...
[ 0, 1, 2, 3, 4 ]
from django.urls import re_path from .consumers import ChatConsumer, ChatLobbyConsumer websocket_urlpatterns = [ re_path(r'ws/chat/(?P<room_id>\w+)/$', ChatConsumer), re_path(r'ws/lobby/$', ChatLobbyConsumer), ]
normal
{ "blob_id": "1bd1769f94b93e0bb674adfd1bb96c778708f6d8", "index": 5593, "step-1": "<mask token>\n", "step-2": "<mask token>\nwebsocket_urlpatterns = [re_path('ws/chat/(?P<room_id>\\\\w+)/$',\n ChatConsumer), re_path('ws/lobby/$', ChatLobbyConsumer)]\n", "step-3": "from django.urls import re_path\nfrom .con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('haiku.txt', 'w') as file: file.write('This is the line 1 of the haiku\n') file.write('Following the line 2 of the haiku\n') file.write('Finishing off with the line 3 of the haiku\n') with open('haiku.txt', '...
flexible
{ "blob_id": "cde2454c68a0d6a0c86b7d647e41a86d3aa97a0d", "index": 8267, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('haiku.txt', 'w') as file:\n file.write('This is the line 1 of the haiku\\n')\n file.write('Following the line 2 of the haiku\\n')\n file.write('Finishing off with the ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class BadArgumentException(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg class TooManyArgumentsException(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg ...
flexible
{ "blob_id": "eed79a3895975a0475c0b192bd8a42e80def2e78", "index": 2502, "step-1": "<mask token>\n\n\nclass BadArgumentException(Exception):\n\n def __init__(self, msg):\n self.msg = msg\n\n def __str__(self):\n return self.msg\n\n\nclass TooManyArgumentsException(Exception):\n\n def __init_...
[ 25, 26, 29, 31, 32 ]
<|reserved_special_token_0|> class Test(unittest.TestCase): <|reserved_special_token_0|> def test_final_summary(self): pkl = os.path.join(self.testfiles_dir, AMPLE_PKL) if not os.path.isfile(pkl): return with open(pkl, 'rb') as f: if sys.version_info.major == 3...
flexible
{ "blob_id": "f6dd5acc75d1a85a996629e22e81cdef316c1dcd", "index": 8939, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def test_final_summary(self):\n pkl = os.path.join(self.testfiles_dir, AMPLE_PKL)\n if not os.path.isfile(pkl):\n return\n wi...
[ 3, 4, 5, 6, 7 ]
#implement variable! import numpy as np class Variable: def __init__(self, data): self.data = data class Function: ''' Base class specific functions are implemented in the inherited class ''' def __call__(self, input): x = input.data #data extract y = self.foward(x) ...
normal
{ "blob_id": "9efd83524ebb598f30c8fb6c0f9f0c65333578e6", "index": 6292, "step-1": "<mask token>\n\n\nclass Function:\n <mask token>\n <mask token>\n\n def foward(self, x):\n raise NotImplementedError()\n\n\nclass Square(Function):\n\n def foward(self, x):\n return x ** 2\n\n\nclass Exp(F...
[ 6, 10, 11, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': logging.basicConfig(stream=sys.stdout, format= '[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s', level=logging.DEBUG) client = docker.from_env() logging.i...
flexible
{ "blob_id": "a5c9ff1fe250310216e2eaa7a6ff5cc76fc10f94", "index": 4324, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n logging.basicConfig(stream=sys.stdout, format=\n '[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s',\n level=logging.DEBUG...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'ivy': {'svm': ({'kernel': 'rbf', 'C': 10.0}, 0.03448275862068966, 0.03508771929824561), 'tuned_ensemble': ({'svm__C': 100000.0, 'rf__n_estimators': 101, 'cart__min_samples_leaf': 7, 'knn__n_neighbors': 2, 'rf__random_state': 1542, 'cart__max_de...
flexible
{ "blob_id": "fa02fb701b59728671a7e87147adaeb33422dcdb", "index": 1600, "step-1": "<mask token>\n", "step-2": "{'ivy': {'svm': ({'kernel': 'rbf', 'C': 10.0}, 0.03448275862068966, \n 0.03508771929824561), 'tuned_ensemble': ({'svm__C': 100000.0,\n 'rf__n_estimators': 101, 'cart__min_samples_leaf': 7,\n '...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class People: <|reserved_special_token_0|> def eat(self): pass print('%s is eating...' % self.name) <|reserved_special_token_0|> <|reserved_special_token_0|> class Man(People): def __init__(self, name, age, money): super(Man, self).__init__(...
flexible
{ "blob_id": "6fdc9b2091652b05d6c1207d2f78b75c880fadda", "index": 9084, "step-1": "<mask token>\n\n\nclass People:\n <mask token>\n\n def eat(self):\n pass\n print('%s is eating...' % self.name)\n <mask token>\n <mask token>\n\n\nclass Man(People):\n\n def __init__(self, name, age, mo...
[ 8, 10, 11, 12, 14 ]
import streamlit as st import pandas as pd import seaborn as sns import matplotlib.pyplot as plt username=st.text_input ("username") upload=st.file_uploader("uploadfile",type=['csv']) button=st.button("submit") if button==True: df=pd.read_csv(upload) st.write(df.head()) fig = plt.figu...
normal
{ "blob_id": "72f1547ea7de78a5fe4b583523e592fa25c0ee77", "index": 2467, "step-1": "<mask token>\n", "step-2": "<mask token>\nif button == True:\n df = pd.read_csv(upload)\n st.write(df.head())\n fig = plt.figure()\n my = fig.add_subplot(1, 1, 1)\n my.scatter(df['sepal.length'], df['petal.length']...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='zuknuft', version='0.1', author='riotbib', author_email= 'riotbib@github', scripts=['zukunft.py'], install_requires=['bottle']) <|reserved_special_token_1|> from distutils.core import setup setup(name='zuknuft',...
flexible
{ "blob_id": "638842cda666100ce197437cb354f66de77eb328", "index": 8065, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='zuknuft', version='0.1', author='riotbib', author_email=\n 'riotbib@github', scripts=['zukunft.py'], install_requires=['bottle'])\n", "step-3": "from distutils.core impor...
[ 0, 1, 2, 3 ]
# Copyright 2018 Google LLC # # 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 or agreed to in writing, s...
normal
{ "blob_id": "9ce406124d36c2baf09cf0d95fceb2ad63948919", "index": 4801, "step-1": "<mask token>\n\n\nclass UnexpectedFormatError(AttributeError):\n pass\n\n\n<mask token>\n\n\ndef get_meals(_mensa, date=None):\n result = requests.get(\n f'https://osnabrueck.my-mensa.de/essen.php?v=5121119&hyp=1&lang=...
[ 6, 7, 8, 9, 10 ]
import numpy as np #!pip install pygame import pygame #from copy import deepcopy pygame.init() #----------- # Modifications (Matthieu, 15/04): # Modification de la représentation du terrain du jeu. Il est maintenant représenté par une seule liste. # un seul identifiant par coupe semble plus simple à gérer qu'un...
normal
{ "blob_id": "576d6bec4a91ba6f0597b76a5da5ad3ef6562b19", "index": 9592, "step-1": "<mask token>\n\n\nclass terrainDeJeu:\n\n def __init__(self, nCoupes, profondeur, nGrainesParCoupelle=4):\n self.plateau = np.full(2 * nCoupes, nGrainesParCoupelle)\n self.nGrainesParCoupelleInit = nGrainesParCoupe...
[ 14, 20, 21, 24, 26 ]
import string import random import os from threading import Thread class Process(Thread): def __init__(self): Thread.__init__(self) def run(self): while True: prenom = id_generator(random.randint(4, 8)) nom = id_generator(random.randint(4, 8)) password = id_...
normal
{ "blob_id": "b9c058bdb04df93beb379d05939b00f4db423cd3", "index": 452, "step-1": "import string\nimport random\nimport os\nfrom threading import Thread\n\nclass Process(Thread):\n def __init__(self):\n Thread.__init__(self)\n\n def run(self):\n while True:\n prenom = id_generator(ra...
[ 0 ]
<|reserved_special_token_0|> def who_win_line(line): elements = set(line) if '.' in elements: return '.' elements.discard('T') if len(elements) >= 2: return 'D' else: return elements.pop() def who_win_tic_tac_toe(original_rows): board_full = True rows = [row[0:TTT...
flexible
{ "blob_id": "2e041e33b5c34c2bddc72b36ff641817f1e21db2", "index": 3735, "step-1": "<mask token>\n\n\ndef who_win_line(line):\n elements = set(line)\n if '.' in elements:\n return '.'\n elements.discard('T')\n if len(elements) >= 2:\n return 'D'\n else:\n return elements.pop()\n...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def dataframe_to_numpy(dataframe): numpy_array = dataframe.to_numpy() return numpy_array <|reserved_special_token_0|> def data_slice(data, num_of_data): data = data[:, 1:num_of_data + 1] return data <|reserved_special_token_1|> <|reserved_special_token_0|> def loa...
flexible
{ "blob_id": "b63dc8b9aa2f0593a4a7eb52a722a9c4da6c9e08", "index": 7804, "step-1": "<mask token>\n\n\ndef dataframe_to_numpy(dataframe):\n numpy_array = dataframe.to_numpy()\n return numpy_array\n\n\n<mask token>\n\n\ndef data_slice(data, num_of_data):\n data = data[:, 1:num_of_data + 1]\n return data\...
[ 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def HP(Di, beta): """ Function that calculates shannon entropy """ P = np.exp(-Di * beta) sumP = np.sum(P) Pi = P / sumP Hi = -np.sum(Pi * np.log2(Pi)) return Hi, Pi <|reserved_special_token_1|>...
flexible
{ "blob_id": "0b05b027e3c3147aa2b9c35a0bdc33633ba6e658", "index": 7129, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef HP(Di, beta):\n \"\"\"\n Function that calculates shannon entropy\n \"\"\"\n P = np.exp(-Di * beta)\n sumP = np.sum(P)\n Pi = P / sumP\n Hi = -np.sum(Pi * np....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @given('I want to send an integer') def step_impl(context): pass <|reserved_special_token_0|> @given('I want to send two integers with one channel') def step_impl(context): pass @given('I want to send two floats with one channel') def step_impl(context): pass <|reserve...
flexible
{ "blob_id": "3770e59c5bd6837a0fb812f80c6549024e06a9e4", "index": 5957, "step-1": "<mask token>\n\n\n@given('I want to send an integer')\ndef step_impl(context):\n pass\n\n\n<mask token>\n\n\n@given('I want to send two integers with one channel')\ndef step_impl(context):\n pass\n\n\n@given('I want to send t...
[ 8, 10, 12, 13, 15 ]
""" 챕터: day4 주제: 반복문(for문) 문제: 1에서 100까지 합을 구하여 출력하시오. 작성자: 한현수 작성일: 2018.9.20. """ result = 0 for i in range(101): result += i print(result)
normal
{ "blob_id": "d2754099adebdb4bd2b028fdf9015571ad773754", "index": 9313, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(101):\n result += i\nprint(result)\n", "step-3": "<mask token>\nresult = 0\nfor i in range(101):\n result += i\nprint(result)\n", "step-4": "\"\"\"\n챕터: day4\n주제:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DateTimeEncoder(json.JSONEncoder): def default(self, z): if isinstance(z, datetime.datetime): return str(z) else: return super().default(z) <|reserved_special_token_0|> def FindWorkload(waclient, workloadName): try: respon...
flexible
{ "blob_id": "c5e003d625d7798eaf4ef5bca28f6311edccb316", "index": 7235, "step-1": "<mask token>\n\n\nclass DateTimeEncoder(json.JSONEncoder):\n\n def default(self, z):\n if isinstance(z, datetime.datetime):\n return str(z)\n else:\n return super().default(z)\n\n\n<mask token...
[ 13, 15, 16, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_token_from_request(request): token_tuple = request.COOKIES.get('money_api_token') matches = re.search('(<Token: (\\S*)>)', token_tuple) token = matches.groups(0)[1] return token <|reserved_special_token...
flexible
{ "blob_id": "2187f38dc9b14ecc355e98fe15d36fdefd548f04", "index": 1159, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_token_from_request(request):\n token_tuple = request.COOKIES.get('money_api_token')\n matches = re.search('(<Token: (\\\\S*)>)', token_tuple)\n token = matches.groups...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class GIFTCommand(BaseInterface): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, **inputs): super(GIFTComm...
flexible
{ "blob_id": "fef1cf75de8358807f29cd06d2338e087d6f2d23", "index": 9162, "step-1": "<mask token>\n\n\nclass GIFTCommand(BaseInterface):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, **inputs):\n super(GIFTCommand, self)....
[ 8, 10, 15, 16, 18 ]
__author__ = 'Administrator' class People: def __init__(self,name,age): self.name = name self.age = age def eat(self): pass print("%s is eating..." % self.name) def sleep(self): print("%s is sleeping..." % self.name) def talk(self): print("%s is talki...
normal
{ "blob_id": "6fdc9b2091652b05d6c1207d2f78b75c880fadda", "index": 9084, "step-1": "<mask token>\n\n\nclass People:\n <mask token>\n\n def eat(self):\n pass\n print('%s is eating...' % self.name)\n <mask token>\n <mask token>\n\n\nclass Man(People):\n\n def __init__(self, name, age, mo...
[ 8, 10, 11, 12, 14 ]
from pydub import AudioSegment import sys import tensorflow as tf import numpy as np from adwtmk.audio import Audio from adwtmk.encoder import * from adwtmk.decoder import * class DAE(object): def __init__(self,model_name): self.model_name = model_name self.process = 0 self.loss = 0 ...
normal
{ "blob_id": "6f53702d9265a7fc57d2ec2e47dc35a0bc7a9f87", "index": 9012, "step-1": "<mask token>\n\n\nclass DAE(object):\n <mask token>\n <mask token>\n\n def fast_training(self, sound):\n self.core_size = 100\n self.batch_size = 1000\n self.Epoches = 50\n self._main(sound, 100...
[ 4, 6, 9, 10, 12 ]
from django.contrib import admin from django.urls import path from django.conf.urls import url from . import views urlpatterns = [ path('admin/', admin.site.urls), path(r'', views.index, name='index'), ]
normal
{ "blob_id": "b0fad3847519bb18365a8cd4226d06e9d96a8308", "index": 1258, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', views.index, name=\n 'index')]\n", "step-3": "from django.contrib import admin\nfrom django.urls import path\nfrom django.con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> COG_QUOTAS = (30, 25, 20, 15, 10, 5, 2, 1), (45, 40, 35, 30, 25, 20, 15, 10) COG_UNSEEN = 1 COG_BATTLED = 2 COG_DEFEATED = 3 COG_COMPLETE1 = 4 COG_COMPLETE2 = 5 <|reserved_special_token_1|> # Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontow...
flexible
{ "blob_id": "fdb680f12dfb4b29f25cfe4f7af80469dc4294cf", "index": 2437, "step-1": "<mask token>\n", "step-2": "COG_QUOTAS = (30, 25, 20, 15, 10, 5, 2, 1), (45, 40, 35, 30, 25, 20, 15, 10)\nCOG_UNSEEN = 1\nCOG_BATTLED = 2\nCOG_DEFEATED = 3\nCOG_COMPLETE1 = 4\nCOG_COMPLETE2 = 5\n", "step-3": "# Fuck you Disyer....
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Variables: size: bytes name: str class cstruct: structname: string <|reserved_special_token_0|> def cpreprosscssor(): maintokens = lexer(mainfile) return def cprocessor(): return <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "24187284ff3e03cf79b8545415005c71f9355ddc", "index": 9062, "step-1": "<mask token>\n\n\nclass Variables:\n size: bytes\n name: str\n\n\nclass cstruct:\n structname: string\n\n\n<mask token>\n\n\ndef cpreprosscssor():\n maintokens = lexer(mainfile)\n return\n\n\ndef cprocessor():\n r...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../sherlock'))) <|reserved_special_token_1|> <|reserved_special_token_0|> import sys import os import subprocess as sp from time import sleep sys.p...
flexible
{ "blob_id": "8f7b1313ba31d761edcadac7b0d04b62f7af8dff", "index": 4759, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),\n '../sherlock')))\n", "step-3": "<mask token>\nimport sys\nimport os\nimport subprocess as sp\nfrom time i...
[ 0, 1, 2, 3 ]
import unittest import math from python.src.sort.insertion import Insertion from python.src.sort.selection import Selection from python.src.sort.shell import Shell from python.test.util.utilities import Utilities class ElementarySortTest(unittest.TestCase): def setUp(self): self.n = 1000 def test_in...
normal
{ "blob_id": "779ef8942bfb55bf017a8da9dfe34c03ac574a9a", "index": 2591, "step-1": "<mask token>\n\n\nclass ElementarySortTest(unittest.TestCase):\n <mask token>\n\n def test_insertion_sort(self):\n insertion = Insertion()\n actual = Utilities.generate_random_array(self.n)\n expected = l...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> class ComposePipelines: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ComposePipelines: <|reserved_special_token_0|> <|reserved_special_token_0|> def __ca...
flexible
{ "blob_id": "13c55c313c740edce48fc979e8956fdd018e8aab", "index": 9716, "step-1": "<mask token>\n\n\nclass ComposePipelines:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ComposePipelines:\n <mask token>\n <mask token>\n\n def __call__(self, image):\n ...
[ 1, 2, 3, 4, 5 ]
import os import datetime import traceback import json import requests import logging from model import Product from naver_api import naver_client_id, naver_client_secret DEBUG = False if not DEBUG: logging.getLogger('boto3').setLevel(logging.WARNING) logging.getLogger('botocore').setLevel(logging.WARNING) ...
normal
{ "blob_id": "76905171602cbeb53903a4b0259685288da3a083", "index": 6365, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n products = list(Product.scan(Product.do_crawl == True))\n for product in products:\n product.search_lowest_price()\n print('{} product(s) crawled'.format(len(p...
[ 1, 2, 3, 4, 5 ]
import time from selenium import webdriver import os from selenium.webdriver.common.by import By with open("file.txt", "w") as file: content = file.write("Tanyuhich") try: browser = webdriver.Chrome() browser.get("http://suninjuly.github.io/file_input.html") input1 = browser.find_element_by_name('...
normal
{ "blob_id": "03270285c6dc99d8dcb9804270421f36b573048c", "index": 2863, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('file.txt', 'w') as file:\n content = file.write('Tanyuhich')\ntry:\n browser = webdriver.Chrome()\n browser.get('http://suninjuly.github.io/file_input.html')\n inpu...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(html.decode('utf-8')) <|reserved_special_token_1|> <|reserved_special_token_0|> seesion = requests.Session() header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/...
flexible
{ "blob_id": "8c652f30cd256912512b6b91d1682af7da0ff915", "index": 8265, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(html.decode('utf-8'))\n", "step-3": "<mask token>\nseesion = requests.Session()\nheader = {'User-Agent':\n 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like...
[ 0, 1, 2, 3 ]
def prime_sieve(n): if n==2: return [2] elif n<2: return [] s=range(3,n+1,2) mroot = n ** 0.5 half=(n+1)/2-1 i=0 m=3 while m <= mroot: if s[i]: j=(m*m-3)/2 s[j]=0 while j<half: s[j]=0 j+=m i=i+1 m=2*i+3 return [2]+[x for x in s if x] ps = prime_sieve(1000000) def get_primes_upto(n): ...
normal
{ "blob_id": "5771f49ad5254588f1683a8d45aa81ce472bb562", "index": 30, "step-1": "\ndef prime_sieve(n): \n\tif n==2: return [2]\n\telif n<2: return []\n\ts=range(3,n+1,2)\n\tmroot = n ** 0.5\n\thalf=(n+1)/2-1\n\ti=0\n\tm=3\n\twhile m <= mroot:\n\t\tif s[i]:\n\t\t\tj=(m*m-3)/2\n\t\t\ts[j]=0\n\t\t\twhile j<half:\n\t...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def lower_upper_confidence_intervals(avg, SD): lower = avg - 2 * SD upper = avg + 2 * SD return lower, upper <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append...
flexible
{ "blob_id": "d423b0bc6cd9ea9795317750141ad5f5eab01636", "index": 1886, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lower_upper_confidence_intervals(avg, SD):\n lower = avg - 2 * SD\n upper = avg + 2 * SD\n return lower, upper\n\n\n<mask token>\n", "step-3": "<mask token>\nsys.path.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ax.plot(data['Date'], data['HCHFI'], label='HCHFI') ax.plot(data['Date'], data['SHA'] / 2.67547, label='SSE Composite Index') ax.plot(data['Date'], data['Hushen300 Index'] / 3.20393, label= 'Hushen300 Index') plt.xlabel('Time/...
flexible
{ "blob_id": "91df15d6d89d070677704572d35218558317a6ec", "index": 117, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.plot(data['Date'], data['HCHFI'], label='HCHFI')\nax.plot(data['Date'], data['SHA'] / 2.67547, label='SSE Composite Index')\nax.plot(data['Date'], data['Hushen300 Index'] / 3.20393, lab...
[ 0, 1, 2, 3, 4 ]
import torch import torch.nn.functional as F import csv class Net(torch.nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Net, self).__init__() self.hidden = torch.nn.Linear(n_feature, n_hidden) self.predict = torch.nn.Linear(n_hidden, n_output) def forward(self, x...
normal
{ "blob_id": "e221553f866de8b3e175197a40982506bf8c1ef9", "index": 205, "step-1": "<mask token>\n\n\nclass Net(torch.nn.Module):\n\n def __init__(self, n_feature, n_hidden, n_output):\n super(Net, self).__init__()\n self.hidden = torch.nn.Linear(n_feature, n_hidden)\n self.predict = torch.n...
[ 3, 4, 5, 6, 7 ]
SQL_INSERCION_COCHE = "INSERT INTO tabla_coches(marca, modelo, color, motor, precio) VALUES (%s,%s,%s,%s,%s);" SQL_LISTADO_COCHES = "SELECT * FROM tabla_coches;"
normal
{ "blob_id": "fd41e6d8530d24a8a564572af46078be77e8177f", "index": 6573, "step-1": "<mask token>\n", "step-2": "SQL_INSERCION_COCHE = (\n 'INSERT INTO tabla_coches(marca, modelo, color, motor, precio) VALUES (%s,%s,%s,%s,%s);'\n )\nSQL_LISTADO_COCHES = 'SELECT * FROM tabla_coches;'\n", "step-3": "SQL_INS...
[ 0, 1, 2 ]
from math import sqrt from Engine.regulators.PID import PID from Engine.regulators.regulator_base_class import RegulatorBaseClass from Engine.robot import Robot, MAX_LINEAR_ACCELERATION, MAX_ANGULAR_SPEED from Util import Pose from Util.geometry import clamp, normalize from Util.pose import Position from config.config...
normal
{ "blob_id": "98bf0a332a6753e500b24bed2af16fe4a1cb9568", "index": 1560, "step-1": "<mask token>\n\n\nclass RealVelocityController(RegulatorBaseClass):\n settings = {'kp': 10, 'ki': 0, 'kd': 1}\n v_d = 4\n emergency_break_constant = 0.4\n emergency_break_safety_factor = 1\n\n def __init__(self):\n ...
[ 10, 11, 13, 14, 15 ]
no = int(input("Enter a number: ")) no = str(no) rev = no[::-1] if no==rev: print(f"{no}--->{rev} Input is a palindrome") else: print(f"{no}--->{rev} Input is not a palindrome")
normal
{ "blob_id": "020a41e7d3cc3f5adf3a38a6852dac6037595372", "index": 2043, "step-1": "<mask token>\n", "step-2": "<mask token>\nif no == rev:\n print(f'{no}--->{rev} Input is a palindrome')\nelse:\n print(f'{no}--->{rev} Input is not a palindrome')\n", "step-3": "no = int(input('Enter a number: '))\nno = s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(friends) print(friends[0]) print(friends[-1]) print(friends[-2]) <|reserved_special_token_1|> friends = ['Vino', 'Ammu', 'Appu'] print(friends) print(friends[0]) print(friends[-1]) print(friends[-2]) <|reserved_special_...
flexible
{ "blob_id": "8050b757c20da7ad8dd3c12a30b523b752d6a3ff", "index": 9457, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(friends)\nprint(friends[0])\nprint(friends[-1])\nprint(friends[-2])\n", "step-3": "friends = ['Vino', 'Ammu', 'Appu']\nprint(friends)\nprint(friends[0])\nprint(friends[-1])\nprint...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def add_logs_to_response(response): response['logs'] = ClientLogger.get_logs() ClientLogger.clear_logs() return response @app.route('/generate/melody', methods=['POST', 'OPTIONS']) @crossdomain(origin='*') def generate_melody(): ClientLogger.log('Generating new melody......
flexible
{ "blob_id": "471cab65aac29f5b47de0ffef8f032dbbadf8dd0", "index": 1877, "step-1": "<mask token>\n\n\ndef add_logs_to_response(response):\n response['logs'] = ClientLogger.get_logs()\n ClientLogger.clear_logs()\n return response\n\n\n@app.route('/generate/melody', methods=['POST', 'OPTIONS'])\n@crossdomai...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class BinaryTree: <|reserved_special_token_0|> def __init__(self, rootObj): self.key = rootObj self.leftChild = None self.rightChild = None self.parent = None def insertLeft(self, newNode): if self.leftChild == None: self.l...
flexible
{ "blob_id": "5f48c7a68cb9734d84dee2cf8ff4d7be490cf328", "index": 2888, "step-1": "<mask token>\n\n\nclass BinaryTree:\n <mask token>\n\n def __init__(self, rootObj):\n self.key = rootObj\n self.leftChild = None\n self.rightChild = None\n self.parent = None\n\n def insertLeft(...
[ 12, 19, 30, 31, 37 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('n:', end='') <|reserved_special_token_0|> print('a:', end='') <|reserved_special_token_0|> for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): ai, aj, ak = sorted([a[i], a[j], a[k]]) if ai + aj > a...
flexible
{ "blob_id": "130f49028833bf57d7e4f9fbb0764801c3508c3b", "index": 3055, "step-1": "<mask token>\n", "step-2": "print('n:', end='')\n<mask token>\nprint('a:', end='')\n<mask token>\nfor i in range(n):\n for j in range(i + 1, n):\n for k in range(j + 1, n):\n ai, aj, ak = sorted([a[i], a[j], ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for p in palabras: print(palabras[p]) <|reserved_special_token_1|> frase = 'todos somos promgramadores' palabras = frase.split() for p in palabras: print(palabras[p]) <|reserved_special_token_1|> frase = "todos somos...
flexible
{ "blob_id": "00c57e7e26a3181ab23697a25257aca479d9ee05", "index": 5755, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor p in palabras:\n print(palabras[p])\n", "step-3": "frase = 'todos somos promgramadores'\npalabras = frase.split()\nfor p in palabras:\n print(palabras[p])\n", "step-4": "fra...
[ 0, 1, 2, 3 ]