code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import sys sys.path.append("..") import helpers helpers.mask_busy_gpus(wait=False) import nltk import numpy as np nltk.download('brown') nltk.download('universal_tagset') data = nltk.corpus.brown.tagged_sents(tagset='universal') all_tags = ['#EOS#','#UNK#','ADV', 'NOUN', 'ADP', 'PRON', 'DET', '.', 'PRT', 'VERB', 'X...
normal
{ "blob_id": "7f7ebc6d3d69fbb19071c63a9ab235ad01f1d414", "index": 306, "step-1": "<mask token>\n\n\ndef to_matrix(lines, token_to_id, max_len=None, pad=0, dtype='int32',\n time_major=False):\n \"\"\"Converts a list of names into rnn-digestable matrix with paddings added after the end\"\"\"\n max_len = ma...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(stats.ttest_ind(a, b)) <|reserved_special_token_0|> print(stats.ttest_ind(a, b)) <|reserved_special_token_1|> <|reserved_special_token_0|> a = np.random.normal(25.0, 5.0, 10000) b = np.random.normal(26.0, 5.0, 10000) prin...
flexible
{ "blob_id": "ba85f3c8a9e40f30076c13487a97567f7bc646dc", "index": 8041, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(stats.ttest_ind(a, b))\n<mask token>\nprint(stats.ttest_ind(a, b))\n", "step-3": "<mask token>\na = np.random.normal(25.0, 5.0, 10000)\nb = np.random.normal(26.0, 5.0, 10000)\npri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ui_Admin(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_Admin(object): def setupUi(self, Admin): Admin.setObjectName('Admin') Admin.resize(679, 490) self....
flexible
{ "blob_id": "5e2a8e95af88a582b6e760a53dfd41f880d66963", "index": 2670, "step-1": "<mask token>\n\n\nclass Ui_Admin(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Admin(object):\n\n def setupUi(self, Admin):\n Admin.setObjectName('Admin')\n Admin.resize(6...
[ 1, 2, 3, 4, 5 ]
import serial import time def main(): # '/dev/tty****' is your port ID con=serial.Serial('/dev/tty****', 9600) print('connected.') while 1: str=con.readline() # byte code print (str.strip().decode('utf-8')) # decoded string if __name__ == '__main__': main()
normal
{ "blob_id": "108c8bbb4d3dbc6b7f32e084b13009296b3c5a80", "index": 8016, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n con = serial.Serial('/dev/tty****', 9600)\n print('connected.')\n while 1:\n str = con.readline()\n print(str.strip().decode('utf-8'))\n\n\n<mask ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ This is a post login API and hence would have APIDetails and SessionDetails in the request object ------------------------------------------------------------------------------------------------- Step 1: find if user's ip address is provided in the reques...
flexible
{ "blob_id": "d7daf9b26f0b9f66b15b8533df032d17719e548b", "index": 3343, "step-1": "<mask token>\n", "step-2": "\"\"\"\nThis is a post login API and hence would have APIDetails and SessionDetails in the request object\n----------------------------------------------------------------------------------------------...
[ 0, 1 ]
class Rectangulo(): def __init__(self, base, altura): self.base = base self.altura = altura def calcular_area(self): return self.base * self.altura base = float(input("Ingrese la base del rectangulo: \n")) altura = float(input("Ingrese la altura del rectangulo: \n")) #Primera instan...
normal
{ "blob_id": "2e60781da004fb86d3a33deae970c1faf2a5037d", "index": 5793, "step-1": "class Rectangulo:\n <mask token>\n\n def calcular_area(self):\n return self.base * self.altura\n\n\n<mask token>\n", "step-2": "class Rectangulo:\n\n def __init__(self, base, altura):\n self.base = base\n ...
[ 2, 3, 4, 5, 6 ]
#Άσκηση 3.2: Ουρά δύο άκρων print("Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ενώ,\nαν θέλεις να βγάλεις το τελευταιο, πληκτρολόγησε 'r'\n ") newNumber = input("Για να ξεκιν...
normal
{ "blob_id": "87bcf53d1c93645a08b10ba0d02edf0d5b0a4906", "index": 5664, "step-1": "<mask token>\n", "step-2": "print(\n \"\"\"Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ...
[ 0, 1, 2, 3 ]
from disaggregation import DisaggregationManager import numpy as np from more_itertools import windowed x = np.random.random_sample(10 * 32 * 1024) w = windowed(x, n=1024, step=128) z = DisaggregationManager._overlap_average(np.array(list(w)), stride=128) print(z.shape) print(x.shape) assert z.shape == x.shape
normal
{ "blob_id": "6d4950ca61cd1e2ee7ef8b409577e9df2d65addd", "index": 4462, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(z.shape)\nprint(x.shape)\nassert z.shape == x.shape\n", "step-3": "<mask token>\nx = np.random.random_sample(10 * 32 * 1024)\nw = windowed(x, n=1024, step=128)\nz = Disaggregation...
[ 0, 1, 2, 3 ]
import time import numpy as np import matplotlib.pyplot as plt class stochasticGradient : def __init__( self , kwargs ) : self.inputVectors = kwargs["inputVectors"] self.expectedOutput = kwargs["expectedOutput"] self.noOfEpochs = kwargs["noO...
normal
{ "blob_id": "775900d4c059c89bfb10f5c3c2a924a41a049438", "index": 8205, "step-1": "<mask token>\n\n\nclass stochasticGradient:\n\n def __init__(self, kwargs):\n self.inputVectors = kwargs['inputVectors']\n self.expectedOutput = kwargs['expectedOutput']\n self.noOfEpochs = kwargs['noOfEpoch...
[ 17, 18, 23, 26, 29 ]
<|reserved_special_token_0|> class lexicon0(db.Model): word = db.StringProperty(required=True) known = db.StringListProperty(indexed=False) <|reserved_special_token_0|> def getjp(before, wordlist, after): global REQUESTURL wordli = wordlist string = '' for x in wordli: string += be...
flexible
{ "blob_id": "c8a6a8633f863e0350157346106a747096d26939", "index": 9912, "step-1": "<mask token>\n\n\nclass lexicon0(db.Model):\n word = db.StringProperty(required=True)\n known = db.StringListProperty(indexed=False)\n\n\n<mask token>\n\n\ndef getjp(before, wordlist, after):\n global REQUESTURL\n wordl...
[ 13, 14, 17, 21, 22 ]
import re class Markdown: __formattedFile = [] __analyzing = [] def __processSingleLine(self, line): if(self.__isHeading(line)): self.__process("p") self.__analyzing.append(re.sub("(#{1,6})", "", line).strip()) self.__process("h" + str(len(re.split("\s", line)[0]))) elif(self.__isH...
normal
{ "blob_id": "13e3337cf9e573b8906fe914a830a8e895af20ba", "index": 3983, "step-1": "<mask token>\n\n\nclass Markdown:\n <mask token>\n <mask token>\n\n def __processSingleLine(self, line):\n if self.__isHeading(line):\n self.__process('p')\n self.__analyzing.append(re.sub('(#{...
[ 9, 10, 11, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def palinPerm(str): charSet = set() for c in str: if c not in charSet: charSet.add(c) else: charSet.remove(c) return len(charSet) == 1 or len(charSet) == 0 <|reserved_special_token_0|> <|reserved_special...
flexible
{ "blob_id": "04487dce97231a7be2bf3b164e93f0ea4d01ba05", "index": 1160, "step-1": "<mask token>\n", "step-2": "def palinPerm(str):\n charSet = set()\n for c in str:\n if c not in charSet:\n charSet.add(c)\n else:\n charSet.remove(c)\n return len(charSet) == 1 or len(...
[ 0, 1, 2, 3, 4 ]
5 1 6 1x 1112#Desember@@@@@
normal
{ "blob_id": "b324c520400f04719b17121b0b4c2d23915e8841", "index": 2666, "step-1": "5 1\r\n6 1x\r\n1112#Desember@@@@@", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> class Styles(models.Model): <|reserved_special_token_0|> @staticmethod def make_style(): index_list = ['모던', '미니멀리즘', '한국', '스칸다나비아', '인더스트리얼', '프로방스', '로맨틱', '클래식', '엔틱'] for i in range(len(index_list)): Styles.objects.create(type=inde...
flexible
{ "blob_id": "1bbadf02c4b9ca22a0099bcc09fa4c62c9901c39", "index": 1069, "step-1": "<mask token>\n\n\nclass Styles(models.Model):\n <mask token>\n\n @staticmethod\n def make_style():\n index_list = ['모던', '미니멀리즘', '한국', '스칸다나비아', '인더스트리얼', '프로방스',\n '로맨틱', '클래식', '엔틱']\n for i in ...
[ 9, 15, 23, 27, 32 ]
import sys def saludar(saludo): print saludo def iniciales(nombre,ape1,ape2): iniciales=nombre[0]+'.'+ape1[0]+'.'+ape2[0]+'.' return "Tus iniciales son:"+iniciales.upper() def iniciales1(nombre,ape1,*apellidos): iniciales=nombre[0]+'.'+ape1[0] for ape in apellidos: iniciales=iniciales+'.'+ape[0] return in...
normal
{ "blob_id": "01b615f8282d4d42c5e83181fffc2d7cb612c096", "index": 704, "step-1": "import sys \n\n\ndef saludar(saludo):\n\tprint saludo\n\ndef iniciales(nombre,ape1,ape2):\n\tiniciales=nombre[0]+'.'+ape1[0]+'.'+ape2[0]+'.'\n\treturn \"Tus iniciales son:\"+iniciales.upper()\n\n\ndef iniciales1(nombre,ape1,*apellid...
[ 0 ]
<|reserved_special_token_0|> def kind(n): s = str(n) l = len(s) i = 0 j = i + 1 decr, bouncy, incr = False, False, False while j < l: a = int(s[i]) b = int(s[j]) if s[i] > s[j]: decr = True elif s[i] < s[j]: incr = True i += 1 ...
flexible
{ "blob_id": "0de27101675eb8328d9a2831ed468a969b03e7d3", "index": 5741, "step-1": "<mask token>\n\n\ndef kind(n):\n s = str(n)\n l = len(s)\n i = 0\n j = i + 1\n decr, bouncy, incr = False, False, False\n while j < l:\n a = int(s[i])\n b = int(s[j])\n if s[i] > s[j]:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def absent(lectureid, sectionid): connection = psycopg2.connect(database='profmate', user='python', password='python', host='34.74.217.167', port='5432') cursor = connection.cursor() postgreSQL_select_Query =...
flexible
{ "blob_id": "e05dac901228e6972c1cb48ce2def3d248b4c167", "index": 3053, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef absent(lectureid, sectionid):\n connection = psycopg2.connect(database='profmate', user='python',\n password='python', host='34.74.217.167', port='5432')\n cursor = c...
[ 0, 1, 2, 3, 4 ]
from math import pow from math import tan import plotly.figure_factory as ff from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot def euler(): h = 0.1 x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5] y_eval = [0.0] delta_y = [0.0] y_real = [0.0] eps = [0.0] for i in range(1, le...
normal
{ "blob_id": "20f0480ee7e0782b23ec8ade150cdd8d8ad718bb", "index": 783, "step-1": "<mask token>\n\n\ndef euler():\n h = 0.1\n x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5]\n y_eval = [0.0]\n delta_y = [0.0]\n y_real = [0.0]\n eps = [0.0]\n for i in range(1, len(x)):\n y_eval.append(y_eval[i - 1] +...
[ 2, 3, 4, 5, 6 ]
def decorate(a): def inner(f): def decorated(*args, **kwargs): return f(a, *args, **kwargs) return decorated return inner @decorate(3) def func(a, b, c): print a, b, c func(1, 2)
normal
{ "blob_id": "d2049b20e00b45df9fb0772d9a654a58a00191c5", "index": 9865, "step-1": "def decorate(a):\n def inner(f):\n def decorated(*args, **kwargs):\n return f(a, *args, **kwargs)\n return decorated\n return inner\n\n\n@decorate(3)\ndef func(a, b, c):\n print a, b, c\n\n\nfunc(1...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if numone > numtwo: print('The first number is bigger') elif numtwo > numone: print('The second number is bigger') else: print('The numbers are the same') if numone % 3 == 0 and numtwo % 3 == 0: print('They are bot...
flexible
{ "blob_id": "a67612e8301728d1fb366d7c8909fa830f04bf45", "index": 9739, "step-1": "<mask token>\n", "step-2": "<mask token>\nif numone > numtwo:\n print('The first number is bigger')\nelif numtwo > numone:\n print('The second number is bigger')\nelse:\n print('The numbers are the same')\nif numone % 3 ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('{0}\n{1}\n{0}'.format(line, header)) for i in range(-10, 31): print('| {:^7} | {:^10.10} |'.format(i, i * 1.8 + 32)) <|reserved_special_token_1|> <|reserved_special_token_0|> __author__ = 'Aspen Thompson' header = '|...
flexible
{ "blob_id": "591d0a166af5b8d0bed851c2f56ecc3da4f3a5eb", "index": 4367, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('{0}\\n{1}\\n{0}'.format(line, header))\nfor i in range(-10, 31):\n print('| {:^7} | {:^10.10} |'.format(i, i * 1.8 + 32))\n", "step-3": "<mask token>\n__author__ = 'Aspen Thom...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class liteQueue: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _get_conn(self): id = th...
flexible
{ "blob_id": "ed6eda4b6dbf3e94d8efb53004b19cd9c49e927e", "index": 3979, "step-1": "<mask token>\n\n\nclass liteQueue:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _get_conn(self):\n id = threading.current_thread().i...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> class SiLU(nn.Layer): def forward(self, x): return x * nn.functional.sigmoid(x) class GroupNorm32(nn.GroupNorm): def forward(self, x): return super().forward(x) <|reserved_special_token_0|> def avg_pool_nd(dims, *args, **kwargs): """ Create a 1D, 2D...
flexible
{ "blob_id": "364d70fab02291bafadebea68fee94c0210e2de9", "index": 4365, "step-1": "<mask token>\n\n\nclass SiLU(nn.Layer):\n\n def forward(self, x):\n return x * nn.functional.sigmoid(x)\n\n\nclass GroupNorm32(nn.GroupNorm):\n\n def forward(self, x):\n return super().forward(x)\n\n\n<mask toke...
[ 9, 11, 12, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: os.chdir(os.path.join(os.getcwd(), 'docs')) print(os.getcwd()) except: pass <|reserved_special_token_0|> g.map(sns.boxplot, 'intronless', 'pct_cyte', order=[False, True]) g.set_ylabels("""% Spermatocyte Cells With...
flexible
{ "blob_id": "5f4d83aa2b530417ecb1598510fb4778b111700b", "index": 6489, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n os.chdir(os.path.join(os.getcwd(), 'docs'))\n print(os.getcwd())\nexcept:\n pass\n<mask token>\ng.map(sns.boxplot, 'intronless', 'pct_cyte', order=[False, True])\ng.set_yl...
[ 0, 1, 2, 3, 4 ]
w = int(input("Width ?")) h= int(input("Height ?")) for b in range(1,w+1): print ("*", end='') print("") for i in range(1,h-1): print ("*", end='') for j in range(1,w-1): print (" ", end='') print ("*", end='') print("") for b in range(1,w+1): print ("*", end='') print("")
normal
{ "blob_id": "32b961f3971819fdbbe1a30fd7cf1883353c1854", "index": 2294, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor b in range(1, w + 1):\n print('*', end='')\nprint('')\nfor i in range(1, h - 1):\n print('*', end='')\n for j in range(1, w - 1):\n print(' ', end='')\n print('*', ...
[ 0, 1, 2, 3 ]
import pytest from ethereum.tools.tester import TransactionFailed def test_cant_ever_init_twice(ethtester, root_chain): ethtester.chain.mine() with pytest.raises(TransactionFailed): root_chain.init(sender=ethtester.k0) with pytest.raises(TransactionFailed): root_chain.init(sender=ethtester...
normal
{ "blob_id": "8417b63e2b7b16d3d58175022662c5b3e59e4aaf", "index": 4640, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_cant_ever_init_twice(ethtester, root_chain):\n ethtester.chain.mine()\n with pytest.raises(TransactionFailed):\n root_chain.init(sender=ethtester.k0)\n with p...
[ 0, 1, 2 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "b9608208f71f25ae05ed9bd7bdf94b8882a26e06", "index": 3091, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('输入鲈鱼的先验概率例如:70,对应70%') <|reserved_special_token_0|> for i in range(0, int(a) * 50): rowa_data = sh.row_values(i) L.append(rowa_data) <|reserved_special_token_0|> for j in range(5000, 5000 + (100 - int(a)) * 50): ...
flexible
{ "blob_id": "077b6d3d7417bbc26e9f23af6f437ff05e3d5771", "index": 812, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('输入鲈鱼的先验概率例如:70,对应70%')\n<mask token>\nfor i in range(0, int(a) * 50):\n rowa_data = sh.row_values(i)\n L.append(rowa_data)\n<mask token>\nfor j in range(5000, 5000 + (100 - in...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def copy_credentials_file(hostname, username, password, src_path, dst_path): ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect(hostname=hostname, username=username, password=password) ftp_client = ssh_clie...
flexible
{ "blob_id": "27f162f2e350fdb284740bd67f4293535f0ab593", "index": 8451, "step-1": "<mask token>\n\n\ndef copy_credentials_file(hostname, username, password, src_path, dst_path):\n ssh_client = paramiko.SSHClient()\n ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n ssh_client.connect(hos...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def getMediaId(contentProviderMediaName): conn = pymssql.connect(host='CHELLSSSQL23.karmalab.net', user= 'TravCatalog', password='travel', database= 'LodgingCatalogMaster_Phoenix') cur = conn.cursor() cur.execute('SELECT * FROM media WHERE contentprovidermedian...
flexible
{ "blob_id": "a5b7f565a1797e5f326bcf26ff7c8ad2469dca70", "index": 7442, "step-1": "<mask token>\n\n\ndef getMediaId(contentProviderMediaName):\n conn = pymssql.connect(host='CHELLSSSQL23.karmalab.net', user=\n 'TravCatalog', password='travel', database=\n 'LodgingCatalogMaster_Phoenix')\n cur ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python3 # -*- coding:utf-8 -*- import socket import select import time """=====================Head Define=====================""" UDP_RECEIVE_TIMEOUT = 1 LOOP_DELAY = 1 """=====================Class=====================""" class UDP_packet: def __init__(self,board_info, board_add, state): se...
normal
{ "blob_id": "7c2a59f698b75d0de89a16310d97a01506c99cb3", "index": 9840, "step-1": "<mask token>\n\n\nclass UDP_packet:\n\n def __init__(self, board_info, board_add, state):\n self.board_type = int('{0:08b}'.format(board_info)[:4], 2)\n self.board_num = int('{0:08b}'.format(board_info)[4:], 2)\n ...
[ 6, 7, 8, 9, 10 ]
# Generated by Django 2.1.2 on 2018-10-25 09:36 import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.utils.timezone import uuid class Migration(migrations.Migration): dependencies = [ ('grafit', '0002_article'), ] operati...
normal
{ "blob_id": "8b0eed6d1f24b5dd30726ce08c97354a5d5ab69b", "index": 7597, "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 = [('grafit', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestModel(tl.LightningModule): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def training_step(self, batch, batch_idx, optimizer_idx): pred = self(batch) loss = tf.reduce_mean(pred) log = {'batch_idx':...
flexible
{ "blob_id": "f2397ba3fe1452238f251111f35b06b4a93e0359", "index": 2441, "step-1": "<mask token>\n\n\nclass TestModel(tl.LightningModule):\n <mask token>\n <mask token>\n <mask token>\n\n def training_step(self, batch, batch_idx, optimizer_idx):\n pred = self(batch)\n loss = tf.reduce_mea...
[ 7, 11, 12, 14, 15 ]
botnet = open("bots.txt","r") bots = botnet.read() print(bots.split('\n')) botnet.close()
normal
{ "blob_id": "ea876d903263c907f63b2f37a81f2576345dae62", "index": 7692, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(bots.split('\\n'))\nbotnet.close()\n", "step-3": "botnet = open('bots.txt', 'r')\nbots = botnet.read()\nprint(bots.split('\\n'))\nbotnet.close()\n", "step-4": "botnet = open(\"b...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.7 on 2021-02-24 05:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('autotasks', '0017_auto_20210210_1512'), ] operations = [ migrations.AddField( model_name='automatedtask', name='run_...
normal
{ "blob_id": "3ab1de77147f6abfabeea10f2a4e85686edffd6f", "index": 2573, "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 = [('autotasks',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main() ->None: """Entry point.""" parser = argparse.ArgumentParser(description='Motion planning script.') parser.add_argument('--params-file-path', '-p', type=str, required= False, default=os.path.join(os.path.dirname(__file__) + '/motion_params.json'), hel...
flexible
{ "blob_id": "b7d75c2523dba0baaf06ba270045a4a344b8156c", "index": 3023, "step-1": "<mask token>\n\n\ndef main() ->None:\n \"\"\"Entry point.\"\"\"\n parser = argparse.ArgumentParser(description='Motion planning script.')\n parser.add_argument('--params-file-path', '-p', type=str, required=\n False...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .sgd import StochasticGradientDescent from .momentum import Momentum
flexible
{ "blob_id": "aa55f1dd4f363e07d5f9104346efaa24c0457d45", "index": 9126, "step-1": "<mask token>\n", "step-2": "from .sgd import StochasticGradientDescent\nfrom .momentum import Momentum\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# 总管buffer和policy from os import path import torch import torch.nn as nn import torch.optim as optim import torch.distributions as distributions import numpy as np from torch.serialization import load import global_var as gv torch.set_default_dtype(gv.torch_default_type) class PG_Agent(object): def __init__( ...
normal
{ "blob_id": "b2cfd397e48213a540608fc232db2eab282935bb", "index": 1481, "step-1": "<mask token>\n\n\nclass PG_Agent(object):\n\n def __init__(self, env, policy: torch.nn.modules.container.Sequential,\n learning_rate: float, n_policy: int, n_episode: int, max_timesteps: int\n ) ->None:\n su...
[ 6, 7, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ANSWER_WITH_CORRECTION = [[[Human, What, Is, BlockObjectThis], [ HumanReplace, The, AbstractDescription, BlockObjectLocation]], [[Human, What, Is, BlockObjectThis, AbstractDescription], [HumanReplace, The, AbstractDesc...
flexible
{ "blob_id": "ceb714e949a72f621aec8b8728fbd1201e22afd1", "index": 8705, "step-1": "<mask token>\n", "step-2": "<mask token>\nANSWER_WITH_CORRECTION = [[[Human, What, Is, BlockObjectThis], [\n HumanReplace, The, AbstractDescription, BlockObjectLocation]], [[Human,\n What, Is, BlockObjectThis, AbstractDescr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Freq(object): def __init__(self, array): self.__array = array self.__frequency_dict = {} self.__array_length = len(array) self.__running_time = round(time.time() * 1000) def get_original_array(self): return self.__array <|reserve...
flexible
{ "blob_id": "b569f0a0dda048d6337e1028a240caabf188a174", "index": 9420, "step-1": "<mask token>\n\n\nclass Freq(object):\n\n def __init__(self, array):\n self.__array = array\n self.__frequency_dict = {}\n self.__array_length = len(array)\n self.__running_time = round(time.time() * ...
[ 3, 5, 6, 7, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def overlap_rect(rec1, rec2): """Determine if rectangles overlap.""" a = rec2[2] <= rec1[0] b = rec1[2] <= rec2[0] c = rec2[3] <= rec1[1] d = rec1[3] <= rec2[1] return not (a or b or c or d) <|reserved_special_token_1|> # leetcode 8...
flexible
{ "blob_id": "0ef03ed455938bd2001581986c38104bfac395ce", "index": 8078, "step-1": "<mask token>\n", "step-2": "def overlap_rect(rec1, rec2):\n \"\"\"Determine if rectangles overlap.\"\"\"\n a = rec2[2] <= rec1[0]\n b = rec1[2] <= rec2[0]\n c = rec2[3] <= rec1[1]\n d = rec1[3] <= rec2[1]\n retu...
[ 0, 1, 2 ]
import argparse def parse_args(): """ Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit. :return: Populated namespace. """ parser = argparse.ArgumentParser(description='baseline Mask R-CNN') parser.add_argument('--dataset', required=True...
normal
{ "blob_id": "b6527a09f346ee1b7dd446a0ff21995a995481a8", "index": 6640, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_args():\n \"\"\"\n Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit.\n :return: Populated namespace.\n ...
[ 0, 1, 2, 3 ]
import os import time import argparse import cPickle as pickle from definitions import OieFeatures from definitions.OieExample import OieExample class FeatureLexicon: """ A wrapper around various dictionaries storing the mined data. It holds 5 dictionaries in total. Two of them store mappings\n - str ...
normal
{ "blob_id": "8102bdf4d29d2d3a1bdddbcfb6045b0660693996", "index": 402, "step-1": "import os\nimport time\nimport argparse\nimport cPickle as pickle\nfrom definitions import OieFeatures\nfrom definitions.OieExample import OieExample\n\n\nclass FeatureLexicon:\n \"\"\"\n A wrapper around various dictionaries ...
[ 0 ]
# -*- coding: UTF-8 -*- ''' Evaluate trained PredNet on KITTI sequences. Calculates mean-squared error and plots predictions. ''' import os import numpy as np from six.moves import cPickle import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from keras import ...
normal
{ "blob_id": "a3507019ca3310d7ad7eb2a0168dcdfe558643f6", "index": 1615, "step-1": "<mask token>\n", "step-2": "<mask token>\nmatplotlib.use('Agg')\n<mask token>\nf.close()\n<mask token>\ntrain_model.load_weights(weights_file)\n<mask token>\nif data_format == 'channels_first':\n X_test = np.transpose(X_test, ...
[ 0, 1, 2, 3, 4 ]
import matplotlib.pyplot as plt import numpy as np # 描画用サンプルデータ #x= np.array([0,1,2,3,4]) y = np.array([2, 2, 3, 4, 5]) print(y) #print(range(y)) plt.figure(figsize=(10,1)) plt.bar(range(len(y)), y) plt.savefig('test.png') plt.clf()
normal
{ "blob_id": "2f714ed54a19ec26d7ecb1979e79366721b3d0fe", "index": 6682, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(y)\nplt.figure(figsize=(10, 1))\nplt.bar(range(len(y)), y)\nplt.savefig('test.png')\nplt.clf()\n", "step-3": "<mask token>\ny = np.array([2, 2, 3, 4, 5])\nprint(y)\nplt.figure(fig...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> mylcd.lcd_clear() mylcd.lcd_display_string('RAS Hi-Pi shutdown', 1) mylcd.lcd_display_string(' See you again ~', 2) mylcd.lcd_display_string('http://rasplay.org', 3) mylcd.lcd_display_string('RaspberryPi Village', 4) sleep(2) os....
flexible
{ "blob_id": "df60d3b829c5702385f59fdefaea04f569fb7db2", "index": 9058, "step-1": "<mask token>\n", "step-2": "<mask token>\nmylcd.lcd_clear()\nmylcd.lcd_display_string('RAS Hi-Pi shutdown', 1)\nmylcd.lcd_display_string(' See you again ~', 2)\nmylcd.lcd_display_string('http://rasplay.org', 3)\nmylcd.lcd_displa...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class K80(TN93): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, kappa, scale_q=True): super(K80, self).__init__(kappa, kappa, 1, self._freqs, scale_q=scale_q ) <|r...
flexible
{ "blob_id": "0f0595793e98187c6aaf5b1f4b59affb06bb598e", "index": 3159, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass K80(TN93):\n <mask token>\n <mask token>\n\n def __init__(self, kappa, scale_q=True):\n super(K80, self).__init__(kappa, kappa, 1, self._freqs, scale_q=scale_q\n...
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> class Subject(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def filter_question(cls): id_l = os.listdir(settings.QUESTION_PATH) r_id_l = random.sample(id_l, 3) return [cls.get_obj_by_...
flexible
{ "blob_id": "7cd6a8a106c21e8e377666d584e19d30c607b7d2", "index": 9345, "step-1": "<mask token>\n\n\nclass Subject(Base):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def filter_question(cls):\n id_l = os.listdir(settings.QUESTION_PATH)\n r_id_l = random.sample(id_l...
[ 21, 23, 24, 27, 30 ]
t = int(input()) m = 0 while(m < t): n = int(input()) arr = list(map(int, input().strip().split(" "))) s = int(input()) hash_map = {} curr_sum = 0 count = 0 for i in range(len(arr)): curr_sum += arr[i] if curr_sum == s: count += 1 if curr_sum - s in hash_m...
normal
{ "blob_id": "3ac69068db94f45bc44a8295a10603126d004b34", "index": 6219, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile m < t:\n n = int(input())\n arr = list(map(int, input().strip().split(' ')))\n s = int(input())\n hash_map = {}\n curr_sum = 0\n count = 0\n for i in range(len(...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 from aws_cdk import core import os from ec2_ialb_aga_custom_r53.network_stack import NetworkingStack from ec2_ialb_aga_custom_r53.aga_stack import AgaStack from ec2_ialb_aga_custom_r53.alb_stack import ALBStack from ec2_ialb_aga_custom_r53.certs_stack import CertsStack from ec2_ialb_aga_custom_...
normal
{ "blob_id": "2f96e58a825744ae6baafd1bfb936210500f0fd0", "index": 6334, "step-1": "<mask token>\n", "step-2": "<mask token>\nec2.add_dependency(net)\n<mask token>\nalb.add_dependency(net)\nalb.add_dependency(ec2)\nalb.add_dependency(cert)\n<mask token>\naga.add_dependency(net)\naga.add_dependency(cert)\naga.add...
[ 0, 1, 2, 3, 4 ]
# NumPy(Numerical Python) 是 Python 语言的一个扩展程序库, # 支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。
normal
{ "blob_id": "94348aed0585024c70062e9201fb41aae2122625", "index": 9331, "step-1": "# NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,\r\n# 支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def quicksort(x, pivot_index): key1_idx, key2_idx, key3_idx = 0, 0, len(x) key1_val, key2_val = 'key1', 'key2' while key2_idx < key3_idx: if x[key2_idx]['key'] == key1_val: x[key1_idx], x[key2_idx...
flexible
{ "blob_id": "f193094c551df2a32860948b1a8710b53ca0dfb6", "index": 2413, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef quicksort(x, pivot_index):\n key1_idx, key2_idx, key3_idx = 0, 0, len(x)\n key1_val, key2_val = 'key1', 'key2'\n while key2_idx < key3_idx:\n if x[key2_idx]['key']...
[ 0, 1, 2, 3, 4 ]
class BinarySearchTreeNode: def __init__(self, node_data): self.data = node_data self.left = None self.right = None def bst_contains(root: BinarySearchTreeNode, number): if root is None: return 0 if(root.data == number): return 1 elif(root.data < number): ...
normal
{ "blob_id": "3bdf3a48451b83347a6c9a9851b5b85b608f0b63", "index": 2826, "step-1": "<mask token>\n", "step-2": "class BinarySearchTreeNode:\n <mask token>\n\n\n<mask token>\n", "step-3": "class BinarySearchTreeNode:\n\n def __init__(self, node_data):\n self.data = node_data\n self.left = No...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def return_dci_df(DCI_dir, subdir, hm_mark, compr_type, suffix): dci_file = '{}/{}/{}_{}{}.csv'.format(DCI_dir, subdir, hm_mark, compr_type, suffix) if os.path.isfile(dci_file): dci_df = pd.read_csv(dci_file, sep='\t', index_col=4) dci_df.columns = ['chr', ...
flexible
{ "blob_id": "4ee47435bff1b0b4a7877c06fb13d13cf53b7fce", "index": 3910, "step-1": "<mask token>\n\n\ndef return_dci_df(DCI_dir, subdir, hm_mark, compr_type, suffix):\n dci_file = '{}/{}/{}_{}{}.csv'.format(DCI_dir, subdir, hm_mark,\n compr_type, suffix)\n if os.path.isfile(dci_file):\n dci_df ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ludwig_get_model_definition(df: 'Dataframe', target: str, features: list): input_features, output_features = [], [] for p in features: if pandas.api.types.is_numeric_dtype(df[p]): input_features.a...
flexible
{ "blob_id": "b7521a604fb49591df814d469f53d35574126fdb", "index": 7609, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ludwig_get_model_definition(df: 'Dataframe', target: str, features: list):\n input_features, output_features = [], []\n for p in features:\n if pandas.api.types.is_nu...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> config_prefix = '<' config_suported_types = ['PNG', 'GIF', 'JPEG'] config_pattern = '^[A-Za-z0-9_]*$' config_max_storage = int(1000000000.0) config_max_name_length = 20 config_message_by_line = 2 config_max_message_length = 2000 config_max_emote_length = 8 * ...
flexible
{ "blob_id": "dc2deb7d4c9cc126a6d80435fe9dbc16d6ac8941", "index": 9397, "step-1": "<mask token>\n", "step-2": "config_prefix = '<'\nconfig_suported_types = ['PNG', 'GIF', 'JPEG']\nconfig_pattern = '^[A-Za-z0-9_]*$'\nconfig_max_storage = int(1000000000.0)\nconfig_max_name_length = 20\nconfig_message_by_line = 2\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def load_covid(): covid = pd.read_csv( 'https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv' ) target = 'new_cases' date = 'date' dataset = covid[covid['loc...
flexible
{ "blob_id": "e19529dce407da0f1e21f6a3696efcefac9ed040", "index": 8500, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef load_covid():\n covid = pd.read_csv(\n 'https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv'\n )\n target = 'new_cases'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def test_form(request): print('test 함수 실행하자 ') return render(request, 'emaillist/test_form.html') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_form(request): print('test 함수 실행하자 ') return render(request, 'emaillist/...
flexible
{ "blob_id": "5220ad793788927e94caf7d6a42df11292851c67", "index": 2734, "step-1": "<mask token>\n\n\ndef test_form(request):\n print('test 함수 실행하자 ')\n return render(request, 'emaillist/test_form.html')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_form(request):\n print('test 함수 실행하자 ')\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def send_rdd(rdd): out_list = rdd.collect() for word in out_list: producer.send('had2020011-out', value=str(word)) <|reserved_special_token_0|> def aggregator(values, old): return (old or 0) + sum(values) <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "12fdeae0ae1618139b20176846e7df5b82f7aa01", "index": 8274, "step-1": "<mask token>\n\n\ndef send_rdd(rdd):\n out_list = rdd.collect()\n for word in out_list:\n producer.send('had2020011-out', value=str(word))\n\n\n<mask token>\n\n\ndef aggregator(values, old):\n return (old or 0) + su...
[ 2, 3, 4, 5, 6 ]
from datareader import * import matplotlib.pyplot as plt from plotting import * from misc import * import leastSquares as lsModel import masim as mAvgSim import numpy as np import pandas as pd import statistics as stat from datetime import datetime as dt from time import mktime def main(): # scrape_data(pd.read_csv('...
normal
{ "blob_id": "8d5e652fda3fb172e6faab4153bca8f78c114cd1", "index": 7973, "step-1": "<mask token>\n\n\ndef main():\n daily_signal_checker('china_stocks.csv', location='chineseStocks/')\n\n\n<mask token>\n\n\ndef daily_signal_checker(stocks, location):\n ndays = 6\n stock_list = pd.read_csv(stocks)\n for...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('input.txt', 'r') as f: data = f.read() <|reserved_special_token_0|> print(res) <|reserved_special_token_0|> for line in res: newHold.append(tuple(int(i) for i in line.split(', '))) print(newHold) <|reserved_spec...
flexible
{ "blob_id": "47476fbb78ca8ce14d30bf226795bbd85b5bae45", "index": 6939, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('input.txt', 'r') as f:\n data = f.read()\n<mask token>\nprint(res)\n<mask token>\nfor line in res:\n newHold.append(tuple(int(i) for i in line.split(', ')))\nprint(newHol...
[ 0, 1, 2, 3, 4 ]
""" Compare 1-D analytical sphere solution to 1-D numerical and 3-D Comsol solutions for transient heat conduction in solid sphere with constant k and Cp. Assumptions: Convection boundary condition at surface. Symmetry about the center of the solid. Heat transfer via radiation assumed to be negligable. Particle does n...
normal
{ "blob_id": "15ca54aff4c688733c9c514ba5856e6bf29a3292", "index": 8345, "step-1": "<mask token>\n\n\ndef despine():\n ax = py.gca()\n ax.spines['top'].set_visible(False)\n ax.spines['right'].set_visible(False)\n py.tick_params(axis='both', bottom='off', top='off', left='off', right=\n 'off')\n\...
[ 1, 2, 3, 4, 5 ]
from util import AutomataError from automata import NFA from base import Node from copy import copy, deepcopy from os.path import commonprefix DEBUG = False LAMBDA = u'\u03bb' PHI = u'\u00d8' def copyDeltas(src): out = dict() for k in src: out[k] = dict() for k2 in src[k]: out[k]...
normal
{ "blob_id": "2fe20f28fc7bba6b8188f5068e2b3c8b87c15edc", "index": 94, "step-1": "<mask token>\n\n\ndef replaceNode(nfa, old, new):\n if DEBUG:\n print('R_Start(%s, %s) ---' % (old, new), nfa)\n if old in nfa._deltas:\n for input in nfa._deltas[old]:\n nfa.addDelta(new, input, nfa._d...
[ 8, 9, 11, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for key in default_registry: env_name = key if key[0].isdigit(): env_name = key.replace('3', 'Three') if not env_name.isidentifier(): logger.warning( f'Environment id {env_name} can not be r...
flexible
{ "blob_id": "3bec28561c306a46c43dafc8bdc2e01f2ea06180", "index": 9491, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key in default_registry:\n env_name = key\n if key[0].isdigit():\n env_name = key.replace('3', 'Three')\n if not env_name.isidentifier():\n logger.warning(\n ...
[ 0, 1, 2, 3 ]
""" Test cases for ldaptor.protocols.ldap.delta """ from twisted.trial import unittest from ldaptor import delta, entry, attributeset, inmemory from ldaptor.protocols.ldap import ldapsyntax, distinguishedname, ldaperrors class TestModifications(unittest.TestCase): def setUp(self): self.foo = ldapsyntax.L...
normal
{ "blob_id": "8054ccb07d0130b75927a4bb9b712ce3d564b8fe", "index": 4702, "step-1": "<mask token>\n\n\nclass TestModificationOpLDIF(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def testReplaceAll(self):\n m = delta.Replace('thud')\n self.assertEqua...
[ 43, 46, 52, 54, 63 ]
from rest_framework import serializers from books.models import Genres, Format, Book, Review, ExtraTableForPrice class GenresSerializer(serializers.ModelSerializer): class Meta: model = Genres fields = ('title', ) class PriceSerializer(serializers.ModelSerializer): class Meta: model...
normal
{ "blob_id": "9c50a3abd353d5ba619eaa217dcc07ab76fb850c", "index": 2519, "step-1": "<mask token>\n\n\nclass BookSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Book\n fields = '__all__'\n\n def create(self, validated_data):\n formats = validated_data.pop('format', []...
[ 9, 11, 12, 13, 14 ]
<|reserved_special_token_0|> class Renderer(common.Branded): def __init__(self, eve): self.eve = eve self.t = 0 def load(self): eve = self.eve eve.cc(open( '/home/jamesb/git/gd2-asset/examples/nightstrike/night0.gd3', 'rb').read()) def draw(self):...
flexible
{ "blob_id": "2471daad5969da29a20417a099a3ecd92fa036b4", "index": 6393, "step-1": "<mask token>\n\n\nclass Renderer(common.Branded):\n\n def __init__(self, eve):\n self.eve = eve\n self.t = 0\n\n def load(self):\n eve = self.eve\n eve.cc(open(\n '/home/jamesb/git/gd2-a...
[ 4, 5, 6, 7, 8 ]
from django.shortcuts import render import datetime from django.http import* from django.core.files.storage import FileSystemStorage import uuid import os import cv2 import numpy as np from pathlib import Path def index(request): print(request.session); today=datetime.datetime.now() return render(request,'index.h...
normal
{ "blob_id": "3378ce72ae67d09258554048138b7f9023000922", "index": 6619, "step-1": "<mask token>\n\n\ndef index(request):\n print(request.session)\n today = datetime.datetime.now()\n return render(request, 'index.html', {'today': today.strftime('%d-%m=%Y')})\n\n\ndef isFileOpen(request):\n stack = requ...
[ 12, 14, 15, 17, 19 ]
# Generated by Django 3.2.4 on 2021-08-09 03:22 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), ('employee', '0013_auto_20...
normal
{ "blob_id": "f7a335db0ddf8a871e98eac54b59c41a40622153", "index": 4566, "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|> <|reserved_special_token_0|> def f(): global animal animal = 'dog' print('local_scope:', animal) print('local:', locals()) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(): global anim...
flexible
{ "blob_id": "4f3908e12102cfd58737952803c710772e960b0e", "index": 2385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f():\n global animal\n animal = 'dog'\n print('local_scope:', animal)\n print('local:', locals())\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef f():\n gl...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def configure_distro(distro='debian', arch='i386', release='unstable'): if distro not in ['ubuntu', 'debian']: print('Unknown Distro %s' % distro) return False if distro == 'ubuntu': if arch in ['amd64', 'i386']: distro_conf['debootstrap_mirror'...
flexible
{ "blob_id": "600691b87f7776e96bbf439d7195b870ed86090b", "index": 1145, "step-1": "<mask token>\n\n\ndef configure_distro(distro='debian', arch='i386', release='unstable'):\n if distro not in ['ubuntu', 'debian']:\n print('Unknown Distro %s' % distro)\n return False\n if distro == 'ubuntu':\n ...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- """ Created on Tue Sep 15 10:28:04 2020 @author: Maxi """ import numpy as np from ase.io import read from RDF_3D import pairCorrelationFunction_3D import matplotlib.pyplot as plt filename = r"C:\Users\Maxi\Desktop\t\Ag_HfO2_cat_3.125_222_t.cif" crystal = read(filename) corrdinates = cryst...
normal
{ "blob_id": "516d9790f40c021d45302948b7fba0cf3e00da0a", "index": 6322, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure()\nplt.plot(r, g_r, color='black')\nplt.xlabel('r')\nplt.ylabel('g(r)')\nplt.xlim((0, rmax))\nplt.ylim((0, 1.05 * g_r.max()))\nplt.show()\n", "step-3": "<mask token>\nfilenam...
[ 0, 1, 2, 3, 4 ]
from setuptools import setup, find_packages setup( packages=find_packages(), setup_requires=["flask"], name="mith1", )
normal
{ "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 ]
def longest_word(s, d): lengths = [(entry, len(entry)) for entry in d] sorted_d = sorted(lengths, key = lambda x: (-x[1], x[0])) for word, length in sorted_d: j = 0 for i in range(0, len(s)): if j < len(word) and word[j] == s[i]: j += 1 if j == len(wo...
normal
{ "blob_id": "86de5b4a72978e2c49e060eefc513e3ed61272ae", "index": 4004, "step-1": "<mask token>\n", "step-2": "def longest_word(s, d):\n lengths = [(entry, len(entry)) for entry in d]\n sorted_d = sorted(lengths, key=lambda x: (-x[1], x[0]))\n for word, length in sorted_d:\n j = 0\n for i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Basic(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _region_test(self, x): if x in self.iana.region: return True elif x in ('XX', 'XK'): return True retu...
flexible
{ "blob_id": "e4f194c3dbc3e1d62866343642e41fa1ecdeab93", "index": 7380, "step-1": "<mask token>\n\n\nclass Basic(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def _region_test(self, x):\n if x in self.iana.region:\n return True\n elif x in ('XX', 'XK'):\...
[ 11, 13, 17, 18, 19 ]
from azfs.az_file_client import ( AzFileClient, export_decorator ) from azfs.az_file_system import AzFileSystem from azfs.utils import BlobPathDecoder from .table_storage import ( TableStorage, TableStorageWrapper ) # comparable tuple VERSION = (0, 2, 14) # generate __version__ via VERSION tuple __ve...
normal
{ "blob_id": "e7239b4bc3db9bd427b9be888621f66e81b5edeb", "index": 2242, "step-1": "<mask token>\n", "step-2": "<mask token>\nVERSION = 0, 2, 14\n__version__ = '.'.join(map(str, VERSION))\n__all__ = ['AzFileClient', 'AzFileSystem', 'BlobPathDecoder',\n 'TableStorage', 'TableStorageWrapper', 'export_decorator'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BytesWriter: <|reserved_special_token_0|> class BytesReader: def read(self, n: int=...) ->bytes: ... def seek(self, offset: int, whence: int=...) ->int: ... <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "e2f134f5ff00405396b8bbf4edc263b70ef5d972", "index": 2435, "step-1": "<mask token>\n\n\nclass BytesWriter:\n <mask token>\n\n\nclass BytesReader:\n\n def read(self, n: int=...) ->bytes:\n ...\n\n def seek(self, offset: int, whence: int=...) ->int:\n ...\n\n\n<mask token>\n", ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'adverts' urlpatterns = [path('', views.AdvertListView.as_view(), name='list'), path( 'create/', views.AdvertFormView.as_view(), name='adverts-create'), path ('<str:category>/', views.AdvertListView.as_view(), n...
flexible
{ "blob_id": "8c1718f56a73fdd962154abfaedc7c0c3cb0d9ba", "index": 6626, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'adverts'\nurlpatterns = [path('', views.AdvertListView.as_view(), name='list'), path(\n 'create/', views.AdvertFormView.as_view(), name='adverts-create'), path\n ('<str:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DeviceBGPSession(PluginTemplateExtension): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_s...
flexible
{ "blob_id": "be566041402dc1705aa9d644edc44de8792fbb3c", "index": 4850, "step-1": "<mask token>\n\n\nclass DeviceBGPSession(PluginTemplateExtension):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass DeviceBGPSessio...
[ 1, 4, 7, 8 ]
from flask import Flask from flask_script import Manager app = Flask(__name__) manager = Manager(app) @app.route('/') def index(): return '2018/6/1 hello python' @app.route('/news') def news(): return '内蒙古新闻资讯,请选择浏览' if __name__ == '__main__': manager.run()
normal
{ "blob_id": "f9d8280d765826b05bfa7989645e487431799f85", "index": 7809, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return '2018/6/1 hello python'\n\n\n@app.route('/news')\ndef news():\n return '内蒙古新闻资讯,请选择浏览'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index()...
[ 2, 3, 4, 5 ]
# 백준 문제(2021.5.22) # 10039번) 상현이가 가르치는 아이폰 앱 개발 수업의 수강생은 원섭, 세희, 상근, 숭, 강수이다. # 어제 이 수업의 기말고사가 있었고, 상현이는 지금 학생들의 기말고사 시험지를 채점하고 있다. # 기말고사 점수가 40점 이상인 학생들은 그 점수 그대로 자신의 성적이 된다. # 하지만, 40점 미만인 학생들은 보충학습을 듣는 조건을 수락하면 40점을 받게 된다. # 보충학습은 거부할 수 없기 때문에, 40점 미만인 학생들은 항상 40점을 받게 된다. # 학생 5명의 점수가 주어졌을 때, 평균 점수를 구하는 프로그램을 작성...
normal
{ "blob_id": "4a13a0d7aa2371d7c8963a01b7cc1b93f4110d5e", "index": 5356, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(5):\n score = int(input())\n if score < 40:\n score = 40\n result += score\nprint(result // 5)\n", "step-3": "result = 0\nfor i in range(5):\n score = ...
[ 0, 1, 2, 3 ]
from django.apps import AppConfig class CfCoreConfig(AppConfig): name = 'cf_core'
normal
{ "blob_id": "01847c9e601eae6775cd4324483740c30e344557", "index": 382, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CfCoreConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CfCoreConfig(AppConfig):\n name = 'cf_core'\n", "step-4": "from django.apps import AppCon...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Pack) admin.site.register(Cliente) <|reserved_special_token_1|> from django.contrib import admin from .models import Cliente, Pack admin.site.register(Pack) admin.site.register(Cliente) <|reserved_special_...
flexible
{ "blob_id": "2af590ad11704ecf21489a5d546e61f40dcceee6", "index": 2121, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Pack)\nadmin.site.register(Cliente)\n", "step-3": "from django.contrib import admin\nfrom .models import Cliente, Pack\nadmin.site.register(Pack)\nadmin.site.registe...
[ 0, 1, 2, 3 ]
# SPDX-License-Identifier: Apache-2.0 """ .. _example-lightgbm-pipe: Convert a pipeline with a LightGbm model ======================================== .. index:: LightGbm *sklearn-onnx* only converts *scikit-learn* models into *ONNX* but many libraries implement *scikit-learn* API so that their models can be inclu...
normal
{ "blob_id": "32227029cb4e852536611f7ae5dec5118bd5e195", "index": 8324, "step-1": "<mask token>\n", "step-2": "<mask token>\nnumpy.random.shuffle(ind)\n<mask token>\npipe.fit(X, y)\nupdate_registered_converter(LGBMClassifier, 'LightGbmLGBMClassifier',\n calculate_linear_classifier_output_shapes, convert_ligh...
[ 0, 1, 2, 3, 4 ]
# template for "Stopwatch: The Game" import math import simplegui # define global variables successcount = 0; totalstopcount = 0; count = 0; T = True; F = True; # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def format(t): A = str(t // 600); tem = (t /...
normal
{ "blob_id": "bb198978ffc799bb43acf870467496e1dcc54d4b", "index": 3710, "step-1": "<mask token>\n\n\ndef format(t):\n A = str(t // 600)\n tem = t // 10\n tem = tem % 60\n B = str(tem // 10)\n C = str(tem % 10)\n D = str(t % 10)\n return A + ':' + B + C + '.' + D\n\n\n<mask token>\n\n\ndef res...
[ 4, 5, 6, 7, 10 ]
<|reserved_special_token_0|> def load_all_vectors(num_chunks): all_vectors = [] meta_data = [] for chunk_id in range(num_chunks): logging.info('Processing file %s', chunk_id) t = time.time() vectors = np.load(FLAGS.sent2vec_dir + '/chunk_%s.vectors.npy' % chunk_id).asty...
flexible
{ "blob_id": "8aa35bcaa4e564306125b37c70a8a92f26da736d", "index": 7418, "step-1": "<mask token>\n\n\ndef load_all_vectors(num_chunks):\n all_vectors = []\n meta_data = []\n for chunk_id in range(num_chunks):\n logging.info('Processing file %s', chunk_id)\n t = time.time()\n vectors =...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python # -*- coding : utf-8 -*- """ @author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com> """ # Director class Director(object): def __init__(self): self.builder = None def construct_building(self): self.builder.new_building() self.builder.build_floor...
normal
{ "blob_id": "8ee26d181f06a2caf2b2b5a71a6113c245a89c03", "index": 3322, "step-1": "#!/usr/bin/python\n# -*- coding : utf-8 -*-\n\"\"\"\n @author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com>\n\"\"\"\n\n# Director\nclass Director(object):\n def __init__(self):\n self.builder = None\n ...
[ 0 ]
<|reserved_special_token_0|> class Node2: def __init__(self, value): self._value = value self._children = [] self._idx = 0 def __repr__(self): return 'Node2({!r})'.format(self._value) <|reserved_special_token_0|> def __iter__(self): self._idx = 0 retu...
flexible
{ "blob_id": "f5513bea4ca5f4c2ac80c4bf537a264a4052d1e9", "index": 8866, "step-1": "<mask token>\n\n\nclass Node2:\n\n def __init__(self, value):\n self._value = value\n self._children = []\n self._idx = 0\n\n def __repr__(self):\n return 'Node2({!r})'.format(self._value)\n <ma...
[ 12, 13, 15, 16, 24 ]
<|reserved_special_token_0|> class Logger(models.Model): Facinet = models.ForeignKey('Facinet', null=False, blank=False, related_name='Loggers') loggerindex = models.IntegerField(unique=True, db_column='LoggerIndex') name = models.TextField(db_column='Name') online = models.IntegerField(db_col...
flexible
{ "blob_id": "02ddf213cd3f455f8d8fbde8621fc4788124d5a9", "index": 3714, "step-1": "<mask token>\n\n\nclass Logger(models.Model):\n Facinet = models.ForeignKey('Facinet', null=False, blank=False,\n related_name='Loggers')\n loggerindex = models.IntegerField(unique=True, db_column='LoggerIndex')\n n...
[ 4, 6, 7, 11, 12 ]
<|reserved_special_token_0|> class TestInterpreter(unittest.TestCase): <|reserved_special_token_0|> def test_HelloWorld(self): result = run_program( """ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+. +++++++..+++.>++.<<+++++++++++++++.>.+++.-----...
flexible
{ "blob_id": "19ab44cec863560513aadd88b5fd4bb40f75e371", "index": 2579, "step-1": "<mask token>\n\n\nclass TestInterpreter(unittest.TestCase):\n <mask token>\n\n def test_HelloWorld(self):\n result = run_program(\n \"\"\"\n ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>...
[ 4, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def drawSquare(): for i in range(4): forward(100) left(90) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def drawSquare(): for i in range(4): forwar...
flexible
{ "blob_id": "1ce5b97148885950983e39b7e99d0cdfafe4bc16", "index": 5382, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef drawSquare():\n for i in range(4):\n forward(100)\n left(90)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef drawSquare():\n for i in range(4):\n ...
[ 0, 1, 2, 3 ]
# This is the template file for Lab #5, Task #1 import numpy import lab5 def digitize(samples,threshold): return 1*(samples > threshold) class ViterbiDecoder: # given the constraint length and a list of parity generator # functions, do the initial set up for the decoder. The # following useful instance ...
normal
{ "blob_id": "19221823f14cf06a55d445fc241fc04e64e5873c", "index": 8323, "step-1": "# This is the template file for Lab #5, Task #1\nimport numpy\nimport lab5\n\ndef digitize(samples,threshold):\n\treturn 1*(samples > threshold)\n\nclass ViterbiDecoder:\n # given the constraint length and a list of parity gener...
[ 0 ]
# Moving Averages Code # Load the necessary packages and modules import pandas as pd import matplotlib.pyplot as plt import data.stock as st # Simple Moving Average def SMA(data, ndays): SMA = pd.Series(data['close'].rolling(ndays).mean(), name='SMA') # SMA = pd.Series(pd.rolling_mean(data['close'], ndays),...
normal
{ "blob_id": "4c9f2b6fd119daa58b7f1dd7153c90df747e62cb", "index": 1249, "step-1": "<mask token>\n\n\ndef get_sma(stock_code, ndays):\n stock_data = st.get_csv_data(stock_code, 'price')\n sma_data = SMA(stock_data, ndays)\n sma_data = sma_data.dropna()\n return sma_data['SMA']\n\n\n<mask token>\n", "...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def set_up(args): set_gpu(args.gpu) ensure_path(args.save_path) torch.manual_seed(args.random_seed) torch.backends.cudnn.deterministic = True <|reserved_special_token_0|> def test(args, data, label, reproduce, subject, fold): seed_all(args.random_seed) set_up(a...
flexible
{ "blob_id": "6ef78e4308f6e693f50df714a5d7af1785e49d7a", "index": 7682, "step-1": "<mask token>\n\n\ndef set_up(args):\n set_gpu(args.gpu)\n ensure_path(args.save_path)\n torch.manual_seed(args.random_seed)\n torch.backends.cudnn.deterministic = True\n\n\n<mask token>\n\n\ndef test(args, data, label, ...
[ 2, 4, 6, 7, 8 ]
queries = [] for n in range(2, 51): for k in range(n, n * n + 1): queries.append((n, k)) print(len(queries)) for n, k in queries: print(n, k)
normal
{ "blob_id": "798d5c68a0aa2057c28d7f333905f20fef965d70", "index": 2850, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(2, 51):\n for k in range(n, n * n + 1):\n queries.append((n, k))\nprint(len(queries))\nfor n, k in queries:\n print(n, k)\n", "step-3": "queries = []\nfor n ...
[ 0, 1, 2 ]
#!/usr/bin/env python3 # Lesson_5 Activity 2 Mailroom Part 2 import os def page_break(): """ Print a separator to distinguish new 'pages'""" print("_"*75+"\n") def get_amount(): """Get valid donation amount from user""" while True: try: amount = input("How much did they donate:...
normal
{ "blob_id": "8a192fc08a65c80b8733a9d07374156c09f36598", "index": 2823, "step-1": "<mask token>\n\n\ndef get_amount():\n \"\"\"Get valid donation amount from user\"\"\"\n while True:\n try:\n amount = input('How much did they donate: ')\n if str(amount).lower() == 'exit':\n ...
[ 6, 7, 8, 9, 12 ]
class Solution: def calculate(self, s: str) ->int: nums = [] ops = [] def cal(): a = nums.pop() b = nums.pop() c = ops.pop() if c == '+': nums.append(b + a) elif c == '-': nums.append(b - a) ...
normal
{ "blob_id": "0ff8743e54509a76e9a7add4be9da279bdee82a6", "index": 5032, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def calculate(self, s: str) ->int:\n nums = []\n ops = []\n\n def cal():\n a = nums.pop()\n ...
[ 0, 1, 2 ]
from rest_framework import serializers from dailytasks.models import Tasks class TasksSerializer(serializers.ModelSerializer): user = serializers.ReadOnlyField(source='user.username') class Meta: model = Tasks fields = ['id', 'created', 'title', 'description', 'status', 'user']
normal
{ "blob_id": "3fa1736fd87448ec0da4649153521d0aba048ccf", "index": 3689, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TasksSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = Tasks\n fields = ['id', 'created', 'title', 'description', 'status',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def curve(): for i in range(200): pen.right(1) pen.forward(1) def heart(): pen.fillcolor('yellow') pen.begin_fill() pen.left(140) pen.forward(113) curve() pen.left(120) curve() pen.forward(112) pen.end_fill() <|reserved_special_t...
flexible
{ "blob_id": "fa925d0ef4f9df3fdf9a51c7fcc88933609bc9e3", "index": 3980, "step-1": "<mask token>\n\n\ndef curve():\n for i in range(200):\n pen.right(1)\n pen.forward(1)\n\n\ndef heart():\n pen.fillcolor('yellow')\n pen.begin_fill()\n pen.left(140)\n pen.forward(113)\n curve()\n ...
[ 2, 3, 4, 5 ]
import sys import time from abc import ABC, abstractmethod from PySide6.QtGui import QPixmap from PySide6.QtWidgets import QApplication import inupdater.resource from inupdater.splash import SplashScreen class UserInterface(ABC): """Interface for GUI element""" def __init__(self) -> None: self.stat...
normal
{ "blob_id": "efeb069a7e2aab7262a557236c693752d2973523", "index": 4169, "step-1": "<mask token>\n\n\nclass UserInterface(ABC):\n <mask token>\n <mask token>\n\n @abstractmethod\n def show_message(self, msg: str):\n \"\"\"Show a message\"\"\"\n <mask token>\n\n @abstractmethod\n def clo...
[ 14, 15, 16, 17, 19 ]