code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __title__ = 'space_tracer' __version__ = '4.10.2' __author__ = 'Don Kirkby' __author_email__ = 'donkirkby@gmail.com' __description__ = 'Trade time for space when debugging your code.' __url__ = 'https://donkirkby.github.io/live-py...
flexible
{ "blob_id": "6cb29ebd9c0f2660d0eb868bec87ffd97cf4d198", "index": 6262, "step-1": "<mask token>\n", "step-2": "<mask token>\n__title__ = 'space_tracer'\n__version__ = '4.10.2'\n__author__ = 'Don Kirkby'\n__author_email__ = 'donkirkby@gmail.com'\n__description__ = 'Trade time for space when debugging your code.'...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def load_data(train_source, train_dist, test_source, test_dist, max_len, vocab_size): """ fin = open(test_source, "r") data2 = fin.read() fin.close() fout = open(train_source, "a") fout.write(data2) fout.close() fin = open(test_dist, "r") data2 = f...
flexible
{ "blob_id": "2962ef1d7ecd4e8d472b9dc36664e4e8745391fd", "index": 3616, "step-1": "<mask token>\n\n\ndef load_data(train_source, train_dist, test_source, test_dist, max_len,\n vocab_size):\n \"\"\"\n fin = open(test_source, \"r\")\n data2 = fin.read()\n fin.close()\n fout = open(train_source, \"...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if CURRENT_PYTHON < REQUIRED_PYTHON: sys.stderr.write( """========================== Unsupported Python Version ========================== This version of MDSANIMA requires Python {}.{} but you're trying to install it ...
flexible
{ "blob_id": "2827a56c12c1e15a6fe26ce182aa07d76735d77f", "index": 407, "step-1": "<mask token>\n", "step-2": "<mask token>\nif CURRENT_PYTHON < REQUIRED_PYTHON:\n sys.stderr.write(\n \"\"\"==========================\nUnsupported Python Version\n==========================\nThis version of MDSANIMA requ...
[ 0, 1, 2, 3, 4 ]
from django.test import TestCase, Client from pdf_crawler.models import Document from rest_framework.reverse import reverse class TestCase(TestCase): client = Client() def setUp(self): Document.objects.create(name='First').save() def test_endpoints(self): """ test for endpoints ...
normal
{ "blob_id": "0d28ab54f08301d9788ca9a5e46d522e043e9507", "index": 4474, "step-1": "<mask token>\n\n\nclass TestCase(TestCase):\n <mask token>\n\n def setUp(self):\n Document.objects.create(name='First').save()\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestCase(TestCase):\n <mask t...
[ 2, 3, 4, 5 ]
import sys from collections import namedtuple from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, \ QHBoxLayout, QStackedWidget, QListWidget, QListWidgetItem from PyQt5.QtCore import Qt, QSize from runWidget import RunWidget from recordWidget import RecordWidget def QListWidget_qss(): return ...
normal
{ "blob_id": "252a6b97f108b7fdc165ccb2a7f61ce31f129d3d", "index": 8693, "step-1": "<mask token>\n\n\nclass MainCentralWidget(QWidget):\n\n def __init__(self):\n super().__init__()\n tab_bar = self.getTabBar(('录制', '运行'))\n tab_page = self.getTabPage()\n tab_bar.currentRowChanged.con...
[ 5, 6, 7, 9, 10 ]
#1.문자열에 홑따옴표 포함기키기 : 쌍따옴표 print("Python's Data Type") #2.문자열에 쌍따옴표 포함시키기 : 홑따옴표 print('"Python is very easy" he said.') #멀티라인(여러줄)표현하기 #1. 연속된 쌍따옴표 3개 사용하기 print("""No pain No gain""") #2. 연속된 쌍따옴표 3개 사용하기 print('''No pain No gain''') #3.이스케이프 코드 \n 삽입하기 print("No pain \n No gain") """ 이스케이프(es...
normal
{ "blob_id": "eb81f1825c4ac8e20dde1daefbdad22f588e696e", "index": 9431, "step-1": "<mask token>\n", "step-2": "print(\"Python's Data Type\")\nprint('\"Python is very easy\" he said.')\nprint(\"\"\"No pain\n No gain\"\"\")\nprint(\"\"\"No pain\n No gain\"\"\")\nprint(\"\"\"No pain \n No gain\"\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def setup(bot): bot.add_cog(EmbedPeek(bot)) <|reserved_special_token_1|> <|reserved_special_token_0|> __red_end_user_data_statement__ = ( 'This cog does not persistently store data or metadata about users.') def set...
flexible
{ "blob_id": "b66142e0b674d3920b8e3ad74e0d0b753f0a78c3", "index": 3471, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef setup(bot):\n bot.add_cog(EmbedPeek(bot))\n", "step-3": "<mask token>\n__red_end_user_data_statement__ = (\n 'This cog does not persistently store data or metadata about u...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from wordcloud import WordCloud, ImageColorGenerator import numpy as np from PIL import Image def word2cloud(text: str, mask_image: Image=None): if mask_image == None: wc = WordCloud(font_path='simhei.ttf', width=800, height=600, mode='RGBA', background_color=...
normal
{ "blob_id": "f9310aa6c26ec10041dac272fa17ac21f74c21ac", "index": 9326, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef word2cloud(text: str, mask_image: Image=None):\n if mask_image == None:\n wc = WordCloud(font_path='simhei.ttf', width=800, height=600, mode=\n 'RGBA', backgr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def configure_log(log_file, verbose=False): filename = log_file if log_file == 'STDOUT': handler = logging.StreamHandler(sys.stdout) elif log_file == 'STDERR': handler = logging.StreamHandler(sys.stderr) else: handler = TimedRotatingFileHandler(file...
flexible
{ "blob_id": "3a96ede91069df0c71905415e598dbbd9d3056fd", "index": 9730, "step-1": "<mask token>\n\n\ndef configure_log(log_file, verbose=False):\n filename = log_file\n if log_file == 'STDOUT':\n handler = logging.StreamHandler(sys.stdout)\n elif log_file == 'STDERR':\n handler = logging.St...
[ 7, 11, 12, 14, 16 ]
<|reserved_special_token_0|> def init(): gpio.setmode(gpio.BCM) gpio.setup(26, gpio.OUT) gpio.setup(19, gpio.OUT) gpio.setup(13, gpio.OUT) gpio.setup(6, gpio.OUT) def turn_left(tf): gpio.output(26, False) gpio.output(19, True) gpio.output(13, False) gpio.output(6, True) sleep...
flexible
{ "blob_id": "a7cbd595b86908fb399bf11e1522588e0b0475c3", "index": 9226, "step-1": "<mask token>\n\n\ndef init():\n gpio.setmode(gpio.BCM)\n gpio.setup(26, gpio.OUT)\n gpio.setup(19, gpio.OUT)\n gpio.setup(13, gpio.OUT)\n gpio.setup(6, gpio.OUT)\n\n\ndef turn_left(tf):\n gpio.output(26, False)\n ...
[ 4, 6, 7, 8, 10 ]
from phylo_utils.data import fixed_equal_nucleotide_frequencies from phylo_utils.substitution_models.tn93 import TN93 class K80(TN93): _name = 'K80' _freqs = fixed_equal_nucleotide_frequencies.copy() def __init__(self, kappa, scale_q=True): super(K80, self).__init__(kappa, kappa, 1, self._freqs, ...
normal
{ "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 ]
indelCost = 1 swapCost = 13 subCost = 12 noOp = 0 def alignStrings(x,y): nx = len(x) ny = len(y) S = matrix(nx+1, ny+1) #?? for i in range (nx+1) for j in range (ny+1) if i == 0: #if the string is empty S[i][j] = j #this will put all the letters from j in i elif j == 0: #if the second string ...
normal
{ "blob_id": "65aa85675393efa1a0d8e5bab4b1dbf388018c58", "index": 261, "step-1": "\nindelCost = 1\nswapCost = 13\nsubCost = 12\nnoOp = 0\n\t\ndef alignStrings(x,y):\n\t\n\tnx = len(x)\n\tny = len(y)\n\tS = matrix(nx+1, ny+1) #?? \n\t\n\tfor i in range (nx+1)\n\t\tfor j in range (ny+1)\n\t\t\tif i == 0:\t#if the s...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_logs(ip_addr, pem_file, log_dir): pem = paramiko.RSAKey.from_private_key_file(pem_file) client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=i...
flexible
{ "blob_id": "a1df804325a074ed980ec864c72fe231e2968997", "index": 4024, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_logs(ip_addr, pem_file, log_dir):\n pem = paramiko.RSAKey.from_private_key_file(pem_file)\n client = paramiko.SSHClient()\n client.set_missing_host_key_policy(paramik...
[ 0, 1, 2, 3, 4 ]
# Chris DeBoever # cdeboeve@ucsd.edu import sys, argparse, pdb, glob, os, re import numpy as np from bisect import bisect_left from scipy.stats import binom ### helper functions ### def find_lt(a,x): """ Find rightmost value less than x in list a Input: list a and value x Output: rightmost value les...
normal
{ "blob_id": "da751e96c225ebc2d30f3cce01ba2f64d0a29257", "index": 3763, "step-1": "<mask token>\n\n\ndef find_lt(a, x):\n \"\"\"\n Find rightmost value less than x in list a\n Input: list a and value x\n Output: rightmost value less than x in a\n \"\"\"\n i = bisect_left(a, x)\n if i:\n ...
[ 7, 8, 9, 11, 12 ]
''' fibonacci(6) => [1, 1, 2, 3, 5, 8] fibonacci(7) => [1, 1, 2, 3, 5, 8, 13] ''' def fibonacci(n): if n == 0: return [] elif n == 1: return [1] elif n == 2: return [1, 1] else: lista = fibonacci(n-1) suma = lista[len(lista)-1] + lista[len(lista)-2] lista...
normal
{ "blob_id": "03062ea08bd6ad88376f7c2aa2c89d2194ed8b2e", "index": 1074, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fibonacci(n):\n if n == 0:\n return []\n elif n == 1:\n return [1]\n elif n == 2:\n return [1, 1]\n else:\n lista = fibonacci(n - 1)\n ...
[ 0, 1, 2, 3, 4 ]
def check_bit4(input): mas=0b1000 desired=input & mas if desired>0: return "om" else : return "off"
normal
{ "blob_id": "29dc940292a6805aabfa5bed22bb75d31140c83f", "index": 3257, "step-1": "<mask token>\n", "step-2": "def check_bit4(input):\n mas = 8\n desired = input & mas\n if desired > 0:\n return 'om'\n else:\n return 'off'\n", "step-3": "def check_bit4(input):\n\tmas=0b1000\n\tdesire...
[ 0, 1, 2 ]
#define the simple_divide function here def simple_divide(item, denom): # start a try-except block try: return item/denom except ZeroDivisionError: return 0 def fancy_divide(list_of_numbers, index): denom = list_of_numbers[index] return [simple_divide(item, denom) for item in lis...
normal
{ "blob_id": "1fbdb0b40f0d65fffec482b63aa2192968b01d4b", "index": 9766, "step-1": "def simple_divide(item, denom):\n try:\n return item / denom\n except ZeroDivisionError:\n return 0\n\n\n<mask token>\n", "step-2": "def simple_divide(item, denom):\n try:\n return item / denom\n ...
[ 1, 2, 3, 4, 5 ]
import openpyxl class TestXLUtility: def __init__(self, driver): self.driver = driver def getRowCount(file, sheetname): workbook = openpyxl.load_workbook(file) #sheet = workbook.get_sheet_by_name(sheetname) sheet = workbook[sheetname] return(sheet.max_row) def get...
normal
{ "blob_id": "adae4f9ebcbbb775fc40278ceec9a0cc30c0a503", "index": 1541, "step-1": "<mask token>\n\n\nclass TestXLUtility:\n <mask token>\n\n def getRowCount(file, sheetname):\n workbook = openpyxl.load_workbook(file)\n sheet = workbook[sheetname]\n return sheet.max_row\n <mask token>...
[ 2, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Classifier(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Classifier(object): <|reserved_special_token_0|> def __init__(self, classifier, scaler, orient, color_space, pix...
flexible
{ "blob_id": "9188d58a6d9e832b8908b823d57249fcdd80ff51", "index": 171, "step-1": "<mask token>\n", "step-2": "class Classifier(object):\n <mask token>\n <mask token>\n", "step-3": "class Classifier(object):\n <mask token>\n\n def __init__(self, classifier, scaler, orient, color_space,\n pix...
[ 0, 1, 2, 3 ]
# -*- coding: UTF-8 -*- ''' model = DQN,DDQN,PDQN,PDDQN,DQN_PER,DDQN_PER,DQN_InAday,DQN_PER_Ipm... ''' # -----------ContolGame------------ # CartPole - v1, MountainCar - v0, Acrobot - v1, Pendulum - v0 # from run_ContolGame import run_Game # run_Game('DQN', 'CartPole-v1', episodes=400) # model,env,episodes # --------...
normal
{ "blob_id": "f49a133fa94aae791ef0f1eec54cf0629f45a0ed", "index": 5153, "step-1": "<mask token>\n", "step-2": "<mask token>\nrun_Game('DQN_PER', 'Breakout', lifes=5, episodes=40001)\n", "step-3": "<mask token>\nfrom run_AtariGame import run_Game\nrun_Game('DQN_PER', 'Breakout', lifes=5, episodes=40001)\n", ...
[ 0, 1, 2, 3 ]
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt BATCH_START=0 TIME_STEPS=20 BATCH_SIZE=50 INPUT_SIZE=1 OUTPUT_SIZE=1 CELL_SIZE=10 LR=0.006 #generate data def get_batch(): global BATCH_START,TIME_STEPS xs=np.arange(BATCH_START,BATCH_START+TIME_STEPS*BATCH_SIZE).reshape((BATCH_SIZE,T...
normal
{ "blob_id": "e54078f21176bbb7accb4164e7b56633b13cc693", "index": 8803, "step-1": "<mask token>\n\n\nclass LSTMRNN(object):\n\n def __init__(self, n_steps, input_size, output_size, cell_size, batch_size\n ):\n self.n_steps = n_steps\n self.input_size = input_size\n self.output_size ...
[ 8, 11, 12, 13, 14 ]
text=open('mytext.txt','w') x=text.write("I like coding\nit is a new part\nof my life!!!") text=open('mytext.txt') read=text.readlines() i=0 counter=0 total=0 print("number of lines :"+str(len(read))) while i<=len(read)-1: counter=counter+read[i].count('\n') + read[i].count(' ') total+=len(read[i])-read[i].cou...
normal
{ "blob_id": "5ad8db85f4f705173cf5d0649af6039ebe1544b2", "index": 7488, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('number of lines :' + str(len(read)))\nwhile i <= len(read) - 1:\n counter = counter + read[i].count('\\n') + read[i].count(' ')\n total += len(read[i]) - read[i].count('\\n')...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __version__ = '0.2.11' <|reserved_special_token_0|> <|reserved_special_token_1|> __version__ = '0.2.11' from climlab.utils import constants from climlab.utils import thermo, legendre from climlab.model.column import GreyRadiationModel, RadiativeConvectiveM...
flexible
{ "blob_id": "8251a9c798b3cdc2f374d0a0406ccfaa11b7c5e3", "index": 5699, "step-1": "<mask token>\n", "step-2": "__version__ = '0.2.11'\n<mask token>\n", "step-3": "__version__ = '0.2.11'\nfrom climlab.utils import constants\nfrom climlab.utils import thermo, legendre\nfrom climlab.model.column import GreyRadia...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Content-type: text/html\n') <|reserved_special_token_0|> if 'echooUser' in str(os.environ): userName = EchooFunctions.getUserName() userName = userName[0] userID = EchooFunctions.getUserID(cursor, userName) <|re...
flexible
{ "blob_id": "dc88686d3cbb4223b4de6847bf4fc29b93054b00", "index": 495, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Content-type: text/html\\n')\n<mask token>\nif 'echooUser' in str(os.environ):\n userName = EchooFunctions.getUserName()\n userName = userName[0]\n userID = EchooFunctions....
[ 0, 1, 2, 3, 4 ]
""" Stirng - Liste - Dosya - Fonksiyon yazıyoruz. - Bu fonksiyon iki parametre alacak. (dosya, string) 1. sorun : Dosyanın içinde string var ise True döndürecek yok ise False 2. sorun : Dosyanın içinde string bulunursa ilk bulunduğu konumu return edecek 3. sorun : Dosyanın içerisinde yazdığımız strinng kaç k...
normal
{ "blob_id": "0d3cc85cd18ee197b24c8b01b71afe82110bfad2", "index": 3487, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fonkString(text, string):\n if string in text:\n print('TRUE')\n print(text.index(string), '. sirada ilk', string, 'bulundu')\n print(text.count(string), '...
[ 0, 1, 2, 3 ]
__version__ = "alph 1.0"
normal
{ "blob_id": "2c4eb07a32c6903ae31006f42c13c55e6cc42eb5", "index": 5245, "step-1": "<mask token>\n", "step-2": "__version__ = 'alph 1.0'\n", "step-3": "__version__ = \"alph 1.0\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import numpy as np import tensorflow as tf class LocNet: def __init__(self, scope, buttom_layer): self.scope = scope with tf.variable_scope(scope) as scope: self.build_graph(buttom_layer) self.gt_loc = tf.placeholder(dtype=tf.float32, shape=(None,4),name='gt_loc') ...
normal
{ "blob_id": "dd4dc1c4a0dc47711d1d0512ef3f6b7908735766", "index": 3149, "step-1": "<mask token>\n\n\nclass LocNet:\n\n def __init__(self, scope, buttom_layer):\n self.scope = scope\n with tf.variable_scope(scope) as scope:\n self.build_graph(buttom_layer)\n self.gt_loc = tf....
[ 2, 3, 4, 5, 6 ]
n=int(input()) k=[4,7,47,74,44,77,444,447,474,477,777,774,747,7444] f=0 for i in k: if(n%i==0): f=1 print("YES") break; if(f==0): print("NO")
normal
{ "blob_id": "6161653fb789040d084e475e0ae25921e2e0676b", "index": 2496, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in k:\n if n % i == 0:\n f = 1\n print('YES')\n break\nif f == 0:\n print('NO')\n", "step-3": "n = int(input())\nk = [4, 7, 47, 74, 44, 77, 444, 447, 47...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class netdespatch_config(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "407f549cf68660c8f8535ae0bed373e2f54af877", "index": 5731, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass netdespatch_config(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 0, 1, 2, 3, 4 ]
#create a list a = [2,3,4,5,6,7,8,9,10] print(a) #indexing b = int(input('Enter indexing value:')) print('The result is:',a[b]) print(a[8]) print(a[-1]) #slicing print(a[0:3]) print(a[0:]) #conconteation b=[20,30] print(a+b) #Repetition print(b*3) #updating print(a[2]) a[2]=100 print(a) #membership print(5 in a) ...
normal
{ "blob_id": "f7d29dd1d990b3e07a7c07a559cf5658b6390e41", "index": 4601, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\n<mask token>\nprint('The result is:', a[b])\nprint(a[8])\nprint(a[-1])\nprint(a[0:3])\nprint(a[0:])\n<mask token>\nprint(a + b)\nprint(b * 3)\nprint(a[2])\n<mask token>\nprint(a...
[ 0, 1, 2, 3 ]
import hashlib md5 = hashlib.md5(b'Najmul') print(md5.hexdigest()) sha1 = hashlib.sha1(b'Najmul') print(sha1.hexdigest()) sha224 = hashlib.sha224(b'Najmul') print(sha224.hexdigest()) sha256 = hashlib.sha256(b'Najmul') print(sha256.hexdigest()) sha384 = hashlib.sha384(b'Najmul') print(sha384.hexdigest()) sha512 = hashli...
normal
{ "blob_id": "ab4c668c8a167f8c387199b7aa49aa742d563250", "index": 1698, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(md5.hexdigest())\n<mask token>\nprint(sha1.hexdigest())\n<mask token>\nprint(sha224.hexdigest())\n<mask token>\nprint(sha256.hexdigest())\n<mask token>\nprint(sha384.hexdigest())\n<...
[ 0, 1, 2, 3 ]
from CTO import CTO #from UI import UIManager from Cidades import Cidades from Database import Database from datetime import datetime class Main: def __init__(self, cidade_filename="", dados_filename=""): #cidade_filename, dados_filename = UIManager().get_filenames() print("cidade: " + cidade_fil...
normal
{ "blob_id": "c5f46be6d7214614892d227c76c75e77433a8fa9", "index": 9517, "step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n def processaCSV(self, filename):\n with open(filename, 'r', encoding='ISO-8859-1') as input_file:\n self.concessao = {}\n self.expansao = {}\n ...
[ 4, 5, 6, 7, 8 ]
from typing import Dict, List from .power_bi_querier import PowerBiQuerier class DeathsByEthnicity(PowerBiQuerier): def __init__(self) ->None: self.source = 'd' self.name = 'deaths by race' self.property = 'race' super().__init__() def _parse_data(self, response_json: Dict[st...
normal
{ "blob_id": "d975b74370acc72101f808e70bef64cee39a5ab8", "index": 6204, "step-1": "<mask token>\n\n\nclass DeathsByEthnicity(PowerBiQuerier):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DeathsByEthnicity(PowerBiQuerier):\n <mask token>\n\n def _parse_data(self, response_json...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NavigationTransformerTrainer(TransformerTrainer): def __init__(self, dataset_reader: NavigationDatasetReader, encoder: TransformerEncoder, optimizer: torch.optim.Optimizer, scheduler: Scheduler, num_epochs: int, num_blocks: int, device: torch.device, che...
flexible
{ "blob_id": "04aacf9461ade2e229076ffdf85aca913037edad", "index": 642, "step-1": "<mask token>\n\n\nclass NavigationTransformerTrainer(TransformerTrainer):\n\n def __init__(self, dataset_reader: NavigationDatasetReader, encoder:\n TransformerEncoder, optimizer: torch.optim.Optimizer, scheduler:\n ...
[ 10, 11, 12, 13, 15 ]
#Интегрирование точного решения кинетик затухания люминесценции символьным методом #Из за сложности получаемых уравнений. Последующий подбор коэффициентов методом МНК # и печать результата # import sympy as sym def del_flu_sym(x ,t = 1 ,Ka = 1, Ktt = 0.5): intens = x**2 return intens x = sym.Symbol('x') t ...
normal
{ "blob_id": "903a431ac39734338b4d464629b4b04a87dc9e8e", "index": 1776, "step-1": "<mask token>\n\n\ndef del_flu_sym(x, t=1, Ka=1, Ktt=0.5):\n intens = x ** 2\n return intens\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef del_flu_sym(x, t=1, Ka=1, Ktt=0.5):\n intens = x ** 2\n return intens\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Notifier(object): <|reserved_special_token_0|> def __init__(self): pass <|reserved_special_token_0|> @abc.abstractmethod def send(self, msg): pass <|reserved_special_token_1|> <|reserved_special_token_0|> class Notifier(object): <|reser...
flexible
{ "blob_id": "f25351a3cb7bf583152baa8e7ec47b0f2161cb9c", "index": 761, "step-1": "<mask token>\n\n\nclass Notifier(object):\n <mask token>\n\n def __init__(self):\n pass\n <mask token>\n\n @abc.abstractmethod\n def send(self, msg):\n pass\n", "step-2": "<mask token>\n\n\nclass Notif...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> data.head() <|reserved_special_token_0|> sb.catplot(x='Age', y='Sex', hue='Survived', col='Embarked', notch=False, palette='Set2', data=data, kind='box', height=4, aspect=0.7) sb.catplot(x='Age', y='Sex', hue='Survived', col='...
flexible
{ "blob_id": "41006ff35299aa72b69c6dc1c71a45b44dca7d6c", "index": 1184, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata.head()\n<mask token>\nsb.catplot(x='Age', y='Sex', hue='Survived', col='Embarked', notch=False,\n palette='Set2', data=data, kind='box', height=4, aspect=0.7)\nsb.catplot(x='Age',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def about(request): teams = Team.objects.all() return render(request, 'pages/about.html', {'teams': teams}) <|reserved_special_token_0|> def contact(request): if request.method == 'POST': name = request.POST['name'] email = request.POST['email'] sub...
flexible
{ "blob_id": "eca40c37e0e437a5f4e5643f5fb7cd3e38605471", "index": 2417, "step-1": "<mask token>\n\n\ndef about(request):\n teams = Team.objects.all()\n return render(request, 'pages/about.html', {'teams': teams})\n\n\n<mask token>\n\n\ndef contact(request):\n if request.method == 'POST':\n name = ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for ln in fh: if ln.startswith('From'): if ln.startswith('From:'): continue else: word = ln.split() lst1.append(word[1]) for word in lst1: data[word] = data.get(word, 0) ...
flexible
{ "blob_id": "4fba13d051a3aceb393a4473cdbf6d4fc684c7ac", "index": 9473, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor ln in fh:\n if ln.startswith('From'):\n if ln.startswith('From:'):\n continue\n else:\n word = ln.split()\n lst1.append(word[1])\nfor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_mysql_uri(user, password, host, database): return f'mysql+pymysql://{user}:{password}@{host}/{database}' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_os_env_value(key): return os.getenv(key) def get_mysql_uri(user,...
flexible
{ "blob_id": "8247b045a5aed4d0f3db6bc2c0edd985f2c4ba30", "index": 5305, "step-1": "<mask token>\n\n\ndef get_mysql_uri(user, password, host, database):\n return f'mysql+pymysql://{user}:{password}@{host}/{database}'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_os_env_value(key):\n return os....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> metadata.create_all(engine) if not os.path.exists(SQLALCHEMY_MIGRATE_REPO): api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository') api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) else: api.ver...
flexible
{ "blob_id": "9bbf0953d228c970764b8ba94675346820bc5d90", "index": 3006, "step-1": "<mask token>\n", "step-2": "<mask token>\nmetadata.create_all(engine)\nif not os.path.exists(SQLALCHEMY_MIGRATE_REPO):\n api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')\n api.version_control(SQLALCHEMY_DATABASE_U...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_browser_driver(): """获取浏览器服务 使用后记得 driver.quit() 否则容易引起状态污染""" try: driver = webdriver.PhantomJS(service_args=['--load-images=no']) except WebDriverException: chrome_options = webdriver.ChromeOptions() chrome_profile = {'profile.managed_default_...
flexible
{ "blob_id": "5ab877ef15cdcd52463b1567c28327dc2eeea2de", "index": 1204, "step-1": "<mask token>\n\n\ndef get_browser_driver():\n \"\"\"获取浏览器服务 使用后记得 driver.quit() 否则容易引起状态污染\"\"\"\n try:\n driver = webdriver.PhantomJS(service_args=['--load-images=no'])\n except WebDriverException:\n chrome_...
[ 1, 2, 3, 4, 5 ]
def ehcf(a, b): p1, q1, h1, p2, q2, h2 = 1, 0, a, 0, 1, b from math import floor while h2 != 0: r = floor(h1/h2) p3 = p1-r*p2 q3 = q1-r*q2 h3 = h1-r*h2 p1,q1,h1,p2,q2,h2 = p2,q2,h2,p3,q3,h3 return (p1, q1, h1) def findinverse(k, p): l = ehcf(k,p)[0] % p return l
normal
{ "blob_id": "d7b426727e11833b3825baac7b379f5ce44ea491", "index": 5495, "step-1": "<mask token>\n", "step-2": "def ehcf(a, b):\n p1, q1, h1, p2, q2, h2 = 1, 0, a, 0, 1, b\n from math import floor\n while h2 != 0:\n r = floor(h1 / h2)\n p3 = p1 - r * p2\n q3 = q1 - r * q2\n h...
[ 0, 1, 2, 3 ]
<|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": "ffd11d49f8499b4bfec8f17d07b66d899dd23d2e", "index": 6924, "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 = [('Cbrowser', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Task: <|reserved_special_token_0|> def __init__(self): """ Create the object :rtype: object """ self.queue = list() self.pending = [] self.complete = [] self.failed = [] self.url_map = {} self.c...
flexible
{ "blob_id": "63ee99012089dcb0e5b41860c95e13fff52c6731", "index": 1546, "step-1": "<mask token>\n\n\nclass Task:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Create the object\n :rtype: object\n \"\"\"\n self.queue = list()\n self.pending = []\n self.com...
[ 8, 9, 12, 13, 14 ]
from .start_node import StartNode from .character_appearance import CharacterAppearance from .character_disappearance import CharacterDisappearance from .replica import Replica from .end_node import EndNode from .choice import Choice from .set_landscape import SetLandscape from .add_item import AddItem from .switch_by_...
normal
{ "blob_id": "cd6e15daa2360ead47f0bac95843b1c030164996", "index": 6879, "step-1": "<mask token>\n", "step-2": "from .start_node import StartNode\nfrom .character_appearance import CharacterAppearance\nfrom .character_disappearance import CharacterDisappearance\nfrom .replica import Replica\nfrom .end_node impor...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if sys.version_info.major == 2: from itertools import izip else: izip = zip <|reserved_special_token_1|> import sys if sys.version_info.major == 2: from itertools import izip else: izip = zip
flexible
{ "blob_id": "88445d8466d7acbf29d2525c7e322611d66494cd", "index": 8315, "step-1": "<mask token>\n", "step-2": "<mask token>\nif sys.version_info.major == 2:\n from itertools import izip\nelse:\n izip = zip\n", "step-3": "import sys\nif sys.version_info.major == 2:\n from itertools import izip\nelse:\...
[ 0, 1, 2 ]
# Copyright (c) 2008 Johns Hopkins University. # All rights reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose, without fee, and without written # agreement is hereby granted, provided that the above copyright # notice, the (updated) modification history ...
normal
{ "blob_id": "f614287a2a118484b67f2b16e429a3335416d186", "index": 3738, "step-1": "# Copyright (c) 2008 Johns Hopkins University.\n# All rights reserved.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose, without fee, and without written\n# agreement is h...
[ 0 ]
from flask import Blueprint, request, jsonify from to_dict import * from validacao import * import sqlite3 from migration import conectar, create_database from contextlib import closing aluno = Blueprint("aluno", __name__) @aluno.route("/hello") def hello(): return "Hello, aluno" @aluno.route("/reseta", methods ...
normal
{ "blob_id": "5068336ca1a180e09a7efd41eea596cdcebb33ae", "index": 5586, "step-1": "<mask token>\n\n\n@aluno.route('/hello')\ndef hello():\n return 'Hello, aluno'\n\n\n@aluno.route('/reseta', methods=['POST'])\ndef reseta():\n sqlaluno = 'DELETE FROM aluno'\n sqldisciplina = 'DELETE FROM disciplina'\n ...
[ 6, 7, 8, 9, 10 ]
import platform import keyboard import threading import atexit from threading import Timer triggerCount = 0 triggerTimer = -1 result = None def cleanup (): print 'cleanup before exit' clearTimer() keyboard triggerCount = 0 def clearTimer (): global triggerTimer global triggerCount try: ...
normal
{ "blob_id": "9e8ed462e429d6c6c0fe232431ee1e98721863e9", "index": 6148, "step-1": "import platform\nimport keyboard\nimport threading\nimport atexit\nfrom threading import Timer\n\ntriggerCount = 0\ntriggerTimer = -1\n\nresult = None\n\ndef cleanup ():\n print 'cleanup before exit'\n clearTimer()\n keybo...
[ 0 ]
''' Дано предложение, в котором имеются буквы с и т. Определить, какая из них встречается позже (при просмотре слова слева направо). Если таких букв несколько, то должны учитываться последние из них. Оператор цикла с условием не использовать. ''' #!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__'...
normal
{ "blob_id": "4bad45f8c135463fadea9b3eed52ab045a51e8db", "index": 2520, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n text = input('Введите предложение: ')\n x1 = text.index('с')\n x2 = text.index('т')\n if x1 > x2:\n print(\"Бурква 'с' встречается позже\")...
[ 0, 1, 2 ]
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv('mgdata.dat.csv') training_set = dataset.iloc[:1100, 1:2].values X_train=[] y_train=[] for i in range(20,1090): X_train.append(training_set[i-20:i,0]) y_train.append(training_set[i,0]) X_train=np.asarray...
normal
{ "blob_id": "28a3763715f5405f8abe2de17ed5f9df1019278b", "index": 6878, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(20, 1090):\n X_train.append(training_set[i - 20:i, 0])\n y_train.append(training_set[i, 0])\n<mask token>\nclassifier.add(Dense(output_dim=35, init='uniform', activat...
[ 0, 1, 2, 3, 4 ]
#Author: Abeer Rafiq #Modified: 11/23/2019 3:00pm #Importing Packages import socket, sys, time, json, sqlite3 import RPi.GPIO as GPIO from datetime import datetime, date #Creating a global server class class GlobalServer: #The constructor def __init__(self, port, room_ip_addrs, app_ip_addrs):...
normal
{ "blob_id": "7ce679d5b889493f278de6deca6ec6bdb7acd3f5", "index": 910, "step-1": "#Author: Abeer Rafiq\n#Modified: 11/23/2019 3:00pm\n\n#Importing Packages\nimport socket, sys, time, json, sqlite3\nimport RPi.GPIO as GPIO\nfrom datetime import datetime, date\n\n#Creating a global server class\nclass GlobalServer:...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if m < n: if m - x < x: x = m - x if n - y < y: y = n - y else: if n - x < x: x = n - x if m - y < y: y = m - y if x < y: print(x) else: print(y) <|reserved_special_token_1...
flexible
{ "blob_id": "002cced6d24a4790d29f195355c795d609f744a7", "index": 9134, "step-1": "<mask token>\n", "step-2": "<mask token>\nif m < n:\n if m - x < x:\n x = m - x\n if n - y < y:\n y = n - y\nelse:\n if n - x < x:\n x = n - x\n if m - y < y:\n y = m - y\nif x < y:\n pr...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class MockResponseError(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class MockResponseParsed(object): HOV = list() def __init__(self): self.HOV.append(('FODT', '010107')) self.HOV.append(('PERS', '5...
flexible
{ "blob_id": "bbff797fab4ac7dc7e6adb81c0eeda561f8ee147", "index": 9603, "step-1": "<mask token>\n\n\nclass MockResponseError(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MockResponseParsed(object):\n HOV = list()\n\n def __init__(self):\n self.HOV.append(('FODT', '010107'...
[ 17, 24, 26, 29, 30 ]
<|reserved_special_token_0|> def read_input(): with open('../input/day12.txt') as f: lines = f.readlines() m = re.search('initial state:\\s([\\.#]+)', lines[0]) initial_state = m.groups()[0] prog = re.compile('([\\.#]{5})\\s=>\\s([\\.#])') rules = [] for i in range(2, len(lines)): ...
flexible
{ "blob_id": "27f001f4e79291825c56642693894375fef3e66a", "index": 1647, "step-1": "<mask token>\n\n\ndef read_input():\n with open('../input/day12.txt') as f:\n lines = f.readlines()\n m = re.search('initial state:\\\\s([\\\\.#]+)', lines[0])\n initial_state = m.groups()[0]\n prog = re.compile(...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class SmartChineseAnalyzer: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class SmartChineseAnalyzer: <|reserved_special_token_0|> def create_components(self, filename): if self.stopwords: ...
flexible
{ "blob_id": "e486e0ab91a8f5671435f5bbcf5340a62a970d3a", "index": 8670, "step-1": "<mask token>\n", "step-2": "class SmartChineseAnalyzer:\n <mask token>\n <mask token>\n", "step-3": "class SmartChineseAnalyzer:\n <mask token>\n\n def create_components(self, filename):\n if self.stopwords:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class LoadStudentsTTable(LoadTable): <|reserved_special_token_0|> def __init__(self, tails): """ Parameters ---------- tails : int 1 or 2. """ if tails == 1: LoadTable.__init__(self, os.path.join(p, ...
flexible
{ "blob_id": "adb6e33dc665f88c82fcc399688a8dbd67b1e3e3", "index": 9894, "step-1": "<mask token>\n\n\nclass LoadStudentsTTable(LoadTable):\n <mask token>\n\n def __init__(self, tails):\n \"\"\"\n\n Parameters\n ----------\n tails : int\n 1 or 2.\n \"\"\"\n ...
[ 8, 18, 19, 21, 23 ]
<|reserved_special_token_0|> class TextDataset(BaseDataset): def __init__(self, source_sentences: Union[Iterable, Sized], target_sentences: Union[Iterable, Sized], shuffle: bool=True, word_frequency_threshold: int=2): super().__init__(source_sentences, target_sentences, shuffle) s...
flexible
{ "blob_id": "e5d7cc65041d65f915d4882b4fdad5bebf79a067", "index": 204, "step-1": "<mask token>\n\n\nclass TextDataset(BaseDataset):\n\n def __init__(self, source_sentences: Union[Iterable, Sized],\n target_sentences: Union[Iterable, Sized], shuffle: bool=True,\n word_frequency_threshold: int=2):\...
[ 12, 19, 20, 22, 27 ]
<|reserved_special_token_0|> def mkdir_tree(source): if source is None: source = 'default' base_dirs = ['../data/clf_meta/%s/' % source] print('base_dirsssssss', base_dirs) for base_dir in base_dirs: if not os.path.exists(base_dir): print('mkdir', base_dir) os.m...
flexible
{ "blob_id": "11ca13aca699b1e0744243645b3dbcbb0dacdb7e", "index": 9588, "step-1": "<mask token>\n\n\ndef mkdir_tree(source):\n if source is None:\n source = 'default'\n base_dirs = ['../data/clf_meta/%s/' % source]\n print('base_dirsssssss', base_dirs)\n for base_dir in base_dirs:\n if n...
[ 3, 4, 5, 6, 7 ]
#coding=utf-8 import pandas as pd # 学生成绩表 df_grade = pd.read_excel("学生成绩表.xlsx") df_grade.head() # 学生信息表 df_sinfo = pd.read_excel("学生信息表.xlsx") df_sinfo.head() # 只筛选第二个表的少量的列 df_sinfo = df_sinfo[["学号", "姓名", "性别"]] df_sinfo.head() # join df_merge = pd.merge(left=df_grade, right=df_sinfo, left_on="学号", right_on="学...
normal
{ "blob_id": "f6c48731b2a4e0a6f1f93034ee9d11121c2d0427", "index": 6810, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf_grade.head()\n<mask token>\ndf_sinfo.head()\n<mask token>\ndf_sinfo.head()\n<mask token>\ndf_merge.head()\n<mask token>\nfor name in ['姓名', '性别'][::-1]:\n new_columns.remove(name)\n...
[ 0, 1, 2, 3, 4 ]
# Copyright 2014 Charles Noneman # # 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 writin...
normal
{ "blob_id": "9a7908212bf13565109cd4d9ab6de65909bc6910", "index": 3606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run():\n \"\"\"Runs all of the tests\"\"\"\n subsuite_list = []\n for _, modname, _ in pkgutil.iter_modules(test.__path__):\n if modname.startswith('test_'):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserStatusAPIView(StatusAPIView): serializer_class = StatusInlineUserSerializer search_fields = 'id', def get_queryset(self, *args, **kwargs): username = self.kwargs.get('username') if username is None: return Status.objects.none() re...
flexible
{ "blob_id": "472a79767f5dc7dc3cd03d89999d322b3885dcbf", "index": 1220, "step-1": "<mask token>\n\n\nclass UserStatusAPIView(StatusAPIView):\n serializer_class = StatusInlineUserSerializer\n search_fields = 'id',\n\n def get_queryset(self, *args, **kwargs):\n username = self.kwargs.get('username')...
[ 4, 6, 7, 8, 9 ]
# Make an array of dictionaries. Each dictionary should have keys: # # lat: the latitude # lon: the longitude # name: the waypoint name # # Make up three entries of various values. waypoints = [ { 'lat': 106.72888 }, { 'lon': 0.69622 }, { 'name': 'Kepulauan Riau' } ] # Write a loop that prints out all the...
normal
{ "blob_id": "5eee3953193e0fc9f44b81059ce66997c22bc8f1", "index": 6960, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor dict in waypoints:\n print(dict)\n", "step-3": "waypoints = [{'lat': 106.72888}, {'lon': 0.69622}, {'name': 'Kepulauan Riau'}]\nfor dict in waypoints:\n print(dict)\n", "ste...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def learn_distributions(file_lists_by_category): """ Estimate the parameters p_d, and q_d from the training set Input ----- file_lists_by_category: A two-element list. The first element is a list of spam files, and the second element is a list of ham files. O...
flexible
{ "blob_id": "7ed84706ace2cbf523021887df1e13d113f9ce4c", "index": 4172, "step-1": "<mask token>\n\n\ndef learn_distributions(file_lists_by_category):\n \"\"\"\n Estimate the parameters p_d, and q_d from the training set\n\n Input\n -----\n file_lists_by_category: A two-element list. The first eleme...
[ 1, 2, 3, 4, 5 ]
from setuptools import setup setup(name = "dragonfab", version = "1.3.0", description = "Fabric support", author = "Joel Pitt", author_email = "joel@joelpitt.com", url = "https://github.com/ferrouswheel/dragonfab", install_requires = ['fabric', 'pip>=1.4', 'wheel'], packages = ['dragonfab']...
normal
{ "blob_id": "61135a10adefd6ba8ffd63e997fa91ce9c78de06", "index": 6444, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='dragonfab', version='1.3.0', description='Fabric support',\n author='Joel Pitt', author_email='joel@joelpitt.com', url=\n 'https://github.com/ferrouswheel/dragonfab', in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' Can you print numbers from 1 to 100 without using any loop. ''' # Use Recursion
flexible
{ "blob_id": "cc703690151acd17430b5a9715e71a694fdeca10", "index": 2116, "step-1": "<mask token>\n", "step-2": "'''\nCan you print numbers from 1 to 100 without using any loop.\n'''\n\n# Use Recursion", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append('../') <|reserved_special_token_0|> if __name__ == '__main__': fn = 'input.txt' with open(fn) as f: program = Program([int(i) for i in f.readline().split(',')]) program.run() result ...
flexible
{ "blob_id": "a54c8ab63c1e0f50d254d6c97ca3f167db7142e9", "index": 4956, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('../')\n<mask token>\nif __name__ == '__main__':\n fn = 'input.txt'\n with open(fn) as f:\n program = Program([int(i) for i in f.readline().split(',')])\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class ObjectValidationErrors(Exception): def __init__(self, errors): self.errors = errors def _get_directory(): p = os.path.dirname(__file__) p = os.path.join(p, os.pardir, os.pardir, 'schema') p = os.path.abspath(p) return p <|reserved_special_token_0|> ...
flexible
{ "blob_id": "c4f39f9212fbe0f591543d143cb8f1721c1f8e1e", "index": 7056, "step-1": "<mask token>\n\n\nclass ObjectValidationErrors(Exception):\n\n def __init__(self, errors):\n self.errors = errors\n\n\ndef _get_directory():\n p = os.path.dirname(__file__)\n p = os.path.join(p, os.pardir, os.pardir...
[ 3, 5, 6, 7, 8 ]
__author__ = 'Freek' __build__ = 'versie 1.0' from iNStagram.file_io.fileio import lees_stationgegevens from iNStagram.api_requests.app_requests import request_instagram from tkinter import * startscherm = Tk() startscherm.title('Foto of video in de buurt!') startscherm.minsize(width=790, height=600, ) startscherm.c...
normal
{ "blob_id": "2804d49fc9f0e40859de1e8eb4f04a849639b1d4", "index": 8277, "step-1": "<mask token>\n\n\ndef weergeef_instagram_links():\n \"\"\"\n Geeft de bijbehorende station dict uit de lijst van alle stations (in de NS API)\n :param stationnaam: geef ofwel kort, middel als lange stationnaam om de bijbeh...
[ 1, 2, 3, 4, 5 ]
import sys, os sys.path.append(os.path.abspath('../models')) from GANSynth import flags as lib_flags from GANSynth import generate_util as gu from GANSynth import model as lib_model from GANSynth import util from GANSynth import train_util import tensorflow as tf import numpy as np import json from models.G...
normal
{ "blob_id": "f13a2820fe1766354109d1163c7e6fe887cd6f34", "index": 7051, "step-1": "<mask token>\n\n\nclass GANSynthWrapper(GenerativeModel):\n\n def __init__(self, ckpt_path, data_size, use_approx=True):\n super(GANSynthWrapper, self).__init__(use_approx=use_approx)\n self.latent_size = 256\n ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class BebopNmpcControl: <|reserved_special_token_0|> def set_bebop_odom(self, odom_msg): if self.received_first_odom_ is False: self.received_first_odom_ = True rospy.loginfo('First odometry received!') self.odom_received_time_ = rospy.Time...
flexible
{ "blob_id": "76d0dd2d6b2d580900283f2623f05dd02a70fcd8", "index": 6825, "step-1": "<mask token>\n\n\nclass BebopNmpcControl:\n <mask token>\n\n def set_bebop_odom(self, odom_msg):\n if self.received_first_odom_ is False:\n self.received_first_odom_ = True\n rospy.loginfo('First ...
[ 10, 12, 13, 15, 18 ]
#!/usr/bin/env python from __future__ import division import sys import math logs = sys.stderr from collections import defaultdict import time from mytime import Mytime import gflags as flags FLAGS=flags.FLAGS flags.DEFINE_string("weights", None, "weights file (feature instances and weights)", short_name="w") flag...
normal
{ "blob_id": "e5fd0fc13a39444a934eea3bd24056073d28eff2", "index": 9869, "step-1": "#!/usr/bin/env python\n\nfrom __future__ import division\n\nimport sys\nimport math\nlogs = sys.stderr\nfrom collections import defaultdict\n\nimport time\nfrom mytime import Mytime\n\nimport gflags as flags\nFLAGS=flags.FLAGS\n\nf...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "59596c69df6a2c453fd147a9c8a2c7d47ed79fb3", "index": 3222, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def greatestCommonFactor(posInt1, posInt2): range_posInt1 = list(range(1, posInt1 + 1)) factors_posInt1 = [] for i in range_posInt1: if posInt1 % i == 0: factors_posInt1.append(i) range_posInt2 = list(range(1, posInt2 + 1))...
flexible
{ "blob_id": "a3f6ea649fc5e60b0f8353b1404912d060686b99", "index": 9550, "step-1": "<mask token>\n", "step-2": "def greatestCommonFactor(posInt1, posInt2):\n range_posInt1 = list(range(1, posInt1 + 1))\n factors_posInt1 = []\n for i in range_posInt1:\n if posInt1 % i == 0:\n factors_po...
[ 0, 1, 2, 3 ]
from os.path import abspath, dirname, join, basename import numpy as np import cv2 import xiuminglib as xm logger, thisfile = xm.config.create_logger(abspath(__file__)) class EXR(): """Reads EXR files. EXR files can be generic or physically meaningful, such as depth, normal, etc. When data loaded are p...
normal
{ "blob_id": "b9cce77d4d2b9ff5563d17927e21166f9c870e3d", "index": 5220, "step-1": "<mask token>\n\n\nclass EXR:\n \"\"\"Reads EXR files.\n\n EXR files can be generic or physically meaningful, such as depth, normal, etc.\n When data loaded are physically meaningful, these methods assume the EXR files\n ...
[ 7, 9, 10, 11, 12 ]
import pprint class ErrorResponseCollection(object): def __init__(self, status, message, param = "message"): self.status = status self.message = message self.param = param def as_md(self): return '\n\n> **%s**\n\n```\n{\n\n\t"%s": "%s"\n\n}\n\n```' % \ ...
normal
{ "blob_id": "ade4d797a83eaa06e8bde90972a56376d7e0f55a", "index": 6086, "step-1": "<mask token>\n\n\nclass ErrorResponseCollection(object):\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass ResponseCollection(object):\n\n def __init__(self, message=None, data=None):\n self.message = messa...
[ 4, 5, 6, 7, 9 ]
# collectd-vcenter - vcenter.py # # Author : Loic Lambiel @ exoscale # Contributor : Josh VanderLinden # Description : This is a collectd python module to gather stats from Vmware # vcenter import logging import ssl import time from pysphere import VIServer try: import collectd COLLECTD_ENABLED...
normal
{ "blob_id": "55f76ae1ffe0fb2d2ca2c7a20aab45ffb00cf178", "index": 613, "step-1": "<mask token>\n\n\nclass CollectdCollector(Collector):\n \"\"\"\n Handle dispatching statistics to collectd.\n\n \"\"\"\n NAME = 'vCenter'\n\n def __init__(self, *args, **kwargs):\n super(CollectdCollector, self...
[ 11, 13, 19, 20, 24 ]
<|reserved_special_token_0|> @app.route('/QAsearch', methods=['POST', 'GET']) def QAsearch(): """Renders the QAsearch page.""" question = '' form = QuestionForm() question = form.question.data if form.validate_on_submit(): return redirect(url_for('answer', word=question)) return render...
flexible
{ "blob_id": "3457a7c080da041ad279239bd6a3d214a3b8e49f", "index": 6695, "step-1": "<mask token>\n\n\n@app.route('/QAsearch', methods=['POST', 'GET'])\ndef QAsearch():\n \"\"\"Renders the QAsearch page.\"\"\"\n question = ''\n form = QuestionForm()\n question = form.question.data\n if form.validate_...
[ 9, 10, 11, 12, 13 ]
<|reserved_special_token_0|> class BasicModel(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def updateModel(self, X, Y): """ Updates the model with new observations. """ self.X = X self.Y = Y def get_X(self...
flexible
{ "blob_id": "88071df9367804b1c6e2b1c80da178ab7658e7a4", "index": 3861, "step-1": "<mask token>\n\n\nclass BasicModel(object):\n <mask token>\n <mask token>\n <mask token>\n\n def updateModel(self, X, Y):\n \"\"\"\n Updates the model with new observations.\n \"\"\"\n self.X...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/comments/<article_id>', methods=['POST']) def get_comments(article_id): comments_range = request.form.get('comments_for_single') try: temp_list = json.loads(comments_range) if isinstance(temp...
flexible
{ "blob_id": "016c004fd95d901a6d55b6f7460397223a6baa3b", "index": 1881, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/comments/<article_id>', methods=['POST'])\ndef get_comments(article_id):\n comments_range = request.form.get('comments_for_single')\n try:\n temp_list = json...
[ 0, 1, 2, 3, 4 ]
from django.utils import timezone from factory import DjangoModelFactory from djtriggers.tests.models import DummyTrigger class DummyTriggerFactory(DjangoModelFactory): class Meta: model = DummyTrigger trigger_type = 'dummy_trigger_test' source = 'tests' date_received = timezone.now() da...
normal
{ "blob_id": "813354c9c294c0323c1b54cda7074fbffa49cdb3", "index": 442, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DummyTriggerFactory(DjangoModelFactory):\n\n\n class Meta:\n model = DummyTrigger\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask tok...
[ 0, 1, 2, 3 ]
from .data_processing import make_request_data, clear_request_data, get_token_from_text from .review import Review
normal
{ "blob_id": "5d654c056e6ef01e72821427c4f8dcb285755ee9", "index": 2933, "step-1": "<mask token>\n", "step-2": "from .data_processing import make_request_data, clear_request_data, get_token_from_text\nfrom .review import Review\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1 ]
<|reserved_special_token_0|> def get_bits(x): return np.where(x < 0, 0, 1) <|reserved_special_token_0|> def mkdir(file_path): folder = os.path.dirname(file_path) if not os.path.exists(folder): os.makedirs(folder) <|reserved_special_token_0|> def concatenate(total, part): return part if...
flexible
{ "blob_id": "74ffbd55867c4b2c6ccbef7d94e0c65aef139057", "index": 7602, "step-1": "<mask token>\n\n\ndef get_bits(x):\n return np.where(x < 0, 0, 1)\n\n\n<mask token>\n\n\ndef mkdir(file_path):\n folder = os.path.dirname(file_path)\n if not os.path.exists(folder):\n os.makedirs(folder)\n\n\n<mask ...
[ 7, 9, 11, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> any([(p in s) for p in patterns for s in strings]) <|reserved_special_token_1|> # Find a list of patterns in a list of string in python any([ p in s for p in patterns for s in strings ])
flexible
{ "blob_id": "c0b6c0636d1900a31cc455795838eb958d1daf65", "index": 9421, "step-1": "<mask token>\n", "step-2": "any([(p in s) for p in patterns for s in strings])\n", "step-3": "# Find a list of patterns in a list of string in python\nany([ p in s for p in patterns for s in strings ])\n", "step-4": null, "...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def AddOverflow(h): nxbins = h.GetXaxis().GetNbins() nybins = h.GetYaxis().GetNbins() idxx = 0.0 idxy = nybins + 1 for ix in range(nxbins): idxx = ix + 1 ovf_bincont = h.GetBinContent(idxx, idxy) last_bincont = h.GetBinContent(idxx, nybins) ...
flexible
{ "blob_id": "b49696d6cac5fbf97172aa7cf16903d002262b5c", "index": 1940, "step-1": "<mask token>\n\n\ndef AddOverflow(h):\n nxbins = h.GetXaxis().GetNbins()\n nybins = h.GetYaxis().GetNbins()\n idxx = 0.0\n idxy = nybins + 1\n for ix in range(nxbins):\n idxx = ix + 1\n ovf_bincont = h....
[ 1, 2, 3, 4, 5 ]
#------------------------------------------------------------------------------- # rtlconverter.py # # PyCoRAM RTL Converter # # Copyright (C) 2013, Shinya Takamaeda-Yamazaki # License: Apache 2.0 #------------------------------------------------------------------------------- import sys import os import subprocess im...
normal
{ "blob_id": "55ffcf5e6120cc07da461e30979dd8a36a599bee", "index": 8353, "step-1": "<mask token>\n\n\nclass RtlConverter(object):\n\n def __init__(self, filelist, topmodule='userlogic', include=None,\n define=None, single_clock=False):\n self.filelist = filelist\n self.topmodule = topmodule...
[ 7, 8, 9, 10, 11 ]
# coding: utf-8 # Copyright 2020. ThingsBoard # # # 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 # # # Unl...
normal
{ "blob_id": "9b30075183cf9611307afa74aa45979872e7e9d5", "index": 8132, "step-1": "<mask token>\n\n\nclass DeviceControllerApi(DeviceControllerApi):\n <mask token>\n <mask token>\n\n def claim_device_using_post(self, device_name, **kwargs):\n \"\"\"claimDevice # noqa: E501\n\n This method ...
[ 10, 11, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(my_list) print(lista_impares) print('') <|reserved_special_token_0|> print(my_list) print(lista_pares) <|reserved_special_token_1|> my_list = [1, 4, 5, 6, 9, 13, 19, 21] lista_impares = [num for num in my_list if num % 2 ...
flexible
{ "blob_id": "e1913c80375e4871119182d0267e9f228818624f", "index": 4309, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(my_list)\nprint(lista_impares)\nprint('')\n<mask token>\nprint(my_list)\nprint(lista_pares)\n", "step-3": "my_list = [1, 4, 5, 6, 9, 13, 19, 21]\nlista_impares = [num for num in m...
[ 0, 1, 2, 3 ]
import FWCore.ParameterSet.Config as cms import FWCore.ParameterSet.VarParsing as VarParsing options = VarParsing.VarParsing() options.register( 'file','',VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, 'File path for storing output') options.parseArguments() file_path = options.f...
normal
{ "blob_id": "6aff61ce5cef537e6b1b19e382d8bf80e3a61693", "index": 1423, "step-1": "<mask token>\n", "step-2": "<mask token>\noptions.register('file', '', VarParsing.VarParsing.multiplicity.singleton,\n VarParsing.VarParsing.varType.string, 'File path for storing output')\noptions.parseArguments()\n<mask toke...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in sys.stdin: edges = [int(x) for x in line.split('x')] edges.sort() ribbon = sum(x * 2 for x in edges[:2]) l, w, h = edges bow = l * w * h total += bow + ribbon print(total) <|reserved_special_t...
flexible
{ "blob_id": "ed85cb61f4bc8bf758dafb10ffbabf87fb4521d0", "index": 9281, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n edges = [int(x) for x in line.split('x')]\n edges.sort()\n ribbon = sum(x * 2 for x in edges[:2])\n l, w, h = edges\n bow = l * w * h\n total +=...
[ 0, 1, 2, 3, 4 ]
import psycopg2 from .configuration import ConfigurationException DB_CONNECT_STRING = "host='{host}' dbname='{dbname}' user='{user}' password='{passwd}'" class DBItemCompany: def __init__(self, _id, tweeter, category, categoryUrl, provenScore, ranking, location, url, categoryId): self.id = _id se...
normal
{ "blob_id": "31b87a3ceca1f48665ecc9754d5f87bb9b7bbf13", "index": 7579, "step-1": "<mask token>\n\n\nclass DBException(Exception):\n \"\"\"\n Represents a generic exception thrown by the Database Manager\n \"\"\"\n pass\n\n\nclass DBManager:\n\n def __init__(self, cfg):\n self.cfg = cfg\n ...
[ 15, 17, 18, 19, 22 ]
# config {stack,buffer,label} def get_features_da(config,sent_dict): features = [] # TODO Improve Features if len(config[0]) > 0: # Top of stack. top = config[0][-1] top_stk_token_feature = 'TOP_STK_TOKEN_'+str(sent_dict['FORM'][top].lower()) features.append(t...
normal
{ "blob_id": "e0ce8a8ad9c842b013bbb1ea1c585b6c4c2a68f5", "index": 2868, "step-1": "<mask token>\n", "step-2": "def get_features_da(config, sent_dict):\n features = []\n if len(config[0]) > 0:\n top = config[0][-1]\n top_stk_token_feature = 'TOP_STK_TOKEN_' + str(sent_dict['FORM'][\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from gym_mag.envs.mag_control_env import MagControlEnv
flexible
{ "blob_id": "dd7896e3beb5e33282b38efe0a4fc650e629b185", "index": 5081, "step-1": "<mask token>\n", "step-2": "from gym_mag.envs.mag_control_env import MagControlEnv\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def get_files1(dirname, size_in_kb): """Return files in dirname that are >= size_in_kb""" for file in glob.glob(os.path.join(dirname, '*')): if os.stat(file).st_size >= size_in_kb * ONE_KB: yield file <|reserved_special_token_1|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "0dec0f04cfe891eea74ef45484fa7433e3429dcd", "index": 7570, "step-1": "<mask token>\n\n\ndef get_files1(dirname, size_in_kb):\n \"\"\"Return files in dirname that are >= size_in_kb\"\"\"\n for file in glob.glob(os.path.join(dirname, '*')):\n if os.stat(file).st_size >= size_in_kb * ONE_KB...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def extract_3d(data: np.ndarray, center: np.ndarray, half_size: int): """ Extract an area around a point in a 3d numpy array, zero padded as necessary such that the specified point is at the center :param data: The numpy array to extract from :param center: The point ...
flexible
{ "blob_id": "26f486131bdf514cd8e41f75d414fe647eaf1140", "index": 9243, "step-1": "<mask token>\n\n\ndef extract_3d(data: np.ndarray, center: np.ndarray, half_size: int):\n \"\"\"\n Extract an area around a point in a 3d numpy array, zero padded as necessary such that the specified point is at the\n cent...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @pytest.mark.skipif('connection.vendor == "mysql"', reason=MYSQL_REASON) def test_invalid_regex(): exception = IntegrityError if connection.vendor == 'sqlite' else DataError with pytest.raises(exception): Page.objects.create(url='(?P<match>.*)') <|reserved_special_token_...
flexible
{ "blob_id": "96065e7e61b63f915561f117d71092e4bfb9a5da", "index": 1149, "step-1": "<mask token>\n\n\n@pytest.mark.skipif('connection.vendor == \"mysql\"', reason=MYSQL_REASON)\ndef test_invalid_regex():\n exception = IntegrityError if connection.vendor == 'sqlite' else DataError\n with pytest.raises(excepti...
[ 1, 3, 4, 5, 7 ]
/Users/AbbyPennington/anaconda/lib/python3.5/os.py
normal
{ "blob_id": "8c4006ed8f4b1744f0316a61d95458b227653fee", "index": 5887, "step-1": "/Users/AbbyPennington/anaconda/lib/python3.5/os.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SpotAdmin(LeafletGeoAdmin): pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SpotAdmin(LeafletGeoAdmin): pass admin.site.register(Spot, SpotAdmin) <|reser...
flexible
{ "blob_id": "7633944366c6655306bc41087b19a474e9c414b5", "index": 7688, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SpotAdmin(LeafletGeoAdmin):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass SpotAdmin(LeafletGeoAdmin):\n pass\n\n\nadmin.site.register(Spot, SpotAdmin)\...
[ 0, 1, 2, 3 ]
import xml.etree.ElementTree as ET class Stage: def __init__(self, costumes, sounds, variables, blocks, scripts, sprites): self.costumes = costumes self.sounds = sounds self.variables = variables self.blocks = blocks self.scripts = scripts self.sprites = sprites ...
normal
{ "blob_id": "575768c200ad81f878c132d68569c84f497091f2", "index": 8137, "step-1": "<mask token>\n\n\nclass Sprite:\n\n def __init__(self, name: str, index: str, xCoord: int, yCoord: int,\n heading: int, scale: float, volume: int, pan: int, rotation: int,\n draggable: bool, hidden: bool, costumes:...
[ 2, 3, 4, 5 ]