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|> while n != 0: a = input().strip().split('~') n = len(a) if n == 1: break ip.append(a[0]) ma.append(a[1]) for i in ip: ipn = i.split('.') try: if 1 <= int(ipn[0]) <= 126: p = ...
flexible
{ "blob_id": "4a13f05fbbe598242f5663d27d578d2eb977e103", "index": 6137, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile n != 0:\n a = input().strip().split('~')\n n = len(a)\n if n == 1:\n break\n ip.append(a[0])\n ma.append(a[1])\nfor i in ip:\n ipn = i.split('.')\n try:\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def DIIS_extrapolate_F(diis_err_mats, diis_fmats): n_diis = len(diis_err_mats) assert n_diis == len(diis_fmats ), 'Number of Fock matrices should equal to number of error matrices' Bmat = -np.ones([n_diis + 1, n_diis + 1]) for di in range(n_diis): for dj in...
flexible
{ "blob_id": "ccc2a976d06e2fa6c91b25c4f95a8f0da32e9b5e", "index": 7878, "step-1": "<mask token>\n\n\ndef DIIS_extrapolate_F(diis_err_mats, diis_fmats):\n n_diis = len(diis_err_mats)\n assert n_diis == len(diis_fmats\n ), 'Number of Fock matrices should equal to number of error matrices'\n Bmat = -...
[ 1, 2, 3, 4, 5 ]
from collections import Counter from collections import deque import os def wc(argval): bool = False if("|" in argval): bool = True del argval[len(argval)-1] hf=open("commandoutput.txt","r+") open("commandoutput.txt","w").close() hf=open("commandoutput.txt","w") numoflines = 0 ...
normal
{ "blob_id": "e9a4ea69a4bd9b75b8eb8092b140691aab763ae4", "index": 2963, "step-1": "from collections import Counter\nfrom collections import deque\nimport os\ndef wc(argval):\n bool = False\n if(\"|\" in argval):\n bool = True\n del argval[len(argval)-1] \n hf=open(\"commandoutput.txt\",\"r+\"...
[ 0 ]
<|reserved_special_token_0|> class OptionsEndPointTest(AuthenticatedAPITestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> class ReceivedOptionsEndPointTest(AuthenticatedAPITestCase): def test_should_only_get_received_options(self): received_question, _ = MultipleChoiceQuestion...
flexible
{ "blob_id": "1152f144e17c11416f9ed56b4408f18615b16dc2", "index": 5187, "step-1": "<mask token>\n\n\nclass OptionsEndPointTest(AuthenticatedAPITestCase):\n <mask token>\n <mask token>\n\n\nclass ReceivedOptionsEndPointTest(AuthenticatedAPITestCase):\n\n def test_should_only_get_received_options(self):\n ...
[ 7, 8, 9, 10, 12 ]
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """Module for mimic explainer and explainable surrogate models.""" from .mimic_explainer import MimicExplainer __all__ = ["MimicExplainer"...
normal
{ "blob_id": "0b8cb522c531ac84d363b569a3ea4bfe47f61993", "index": 5390, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['MimicExplainer']\n", "step-3": "<mask token>\nfrom .mimic_explainer import MimicExplainer\n__all__ = ['MimicExplainer']\n", "step-4": "# ----------------------------------...
[ 0, 1, 2, 3 ]
#1.25.2019 - shashi #Program that accepts an array of different elements #And moves all the integer 0s to the end of it. String 0s like "0" or "0.0" remain untouched. def shiftZeroesToEnd(myArray): #function starts here zeroCounter = 0 #counter to keep track of how many 0s exist. shiftedArray = [] #array to h...
normal
{ "blob_id": "4a9c42727a28e19cf1eebcf72784b85bbae695bf", "index": 3429, "step-1": "<mask token>\n", "step-2": "def shiftZeroesToEnd(myArray):\n zeroCounter = 0\n shiftedArray = []\n for item in myArray:\n if (str(item) == '0' or str(item) == '0.0') and type(item) is not str:\n zeroCou...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 """ 02-allelefreq.py <vcf file> """ import sys import matplotlib.pyplot as plt import pandas as pd vcf = open(sys.argv[1]) maf = [] for line in vcf: if "CHR" in line: continue cols = line.rstrip("\n").split() values = float(cols[4]) maf.append(values) fig, ax = pl...
normal
{ "blob_id": "dd79ffe3922494bcc345aec3cf76ed9efeb5185c", "index": 3916, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in vcf:\n if 'CHR' in line:\n continue\n cols = line.rstrip('\\n').split()\n values = float(cols[4])\n maf.append(values)\n<mask token>\nax.hist(maf, bins=100,...
[ 0, 1, 2, 3, 4 ]
import numpy as np np.set_printoptions(precision = 1) pi = np.pi def convertRadian(theta): radian = (theta) * (np.pi) / 180 return radian def mkMatrix(radian, alpha, dis): matrix = np.matrix([[np.cos(radian),(-1)*np.sin(radian)*np.cos(alpha), np.sin(radian)*np.sin(alpha), a1 * np.cos(radian)], ...
normal
{ "blob_id": "47c6f9767b97469fe7e97ab3b69650265a8021d8", "index": 6257, "step-1": "import numpy as np\n\nnp.set_printoptions(precision = 1)\npi = np.pi\n\ndef convertRadian(theta):\n radian = (theta) * (np.pi) / 180\n return radian\n\ndef mkMatrix(radian, alpha, dis):\n matrix = np.matrix([[np.cos(radian...
[ 0 ]
def geo_avg(x,lat,dim=2): ''' geo_avg: to calculate weighting average according to latitude input: x: variable lat: corresponding latittude dim: the order of the lat dimension, two cases: 2:[time,lev,lat,*lon],or 1:[time or lev, lat, *lon] output: result: 1d or 2d avera...
normal
{ "blob_id": "a2871585ce36888cf89c4dc5a6a7de6b212412bb", "index": 1153, "step-1": "def geo_avg(x, lat, dim=2):\n \"\"\"\n geo_avg: to calculate weighting average according to latitude\n input: \n x: variable \n lat: corresponding latittude\n dim: the order of the lat dimension, two c...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(table) with open('table.txt', 'a') as f: f.write(f'{num} table is: {str(table)}') f.write('\n') <|reserved_special_token_1|> num = int(input('Enter the number: ')) table = [(num * i) for i in range(1, 11)] print(t...
flexible
{ "blob_id": "657ac500c40ddbd29f5e3736a78ed43e7d105478", "index": 9417, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(table)\nwith open('table.txt', 'a') as f:\n f.write(f'{num} table is: {str(table)}')\n f.write('\\n')\n", "step-3": "num = int(input('Enter the number: '))\ntable = [(num * ...
[ 0, 1, 2, 3 ]
'''Turning on or off, toggling and checking the status' of a specific relay''' #!/bin/env python3 from time import sleep from gpiozero import LED RELAYS = [ LED(23), LED(24), LED(25), LED(8), LED(7), LED(1), LED(12), LED(16) ] def on_action(relay_option, number): '''To turn on t...
normal
{ "blob_id": "d82412055affc96d634957c953a35ea69b7e702f", "index": 403, "step-1": "<mask token>\n\n\ndef on_action(relay_option, number):\n \"\"\"To turn on the chosen relay\"\"\"\n relay_option.on()\n print(f'relay {number} is turning on')\n\n\n<mask token>\n\n\ndef toggle_action(relay_option, number):\n...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def bullets(chunks): print('bullets') final_string = ( 'Your list in latex can be created with the following command: \n') final_string += '> \\begin{itemize} \n' for e in chunks: print(final_string) final_string += f'>...
flexible
{ "blob_id": "7a920b3609bb29cd26b159b48290fa6978839416", "index": 7377, "step-1": "<mask token>\n", "step-2": "def bullets(chunks):\n print('bullets')\n final_string = (\n 'Your list in latex can be created with the following command: \\n')\n final_string += '> \\\\begin{itemize} \\n'\n for e...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Files(Base): <|reserved_special_token_0|> def upload_file(self, channel_id, files): return self.client.post(self.endpoint, data={'channel_id': channel_id}, files=files) def get_file(self, file_id): return self.client.get(self.endpoint + '/' ...
flexible
{ "blob_id": "0686dec7f3dc23f01ffff41f611a1bb597bb5352", "index": 829, "step-1": "<mask token>\n\n\nclass Files(Base):\n <mask token>\n\n def upload_file(self, channel_id, files):\n return self.client.post(self.endpoint, data={'channel_id':\n channel_id}, files=files)\n\n def get_file(s...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> def get_gff_from_list(gff_filename, listfile, partial_ok=False): seqs = [line.strip() for line in open(listfile)] for r in GFF.collapseGFFReader(gff_filename): if r.seqid in seqs or r.seqid.split('|')[0 ] in seqs or partial_ok and any(r.seqid.startswith(x) for ...
flexible
{ "blob_id": "166520ab5b9fd5a55dd2aa30b4d62f55096ce6cb", "index": 2105, "step-1": "<mask token>\n\n\ndef get_gff_from_list(gff_filename, listfile, partial_ok=False):\n seqs = [line.strip() for line in open(listfile)]\n for r in GFF.collapseGFFReader(gff_filename):\n if r.seqid in seqs or r.seqid.spli...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def replaceNanWithMean(): dataMat = loadDataSet('secom.data.txt', '') numFeat = shape(dataMat)[1] for i in range(numFeat): meanVal = mean(dataMat[nonzero(~isnan(dataMat[:, i].A))[0], i]) dataMat[nonzero(isnan(dataMat[:, i].A))[0], i] = meanVal return dataMa...
flexible
{ "blob_id": "5f00cd446b219203c401799ba7b6205c7f1f8e9f", "index": 3510, "step-1": "<mask token>\n\n\ndef replaceNanWithMean():\n dataMat = loadDataSet('secom.data.txt', '')\n numFeat = shape(dataMat)[1]\n for i in range(numFeat):\n meanVal = mean(dataMat[nonzero(~isnan(dataMat[:, i].A))[0], i])\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def evaluate(model, X_te, y_te): """ Given the model and independent and dependent testing data, print out statements that evaluate classifier """ probs = model.predict_proba(X_te) plt.hist(probs[:, 1]) ...
flexible
{ "blob_id": "62de629d8f28435ea8dc3dc093cac95e7cedf128", "index": 7859, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef evaluate(model, X_te, y_te):\n \"\"\"\n Given the model and independent and dependent testing data,\n print out statements that evaluate classifier\n \"\"\"\n probs...
[ 0, 1, 2, 3, 4 ]
''' Copyright (c) 2021, Štěpán Beneš The purpose of this script it to take the 5 BSE and 5 SE hand-picked prototype images and turn them into the same shape and format as the rest of the data. Prototype images are resized to 768x768, the info bar is cropped off. Afterwards the images are normalized to float32 in ran...
normal
{ "blob_id": "af7af5d1048d2b0968e831aad89d5baf30cab608", "index": 3210, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(proto_images_se_list.shape)\nprint(proto_images_bse_list.shape)\nnp.save('Data/SE_prototypes.npy', proto_images_se_list)\nnp.save('Data/BSE_prototypes.npy', proto_images_bse_list)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def horner(poly, x): result = poly[0] for i in range(1, len(poly)): result = result * x + poly[i] return result <|reserved_special_token_0|> <|reserved_special_token_1|> def horner(poly, x): result = poly[0] for i in range(1, ...
flexible
{ "blob_id": "750565af03d945fbdc32e26347b28977b203e9dc", "index": 4858, "step-1": "<mask token>\n", "step-2": "def horner(poly, x):\n result = poly[0]\n for i in range(1, len(poly)):\n result = result * x + poly[i]\n return result\n\n\n<mask token>\n", "step-3": "def horner(poly, x):\n resu...
[ 0, 1, 2, 3, 4 ]
""" exercise 9-7-9-2 """ fname = raw_input("Enter file name: ") filehandle = open(fname) d = dict() for line in filehandle: newline = line.split() if newline != [] and newline[0] == 'From': day = newline[2] if day not in d: d[day] = 1 else: d[day] += 1 print d
normal
{ "blob_id": "7beb9d9e24f4c9a4e1a486048371da79c35d0927", "index": 8527, "step-1": "\"\"\"\r\nexercise 9-7-9-2\r\n\r\n\"\"\"\r\n\r\nfname = raw_input(\"Enter file name: \")\r\nfilehandle = open(fname)\r\nd = dict()\r\nfor line in filehandle:\r\n newline = line.split()\r\n if newline != [] and newline[0] == 'From':...
[ 0 ]
import logging from tqdm import tqdm logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def create_tables(db_engine): """RUN SQL STATEMENTS TO CREATE TABLES""" with db_engine.connect() as conn: create_table_stmts = [] create_drugs_table = """ DROP TABLE IF EXISTS dr...
normal
{ "blob_id": "f4c3b6ee6389b31c6a280bf7cfe920a2791c1299", "index": 4125, "step-1": "<mask token>\n\n\ndef create_tables(db_engine):\n \"\"\"RUN SQL STATEMENTS TO CREATE TABLES\"\"\"\n with db_engine.connect() as conn:\n create_table_stmts = []\n create_drugs_table = \"\"\"\n DROP TABLE I...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python import rospy from std_msgs.msg import * __print__ = '' def Print(msg): global __print__ target = int(msg.data.split(';')[0]) * 2 if target == 0: __print__ = msg.data.split(';')[-1] + '\n' + '\n'.join(__print__.split('\n')[1:]) else: __print__ = '\n'.join(__print...
normal
{ "blob_id": "007caece16f641947043faa94b8a074efe8ebadb", "index": 6994, "step-1": "#!/usr/bin/env python\n\nimport rospy\nfrom std_msgs.msg import *\n\n__print__ = ''\n\ndef Print(msg):\n global __print__\n\n target = int(msg.data.split(';')[0]) * 2\n if target == 0:\n __print__ = msg.data.split('...
[ 0 ]
#!/usr/bin/python import errno import fuse import stat import time #from multiprocessing import Queue from functools import wraps from processfs.svcmanager import Manager import processfs.svcmanager as svcmanager fuse.fuse_python_api = (0, 2) _vfiles = ['stdin', 'stdout', 'stderr', 'cmdline', 'control', 'status'] ...
normal
{ "blob_id": "028c2193e180ccdbfdcc51e5d061904ea1d6164e", "index": 3536, "step-1": "#!/usr/bin/python\n\nimport errno\nimport fuse\nimport stat\nimport time\n#from multiprocessing import Queue\nfrom functools import wraps\n\nfrom processfs.svcmanager import Manager\nimport processfs.svcmanager as svcmanager\n\nfus...
[ 0 ]
from flask import Flask, render_template, request, redirect #from gevent.pywsgi import WSGIServer import model as db import sys import time, calendar import jsonify def get_date(date): date = date.split("/") time = str(date[0]) day_str = calendar.day_name[calendar.weekday(int(date[3]), int(date[2]), int(da...
normal
{ "blob_id": "79390f3ae5dc4cc9105a672d4838a8b1ba53a248", "index": 3959, "step-1": "<mask token>\n\n\ndef get_date(date):\n date = date.split('/')\n time = str(date[0])\n day_str = calendar.day_name[calendar.weekday(int(date[3]), int(date[2]),\n int(date[1]))]\n day_num = str(int(date[1]))\n ...
[ 6, 8, 9, 10, 11 ]
쫲𪪌𤣬㐭𤙵⃢姅幛𑄹馻돷軔ሠ𡺶ײַ𢊅𠞡鞿𭞎𦠟𦔻뜸𣦏蛫履뜟𢒰疅𗕢𨞧漷𫴫礴𬽣𨚒𠻚゚罉ꉷ🕸𡑁𩂱𑫌抿锃𫕊𦿮橖𓋊𧭠酞Ё햾𞄶𪳧蕱ꗍ𐊯𬏷먽𬻩뱩𗼾𠑧銋𝂥蘒굳뜀𬜀𮧛𡐔𭋇𭘡𬙒蕶믅𬂚𡟐剿𨸒ᄉ𮩨烘𮩽𭚱𗨦ﳇ큿턽쾘𩁻ꫲ𗨿蚀𨊍胗𗔑鼴𨵾㽡𩠌ݜ𪢭𩘼넴𤩭𬩽𢺤𫅬𧁏響𬶉喡𘨘뉵𨲊Ζ𥀐𩨇𠮢⏂𭖳𫓢𧛃𦥮単𦇭𮏨𬋪婓츏𪱔𭄿𦭺𣍵蹖🨞ޝ仂䱔讔ﭑ𨹟𐊁ﱥ𧅔𓇪뽼𗩢픛𖮌䮁ီ邾ࢠ㭨𣯇𩱵𥋭ѽ샑𭹓𫳃𧝽𥲇ᛲ𘁕粣𣑑ᒔ𣥕쯞⒋𩍥纝攂𨄷ͭ𧲵퍃氩𢐅𤵲뎋𥵘黴𤼩𬝉ⶌ𥬥𧺥浞🇴𑨲𠎆筬⌝༤쾘𤌲ы𡚎𑲙㽰𐛱𫛛�...
normal
{ "blob_id": "76c1929e901fce469661a299184765875d0eb53f", "index": 3658, "step-1": "쫲𪪌𤣬㐭𤙵⃢姅幛𑄹馻돷軔ሠ𡺶ײַ𢊅𠞡鞿𭞎𦠟𦔻뜸𣦏蛫履뜟𢒰疅𗕢𨞧漷𫴫礴𬽣𨚒𠻚゚罉ꉷ🕸𡑁𩂱𑫌抿锃𫕊𦿮橖𓋊𧭠酞Ё햾𞄶𪳧蕱ꗍ𐊯𬏷먽𬻩뱩𗼾𠑧銋𝂥蘒굳뜀𬜀𮧛𡐔𭋇𭘡𬙒蕶믅𬂚𡟐剿𨸒ᄉ𮩨烘𮩽𭚱𗨦ﳇ큿턽쾘𩁻ꫲ𗨿蚀𨊍胗𗔑鼴𨵾㽡𩠌ݜ𪢭𩘼넴𤩭𬩽𢺤𫅬𧁏響𬶉喡𘨘뉵𨲊Ζ𥀐𩨇𠮢⏂𭖳𫓢𧛃𦥮単𦇭𮏨𬋪婓츏𪱔𭄿𦭺𣍵蹖🨞ޝ仂䱔讔ﭑ𨹟𐊁ﱥ𧅔𓇪뽼...
[ 0 ]
<|reserved_special_token_0|> class UsageData(Base): <|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|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "6db0adf25a7cc38c8965c07cc80bde0d82c75d56", "index": 3955, "step-1": "<mask token>\n\n\nclass UsageData(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def dt...
[ 9, 11, 12, 16, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> 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, ...
flexible
{ "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 ]
import json import time from keySender import PressKey,ReleaseKey,dk config = { "Up": "W", "Down": "S", "Left": "A", "Right": "D", "Grab": "LBRACKET", "Drop": "RBRACKET" } ### Commands # Move def Move(direction,delay=.2): PressKey(dk[config[direction]]) time.sleep(delay) # Replace with a better condition Rele...
normal
{ "blob_id": "1e7789b154271eb8407a027c6ddf6c941cc69a41", "index": 3070, "step-1": "<mask token>\n\n\ndef Move(direction, delay=0.2):\n PressKey(dk[config[direction]])\n time.sleep(delay)\n ReleaseKey(dk[config[direction]])\n\n\ndef Action(direction, pull=None):\n delay = 0.6\n if pull:\n del...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.2.5 on 2021-07-27 17:12 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', ...
normal
{ "blob_id": "d145f4c061c8f364756012832a07adc305e35e5c", "index": 5772, "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|> def create_documents(): """ 按标点符号或是空格存储文件 """ documents_length = 0 chars, labels = [], [] chars_file = codecs.open('data/data.data', 'w', 'utf-8') labels_file = codecs.open('data/label.data', 'w', 'utf-8') with codecs.open('data/train.data', 'r', 'utf-8') as f: ...
flexible
{ "blob_id": "f22836fc4fed22d833755db0ff34502170260766", "index": 9260, "step-1": "<mask token>\n\n\ndef create_documents():\n \"\"\" 按标点符号或是空格存储文件 \"\"\"\n documents_length = 0\n chars, labels = [], []\n chars_file = codecs.open('data/data.data', 'w', 'utf-8')\n labels_file = codecs.open('data/lab...
[ 4, 7, 8, 10, 11 ]
import boto3 import time import datetime from datetime import date import sqlite3 import logging import logging.handlers from decimal import * ### LOGS CONFIGURATION ### LOG_FILENAME = '/home/pi/Thermostat/alexaThermostat/logs/alexaThermostat.out' # Set up a specific logger with our desired output level my_logger = l...
normal
{ "blob_id": "fcc75550e1317a15c36bc8100c28af59b68e1381", "index": 1571, "step-1": "<mask token>\n", "step-2": "<mask token>\nmy_logger.setLevel(logging.DEBUG)\n<mask token>\nhandler.setFormatter(formatter)\nmy_logger.addHandler(handler)\n<mask token>\nwhile 1:\n c.execute(\n 'SELECT * FROM TEMP_HIST W...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from main.models import Assignment, Review, Sample, Question, SampleMultipleFile # Register your models here. admin.site.register(Assignment) admin.site.register(Review) admin.site.register(Question) class MultipleFileInline(admin.TabularInline): model = SampleMultipleFile class S...
normal
{ "blob_id": "d18c45c08face08ce8f7dad915f1896c24c95cbf", "index": 2991, "step-1": "<mask token>\n\n\nclass SampleAdmin(admin.ModelAdmin):\n inlines = [MultipleFileInline]\n prepopulated_fields = {'slug': ('heading',)}\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MultipleFileInline(admin.Tabula...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python import sys import typer from cupcake import version_callback from cupcake.sequence import GFF app = typer.Typer( name="cupcake.sequence.get_gffs_from_list", help="Get records from a GFF file from a list", ) def get_gff_from_list(gff_filename, listfile, partial_ok=False): seqs = [l...
normal
{ "blob_id": "166520ab5b9fd5a55dd2aa30b4d62f55096ce6cb", "index": 2105, "step-1": "<mask token>\n\n\ndef get_gff_from_list(gff_filename, listfile, partial_ok=False):\n seqs = [line.strip() for line in open(listfile)]\n for r in GFF.collapseGFFReader(gff_filename):\n if r.seqid in seqs or r.seqid.spli...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Multiplication Table of', num) for i in range(1, 10): print(num, 'a', i, '=', num * i) <|reserved_special_token_1|> num = int(input('Enter the number: ')) print('Multiplication Table of', num) for i in range(1, 10): ...
flexible
{ "blob_id": "15bf84b716caf66a23706e9292b47ddb9bf4d35e", "index": 4326, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Multiplication Table of', num)\nfor i in range(1, 10):\n print(num, 'a', i, '=', num * i)\n", "step-3": "num = int(input('Enter the number: '))\nprint('Multiplication Table of...
[ 0, 1, 2, 3 ]
import random tree_age = 1 state = "alive" value = 1 age_display = "Your tree have an age of: {}".format(tree_age) state_display = "Your tree is {}.".format(state) def tree_state(x): if x <= 19: state = "alive" return state elif x <= 49: rand = random.randrange(tree_...
normal
{ "blob_id": "763f552329a0d38900e08081a1017b33cd882868", "index": 9391, "step-1": "<mask token>\n\n\ndef tree_state(x):\n if x <= 19:\n state = 'alive'\n return state\n elif x <= 49:\n rand = random.randrange(tree_age, 51, 1)\n if rand == 50:\n state = 'dead'\n ...
[ 1, 2, 3, 4, 5 ]
from django.contrib import admin from search.models import PrimaryCategory,PlaceCategory class PrimaryCategoryAdmin(admin.ModelAdmin): list_display = ('primary_name','is_active','description','image',) actions = None def has_delete_permission(self,request,obj=None): return False ...
normal
{ "blob_id": "606abf8501d85c29051df4bf0276ed5b098ee6c5", "index": 8679, "step-1": "<mask token>\n\n\nclass PrimaryCategoryAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass PlaceCategoryAdmin(admin.ModelAdmin):\n list_display = ('category_name', 'is_paid', 'description', ...
[ 5, 6, 7, 8, 10 ]
__source__ = 'https://leetcode.com/problems/merge-two-binary-trees/' # Time: O(n) # Space: O(n) # # Description: Leetcode # 617. Merge Two Binary Trees # # Given two binary trees and imagine that when you put one of them to cover the other, # some nodes of the two trees are overlapped while the others are not. # # You...
normal
{ "blob_id": "42371760d691eac9c3dfe5693b03cbecc13fd94d", "index": 6066, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n\nclass TestMethods(unittest.TestCase):\n\n def test_Local(self):\n self.assertEqual(1, 1)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution...
[ 3, 4, 7, 8, 10 ]
"""Base class for an array of annotated genomic regions.""" import logging from typing import Callable, Dict, Iterable, Iterator, Mapping, Optional, Sequence, Union from collections import OrderedDict import numpy as np import pandas as pd from .chromsort import sorter_chrom from .intersect import by_ranges, into_ran...
normal
{ "blob_id": "0b833276ca10118f2d60e229ff03400b03915958", "index": 2429, "step-1": "<mask token>\n\n\nclass GenomicArray:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, data_table: Optional[Union[Sequence, pd.DataFrame]],\n meta_dict: Optional[Mapping]=None):\n if dat...
[ 36, 38, 48, 49, 55 ]
<|reserved_special_token_0|> class TestData: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestData: <|reserved_special_token_0|> def get_test_data(self): return self.images <|reserved_special_token_1|> <|rese...
flexible
{ "blob_id": "122c4f3a2949ee675b7dd64b9f9828e80cbe5610", "index": 1246, "step-1": "<mask token>\n\n\nclass TestData:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestData:\n <mask token>\n\n def get_test_data(self):\n return self.images\n", "step-3": "<mask token>\n\...
[ 1, 2, 3, 4, 5 ]
from models import Session, FacebookUser, FacebookPage, FacebookGroup from lib import get_scraper, save_user, save_page import logging logging.basicConfig(level=logging.DEBUG) session = Session() scraper = get_scraper(True) for user in session.query(FacebookUser).filter(FacebookUser.data=="todo").filter("username ~ '...
normal
{ "blob_id": "77ae3ef1f6f267972a21f505caa7be29c19a6663", "index": 8369, "step-1": "from models import Session, FacebookUser, FacebookPage, FacebookGroup\nfrom lib import get_scraper, save_user, save_page\n\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\nsession = Session()\nscraper = get_scraper(True)\...
[ 0 ]
import numpy as np def GradientDescent(f, gradf, x0, epsilon, num_iter, line_search, disp=False, callback=None, **kwargs): x = x0.copy() iteration = 0 opt_arg = {"f": f, "grad_f": gradf} for key in kwargs: opt_arg[key] = kwargs[key] while True: gradient = -gradf(x) alpha = line_search(x...
normal
{ "blob_id": "dca36de5556b120b8b93eac0ad7b971ad735d907", "index": 313, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GradientDescent(f, gradf, x0, epsilon, num_iter, line_search, disp=\n False, callback=None, **kwargs):\n x = x0.copy()\n iteration = 0\n opt_arg = {'f': f, 'grad_f': gr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @skipIf(not net.HAS_NAPALM, 'napalm module required for this test') class NetTest(TestCase, LoaderModuleMockMixin): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_interfaces(self): ret = net.interfaces() self.assertEqual(None, ret) def...
flexible
{ "blob_id": "0fb288e3ab074e021ec726d71cbd5c8546a8455b", "index": 744, "step-1": "<mask token>\n\n\n@skipIf(not net.HAS_NAPALM, 'napalm module required for this test')\nclass NetTest(TestCase, LoaderModuleMockMixin):\n <mask token>\n <mask token>\n\n def test_interfaces(self):\n ret = net.interfac...
[ 5, 6, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dictn) <|reserved_special_token_1|> listtuple = [(1, 2), (2, 3), (3, 4), (4, 5)] dictn = dict(listtuple) print(dictn)
flexible
{ "blob_id": "85bc304c69dac8bb570f920f9f12f558f4844c49", "index": 8644, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dictn)\n", "step-3": "listtuple = [(1, 2), (2, 3), (3, 4), (4, 5)]\ndictn = dict(listtuple)\nprint(dictn)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
""" Created on Fri Aug 4 19:19:31 2017 @author: aw1042 """ import requests import threading import sys import re import xml.etree.ElementTree as ET import smtplib from credentials import * argsObj = {} for arg1, arg2 in zip(sys.argv[:-1], sys.argv[1:]): if arg1[0] == '-': argsObj[arg1] = arg2 posts = ...
normal
{ "blob_id": "297a17ca5aaafb368a1e4cba35e387c67e9f793f", "index": 7420, "step-1": "\"\"\"\nCreated on Fri Aug 4 19:19:31 2017\n\n@author: aw1042\n\"\"\"\nimport requests\nimport threading\nimport sys\nimport re\nimport xml.etree.ElementTree as ET\nimport smtplib\nfrom credentials import *\n\n\n\nargsObj = {}\nfo...
[ 0 ]
'''Чи можна в квадратному залі площею S помістити круглу сцену радіусом R так, щоб від стіни до сцени був прохід не менше K?''' from math import sqrt s = int(input('Input your area of square (S): ')) r = int(input('Input your radius of scene (R): ')) k = int(input('Input your width of passage (K): ')) k2 = sqrt...
normal
{ "blob_id": "31a2fa5b2febc2ef80b57e45c2ebb662b886c4b7", "index": 6043, "step-1": "<mask token>\n", "step-2": "<mask token>\nif k2 >= k:\n print(' Yes, the scene can be set.')\nelse:\n print(\" Sorry, but the scene can't be set.\")\n", "step-3": "<mask token>\ns = int(input('Input your area of squ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 from optparse import OptionParser from urllib import request, parse from urllib.error import URLError, HTTPError import ssl import re ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) ssl_context.options &= ssl.CERT_NONE class Settings: SINGLETON = None def __init__(self): self....
normal
{ "blob_id": "e92a738d3233450b255605619dafadd4d829604b", "index": 9067, "step-1": "<mask token>\n\n\nclass Settings:\n SINGLETON = None\n\n def __init__(self):\n self.url_pattern = (\n 'href=\"((http[s]?://|/)(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\\\(\\\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)\"'\n ...
[ 14, 19, 20, 21, 25 ]
import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.select import Select from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions class TestTa...
normal
{ "blob_id": "777dc2056443f0404ccb75d570f2ddc3a3aa747b", "index": 6669, "step-1": "<mask token>\n\n\nclass TestTaniHub:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestTaniHub:\n <mask token>\n <mask token>\n\n def test_tanihub_number_2...
[ 1, 2, 4, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(res, type(res)) print(res.decode('gbk')) <|reserved_special_token_1|> x = '上' res = x.encode('gbk') print(res, type(res)) print(res.decode('gbk')) <|reserved_special_token_1|> #coding:utf-8 x = '上' res = x.encode('gbk...
flexible
{ "blob_id": "3c053bf1b572759eddcd310d185f7e44d82171a5", "index": 9153, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "step-3": "x = '上'\nres = x.encode('gbk')\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "step-4": "#coding:utf-8\n\nx = '上'\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Protocol: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @abstractmethod def execute(self, command): """"execute command method""" class LocalProtocol(Protocol): """simple protocol for using bots within app""...
flexible
{ "blob_id": "8d1067a9bb0629276ef27de91f63cf2370a44e24", "index": 1369, "step-1": "<mask token>\n\n\nclass Protocol:\n <mask token>\n <mask token>\n <mask token>\n\n @abstractmethod\n def execute(self, command):\n \"\"\"\"execute command method\"\"\"\n\n\nclass LocalProtocol(Protocol):\n ...
[ 6, 7, 8, 11 ]
<|reserved_special_token_0|> class APIAuditAgent(AuditAgent): <|reserved_special_token_0|> def __init__(self): self._url = 'http://localhost:3000/auditlogs/create' self._resp = None def change_endpoint(self, url: str): """ Changes the default POST endpoint URL. Ca...
flexible
{ "blob_id": "45a57fac564f23253f9d9cd5d0fd820e559c15b9", "index": 1212, "step-1": "<mask token>\n\n\nclass APIAuditAgent(AuditAgent):\n <mask token>\n\n def __init__(self):\n self._url = 'http://localhost:3000/auditlogs/create'\n self._resp = None\n\n def change_endpoint(self, url: str):\n ...
[ 8, 9, 10, 11 ]
<|reserved_special_token_0|> def sign_in(): root.destroy() import main <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> root.title('Register-Form') root.geometry('600x450+-2+86') root.minsize(120, 1) def delete(): if Entry1.get() == '': messagebox.showe...
flexible
{ "blob_id": "37cafe5d3d3342e5e4070b87caf0cfb5bcfdfd8d", "index": 1613, "step-1": "<mask token>\n\n\ndef sign_in():\n root.destroy()\n import main\n\n\n<mask token>\n", "step-2": "<mask token>\nroot.title('Register-Form')\nroot.geometry('600x450+-2+86')\nroot.minsize(120, 1)\n\n\ndef delete():\n if Ent...
[ 1, 4, 5, 6, 7 ]
"""Largest product in a series Problem 8 The four adjacent digits in the 1000-digit number that have the greatest product are 9 x 9 x 8 x 9 = 5832. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 125406987471585238...
normal
{ "blob_id": "601d32bf30aa454bbc7d31d6ce4b7296cef0fdfe", "index": 9374, "step-1": "\"\"\"Largest product in a series\nProblem 8\nThe four adjacent digits in the 1000-digit number that have the greatest product\nare 9 x 9 x 8 x 9 = 5832.\n\n73167176531330624919225119674426574742355349194934\n9698352031277450632623...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Input(Base): def clear(self): element = self.driver.find_element_by_xpath(self.params['xpath']) if self.params.get('clear', None): element.clear() return True element.cl...
flexible
{ "blob_id": "7503a0c8f83ff0ce370ed7bce733b09d9a2c69c4", "index": 817, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Input(Base):\n\n def clear(self):\n element = self.driver.find_element_by_xpath(self.params['xpath'])\n if self.params.get('clear', None):\n element.c...
[ 0, 2, 3, 4, 5 ]
from collections import Counter # Complete the isValid function below. def isValid(s): if not s: return True x = Counter(s) print(x) first_c = x.pop(s[0]) cnt = 0 for k, c in x.items(): if c != first_c: if first_c == 1: cnt += 1 firs...
normal
{ "blob_id": "760daa908ca92e7fb1393bdf28fee086dc1648ef", "index": 6418, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef isValid(s):\n if not s:\n return True\n x = Counter(s)\n print(x)\n first_c = x.pop(s[0])\n cnt = 0\n for k, c in x.items():\n if c != first_c:\n ...
[ 0, 1, 2, 3, 4 ]
from abc import abstractmethod from anoncreds.protocol.repo.public_repo import PublicRepo from anoncreds.protocol.types import ClaimDefinition, PublicKey, SecretKey, ID, \ RevocationPublicKey, AccumulatorPublicKey, Accumulator, TailsType, \ RevocationSecretKey, AccumulatorSecretKey, \ TimestampType from an...
normal
{ "blob_id": "890841c8892e89375bb022f0d469fefc27414a2b", "index": 5823, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass IssuerWalletInMemory(IssuerWallet, WalletInMemory):\n\n def __init__(self, claimDefId, repo: PublicRepo):\n WalletInMemory.__init__(self, claimDefId, repo)\n se...
[ 0, 2, 4, 5, 6 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Brateaqu, Farolflu" __copyright__ = "Copyright 2019" __credits__ = ["Quentin BRATEAU", "Luca FAROLFI"] __license__ = "GPL" __version__ = "1.0" __email__ = ["quentin.brateau@ensta-bretagne.org", "luca.farolfi@ensta-bretagne.org"] # Importing modules import...
normal
{ "blob_id": "7cb75195df567a5b65fe2385423b0082f3b9de4b", "index": 1051, "step-1": "<mask token>\n\n\nclass GameMap(list):\n <mask token>\n\n def __init__(self):\n super().__init__()\n self.xmax = 5\n self.ymax = 5\n self.__nb_elephants = 0\n self.__nb_rhinoceros = 0\n ...
[ 8, 9, 11, 15, 18 ]
<|reserved_special_token_0|> def main(request): c = base_context(request) template = get_template('index.html') c['title'] = _('Request') form = RequestForm() user = request.user c['user'] = user if user.is_authenticated(): e = Employee.objects.filter(user=user) if e: ...
flexible
{ "blob_id": "11163dc99ee65ab44494c08d81e110e9c42390ae", "index": 3130, "step-1": "<mask token>\n\n\ndef main(request):\n c = base_context(request)\n template = get_template('index.html')\n c['title'] = _('Request')\n form = RequestForm()\n user = request.user\n c['user'] = user\n if user.is_...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pylab.plot(x, y) <|reserved_special_token_0|> pylab.plot(x, y, '--') pylab.text(w / 4.0, h / 12.0 - w / 4.0 * sin(th) - h / 30.0, '$A_{a,subcool}$', ha='center', va='center') <|reserved_special_token_0|> pylab.plot(x, y, '--')...
flexible
{ "blob_id": "c485466a736fa0a4f183092e561a27005c01316d", "index": 8616, "step-1": "<mask token>\n", "step-2": "<mask token>\npylab.plot(x, y)\n<mask token>\npylab.plot(x, y, '--')\npylab.text(w / 4.0, h / 12.0 - w / 4.0 * sin(th) - h / 30.0,\n '$A_{a,subcool}$', ha='center', va='center')\n<mask token>\npylab...
[ 0, 1, 2, 3, 4 ]
############################################-############################################ ################################ F I L E A U T H O R S ################################ # MIKE - see contacts in _doc_PACKAGE_DESCRIPTION ####################################### A B O U T #######################################...
normal
{ "blob_id": "58667da8898c2277ecc3d9d738d6553dd3416436", "index": 7323, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef some_func():\n CFG.start_clock_module = datetime.datetime.now()\n LOG.write_me('\\tSTART - CLEAN.py (' + datetime.datetime.now().strftime(\n '%y-%m-%d | %H:%M') + ')'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='qlquery', version='1.0', license='MIT', packages=['qlquery'], install_requires=['my-fake-useragent', 'requests', 'beautifulsoup4'], zip_safe=False) <|reserved_special_token_1|> from setuptools import setup s...
flexible
{ "blob_id": "f11ede752df7d9aff672eee4e230b109fcbf987b", "index": 8555, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='qlquery', version='1.0', license='MIT', packages=['qlquery'],\n install_requires=['my-fake-useragent', 'requests', 'beautifulsoup4'],\n zip_safe=False)\n", "step-3": "...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Date: <|reserved_special_token_0|> <|reserved_special_token_1|> class Date: def __init__(self, strDate): strDate = strDate.split('.') self.day = strDate[0] self.month = strDate[1] self.year = strDate[2]
flexible
{ "blob_id": "805fc9a26650f85227d14da972311ffbd9dbd555", "index": 16, "step-1": "<mask token>\n", "step-2": "class Date:\n <mask token>\n", "step-3": "class Date:\n\n def __init__(self, strDate):\n strDate = strDate.split('.')\n self.day = strDate[0]\n self.month = strDate[1]\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class ImageClassifier: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def extract_image_features(self, data): fd = None for pic in data: rescaled_picture = exposure.rescale_intensity(pic) feat...
flexible
{ "blob_id": "58204b4b035aa06015def7529852e882ffdd369a", "index": 8997, "step-1": "<mask token>\n\n\nclass ImageClassifier:\n <mask token>\n <mask token>\n <mask token>\n\n def extract_image_features(self, data):\n fd = None\n for pic in data:\n rescaled_picture = exposure.res...
[ 5, 7, 9, 10, 12 ]
# Generated by Django 3.0.1 on 2020-02-01 16:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shopUser', '0024_order_contact'), ] operations = [ migrations.AddField( model_name='order', name='location', ...
normal
{ "blob_id": "0a5570ef17efa26ef6317930df616c8326f83314", "index": 2936, "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 = [('shopUser', ...
[ 0, 1, 2, 3, 4 ]
# 给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。 # # DEMO: # 输入: 3 # 输出: # [ # [ 1, 2, 3 ], # [ 8, 9, 4 ], # [ 7, 6, 5 ] # ] class Solution: def generateMatrix(self, n): """ 与 54 思路类似,注意边界... :type n: int :rtype: List[List[int]] """ array = [[0 for _ in ran...
normal
{ "blob_id": "f6bfb055e1c1750702580fc9c9295b8528218910", "index": 7416, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def generateMatrix(self, n):\n \"\"\"\n 与 54 思路类似,注意边界...\n :type n: int\n :rtype: List[List[in...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # python >= 3.7 # supported xmanager version <5.1, 5.1, 5.2, 6 import os import argparse import configparser import unicodedata from win32api import GetComputerName, GetUserName from win32security import LookupAccountName, ConvertSidToStringSid from base64 import b64encode, b64decode from Cryp...
normal
{ "blob_id": "5f2427c077d460d109f5a3e94b93f72c090f036d", "index": 7181, "step-1": "<mask token>\n\n\ndef decrypt_string(password_string, need_return=False):\n if not is_number(VERSION):\n raise ValueError('Invalid argument: --Version')\n ver = float(VERSION)\n Cipher = ARC4.new(getCipherKey())\n ...
[ 5, 8, 9, 10, 11 ]
# Generated by Django 2.2.3 on 2019-07-27 10:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('beerFriends', '0006_auto_20190726_1504'), ] operations = [ migrations.AlterField( model_name='beer', name='rating', ...
normal
{ "blob_id": "68f3d3fce52d08381adc522ee032ef3181aec82a", "index": 400, "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 = [('beerFriends'...
[ 0, 1, 2, 3, 4 ]
rak="hello\n" n=input() print(rak * int(n))
normal
{ "blob_id": "b0e4042ac4ed54cafedb9e53244c164527559e39", "index": 5406, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(rak * int(n))\n", "step-3": "rak = 'hello\\n'\nn = input()\nprint(rak * int(n))\n", "step-4": "rak=\"hello\\n\"\nn=input()\nprint(rak * int(n)) \n", "step-5": null, "step-i...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python """ This example shows how to create an unstructured grid. """ import vtk import numpy as np import pickle as pkl colors_list = pkl.load(open('permuted_colors.pkl','rb')) meta = pkl.load(open('v_atlas/meta_information.pkl','rb')) def main(): colors = vtk.vtkNamedColors() Data=np.load(...
normal
{ "blob_id": "7261c5f9ac87c8337383daec312372b345ab7652", "index": 4109, "step-1": "<mask token>\n\n\ndef main():\n colors = vtk.vtkNamedColors()\n Data = np.load('tessaltions_compressed.npz')\n indices = meta['sorted_keys']\n struct_D = {}\n for i, s in enumerate(set([x[0] for x in indices])):\n ...
[ 1, 2, 3, 4, 5 ]
#coding=utf-8 import shutil import zipfile # shutil.copyfile("file03.txt","file05.txt") #拷贝 # shutil.copytree("movie/大陆","电影") #拷贝文件夹 #忽略不需要拷贝的文件 # shutil.copytree("movie/大陆","电影",ignore=shutil.ignore_patterns("*.txt","*.html")) #压缩和解压缩 # shutil.make_archive("电影/压缩","zip","movie/大陆") z1 = zipfile.ZipFile("a.z...
normal
{ "blob_id": "81f5753e8d0004244b4ee8e26895cb2b38fbb8b6", "index": 751, "step-1": "<mask token>\n", "step-2": "<mask token>\nz1.write('file05.txt')\nz1.write('file03.txt')\nz1.close()\n<mask token>\nz2.extractall('电影')\nz2.close()\n", "step-3": "<mask token>\nz1 = zipfile.ZipFile('a.zip', 'w')\nz1.write('file0...
[ 0, 1, 2, 3, 4 ]
''' Написати програму, що визначає, яка з двох точок знаходиться ближче до початку координат. ''' import re re_number = re.compile("^[-+]?\d+\.?\d*$") def validator(pattern,promt): text=input(promt) while not bool(pattern.match(text)): text = input(promt) return text def number_validator(promt)...
normal
{ "blob_id": "2d5993489ff3120d980d29edbb53422110a5c039", "index": 3561, "step-1": "<mask token>\n\n\ndef validator(pattern, promt):\n text = input(promt)\n while not bool(pattern.match(text)):\n text = input(promt)\n return text\n\n\ndef number_validator(promt):\n number = float(validator(re_nu...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/6/26 16:11 # @Author : Micky # @Site : # @File : 01_压缩相关知识.py # @Software: PyCharm import numpy as np from PIL import Image from scipy import misc if __name__ == '__main__': # 图像加载 image = Image.open('../datas/xiaoren.png') # 图像转换为num...
normal
{ "blob_id": "176120d4f40bc02b69d7283b7853b74adf369141", "index": 4726, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n image = Image.open('../datas/xiaoren.png')\n img = np.asarray(image)\n print(img.shape)\n imageNew = np.zeros((600, 100, 3))\n imageNew = image...
[ 0, 1, 2, 3 ]
import socket import struct from fsuipc_airspaces.position import Position # Adapted from tools/faker.js in github.com/foucdeg/airspaces _START_BUFFER = bytes([68, 65, 84, 65, 60, 20, 0, 0, 0]) _END_BUFFER = bytes([0] * 20) _START_TRANSPONDER = bytes([104, 0, 0, 0, 0, 0, 0, 0]) _END_TRANSPONDER = bytes([0] * 24) d...
normal
{ "blob_id": "68fa47e528e5c7c553c3c49ee5b7372b8a956302", "index": 3364, "step-1": "<mask token>\n\n\nclass XPlaneDataOut:\n\n def __init__(self, host: str, port: int) ->None:\n self.address = host, port\n self.socket = socket.socket(family=socket.AF_INET, type=socket.\n SOCK_DGRAM)\n\n...
[ 3, 4, 5, 6, 7 ]
# coding: utf-8 BOT_NAME = ['lg'] SPIDER_MODULES = ['lg.spiders'] NEWSPIDER_MODULE = 'lg.spiders' DOWNLOAD_DELAY = 0.1 # 间隔时间 LOG_LEVEL = 'WARNING'
normal
{ "blob_id": "bed3d83f682404719a95be360cdd74be9dc87991", "index": 3718, "step-1": "<mask token>\n", "step-2": "BOT_NAME = ['lg']\nSPIDER_MODULES = ['lg.spiders']\nNEWSPIDER_MODULE = 'lg.spiders'\nDOWNLOAD_DELAY = 0.1\nLOG_LEVEL = 'WARNING'\n", "step-3": "# coding: utf-8\n\nBOT_NAME = ['lg']\n\nSPIDER_MODULES ...
[ 0, 1, 2 ]
#!/usr/bin/python3 def add_tuple(tuple_a=(), tuple_b=()): if len(tuple_a) < 1: a_x = 0 else: a_x = tuple_a[0] if len(tuple_a) < 2: a_y = 0 else: a_y = tuple_a[1] if len(tuple_b) < 1: b_x = 0 else: b_x = tuple_b[0] if len(tuple_b) < 2: b...
normal
{ "blob_id": "1522ebb52504f7f27a526b597fe1e262bbcbfbb0", "index": 4429, "step-1": "<mask token>\n", "step-2": "def add_tuple(tuple_a=(), tuple_b=()):\n if len(tuple_a) < 1:\n a_x = 0\n else:\n a_x = tuple_a[0]\n if len(tuple_a) < 2:\n a_y = 0\n else:\n a_y = tuple_a[1]\n ...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """" Created on Saturday, January 18, 2020 @author: lieur This test case sets silver and gold to 0, which in most cases prevent the computer from buying provinces. This tests to see if the game ends when one more supply car hits 0 (since silver and gold are already at 0 and the game ends when...
normal
{ "blob_id": "fa833e9cd1e624d9ecfb2fcc6d9e22955c9e4b1e", "index": 6258, "step-1": "<mask token>\n", "step-2": "<mask token>\ntestUtility.play_game(supply, supply_order, players, trash)\ntestUtility.display_game_results(players)\n", "step-3": "<mask token>\nplayer_names = ['Annie', '*Ben', '*Carla']\nnV, nC = ...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 """ Styled object ============= A :class:`~benker.styled.Styled` object contains a dictionary of styles. It is mainly used for :class:`~benker.table.Table`, :class:`~benker.table.RowView`, :class:`~benker.table.ColView`, and :class:`~benker.cell.Cell`. """ import pprint class Styled(object): ""...
normal
{ "blob_id": "8fa58791aae1352109b3bf7410d68bf5ae1d8cb7", "index": 9559, "step-1": "<mask token>\n\n\nclass Styled(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return str(self._styles)\n\n def __repr__(self):\n cls = self.__class__.__name__\n it...
[ 5, 6, 8, 9, 10 ]
#Copyright 2020 Side Li, Arun Kumar # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing...
normal
{ "blob_id": "203e678d565753bb51e1bbd90ffec0f3260b22fb", "index": 119, "step-1": "<mask token>\n\n\ndef line_count(filename, hdfs_used=False, client=None):\n if hdfs_used:\n with client.read(filename, encoding='utf-8') as reader:\n num_lines = sum(1 for _ in reader)\n return num_li...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def main(argv): """ Main function which shows the usage, retrieves the command line parameters and invokes the required functions to do the expected job. :param argv: (dictionary) options and values specified in the command line """ print('Preparing for balanced d...
flexible
{ "blob_id": "2b82d66803ae0a0b03204318975d3c122f34f0cf", "index": 7003, "step-1": "<mask token>\n\n\ndef main(argv):\n \"\"\"\n Main function which shows the usage, retrieves the command line parameters and invokes the required functions to do\n the expected job.\n\n :param argv: (dictionary) options ...
[ 5, 6, 7, 8, 9 ]
from django.utils.html import strip_tags from django.core.mail import send_mail from django.urls import reverse from django.http import HttpResponseRedirect def Email(doctorFullName,password,otp,email,id): print("\n== UTILS ===") html_message=''' <html> <body> <p>Welcome %s and pass is %s...
normal
{ "blob_id": "4ecf9c03750a31ecd113a7548df4e2a700e775e0", "index": 4034, "step-1": "<mask token>\n\n\ndef emailpatient(firstname, lastname, password, otp, email, id):\n print('\\n== UTILS ===')\n html_message = (\n \"\"\"\n <html>\n <body>\n <p>Welcome %s %s and pass is %s and otp is %d</p>\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if user_list[-1] == 'wolf': print('Please go away and stop eating my sheep') else: user_list.reverse() print( f"Oi! Sheep number {user_list.index('wolf,')}! You are about to be eaten by a wolf!" ) <|r...
flexible
{ "blob_id": "16850d931eec0356f71317cc24461e006fbcd59c", "index": 6192, "step-1": "<mask token>\n", "step-2": "<mask token>\nif user_list[-1] == 'wolf':\n print('Please go away and stop eating my sheep')\nelse:\n user_list.reverse()\n print(\n f\"Oi! Sheep number {user_list.index('wolf,')}! You ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ShowFormat(): """File format example""" print( """ #rfmix output, 3 person, 2 snps ------------------------ 1 1 2 1 2 2 1 2 2 1 2 2 #id average: ------------------------ 0.8 0.5 0.1 #out...
flexible
{ "blob_id": "7f9046582ff03d1c72d191a8f78c911cbc8a0650", "index": 5907, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ShowFormat():\n \"\"\"File format example\"\"\"\n print(\n \"\"\"\n #rfmix output, 3 person, 2 snps\n ------------------------\n1 1 2 1 2 2\n1 2 2 1 2 2\n\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "e68d872232b3eab4c33cbbe4376be7dd788888e2", "index": 1242, "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|> try: urllib.request.urlopen('http://blog.csdn.net/jo_andy') except urllib.error.URLError as e: if hasattr(e, 'code'): print(e.code) if hasattr(e, 'reason'): print(e.reason) <|reserved_special_token_1|...
flexible
{ "blob_id": "2ffd0de2888872cfa664919fcfc54b8e60b03280", "index": 5256, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n urllib.request.urlopen('http://blog.csdn.net/jo_andy')\nexcept urllib.error.URLError as e:\n if hasattr(e, 'code'):\n print(e.code)\n if hasattr(e, 'reason'):\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class _TELECONFERENCES(_TELECONFERENCE): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class _TELECONFERENCES(_TELECONFERENCE): def __init__(self): _TELECONFERENCE._...
flexible
{ "blob_id": "9021fa440561461ee179f333aa04a155d06c6e86", "index": 7255, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n\n def __init__(self):\n _TELECONFERE...
[ 0, 1, 2, 3, 4 ]
## Script (Python) "after_rigetta" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=state_change ##title= ## doc = state_change.object #Aggiornamento dello stato su plominoDocument doc.updateStatus() if script.run_script(doc, script....
normal
{ "blob_id": "096d82e1f9e8832f6605d23c8bb324e045b6b14f", "index": 7393, "step-1": "<mask token>\n", "step-2": "<mask token>\ndoc.updateStatus()\nif script.run_script(doc, script.id) != False:\n if doc.naming('richiesta') != 'integrazione':\n doc.sendThisMail('rigetta')\n script.run_script(doc, scri...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import csv import math def load_data_from_file(filename): """ Load that data, my dude(tte) :param filename: The file from which you want to load data :return: Time and position data of the file """ time = [] position = [] with open(filename, 'r') a...
normal
{ "blob_id": "4545ce36c4d3df50e263d3323c04c53acb2b50e0", "index": 7888, "step-1": "<mask token>\n\n\ndef load_data_from_file(filename):\n \"\"\"\n Load that data, my dude(tte)\n :param filename: The file from which you want to load data\n :return: Time and position data of the file\n \"\"\"\n ti...
[ 5, 6, 8, 9, 10 ]
from classes.Board import Board class Visualiser: coordinate_map = ("a", "b", "c", "d", "e", "f", "g", "h") __dimensions = 8 def __init__(self): self.map = [] self.__build_map() def __build_map(self): """ Creates the array of the battlefield. Should never be used for ...
normal
{ "blob_id": "e5e012e40a71dee9f4dbd9913590aef125b758df", "index": 223, "step-1": "<mask token>\n\n\nclass Visualiser:\n <mask token>\n <mask token>\n <mask token>\n\n def __build_map(self):\n \"\"\"\n Creates the array of the battlefield. Should never be used for logical operations\n ...
[ 4, 5, 6, 7, 8 ]
""" USAGE: o install in develop mode: navigate to the folder containing this file, and type 'python setup.py develop --user'. (ommit '--user' if you want to install for all users) """ from setupt...
normal
{ "blob_id": "cfa862988edf9d70aa5e975cca58b4e61a4de847", "index": 759, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='gromacsplotter', version='0.1', description=\n 'Read xvg files created with gromacs for plotting with matplotlib', url\n ='', author='Ilyas Kuhlemann', author_email='ilya...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TIME_CHECK(Enum): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TIME_CHECK(Enum): BEFORE_START = 0 DURING_TIME = 1 AFTER_END = 2 <|reserved_special...
flexible
{ "blob_id": "967984444d9e26452226b13f33c5afbc96b5fe2b", "index": 3176, "step-1": "<mask token>\n\n\nclass TIME_CHECK(Enum):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TIME_CHECK(Enum):\n BEFORE_START = 0\n DURING_TIME = 1\n AFTER_END = 2\n", "step-3"...
[ 1, 2, 3, 4, 5 ]
friends = ["Vino", "Ammu", "Appu"] print(friends) print(friends[0]) # returns the last element in the list print(friends[-1]) # returns the second to last element in the list print(friends[-2])
normal
{ "blob_id": "8050b757c20da7ad8dd3c12a30b523b752d6a3ff", "index": 9457, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(friends)\nprint(friends[0])\nprint(friends[-1])\nprint(friends[-2])\n", "step-3": "friends = ['Vino', 'Ammu', 'Appu']\nprint(friends)\nprint(friends[0])\nprint(friends[-1])\nprint...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def to_dict(table): table_d = dict() for i in range(len(table)): for j in range(i): table_d[i, j] = table[i][j] table_d[j, i] = table[i][j] return table_d def next_key(d, original_length, ignoring_keys=[], attension_values=[]): if len(igno...
flexible
{ "blob_id": "aee009b37b99bf44e27c608470c43834a58e0cc7", "index": 8490, "step-1": "<mask token>\n\n\ndef to_dict(table):\n table_d = dict()\n for i in range(len(table)):\n for j in range(i):\n table_d[i, j] = table[i][j]\n table_d[j, i] = table[i][j]\n return table_d\n\n\ndef...
[ 3, 4, 5, 6, 7 ]
from django.http import HttpResponse from django.shortcuts import render def home(request): return render(request, 'home.html') def people(request): return render(request, 'people.html') def docs(request): return render(request, 'docs.html') def gallery(request, page=None): if page: retu...
normal
{ "blob_id": "f7a493ab8e9845d0e9da33a0ee45d7c3ef66deb5", "index": 7507, "step-1": "<mask token>\n\n\ndef home(request):\n return render(request, 'home.html')\n\n\n<mask token>\n\n\ndef docs(request):\n return render(request, 'docs.html')\n\n\n<mask token>\n\n\ndef publications(request):\n return render(r...
[ 3, 4, 5, 7 ]
<|reserved_special_token_0|> def main(): filename = sys.argv[1] do_it(filename=filename) def get_valid_userblock_size(min): result = 2 ** int(math.ceil(math.log(min, 2))) if result < 512: result = 512 return result <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved...
flexible
{ "blob_id": "b20bf203a89ed73cc65db50fdbef897667fe390f", "index": 2804, "step-1": "<mask token>\n\n\ndef main():\n filename = sys.argv[1]\n do_it(filename=filename)\n\n\ndef get_valid_userblock_size(min):\n result = 2 ** int(math.ceil(math.log(min, 2)))\n if result < 512:\n result = 512\n re...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Player: <|reserved_special_token_0|> @property def uri(self): return self._uri @uri.setter def uri(self, value): self._uri = value self.player.set_state(Gst.State.NULL) if value: self.player.set_property('uri', value)...
flexible
{ "blob_id": "01e9ceb516a323a2017c65e368da419c6570dce2", "index": 7304, "step-1": "<mask token>\n\n\nclass Player:\n <mask token>\n\n @property\n def uri(self):\n return self._uri\n\n @uri.setter\n def uri(self, value):\n self._uri = value\n self.player.set_state(Gst.State.NULL...
[ 3, 6, 8, 9, 10 ]
# 10.13.20 - sjg # Exercise 15 - solution A # Write a function called greatestCommomFactor that, #given two distinct positive integers, #returns the greatest common factor of those two values #Input: greatestCommonFactor(9,12) #Output: 3 #Input: greatestCommonFactor(6,18) #Output: 6 #Input: greatestCommonFactor(11...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for files in range(30): file = open('NewResults' + str(files + 1) + '.data') for line in file: if line != '\n': j = json.loads(line) if controller == 0: startTime = j['metric...
flexible
{ "blob_id": "03284f20e614a5f8f5c21939acf49490d6ffd3a3", "index": 7812, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor files in range(30):\n file = open('NewResults' + str(files + 1) + '.data')\n for line in file:\n if line != '\\n':\n j = json.loads(line)\n if contr...
[ 0, 1, 2, 3, 4 ]
import openerp from openerp import pooler from openerp.report import report_sxw import xlwt from openerp.addons.report_xls.report_xls import report_xls from openerp.tools.translate import _ class openacademy_course_xls_parser(report_sxw.rml_parse): def __init__(self, cursor, uid, name, context): super(openacademy_c...
normal
{ "blob_id": "5c415d5bf9d6952863a662d300cb1f706ef02a8f", "index": 1048, "step-1": "<mask token>\n\n\nclass openacademy_course_xls_parser(report_sxw.rml_parse):\n\n def __init__(self, cursor, uid, name, context):\n super(openacademy_course_xls_parser, self).__init__(cursor, uid,\n name, contex...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> subprocess.call('./serve_model.sh') subprocess.call(['flask', 'run']) <|reserved_special_token_1|> <|reserved_special_token_0|> os.environ['FLASK_APP'] = 'app/app.py' os.environ['FLASK_DEBUG'] = '1' subprocess.call('./serve_mod...
flexible
{ "blob_id": "cbad5d6f381e788a2f064aac0a5d468f40b39c93", "index": 3696, "step-1": "<mask token>\n", "step-2": "<mask token>\nsubprocess.call('./serve_model.sh')\nsubprocess.call(['flask', 'run'])\n", "step-3": "<mask token>\nos.environ['FLASK_APP'] = 'app/app.py'\nos.environ['FLASK_DEBUG'] = '1'\nsubprocess.c...
[ 0, 1, 2, 3, 4 ]
import numpy as np import torch import torch.nn as nn from utils import * from collections import OrderedDict from torchsummary import summary class Model(nn.Module): """Example usage: model = Model() outputs = model(pov_tensor, feat_tensor) """ def __init__(self): super(Model, self).__in...
normal
{ "blob_id": "981cfecdb50b5f3ae326bf3103163f6e814ccc95", "index": 6857, "step-1": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 1, 2, 4, 5, 6 ]
#!/usr/bin/python3 # -*- coding:utf-8 -*- import re def main(): s = input().strip() s = s.replace('BC', 'X') ans = 0 for ax in re.split(r'[BC]+', s): inds = [] for i in range(len(ax)): if ax[i] == 'A': inds.append(i) ans += sum([len(ax) - 1 - ind for ind in inds]) - sum(range(len(ind...
normal
{ "blob_id": "4100415b0df52e8e14b00dd66c7c53cd46c0ea6e", "index": 2378, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n s = input().strip()\n s = s.replace('BC', 'X')\n ans = 0\n for ax in re.split('[BC]+', s):\n inds = []\n for i in range(len(ax)):\n ...
[ 0, 1, 2, 3, 4 ]
''' Generate a ten-character alphanumeric password with at least one lowercase, at least one uppercase character, and at least three digits ''' import secrets import string alphabets = string.ascii_letters + string.digits while True: password = "".join(secrets.choice(alphabets) for i in range(10)) if(a...
normal
{ "blob_id": "0c283cd31203291da24226a0eae781bd397e84d4", "index": 9526, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n password = ''.join(secrets.choice(alphabets) for i in range(10))\n if any(c.islower() for c in password) and any(c.isupper() for c in password\n ) and sum(c.isd...
[ 0, 1, 2, 3, 4 ]