code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def number_of_subscribers(subreddit): """return the number of subscribers from an Reddit API""" import requests resInf = requests.get('https://www.reddit.com/r/{}/about.json'.format( subreddit), headers={'Use...
flexible
{ "blob_id": "db1e3a109af2db2c8794a7c9c7dfb0c2ccee5800", "index": 932, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef number_of_subscribers(subreddit):\n \"\"\"return the number of subscribers from an Reddit API\"\"\"\n import requests\n resInf = requests.get('https://www.reddit.com/r/{}/...
[ 0, 1, 2 ]
''' quick and dirty remote shell using sockets and file descriptors ''' import socket import os s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind(('',8082)) s.listen(1) conn,__=s.accept() os.dup2(conn.fileno(),0) os.dup2(conn.fileno(),1) #print("asdf") os.system('/bin/bash') conn.close()
normal
{ "blob_id": "38a2113c0531648a90cf70c4b18d640d5ebb3f47", "index": 5637, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.bind(('', 8082))\ns.listen(1)\n<mask token>\nos.dup2(conn.fileno(), 0)\nos.dup2(conn.fileno(), 1)\nos.system('/bin/bash')\nconn.close()\n", "step-3": "<mask token>\ns = socket.socket(...
[ 0, 1, 2, 3, 4 ]
"""Distribution script for unitreport.""" import setuptools with open("README.md", "r") as f: long_description = f.read() setuptools.setup( name="unitreport", version="0.1.1", author="annahadji", author_email="annahadji@users.noreply.github.com", description="A small unittest-based tool for ge...
normal
{ "blob_id": "7a243f5e24d81d3395cc790dface5e795b9c04e6", "index": 4495, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('README.md', 'r') as f:\n long_description = f.read()\nsetuptools.setup(name='unitreport', version='0.1.1', author='annahadji',\n author_email='annahadji@users.noreply.git...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get('https://www.zhaopin.com/') time.sleep(5) driver.find_element_by_id('KeyWord_kw2').send_keys('技术') driver.find_element_by_class_name('doSearch').click() time.sleep(5) <|reserved_special_token_1|> <|reserved_special_t...
flexible
{ "blob_id": "fc5a4c27a21c2bd3900a6ad0bff68c249fe29d7a", "index": 1865, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.zhaopin.com/')\ntime.sleep(5)\ndriver.find_element_by_id('KeyWord_kw2').send_keys('技术')\ndriver.find_element_by_class_name('doSearch').click()\ntime.sleep(5)\n", ...
[ 0, 1, 2, 3 ]
import numpy as np import math class KMeans(object): def __init__(self, data, option): self.data = data self.membership = None self.centroids = None self.option = option self.temp_data = None def fit(self, K): data = np.asmatrix(self.data[0]) if self.o...
normal
{ "blob_id": "5cf73e003b744b438c0db67ab39fb10a3f879f2f", "index": 8556, "step-1": "<mask token>\n\n\nclass KMeans(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass KMeans(object):\n\n def __init__(self, data, option):\n self.data = data\n self...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @mark.parametrize('filename, with_', (('test_pmaps_auto.h5', True), ('test_pmaps_manu.h5', False))) def test_pmap_writer(config_tmpdir, filename, with_, s12_dataframe_converted, s2si_dataframe_converted): ...
flexible
{ "blob_id": "c36adc3cf5de2f0ae3ee9b9823304df393ebce63", "index": 5679, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@mark.parametrize('filename, with_', (('test_pmaps_auto.h5', \n True), ('test_pmaps_manu.h5', False)))\ndef test_pmap_writer(config_tmpdir, filename, with_,\n s12_dat...
[ 0, 1, 2, 3, 4 ]
# put your python code here time_one = abs(int(input())) time_two = abs(int(input())) time_three = abs(int(input())) time_four = abs(int(input())) time_five = abs(int(input())) time_six = abs(int(input())) HOUR = 3600 # 3600 seconds in an hour MINUTE = 60 # 60 seconds in a minute input_one = time_one * HOUR + time...
normal
{ "blob_id": "7a4044acaa191509c96e09dcd48e5b951ef7a711", "index": 3582, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(abs(input_one - input_two))\n", "step-3": "time_one = abs(int(input()))\ntime_two = abs(int(input()))\ntime_three = abs(int(input()))\ntime_four = abs(int(input()))\ntime_five = a...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestMiriMeasuredModel(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_creation(self): dq_def_names = list(MiriMeasuredModel.dq_def_names) schema_names = list(self.dataproduct.get_field_names('dq_def')) self....
flexible
{ "blob_id": "644b4a2f0e8ce95e669c9c01df111c943e0c4af2", "index": 3417, "step-1": "<mask token>\n\n\nclass TestMiriMeasuredModel(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_creation(self):\n dq_def_names = list(MiriMeasuredModel.dq_def_names)\n schema_names = list(self.da...
[ 19, 23, 27, 28, 31 ]
def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico): lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico] return lixos[n]
normal
{ "blob_id": "71a9c9b8f47dcfbecc154c44d5a72ddbd852145a", "index": 328, "step-1": "<mask token>\n", "step-2": "def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico):\n lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico]\n return lixos...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', password='383240gyz', db='bycicle', charset='utf8') print(conn) try: with conn.cursor() as cursor: cursor.execu...
flexible
{ "blob_id": "3135483c68880eeeaf7ebc085a6cd3c0c7f0550c", "index": 1859, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root',\n password='383240gyz', db='bycicle', charset='utf8')\n print(conn)\n try:\n with...
[ 0, 1, 2, 3, 4 ]
''' Given an array of ints length 3, return an array with the elements "rotated left" so {1, 2, 3} yields {2, 3, 1}. rotate_left3([1, 2, 3]) → [2, 3, 1] rotate_left3([5, 11, 9]) → [11, 9, 5] rotate_left3([7, 0, 0]) → [0, 0, 7] ''' #卡了很久,还是列表的基本操作不太熟 #参考:https://zhidao.baidu.com/question/1244520812319200859.html def r...
normal
{ "blob_id": "b7ebee3c96fd9cd3d8ddc69838363925085a944d", "index": 1347, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef rotate_left3(nums):\n if len(nums) < 3:\n return 0\n nums.append(nums[0])\n del nums[0]\n return nums\n", "step-3": "'''\nGiven an array of ints length 3, ret...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def despine(): ax = py.gca() ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) py.tick_params(axis='both', bottom='off', top='off', left='off', right= 'off') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_t...
flexible
{ "blob_id": "15ca54aff4c688733c9c514ba5856e6bf29a3292", "index": 8345, "step-1": "<mask token>\n\n\ndef despine():\n ax = py.gca()\n ax.spines['top'].set_visible(False)\n ax.spines['right'].set_visible(False)\n py.tick_params(axis='both', bottom='off', top='off', left='off', right=\n 'off')\n\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class RepeatWorkBreak(rumps.App): <|reserved_special_token_0|> def set_up_menu(self): self.timer.stop() self.timer.count = 0 self.app.title = self.config['app_title'] def convert_seconds_to_time_string(self, seconds) ->str: seconds = seconds %...
flexible
{ "blob_id": "2ca91c410b8c8d6306d5ed918783a4d77a091ba8", "index": 360, "step-1": "<mask token>\n\n\nclass RepeatWorkBreak(rumps.App):\n <mask token>\n\n def set_up_menu(self):\n self.timer.stop()\n self.timer.count = 0\n self.app.title = self.config['app_title']\n\n def convert_secon...
[ 7, 10, 11, 12, 14 ]
from .fieldmatrix import *
normal
{ "blob_id": "fc4fafe4e29a7f116c38be265fce8e4fb6638330", "index": 6848, "step-1": "<mask token>\n", "step-2": "from .fieldmatrix import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
"""Calculator is built using "ping pong" algorithm, without eval() etc. Main final function: calculate_expression(). calculate_expression() uses two functions in utils.py: clear_and_convert() and calculator_without_parentheses(). calculator_without_parentheses() uses two remaining functions: math_operation() -> ping_ca...
normal
{ "blob_id": "c336bb6cdadfb836ab68ebd5bbb210f63af3d084", "index": 2287, "step-1": "<mask token>\n\n\ndef ping_calculate_pong(expression, operator_index):\n \"\"\"The function takes two arguments.\n Argument 1: an expression from which we will extract one subexpression.\n Argument 2: the index of the math...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self) ->None: """Initialize flow.""" super().__init__() self._current: dict[str, Any] = {} self._hub: PhilipsTV |...
flexible
{ "blob_id": "515967656feea176e966de89207f043f9cc20c61", "index": 6716, "step-1": "<mask token>\n\n\nclass ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):\n <mask token>\n <mask token>\n\n def __init__(self) ->None:\n \"\"\"Initialize flow.\"\"\"\n super().__init__()\n self._cu...
[ 6, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def preprocess_transformers(y_train, transf): if transf != 'ln': if transf == 'minmax': scaler = MinMaxScaler() scaler2 = MinMaxScaler() elif transf == 'standard': scaler =...
flexible
{ "blob_id": "890d50c741ffd576312c63dc450e274b4517bf12", "index": 9856, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef preprocess_transformers(y_train, transf):\n if transf != 'ln':\n if transf == 'minmax':\n scaler = MinMaxScaler()\n scaler2 = MinMaxScaler()\n ...
[ 0, 2, 3, 4, 5 ]
from flask import Blueprint web = Blueprint('web', __name__) from app.web import auth from app.web import user from app.web import book
normal
{ "blob_id": "02182f0379e58b64bbe17cc5f433e8aae7814976", "index": 196, "step-1": "<mask token>\n", "step-2": "<mask token>\nweb = Blueprint('web', __name__)\n<mask token>\n", "step-3": "from flask import Blueprint\nweb = Blueprint('web', __name__)\nfrom app.web import auth\nfrom app.web import user\nfrom app....
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def FindGreatestSumOfSubArray(self, array): dp = [array[0]] res = array[0] for i in range(1, len(arra...
flexible
{ "blob_id": "fcca845b60b050fa5dd0a3c50b3c36c154022f07", "index": 1467, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def FindGreatestSumOfSubArray(self, array):\n dp = [array[0]]\n res = array[0]\n f...
[ 1, 2, 3, 4, 5 ]
import numpy as np def find_saddle_points(A): B = [] for i in range(A.shape[0]): min_r = np.min(A[i]) ind_r = 0 max_c = 0 ind_c = 0 for j in range(A.shape[1]): if (A[i][j] == min_r): min_r = A[i][j] ind_r = j for k in range(A.shape[0]): if (A[k][ind_r] >= max_c): max_c = A[k][ind_...
normal
{ "blob_id": "808fe8f106eaff00cf0080edb1d8189455c4054b", "index": 6706, "step-1": "<mask token>\n\n\ndef find_saddle_points(A):\n B = []\n for i in range(A.shape[0]):\n min_r = np.min(A[i])\n ind_r = 0\n max_c = 0\n ind_c = 0\n for j in range(A.shape[1]):\n if A...
[ 5, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class CancelReservedTickets(Command): def run(self): payments = Purchase.query.filter(Purchase.state == 'reserved', Purchase.modified < datetime.utcnow() - timedelta(days=3), ~ Purchase.payment_id.is_(None)).join(Payment).with_entities(Payment ...
flexible
{ "blob_id": "1de46ee2818b4cb2ae68ef5870581c341f8d9b04", "index": 4020, "step-1": "<mask token>\n\n\nclass CancelReservedTickets(Command):\n\n def run(self):\n payments = Purchase.query.filter(Purchase.state == 'reserved', \n Purchase.modified < datetime.utcnow() - timedelta(days=3), ~\n ...
[ 6, 7, 9, 10, 11 ]
""" Suffix Arrays - Optimized O(n log n) - prefix doubling A suffix is a non-empty substring at the end of the string. A suffix array contains all the sorted suffixes of a string A suffix array provides a space efficient alternative to a suffix tree which itself is a compressed version of a trie. Suffix array can do ...
normal
{ "blob_id": "5a2106f5255493d2f6c8cb9e06a2666c8c55ed38", "index": 3852, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef prefix_doubling_suffix_array(n):\n n_len = len(n)\n if n_len == 0:\n return []\n if n_len == 1:\n return [0]\n suffixes = []\n for i in range(n_len):\...
[ 0, 1, 2, 3, 4 ]
""" Carl Bunge Washington State University June 2018 Adapted from @author: Luka Denies from TU Delft. Changelog: 11/2017 - Integration of CoolProp 06/2018 - Update to OpenFOAM-5.x (Mass-based thermodynamics (for example: cpMcv to CpMCv)) 03/2019 - Update to include parahydrogen properties from Refprop """ import Co...
normal
{ "blob_id": "7ac15f422ca2cd0d30e936b7dd17c96e1f3abff0", "index": 8429, "step-1": "\"\"\"\nCarl Bunge\nWashington State University\nJune 2018\n\nAdapted from @author: Luka Denies from TU Delft.\n\nChangelog:\n11/2017 - Integration of CoolProp\n06/2018 - Update to OpenFOAM-5.x (Mass-based thermodynamics (for examp...
[ 0 ]
<|reserved_special_token_0|> class IceCubedClientBase(IceCubedClientABC): BASE_URI = 'https://ice3x.com/api/v1/' def __init__(self, api_key: str=None, secret: str=None) ->None: """Instantiate the client Args: api_key: An ICE3X public API key secret: An ICE3X private A...
flexible
{ "blob_id": "8bd918896fb72c89a622ba4e18666bb90755cafd", "index": 4545, "step-1": "<mask token>\n\n\nclass IceCubedClientBase(IceCubedClientABC):\n BASE_URI = 'https://ice3x.com/api/v1/'\n\n def __init__(self, api_key: str=None, secret: str=None) ->None:\n \"\"\"Instantiate the client\n\n Args...
[ 5, 6, 7, 9, 10 ]
from partyparrot import convert_with_alphabet_emojis, convert def test_convert_char_to_alphabet(): assert convert_with_alphabet_emojis("") == "" assert convert_with_alphabet_emojis(" ") == " " assert convert_with_alphabet_emojis("\n") == "\n" assert ( convert_with_alphabet_emojis(" one two")...
normal
{ "blob_id": "c3bfcb971a6b08cdf98200bd2b2a8fe6ac2dd083", "index": 6969, "step-1": "<mask token>\n\n\ndef test_convert_wrong_char():\n txt = convert('@!*', ':icon:', ':nbsp')\n assert txt == \"\"\":icon::icon::icon::nbsp:nbsp:icon::icon::icon::nbsp:nbsp:icon::icon::icon:\n:nbsp:nbsp:icon::nbsp:nbsp:nbsp:nbsp...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'name': 'John Doe', 'age': 24} {'name': 'John Doe', 'age': 24} func({'name': 'John Doe', 'age': 24}) <|reserved_special_token_1|> # cases where DictAchievement should unlock # >> CASE {'name': 'John Doe', 'age': 24} # >> CASE { 'name': 'John Doe', ...
flexible
{ "blob_id": "874fa2a6afdd04f3f2232a86f56d220447160ede", "index": 5167, "step-1": "<mask token>\n", "step-2": "{'name': 'John Doe', 'age': 24}\n{'name': 'John Doe', 'age': 24}\nfunc({'name': 'John Doe', 'age': 24})\n", "step-3": "# cases where DictAchievement should unlock\n\n# >> CASE\n{'name': 'John Doe', '...
[ 0, 1, 2 ]
from django.http import HttpResponseRedirect from django.urls import reverse from django.contrib import messages from datetime import datetime, timedelta class DeadlineMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): re...
normal
{ "blob_id": "0d3e1df1720812e8546b1f3509c83d1e6566e103", "index": 4639, "step-1": "<mask token>\n\n\nclass DeadlineMiddleware:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DeadlineMiddleware:\n\n def __init__(self, get_response):\n self.get_response = ge...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def manual_test(): dict_processedtext = process_textfile(string_path= 'C:\\Users\\Rives\\Downloads\\Quizzes\\Quiz 0 Overwrite Number 1.txt', encryption_algorithm='rotate', algorithm_key=1, shift_left=True) print('Encrypt ROT1 with default values.') print(dict_p...
flexible
{ "blob_id": "5dccd015a90927e8d2a9c0ea4b11b24bfd4bb65e", "index": 5690, "step-1": "<mask token>\n\n\ndef manual_test():\n dict_processedtext = process_textfile(string_path=\n 'C:\\\\Users\\\\Rives\\\\Downloads\\\\Quizzes\\\\Quiz 0 Overwrite Number 1.txt',\n encryption_algorithm='rotate', algorith...
[ 2, 3, 4, 5, 6 ]
from django.core.management.base import BaseCommand from journal.models import Journal from article.models import ArticleCoverSetting from django.conf import settings import os class Command(BaseCommand): def handle(self, *args, **options): print('Loading article settings') ArticleCoverSetting.ob...
normal
{ "blob_id": "a3d27561488c38e1256eb33abad108ad42081eb6", "index": 9253, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Command(BaseCommand):\n\n def handle(self, *args, **options):\n print('Loading article...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(t) <|reserved_special_token_0|> for _ in range(t): a = random.randint(1, n) b = random.choice(prime) print(a, b) for _ in range(a): print(random.randint(1, n), end=' ') print('') <|reserved_spec...
flexible
{ "blob_id": "16738e7d89bee8074f39d0b3abc3fa786faf081f", "index": 2370, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(t)\n<mask token>\nfor _ in range(t):\n a = random.randint(1, n)\n b = random.choice(prime)\n print(a, b)\n for _ in range(a):\n print(random.randint(1, n), end=' ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while 1: line = f.readline() if not line: break yesterday_lyric = yesterday_lyric + line.strip() + '\n' f.close() <|reserved_special_token_0|> print("Number of a Word 'YESTERDAY'", num_of_yesterday) <|reserved_...
flexible
{ "blob_id": "8559448822b3d3989a9795e7b497a2791588c327", "index": 9539, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 1:\n line = f.readline()\n if not line:\n break\n yesterday_lyric = yesterday_lyric + line.strip() + '\\n'\nf.close()\n<mask token>\nprint(\"Number of a Word 'YESTER...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Board: def __init__(self, nrows, ncols, random_seed=42): self.nrows = nrows self.ncols = ncols self.random = random.Random() self.random.seed(random_seed) self.board = np.zeros((nrows, ncols)) self.score = 0 self.__add_new...
flexible
{ "blob_id": "cab45a823e319bd504b3db68cf70bff315f44fc6", "index": 7462, "step-1": "<mask token>\n\n\nclass Board:\n\n def __init__(self, nrows, ncols, random_seed=42):\n self.nrows = nrows\n self.ncols = ncols\n self.random = random.Random()\n self.random.seed(random_seed)\n ...
[ 10, 12, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def write_file(path, text): path.write_text(text) return path <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def write_file(path, text): path.write_text(text) return...
flexible
{ "blob_id": "700d35f9e941fe9325821a377ec1ca1c245ddaec", "index": 176, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef write_file(path, text):\n path.write_text(text)\n return path\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef write_file(path, text):\n path.write_text(text)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AccessDenied(Exception): pass class FileNotFound(Exception): pass class NotDirectory(Exception): pass <|reserved_special_token_0|> def get_parent(path): """A megadott elem szulokonyvtarat adja meg""" parent = os.path.dirname(path) try: get_abs...
flexible
{ "blob_id": "d9156c20e046f608563bc6779575e14cc60f4c25", "index": 896, "step-1": "<mask token>\n\n\nclass AccessDenied(Exception):\n pass\n\n\nclass FileNotFound(Exception):\n pass\n\n\nclass NotDirectory(Exception):\n pass\n\n\n<mask token>\n\n\ndef get_parent(path):\n \"\"\"A megadott elem szulokony...
[ 5, 6, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': url = 'https://www.sogou.com/' reponse = requests.get(url=url) page_text = reponse.text print(page_text) with open('./sogou.html', 'w', encoding='utf-8') as fp: fp.write(page_...
flexible
{ "blob_id": "7ae6ed8797d6ee02effd04750e243c5a59840177", "index": 8444, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url = 'https://www.sogou.com/'\n reponse = requests.get(url=url)\n page_text = reponse.text\n print(page_text)\n with open('./sogou.html', 'w',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Time One :: ', time_one) <|reserved_special_token_0|> print('Time Two :: ', time_two) <|reserved_special_token_0|> print('Date One :: ', date_one) <|reserved_special_token_0|> print('Today :: ', today, today.timetuple()) pr...
flexible
{ "blob_id": "1ed7dba63db38e53a1dc5fac3c36f0dd98075c1f", "index": 4305, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Time One :: ', time_one)\n<mask token>\nprint('Time Two :: ', time_two)\n<mask token>\nprint('Date One :: ', date_one)\n<mask token>\nprint('Today :: ', today, today.timetuple())\n...
[ 0, 1, 2, 3, 4 ]
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ exist = set() s_to_t = {} if len(s) != len(t): return False for i, v in enumerate(s): if v not in s_t...
normal
{ "blob_id": "b4e2897e20448d543c93402174db7da4066a8510", "index": 5144, "step-1": "<mask token>\n\n\nclass Solution_ref(object):\n\n def isIsomorphic(self, s, t):\n return [s.find(i) for i in s] == [t.find(j) for j in t]\n\n\n<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n\n\nc...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> matplotlib.use('agg') <|reserved_special_token_0|> def f(x, A, B): return A * x + B <|reserved_special_token_0|> plt.plot(x_plot, f(x_plot, *params), 'k-', label='Anpassungsfunktion', linewidth=0.5) print(params) print...
flexible
{ "blob_id": "4932a357cfd60cb65630345e75794ebf58b82c82", "index": 8696, "step-1": "<mask token>\n", "step-2": "<mask token>\nmatplotlib.use('agg')\n<mask token>\n\n\ndef f(x, A, B):\n return A * x + B\n\n\n<mask token>\nplt.plot(x_plot, f(x_plot, *params), 'k-', label='Anpassungsfunktion',\n linewidth=0.5...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.imshow(imgL, cmap='gray') plt.axis('off') plt.show() <|reserved_special_token_0|> print(disparity) plt.imshow(disparity) plt.axis('off') plt.show() <|reserved_special_token_0|> plt.imshow(depth) plt.show() <|reserved_special_t...
flexible
{ "blob_id": "14761cc2593556f58a7dc4e499db71456d7c7048", "index": 3237, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.imshow(imgL, cmap='gray')\nplt.axis('off')\nplt.show()\n<mask token>\nprint(disparity)\nplt.imshow(disparity)\nplt.axis('off')\nplt.show()\n<mask token>\nplt.imshow(depth)\nplt.show()...
[ 0, 1, 2, 3, 4 ]
num = int(input("Enter the number: ")) print("Multiplication Table of", num) for i in range(1, 10): print(num,"a",i,"=",num * i)
normal
{ "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 ]
# -*- coding: utf-8 -*- from matplotlib import pyplot as plt from matplotlib import colors import numpy as np import sys max_value = int(sys.argv[1]) file1 = open(sys.argv[2]) file2 = open(sys.argv[3]) file3 = open(sys.argv[4]) histogram = np.zeros(max_value, dtype=int).tolist() highest_value = 0.0 sample_size = 0...
normal
{ "blob_id": "8356bc92a3a8b561d55bf5f2d9aeb0da89b730ca", "index": 1387, "step-1": "# -*- coding: utf-8 -*-\nfrom matplotlib import pyplot as plt\nfrom matplotlib import colors\nimport numpy as np\nimport sys\n\nmax_value = int(sys.argv[1])\n\nfile1 = open(sys.argv[2])\nfile2 = open(sys.argv[3])\nfile3 = open(sys....
[ 0 ]
class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ if not board or not board[0]: return not word self.length = len(word) def hasPathCore(row, col, depth=0): if self.length...
normal
{ "blob_id": "9b8db3407313a3e39d429b7c10897fc447fcdc27", "index": 1337, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def exist(self, board, word):\n \"\"\"\n :type board: List[List[str]]\n :type word: ...
[ 1, 2, 3, 4, 5 ]
import torch class Activation(torch.nn.Module): def __init__(self): super().__init__() self.swish = lambda x: x * torch.sigmoid(x) self.linear = lambda x: x self.sigmoid = lambda x: torch.sigmoid(x) self.neg = lambda x: -x self.sine = lambda x: torch.sin(x) self.params = torch.nn.Parameter(torch.zero...
normal
{ "blob_id": "850310b6c431981a246832e8a6f5417a88587b99", "index": 3151, "step-1": "<mask token>\n\n\nclass ResizableConv2d(torch.nn.Module):\n <mask token>\n\n def forward(self, x):\n y = self.conv(x)\n y = self.conv2(y)\n y = self.resize(y)\n y = y + self.resize(self.residual_co...
[ 10, 11, 12, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for n in range(N): x = int(input()) l.append(x) l.sort() print(*l, sep='\n') <|reserved_special_token_1|> N = int(input()) l = [] for n in range(N): x = int(input()) l.append(x) l.sort() print(*l, sep='\n')
flexible
{ "blob_id": "a699b43c57c315967a6d1881d7012fee4a93607b", "index": 6347, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(N):\n x = int(input())\n l.append(x)\nl.sort()\nprint(*l, sep='\\n')\n", "step-3": "N = int(input())\nl = []\nfor n in range(N):\n x = int(input())\n l.append...
[ 0, 1, 2 ]
#!/usr/bin/python """ Created on Aug 1 2014 """ import rospy def my_callback(event): print 'Timer called at ' + str(event.current_real) if __name__ == '__main__': rospy.init_node('timer') rospy.Timer(rospy.Duration(2), my_callback) rospy.spin()
normal
{ "blob_id": "4e61f9fefe8e6b5203ba05ac9bd626db1102df36", "index": 122, "step-1": "#!/usr/bin/python\n\"\"\"\nCreated on Aug 1 2014\n\n\"\"\"\n\nimport rospy\ndef my_callback(event):\n print 'Timer called at ' + str(event.current_real)\n\nif __name__ == '__main__':\n rospy.init_node('timer')\n\n rospy.Ti...
[ 0 ]
from django.shortcuts import render from django.views.generic.base import View from .models import Article, Tag, Category from pure_pagination import Paginator, EmptyPage, PageNotAnInteger class ArticleView(View): '''文章详情页''' def get(self, request, article_id): # 文章详情 article = Article.object...
normal
{ "blob_id": "2fd40f4d69223933d53d8ed2abd5f6d3ccd2f509", "index": 3850, "step-1": "<mask token>\n\n\nclass CategoryView(View):\n \"\"\"文章分类页\"\"\"\n\n def get(self, request, category_id):\n category = Category.objects.get(id=int(category_id))\n category_articles = category.article_set.all()\n ...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Page(frontik.handler.PageHandler): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Page(frontik.handler.PageHandler): def get_page(self): self.set_xsl(self...
flexible
{ "blob_id": "6f331eedcdaceaded142c3ffe9400aaa817613c1", "index": 5795, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Page(frontik.handler.PageHandler):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Page(frontik.handler.PageHandler):\n\n def get_page(self):\n self.set_xsl...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName('Dialog') Dialog.resize(607, 723) self.start = QtWidgets.QLabel(Dialog) self.start.setGeometry(QtCore.QRect(10, 70, 59, 24)) self.start.setObjectName('start') self...
flexible
{ "blob_id": "c076aed1bfff51f8edf5ab4ef029b7fa7ca2422c", "index": 9479, "step-1": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectName('Dialog')\n Dialog.resize(607, 723)\n self.start = QtWidgets.QLabel(Dialog)\n self.start.setGeometry(Qt...
[ 2, 3, 4, 5, 6 ]
import sys sys.path.append("/home/mccann/bin/python/obsolete") from minuit import * execfile("/home/mccann/antithesis/utilities.py") nobeam = getsb("cos") ebeam = getsb("bge") pbeam = getsb("bgp") import gbwkf import gbwkftau runstart = pickle.load(open("/home/mccann/antithesis/old_dotps/runstart.p")) runend = pickle....
normal
{ "blob_id": "51cd74bff5a0883a7bee2b61b152aecb2c5ccc66", "index": 6263, "step-1": "import sys\nsys.path.append(\"/home/mccann/bin/python/obsolete\")\n\nfrom minuit import *\nexecfile(\"/home/mccann/antithesis/utilities.py\")\nnobeam = getsb(\"cos\")\nebeam = getsb(\"bge\")\npbeam = getsb(\"bgp\")\nimport gbwkf\ni...
[ 0 ]
<|reserved_special_token_0|> class LRUCache: def __init__(self, get_from_origin, max_size=1024): if max_size == 0: raise NotImplementedError() if max_size < 0: raise ValueError() self.size = 0 self.max_size = max_size self._get_from_origin = get_fro...
flexible
{ "blob_id": "9c251e0224979877b9ce244e4871fd4c403abb8e", "index": 1583, "step-1": "<mask token>\n\n\nclass LRUCache:\n\n def __init__(self, get_from_origin, max_size=1024):\n if max_size == 0:\n raise NotImplementedError()\n if max_size < 0:\n raise ValueError()\n sel...
[ 10, 14, 16, 23, 24 ]
# content of conftest.py import pytest import sys sys.path.insert(1, '../Generic') import PQ9Client def pytest_configure(config): print("pytest_configure") def pytest_collection_modifyitems(session, config, items): print("sono qui", items) def pytest_ignore_collect(path, config): print(path) ...
normal
{ "blob_id": "ad88685e3f1cd5e0ddb42a5982a05ff8ee7b8111", "index": 1586, "step-1": "<mask token>\n\n\ndef pytest_addoption(parser):\n print('Option ')\n parser.addoption('--destination', action='store', help=\n 'subsystem address', dest='destination')\n\n\n@pytest.fixture\ndef destination(request):\n ...
[ 2, 5, 6, 7, 9 ]
<|reserved_special_token_0|> def config_complete(): pass <|reserved_special_token_0|> def get_size(h): global disk return len(disk) <|reserved_special_token_0|> def is_rotational(h): return False def can_trim(h): return True def pread(h, count, offset): global disk return disk[...
flexible
{ "blob_id": "2e3c1bf0a4c88bda35a48008cace8c21e071384e", "index": 8378, "step-1": "<mask token>\n\n\ndef config_complete():\n pass\n\n\n<mask token>\n\n\ndef get_size(h):\n global disk\n return len(disk)\n\n\n<mask token>\n\n\ndef is_rotational(h):\n return False\n\n\ndef can_trim(h):\n return True...
[ 7, 8, 11, 12, 13 ]
""" This class runs the RL Training """ from __future__ import division import logging import numpy as np from data.data_provider import DataProvider from episode.episode import Episode from tracker import TrainingTracker from tqdm import tqdm class RLTrainer(object): """ Creates RL training object """ ...
normal
{ "blob_id": "7c004cb0c9eefa5e88f5085fb3b2878db98d2b20", "index": 3200, "step-1": "<mask token>\n\n\nclass RLTrainer(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RLTrainer(object):\n <mask token>\n\n def __init__(self, config_, grid_search=False):\n...
[ 1, 3, 4, 5, 6 ]
# Generated by Django 2.1.5 on 2019-01-20 18:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Destination', fields=[ ...
normal
{ "blob_id": "6907a1e08d728732eebf81fec7c0dab8729448e2", "index": 9712, "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 ]
''' This script will do auto-check in/out for ZMM100 fingerprint access control device by ZKSoftware. At my office, the manager uses an application to load data from the fingerprint device. After he loads data, log in device's database is cleared. So in my case, I write this script to automate checking in/out everyday...
normal
{ "blob_id": "3d1e6be71f92910cdc9eb2bf60ea7f8f1187f706", "index": 3698, "step-1": "<mask token>\n\n\ndef get_server_ip(device_ip):\n import socket\n s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n s.connect((device_ip, 80))\n return s.getsockname()[0]\n\n\ndef transfer_file(from_ip, to_ip, remo...
[ 6, 12, 13, 14, 16 ]
<|reserved_special_token_0|> class TestTrainer(object): <|reserved_special_token_0|> @classmethod def teardown_class(cls): """ teardown any state that was previously setup with a call to setup_class. """ pass <|reserved_special_token_0|> def ignore_test_load_local...
flexible
{ "blob_id": "192c44540018b9e1ab857bdbfba6fdb39bb74431", "index": 8769, "step-1": "<mask token>\n\n\nclass TestTrainer(object):\n <mask token>\n\n @classmethod\n def teardown_class(cls):\n \"\"\" teardown any state that was previously setup with a call to\n setup_class.\n \"\"\"\n ...
[ 10, 12, 13, 14, 16 ]
class Helper: <|reserved_special_token_0|> <|reserved_special_token_0|> def display_command(self, command): if command not in self.commands: return "That command doesn't exist :/" result = f'__**Command: {command[0].upper()}{command[1:]}**__\n\n' result += self.command_d...
flexible
{ "blob_id": "fdf76ff20260c25d95a9bf751fa78156071a7825", "index": 7487, "step-1": "class Helper:\n <mask token>\n <mask token>\n\n def display_command(self, command):\n if command not in self.commands:\n return \"That command doesn't exist :/\"\n result = f'__**Command: {command[...
[ 2, 3, 4, 5, 6 ]
from mongoengine import Document, StringField, BooleanField, ListField, Q import exceptions class Category(Document): id = StringField(primary_key=True) name = StringField() is_base_expenses = BooleanField(default=False) aliases = ListField(StringField()) @classmethod def get_category_by_text...
normal
{ "blob_id": "63d9a0fa0d0747762e65f6f1e85e53090035454c", "index": 583, "step-1": "<mask token>\n\n\nclass Category(Document):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Category(Document):\n <mask token>\n <mask token>\n...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __version__ = '2.1.2' default_app_config = 'channels.apps.ChannelsConfig' DEFAULT_CHANNEL_LAYER = 'default' <|reserved_special_token_1|> __version__ = "2.1.2" default_app_config = "channels.apps.ChannelsConfig" DEFAULT_CHANNEL_LAYER = "default"
flexible
{ "blob_id": "92e414c76f4c585092a356d7d2957e91c1477c5f", "index": 5658, "step-1": "<mask token>\n", "step-2": "__version__ = '2.1.2'\ndefault_app_config = 'channels.apps.ChannelsConfig'\nDEFAULT_CHANNEL_LAYER = 'default'\n", "step-3": "__version__ = \"2.1.2\"\n\ndefault_app_config = \"channels.apps.ChannelsCo...
[ 0, 1, 2 ]
import pickle import saveClass as sc import libcell as lb import numpy as np import struct import os # def save_Ldend(Ldends, bfname): # # create a binary file # bfname='Dend_length.bin' # binfile = file(bfname, 'wb') # # and write out two integers with the row and column dimension # header = struc...
normal
{ "blob_id": "6eb8172e7e26ad6ec9cb0d30c5a0613ce79296e6", "index": 8421, "step-1": "<mask token>\n\n\ndef save_ave_replay(aveData, nIter, nStart, bfname):\n vd = np.zeros((nIter, 4, nStart))\n for i_trial in range(nIter):\n vv = aveData[i_trial]\n for i_dendrite in range(4):\n vvv = ...
[ 1, 2, 3, 4, 5 ]
#Recursively parse a string for a pattern that can be either 1 or 2 characters long
normal
{ "blob_id": "4d524bb4b88b571c9567c651be1b1f1f19fd3c0b", "index": 6296, "step-1": "#Recursively parse a string for a pattern that can be either 1 or 2 characters long", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('register_curier/', views.curier_register, name= 'register_curier'), path('private_сurier/', views.private_сurier, name= 'private_сurier'), path('private_сurier2/', views.private_сurier2, name ='pri...
flexible
{ "blob_id": "c1a83c9551e83e395a365210a99330fee7877dff", "index": 6881, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('register_curier/', views.curier_register, name=\n 'register_curier'), path('private_сurier/', views.private_сurier, name=\n 'private_сurier'), path('private_сur...
[ 0, 1, 2, 3 ]
import pandas as pd import numpy as np df1 = pd.DataFrame(np.ones((3, 4))*0, columns=['a', 'b', 'c', 'd']) df2 = pd.DataFrame(np.ones((3, 4))*1, columns=['a', 'b', 'c', 'd']) df3 = pd.DataFrame(np.ones((3, 4))*2, columns=['a', 'b', 'c', 'd']) # 竖向合并 # ignore_index对行索引重新排序 res1 = pd.concat([df1, df2, df3], axis=0, ig...
normal
{ "blob_id": "0a38cf6e0518a08895ed7155069aa2257c7b352e", "index": 4662, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(res1)\n<mask token>\nprint(res2)\n<mask token>\nprint(res3)\n<mask token>\nprint(res4)\n<mask token>\nprint(res5)\n<mask token>\nprint(res6)\n", "step-3": "<mask token>\ndf1 = pd....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': bestPrecision = [0, 0, 0, 0, 0, 0] bestPrecisionFile = ['', '', '', '', '', ''] bestRecall = [0, 0, 0, 0, 0, 0] bestRecallFile = ['', '', '', '', '', ''] bestSupport = [0, 0, 0, 0, 0,...
flexible
{ "blob_id": "22c498d84f40455d89ed32ccf3bf8778cb159579", "index": 79, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n bestPrecision = [0, 0, 0, 0, 0, 0]\n bestPrecisionFile = ['', '', '', '', '', '']\n bestRecall = [0, 0, 0, 0, 0, 0]\n bestRecallFile = ['', '', '', ...
[ 0, 1, 2, 3 ]
import pytest @pytest.mark.usefixtures("driver") class BaseClass: """BaseClass takes in driver fixture."""
normal
{ "blob_id": "1b49cb59ebdb548cfc7567cd5cb4affe30f33aac", "index": 5576, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n <mask token>\n", "step-3": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n \"\"\"BaseClass tak...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Stopwords: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Stopwords: def __init__(self, base_dir='data'): self.base_dir = base_dir <|reserved_special_token_0|> <|reserved_speci...
flexible
{ "blob_id": "dad4e14da734f2e2329f4cbe064c73c82a4ae27c", "index": 8119, "step-1": "<mask token>\n\n\nclass Stopwords:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Stopwords:\n\n def __init__(self, base_dir='data'):\n self.base_dir = base_dir\n <mask token>\n", "step-...
[ 1, 2, 3, 4, 5 ]
import socket clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) clientsocket.connect(('localhost', 9999)) clientsocket.send('hallooooo')
normal
{ "blob_id": "7d3d4476343579a7704c4c2b92fafd9fa5da5bfe", "index": 9294, "step-1": "<mask token>\n", "step-2": "<mask token>\nclientsocket.connect(('localhost', 9999))\nclientsocket.send('hallooooo')\n", "step-3": "<mask token>\nclientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nclientsocket.con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FileTransProgram(object): def __init__(self, ADDR, file_name): self.ADDR = ADDR self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(ADDR) self.file_name = file_name <|reserved_special_token_0|> <|reserved_speci...
flexible
{ "blob_id": "231a07e63e40f2e4d204cde76c52e64b922da1b8", "index": 2619, "step-1": "<mask token>\n\n\nclass FileTransProgram(object):\n\n def __init__(self, ADDR, file_name):\n self.ADDR = ADDR\n self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self.sock.connect(ADDR)\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for a in range(1, 11, 1): print(b, 'x', a, '=', a * b) <|reserved_special_token_1|> b = int(input('enter anum ')) for a in range(1, 11, 1): print(b, 'x', a, '=', a * b)
flexible
{ "blob_id": "bf83556b8e8855a0e410fcfb3b42161fbc681830", "index": 3075, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor a in range(1, 11, 1):\n print(b, 'x', a, '=', a * b)\n", "step-3": "b = int(input('enter anum '))\nfor a in range(1, 11, 1):\n print(b, 'x', a, '=', a * b)\n", "step-4": nul...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class MainApplication(tk.Frame): <|reserved_special_token_0|> def count_up(self): if self.var_count.get() == 0 and self.lst_counts.index(tk.END) == 0: SaveCount(tk.Toplevel(), self.save_to_listbox) return elif not self.selected_count: ...
flexible
{ "blob_id": "7e2bf898eb1c0118205042797e6dac535342979b", "index": 185, "step-1": "<mask token>\n\n\nclass MainApplication(tk.Frame):\n <mask token>\n\n def count_up(self):\n if self.var_count.get() == 0 and self.lst_counts.index(tk.END) == 0:\n SaveCount(tk.Toplevel(), self.save_to_listbox...
[ 6, 9, 14, 15, 16 ]
import pandas as pd df = pd.read_csv('~/Documents/data/tables.csv') mdfile = open('tables_with_refs.md', 'w') mdfile.write('# Tables with references\n') for i, row in df.iterrows(): t = '\n```\n{% raw %}\n' + str(row['table']) + '\n{% endraw %}\n```\n' r = '\n```\n{% raw %}\n' + str(row['refs']) + '\n{% endraw ...
normal
{ "blob_id": "8de6877f040a7234da73b55c8b7fdefe20bc0d6e", "index": 9538, "step-1": "<mask token>\n", "step-2": "<mask token>\nmdfile.write('# Tables with references\\n')\nfor i, row in df.iterrows():\n t = '\\n```\\n{% raw %}\\n' + str(row['table']) + '\\n{% endraw %}\\n```\\n'\n r = '\\n```\\n{% raw %}\\n...
[ 0, 1, 2, 3 ]
import time from bitfinex_trade_client import BitfinexClient,BitfinexTradeClient KEY = "nBi8YyJZZ9ZhSOf2jEpMAoBpzKt2Shh6IoLdTjFRYvb" SECRET = "XO6FUYbhFYqBflXYSaKMiu1hGHLhGf63xsOK0Pf7osA" class EMA: def __init__(self, duration): self.value = 0 self.duration = duration self.count = 0 ...
normal
{ "blob_id": "6abfd6c0a644356ae0bc75d62472b5c495118a8e", "index": 4466, "step-1": "<mask token>\n\n\nclass BitfinexMMTrader:\n <mask token>\n\n def get_fees(self):\n account_info = self.trade_client.account_info()\n return float(account_info[0]['maker_fees'])\n\n def get_pnl(self):\n ...
[ 11, 16, 20, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): """""" args1 = {'progname': 'whoami', 'command': '/usr/bin/whoami', 'procnum': 1, 'autolaunch': True, 'starttime': 5, 'restart': 'never', 'retries': 2, 'stopsig': 'SSIG', 'stoptime': 10, 'exit...
flexible
{ "blob_id": "c58f40d369388b94778e8583176f1ba8b81d0c5e", "index": 4083, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"\"\"\"\n args1 = {'progname': 'whoami', 'command': '/usr/bin/whoami', 'procnum':\n 1, 'autolaunch': True, 'starttime': 5, 'restart': 'never',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print( """My name is Jia-Chi. I have an older sister. I prefer Coke. My favorite song is "Amazing Grace\"""" ) print("""Liang, Jia-Chi 1 Coke Amazing Grace""") <|reserved_special_token_1|> #case1 print("My name is Jia-Chi. \nI have an older siste...
flexible
{ "blob_id": "55986f6c2dafe650704660142cf85640e763b26d", "index": 3291, "step-1": "<mask token>\n", "step-2": "print(\n \"\"\"My name is Jia-Chi. \nI have an older sister. \nI prefer Coke.\nMy favorite song is \"Amazing Grace\\\"\"\"\"\n )\nprint(\"\"\"Liang, Jia-Chi\n1\nCoke\nAmazing Grace\"\"\")\n", "...
[ 0, 1, 2 ]
n = int(input()) b = 0 p = [0,0] flg = True for i in range(n): t,x,y = map(int,input().split()) diff = abs(x - p[0]) + abs(y - p[1]) time = t - b if(diff > time or time%2 != diff %2): flg = False break else: b = t p[0] = x p[1] = y if flg: print("Yes") else: print("No")
normal
{ "blob_id": "8bc465a1b546907d8a9e5eee2cae672befb1ea13", "index": 7808, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n t, x, y = map(int, input().split())\n diff = abs(x - p[0]) + abs(y - p[1])\n time = t - b\n if diff > time or time % 2 != diff % 2:\n flg = False\n...
[ 0, 1, 2, 3 ]
import h5py import numpy as np #import tracking dt = h5py.special_dtype(vlen=bytes) def stringDataset(group, name, data, system=None): dset = group.create_dataset(name, (1,), dtype=dt, data=data) if system: addSystemAttribute(dset, system) return dset def addStringAttribute(dset_or_group, name, d...
normal
{ "blob_id": "d4ac5c6f08e9baa458fbe0ca7aa90c4d9372844f", "index": 408, "step-1": "<mask token>\n\n\ndef stringDataset(group, name, data, system=None):\n dset = group.create_dataset(name, (1,), dtype=dt, data=data)\n if system:\n addSystemAttribute(dset, system)\n return dset\n\n\ndef addStringAttr...
[ 4, 5, 7, 8, 9 ]
with open("out.txt", "w", encoding = "utf_8") as file: file.write("明日の天気です∖n") file.write("関西地方はおおむね晴れ.") file.write("紅葉を見るには絶好の日和でしょう∖n") file.write(“映像は嵐山の様子です.") file.write("今年も大変な数の観光客が訪れているようですね.∖n")
normal
{ "blob_id": "4fea9941defd6703be3cae034d979933262074e3", "index": 3728, "step-1": "with open(\"out.txt\", \"w\", encoding = \"utf_8\") as file:\n file.write(\"明日の天気です∖n\")\n file.write(\"関西地方はおおむね晴れ.\")\n file.write(\"紅葉を見るには絶好の日和でしょう∖n\")\n file.write(“映像は嵐山の様子です.\")\n file.write(\"今年も大変な数の観光客が訪れて...
[ 0 ]
import tkinter as tk from tkinter import ttk, messagebox, Menu ventana = tk.Tk() EntryArr = [] Label = ["¿Que es la analisis psicologico?", "¿Como se lee la mente?", "¿Cuantas persepciones psicologicas existen?", "¿Padre de la Psicologia moderna?", "Parte del cuerpo donde esta la psyco"] Arr3 = tk.IntVar() opciones1 ...
normal
{ "blob_id": "aeab80e2d0006ffa938366ef046d2ab3d387f88c", "index": 1152, "step-1": "<mask token>\n\n\ndef click():\n i = 0\n cal = 0\n info = ''\n for x in EntryArr:\n if not x.get():\n messagebox.showinfo('Error', 'Campos no llenos')\n return\n else:\n in...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def setup(): size(500, 800) rectMode(CENTER) global atStartUp atStartUp = True global startTimeMs startTimeMs = millis() global bg, go, sb bg = loadImage('assets\\background.png') bg.resize(width, height) go = loadImage('assets\\gameover.jpg') g...
flexible
{ "blob_id": "850251338e8af841a5214b37610d1b6fba572aa5", "index": 1138, "step-1": "<mask token>\n\n\ndef setup():\n size(500, 800)\n rectMode(CENTER)\n global atStartUp\n atStartUp = True\n global startTimeMs\n startTimeMs = millis()\n global bg, go, sb\n bg = loadImage('assets\\\\backgrou...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Player: def __init__(self): data = self._get_status() time.sleep(data['cooldown']) self.name = data['name'] self.cooldown = data['cooldown'] self.encumbrance = data['encumbrance'] self.strength = data['strength'] self.spee...
flexible
{ "blob_id": "edd70f55e76418911d304d6eb41a6d2a93005a58", "index": 890, "step-1": "<mask token>\n\n\nclass Player:\n\n def __init__(self):\n data = self._get_status()\n time.sleep(data['cooldown'])\n self.name = data['name']\n self.cooldown = data['cooldown']\n self.encumbranc...
[ 11, 15, 17, 19, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def make_example(): addr = './example.xlsx' work_book = Workbook() work_sheet = work_book.active work_sheet['A1'] = 'Hello World!' select_cell = work_sheet.cell(row=2, column=2, value='I select this cell') ...
flexible
{ "blob_id": "d7524a455e62594e321b67f0a32a5c3a7437c1d6", "index": 1093, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_example():\n addr = './example.xlsx'\n work_book = Workbook()\n work_sheet = work_book.active\n work_sheet['A1'] = 'Hello World!'\n select_cell = work_sheet.ce...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Config(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def get_pb(cls): """Get a pb instance f...
flexible
{ "blob_id": "4b552731fcfc661c7ad2d63c7c47f79c43a8ae5e", "index": 4839, "step-1": "<mask token>\n\n\nclass Config(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def get_pb(cls):\n \"\"\"Get a pb instance from the...
[ 4, 6, 7, 9, 10 ]
<|reserved_special_token_0|> def import_infadeveloper(**KeyWordArguments): """Import IDQ Components""" KeyWordArguments['Tool'] = 'Import' ImportCommand = buildCommand.build(**KeyWordArguments) result = executeInfacmd.execute(ImportCommand, constants.DEPLOYARTIFACT) return result def export_infa...
flexible
{ "blob_id": "09b14705a6905470058b5eecc6dd0bb214975c66", "index": 6408, "step-1": "<mask token>\n\n\ndef import_infadeveloper(**KeyWordArguments):\n \"\"\"Import IDQ Components\"\"\"\n KeyWordArguments['Tool'] = 'Import'\n ImportCommand = buildCommand.build(**KeyWordArguments)\n result = executeInfacm...
[ 10, 11, 12, 13, 14 ]
#!/usr/bin/env python class Problem1(object): def sum_below(self, threshold): current_number = 1 total = 0 while current_number < threshold: if (current_number % 3 == 0) or (current_number % 5 == 0): total += current_number current_number += 1 ...
normal
{ "blob_id": "918653cdeea8d91921f8b96779fcd3ebce491948", "index": 1217, "step-1": "#!/usr/bin/env python\nclass Problem1(object):\n def sum_below(self, threshold):\n current_number = 1\n total = 0\n while current_number < threshold:\n if (current_number % 3 == 0) or (current_num...
[ 0 ]
<|reserved_special_token_0|> def generate_model(base_model: tf.keras.Model, img_shape: Tuple[Optional[ int], Optional[int], Optional[int]], freeze: Union[bool, int, float]= False, preprocess_input: Optional[Callable]=None, use_data_augmentation: bool=True): inputs = tf.keras.layers.Input(shape=img_sha...
flexible
{ "blob_id": "86d42716e05155f9e659b22c42635a8f5b8c4a60", "index": 753, "step-1": "<mask token>\n\n\ndef generate_model(base_model: tf.keras.Model, img_shape: Tuple[Optional[\n int], Optional[int], Optional[int]], freeze: Union[bool, int, float]=\n False, preprocess_input: Optional[Callable]=None, use_data_a...
[ 1, 2, 3, 4, 5 ]
if answ[1] == 'дата': apisay(datetime.date.today(), toho, torep)
normal
{ "blob_id": "66444047f9e5eea845c8ac2dbaaf16fc2914d6ec", "index": 370, "step-1": "<mask token>\n", "step-2": "if answ[1] == 'дата':\n apisay(datetime.date.today(), toho, torep)\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# Project Overview # Implement the k-means algorithm and apply your implementation on the given dataset, # which contains a set of 2-D points. # Import Libraries import scipy.io import pandas as pd import matplotlib.pyplot as plt import random import numpy as np import time print("\nProgram Started :",tim...
normal
{ "blob_id": "b734a4405d1f5b3650d7149ae80e14548e2dbda4", "index": 4297, "step-1": "<mask token>\n\n\ndef map_cluster_data(data, K):\n clusterDataMap = {}\n for k in range(K):\n clusterDataMap[k + 1] = np.array([]).reshape(2, 0)\n for i in range(m):\n clusterDataMap[clusters[i]] = np.c_[clus...
[ 3, 5, 6, 7, 9 ]
from time import time class Task: def __init__(self, f, ready: float): self._f = f self._ready = ready def set_ready(self, ready: float) -> None: self._ready = ready def get_ready(self) -> float: return self._ready def __call__(self) -> None: self._f() de...
normal
{ "blob_id": "b094693b11fdc4f5fbff30e79a9f82d40104611d", "index": 2697, "step-1": "<mask token>\n\n\nclass Task:\n <mask token>\n\n def set_ready(self, ready: float) ->None:\n self._ready = ready\n <mask token>\n\n def __call__(self) ->None:\n self._f()\n <mask token>\n\n def __str...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(enum_users) <|reserved_special_token_0|> print(triplets) <|reserved_special_token_1|> <|reserved_special_token_0|> file_path = sys.argv[1] triplets = np.loadtxt(os.path.join(file_path, 'kaggle_visible_evaluation_tripl...
flexible
{ "blob_id": "f3d9e783491916e684cda659afa73ce5a6a5894a", "index": 4063, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(enum_users)\n<mask token>\nprint(triplets)\n", "step-3": "<mask token>\nfile_path = sys.argv[1]\ntriplets = np.loadtxt(os.path.join(file_path,\n 'kaggle_visible_evaluation_trip...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if s in sheik: print('Vowel') elif s != sheik: print('Consonant') else: print('invalid') <|reserved_special_token_1|> sheik = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] s = raw_input() if s in sheik: pri...
flexible
{ "blob_id": "0fb8a9b1073446a62b46a802da69b66e78533c2a", "index": 7293, "step-1": "<mask token>\n", "step-2": "<mask token>\nif s in sheik:\n print('Vowel')\nelif s != sheik:\n print('Consonant')\nelse:\n print('invalid')\n", "step-3": "sheik = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\ns = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BaseDQNTrainer(BaseTrainer): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def update_model(self, batch): batch_s = np.array([i[0] for i in batch]) batch_a = np.array([i[1] for i in batch]) batch_r = n...
flexible
{ "blob_id": "8bf0141cee2832134d61e49652330c7d21583dcd", "index": 5201, "step-1": "<mask token>\n\n\nclass BaseDQNTrainer(BaseTrainer):\n <mask token>\n <mask token>\n <mask token>\n\n def update_model(self, batch):\n batch_s = np.array([i[0] for i in batch])\n batch_a = np.array([i[1] f...
[ 3, 4, 6, 7 ]
<|reserved_special_token_0|> def leialetra(): """ =>Função para validar letras. parm=msg: Recebe dados to tipo string sendo Ss ou Nn. return: String de valor S. """ while True: try: msg = str(input('Deseja fazer uma pergunta? [s/n] ')).upper()[0] except ...
flexible
{ "blob_id": "1fff681363c4c91c47c2818681a3f2f125dd8c83", "index": 2022, "step-1": "<mask token>\n\n\ndef leialetra():\n \"\"\"\n =>Função para validar letras.\n parm=msg: Recebe dados to tipo string sendo Ss ou Nn.\n return: String de valor S.\n \"\"\"\n while True:\n try:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> @_f @_p.types(None, _cs.GLuint, _cs.GLsizei, arrays.GLfloatArray) def glDepthRangeArrayfvNV(first, count, v): pass @_f @_p.types(None, _cs.GLuint, _cs.GLfloat, _cs.GLfloat) def glDepthRangeIndexedfNV(index, n, f): pass @_f @_p.types(None, _cs.GLenum, _cs.GLuint) def glDisablei...
flexible
{ "blob_id": "9535973f9714926269490b8550a67c74d04d8f0a", "index": 834, "step-1": "<mask token>\n\n\n@_f\n@_p.types(None, _cs.GLuint, _cs.GLsizei, arrays.GLfloatArray)\ndef glDepthRangeArrayfvNV(first, count, v):\n pass\n\n\n@_f\n@_p.types(None, _cs.GLuint, _cs.GLfloat, _cs.GLfloat)\ndef glDepthRangeIndexedfNV(...
[ 11, 12, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def summation(numbers): positive_numbers = [] normalized_numbers = [] numbers_list = numbers.split() for idx, arg in enumerate(numbers_list): int_arg = int(arg) if int_arg < 0: new_arg = abs(int_arg) * 2 els...
flexible
{ "blob_id": "791df87235f5da634fc62ebc3a3741cea6e2deca", "index": 3841, "step-1": "<mask token>\n", "step-2": "def summation(numbers):\n positive_numbers = []\n normalized_numbers = []\n numbers_list = numbers.split()\n for idx, arg in enumerate(numbers_list):\n int_arg = int(arg)\n if...
[ 0, 1 ]
#/usr/bin/python # File: UdpClient.py # Author: David Zemon # Project: Project1 # # Created with: PyCharm Community Edition """ @description: """ __author__ = 'david' import logging from src.UDP import UDPClient logging.basicConfig(level="DEBUG") serverName = '127.0.0.1' serverPort = 12000 client = UDPClient()...
normal
{ "blob_id": "4d388c912915c3f1f9e433f1342289f0864b3a11", "index": 409, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level='DEBUG')\n<mask token>\nclient.sendto(message.encode('utf-8'), (serverName, serverPort))\n<mask token>\nprint(modifiedMessage.decode('utf-8'))\nclient.close()\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class HomelyTests(TestCase): <|reserved_special_token_0|> def setUp(self): """Get Flask test client.""" self.client = app.test_client() app.config['TESTING'] = True def test_properties_index(self): """Test the properties homepage.""" r...
flexible
{ "blob_id": "cef6b5ef2082dc5910806550d9a9c96357752baf", "index": 3541, "step-1": "<mask token>\n\n\nclass HomelyTests(TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Get Flask test client.\"\"\"\n self.client = app.test_client()\n app.config['TESTING'] = True\n\n def test_pro...
[ 7, 10, 11, 14, 15 ]
# Copyright 2015 Google Inc. All Rights Reserved. # # 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 a...
normal
{ "blob_id": "b4ce95d754dd0d7c1b91fa0348de0194a4397aca", "index": 6830, "step-1": "<mask token>\n\n\nclass NodeLookup(object):\n \"\"\"Converts integer node ID's to human readable labels.\"\"\"\n\n def __init__(self, label_lookup_path=None, uid_lookup_path=None):\n if not label_lookup_path:\n ...
[ 6, 7, 11, 13, 14 ]
#Coded by J. Prabhath #14th April, 2020 #Released under GNU GPL import numpy as np import matplotlib.pyplot as plt from scipy import signal K = 96 Kp = 1 Td = 1.884 s1 = signal.lti([-1/Td],[0,-2,-4,-6], K) s2 = signal.lti([],[0,-2,-4,-6], K) w,mag1,phase1 = signal.bode(s1) _,mag2,phase2 = signal.bode(s2) plt.xlabel...
normal
{ "blob_id": "84e84d9f35702c2572ad5e7daa92a271674986dc", "index": 3882, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.xlabel('Freq (in rad/s)')\nplt.ylabel('Phase (in deg)')\nplt.title('Phase plot')\nplt.semilogx(w, phase1, label='With Controller')\nplt.semilogx(w, phase2, label='Without Controller')...
[ 0, 1, 2, 3, 4 ]
from tempfile import mkdtemp from shutil import rmtree from os.path import join import os MAX_UNCOMPRESSED_SIZE = 100e6 # 100MB # Extracts a zipfile into a directory safely class ModelExtractor(object): def __init__(self, modelzip): self.modelzip = modelzip def __enter__(self): if not self._...
normal
{ "blob_id": "04670041dab49f8c2d4a0415030356e7ea92925f", "index": 902, "step-1": "<mask token>\n\n\nclass ModelExtractor(object):\n\n def __init__(self, modelzip):\n self.modelzip = modelzip\n\n def __enter__(self):\n if not self.__is_model_good():\n raise ValueError('Invalid model ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ModifyImages(path, path1): imagesList = listdir(path) for image in imagesList: old_img = PImage.open(path + image) old_size = old_img.size new_size = 540, 420 new_img = PImage.new('L',...
flexible
{ "blob_id": "9cad36de6231f310ef9022f16f6ed0da83a003b3", "index": 9757, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ModifyImages(path, path1):\n imagesList = listdir(path)\n for image in imagesList:\n old_img = PImage.open(path + image)\n old_size = old_img.size\n new...
[ 0, 1, 2, 3 ]