code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#5.8-5.9 users = ['user1', 'user2', 'user3', 'user4', 'admin'] #users = [] if users: for user in users: if user == 'admin': print(f"Hello, {user}, would you like to see a status report?") else: print(f"Hello, {user}, thank you for logging in again") else: print("We need t...
normal
{ "blob_id": "c355be4e05d1df7f5d6f2e32bbb5a8086babe95b", "index": 7946, "step-1": "<mask token>\n", "step-2": "<mask token>\nif users:\n for user in users:\n if user == 'admin':\n print(f'Hello, {user}, would you like to see a status report?')\n else:\n print(f'Hello, {use...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def construct_param_dict(params, K_RC, K_CP, m_P): """ Construct all the parameters from its relationships with body size and temperature, using the normalizing constants and scaling exponent w """ w = params['w'] pd = params['pd'] pv = params['pv'] Er = params...
flexible
{ "blob_id": "99c12e925850fe7603831df5b159db30508f4515", "index": 3832, "step-1": "<mask token>\n\n\ndef construct_param_dict(params, K_RC, K_CP, m_P):\n \"\"\"\n Construct all the parameters from its relationships with body size and temperature, using the normalizing constants and scaling exponent w\n \...
[ 5, 8, 9, 10, 11 ]
import sys import os PROJ_DIR = os.path.dirname(os.path.dirname(__file__)) sys.path.append(PROJ_DIR)
normal
{ "blob_id": "54276074d84e63e6418f8738bb7f910424f1c94d", "index": 9469, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(PROJ_DIR)\n", "step-3": "<mask token>\nPROJ_DIR = os.path.dirname(os.path.dirname(__file__))\nsys.path.append(PROJ_DIR)\n", "step-4": "import sys\nimport os\nPROJ_DIR ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def _create_event_statement(event_name): """Return a SQL statement to create a Event vertex.""" field_name_to_value = {'name': event_name, 'event_date': get_random_date(), 'uuid': get_uuid()} return create_vertex_statement('Event', field_name_to_value) <|reserved_spe...
flexible
{ "blob_id": "a521befba58aa85c2fcfe6006db4b161123585f1", "index": 5341, "step-1": "<mask token>\n\n\ndef _create_event_statement(event_name):\n \"\"\"Return a SQL statement to create a Event vertex.\"\"\"\n field_name_to_value = {'name': event_name, 'event_date':\n get_random_date(), 'uuid': get_uuid...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def create_app(): app = Flask(__name__) Bootstrap(app) return app <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_app(): app = Flask(__name__) Bootstrap(app) return app logging.basicConfig(level=logging.DEB...
flexible
{ "blob_id": "bd726c86bdecd0b63eb48d056932706d3ecf147d", "index": 7665, "step-1": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n Bootstrap(app)\n return app\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n Bootstrap(app)\n return ap...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> helpMessage = ( """ **Vocal / Musique** `{0}join` Va rejoindre le salon vocale dans laquelle vous êtes. `{0}leave` Va partir du salon vocale dans laquelle vous êtes. `{0}play [YouTube Url]` *ou* `{0}play [musique ou video à...
flexible
{ "blob_id": "f7283750923e1e430ff1f648878bbb9a0c73d2c4", "index": 7880, "step-1": "<mask token>\n", "step-2": "<mask token>\nhelpMessage = (\n \"\"\"\n**Vocal / Musique**\n\n`{0}join`\nVa rejoindre le salon vocale dans laquelle vous êtes.\n\n`{0}leave`\nVa partir du salon vocale dans laquelle vous êtes.\n\n`...
[ 0, 1, 2, 3 ]
from pwn import * hostname = "pwnable.kr" portnum = 2222 username = "input2" passwd = "guest" def main(): args = ["./input"] print("./input", end="") for x in range(99): print(" AA", end="") args.append("AA") print(args) ''' s = ssh(host=hostname, port=portnum, ...
normal
{ "blob_id": "9184779731d6102498934d77b6d3c0283fc594d9", "index": 7498, "step-1": "<mask token>\n\n\ndef main():\n args = ['./input']\n print('./input', end='')\n for x in range(99):\n print(' AA', end='')\n args.append('AA')\n print(args)\n\n\n<mask token>\n", "step-2": "<mask token>\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class SpecificationsEventHandler(FileSystemEventHandler): <|reserved_special_token_0|> def __init__(self): self.paused = False self.banner = ( '============================================================') def on_modified(self, event): su...
flexible
{ "blob_id": "95ea8a21d3ac44c7760179bc4ebf67f0c16e6a19", "index": 2421, "step-1": "<mask token>\n\n\nclass SpecificationsEventHandler(FileSystemEventHandler):\n <mask token>\n\n def __init__(self):\n self.paused = False\n self.banner = (\n '==========================================...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): batch_size = 64 valid_batch_size = 8 dataset_size = 500 learning_rate = 0.001 weight_decay = 0.0001 epochs = 30 show_frq = 20 negative_size = 10 negative_expand = 1 negative_si...
flexible
{ "blob_id": "41f2a5ba0d7a726389936c1ff66a5724209ee99c", "index": 4099, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n batch_size = 64\n valid_batch_size = 8\n dataset_size = 500\n learning_rate = 0.001\n weight_decay = 0.0001\n epochs = 30\n show_frq = 20\n negat...
[ 0, 1, 2, 3, 4 ]
def raizCubica(numero): r = pow(numero,(1/3)) return r numeros = [] raices = [] for x in range(5): numeros.insert(x, float(input("Ingrese Numero: "))) raices.insert(x, round(raizCubica(numeros[x]),3)) print("Numeros: ", numeros) print("Raices: ", raices)
normal
{ "blob_id": "180f7f0ade9770c6669680bd13ac8f2fd55cc8c7", "index": 357, "step-1": "<mask token>\n", "step-2": "def raizCubica(numero):\n r = pow(numero, 1 / 3)\n return r\n\n\n<mask token>\n", "step-3": "def raizCubica(numero):\n r = pow(numero, 1 / 3)\n return r\n\n\n<mask token>\nfor x in range(5...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @click.group() def main(): """ An empty click group, required in order to bundle the other commands. """ pass <|reserved_special_token_0|> @main.command(help= """Reads the route list between a source airport and a destination airport and write...
flexible
{ "blob_id": "234aad868ea71bbe476b303bcff37221820f1d90", "index": 4310, "step-1": "<mask token>\n\n\n@click.group()\ndef main():\n \"\"\"\n An empty click group, required in order to bundle the other commands.\n \"\"\"\n pass\n\n\n<mask token>\n\n\n@main.command(help=\n \"\"\"Reads the route list b...
[ 4, 6, 7, 8, 10 ]
import os, pygame import sys from os import path from random import choice WIDTH = 1000 HEIGHT = 800 FPS = 60 BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) GRAY80 = (204, 204, 204) GRAY = (26, 26, 26) screen = pygame.disp...
normal
{ "blob_id": "7301a521586049ebb5e8e49b604cc96e3acc1fe9", "index": 3512, "step-1": "<mask token>\n\n\ndef draw_text(surf, text, size, x, y):\n font_name = pygame.font.match_font('OCR A Extended')\n font = pygame.font.Font(font_name, size)\n text_surface = font.render(text, True, WHITE)\n text_rect = te...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('haha') <|reserved_special_token_1|> import cv2 import torch print('haha')
flexible
{ "blob_id": "00f8992173321dfa5ac5b125a2e663b159fafb23", "index": 4267, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('haha')\n", "step-3": "import cv2\nimport torch\nprint('haha')\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def largestVar(s: str): freq = {i: (0) for i in range(26)} for i in range(len(s)): freq[int(chr(i) - 'a')] += 1 max_var = 0 for a in range(26): for b in range(26): left_a = freq[a] left_b = freq[b] <|r...
flexible
{ "blob_id": "4bd2923381cd3ead9a5605363a86f41b3743bf27", "index": 7223, "step-1": "<mask token>\n", "step-2": "def largestVar(s: str):\n freq = {i: (0) for i in range(26)}\n for i in range(len(s)):\n freq[int(chr(i) - 'a')] += 1\n max_var = 0\n for a in range(26):\n for b in range(26):...
[ 0, 1, 2 ]
from wtforms import Form, StringField class SearchForm(Form): criteria = StringField("Texto a buscar")
normal
{ "blob_id": "1896f4d5b304915d5cbbb30b0a83854c4a8cc60c", "index": 7566, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SearchForm(Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SearchForm(Form):\n criteria = StringField('Texto a buscar')\n", "step-4": "from wtforms import...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestDefaultApi(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def tearDown(self): pass <|reserved_special_token_0|> def test_meme_meme_id_delete(self): """Test case for meme_meme_id_delete Delete meme by I...
flexible
{ "blob_id": "fca46c095972e8190ee9c93f3bddbb2a49363a7f", "index": 6903, "step-1": "<mask token>\n\n\nclass TestDefaultApi(unittest.TestCase):\n <mask token>\n <mask token>\n\n def tearDown(self):\n pass\n <mask token>\n\n def test_meme_meme_id_delete(self):\n \"\"\"Test case for meme_...
[ 5, 8, 9, 10, 11 ]
import torch import torch.multiprocessing as mp import random class QManeger(object): def __init__(self, opt, q_trace, q_batch): self.traces_s = [] self.traces_a = [] self.traces_r = [] self.lock = mp.Lock() self.q_trace = q_trace self.q_batch = q_batch sel...
normal
{ "blob_id": "b693cc63e2ee4c994ef7b5e44faea99f15a021f6", "index": 68, "step-1": "<mask token>\n\n\nclass QManeger(object):\n <mask token>\n <mask token>\n\n def listening(self):\n while True:\n traces = self.q_trace.get(block=True)\n for s, a, r in zip(traces[0], traces[1], t...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class BruteForceAttackState(State): def run(self): os_val = np.random.choice(['Windows7', 'Windows10', 'Ubuntu16', 'MacOS10']) addr_val = np.random.choice(['127.0.0.6', '127.0.0.7', '127.0.0.13', '127.0.0.42']) for i in range(self.itera...
flexible
{ "blob_id": "cf3b4e2c76091f95d24e8a987a63ece46503d6e8", "index": 3459, "step-1": "<mask token>\n\n\nclass BruteForceAttackState(State):\n\n def run(self):\n os_val = np.random.choice(['Windows7', 'Windows10', 'Ubuntu16',\n 'MacOS10'])\n addr_val = np.random.choice(['127.0.0.6', '127.0...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MarketingemailsConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MarketingemailsConfig(AppConfig): name = 'marketingemails' <|reserved_special_to...
flexible
{ "blob_id": "19bb58ab440ca00bf6410a70a8b6bbc24eec96c1", "index": 492, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n name = 'marketingemails'\n", "step-4": "from...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def layer_forward(x, w): """ input: - inputs (x): (N, d_1, ..., d_k), - weights (w): (D, M) """ z = None output = [] cache = x, w, z, output return output, cache <|reserved_special_token_0|> def affine_backward(d_output, cache): ...
flexible
{ "blob_id": "c1fd6e940b3b15ae01a102b3c0aba9bd327c77b2", "index": 8403, "step-1": "<mask token>\n\n\ndef layer_forward(x, w):\n \"\"\"\n input:\n - inputs (x): (N, d_1, ..., d_k),\n - weights (w): (D, M)\n \"\"\"\n z = None\n output = []\n cache = x, w, z, output\n r...
[ 4, 5, 6, 7, 8 ]
import numpy as np #1 def longest_substring(string1,string2): mat=np.zeros(shape=(len(string1),len(string2))) for x in range(len(string1)): for y in range(len(string2)): if x==0 or y==0: if string1[x]==string2[y]: mat[x,y]=1 else: ...
normal
{ "blob_id": "6bb7dafea73aff7aca9b0ddc1393e4db6fcf0151", "index": 4828, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef longest_substring(string1, string2):\n mat = np.zeros(shape=(len(string1), len(string2)))\n for x in range(len(string1)):\n for y in range(len(string2)):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SwarmModel: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class NeighbourhoodModel: _particles = [] _bestPosition = None _bestPositionFitness = -1 ...
flexible
{ "blob_id": "5c06229f8e80a7225620f25941cc5276a9021e53", "index": 5353, "step-1": "<mask token>\n\n\nclass SwarmModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass NeighbourhoodModel:\n _particles = []\n _bestPosition = None\n _bestPositionFitness =...
[ 10, 11, 12, 15, 16 ]
""" module : watcher.py description : Script to automatically watch a directory (via watchdog) for tests and run them via py.test """ import sys import os.path import subprocess import time from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler class SpecificationsEventHandler(Fil...
normal
{ "blob_id": "95ea8a21d3ac44c7760179bc4ebf67f0c16e6a19", "index": 2421, "step-1": "<mask token>\n\n\nclass SpecificationsEventHandler(FileSystemEventHandler):\n <mask token>\n\n def __init__(self):\n self.paused = False\n self.banner = (\n '==========================================...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def trans_screen(): pyautogui.doubleClick(492, 974) pyautogui.typewrite(['enter'], 0.01) def trans_chinese(): for c_rubbish in chinese_rubbish: pin = p.get_pinyin(c_rubbish, '') pin_list = list(pin) pin_list.append('1') rubbish_set.append(pin_...
flexible
{ "blob_id": "23e673909b2f1eb9a265ce84ad63464e20e99c6a", "index": 3449, "step-1": "<mask token>\n\n\ndef trans_screen():\n pyautogui.doubleClick(492, 974)\n pyautogui.typewrite(['enter'], 0.01)\n\n\ndef trans_chinese():\n for c_rubbish in chinese_rubbish:\n pin = p.get_pinyin(c_rubbish, '')\n ...
[ 4, 5, 6, 7, 8 ]
def selectionSort(arr, low, high): for i in range(len(arr)): mini = i for j in range(i + 1, len(arr)): if arr[mini] > arr[j]: mini = j arr[i], arr[mini] = arr[mini], arr[i] return arr
normal
{ "blob_id": "c91be6cc332139c5b1e7ee5a3512482d0f8620b1", "index": 7322, "step-1": "<mask token>\n", "step-2": "def selectionSort(arr, low, high):\n for i in range(len(arr)):\n mini = i\n for j in range(i + 1, len(arr)):\n if arr[mini] > arr[j]:\n mini = j\n arr[...
[ 0, 1 ]
#!/usr/bin/env python3 # # main.py - By Steven Chen Hao Nyeo # Graphical interface for Socionics Engine # Created: August 8, 2019 import wx from cognitive_function import * from entity import Entity from function_to_type import Translator from function_analysis import * class TypeFrame(wx.Frame): def __init__(s...
normal
{ "blob_id": "519dbe97ce9de30e616d660ef168e686c52b01b5", "index": 5452, "step-1": "<mask token>\n\n\nclass TypeFrame(wx.Frame):\n <mask token>\n\n def createCogButtons(self, row):\n cogButtons = self.domButtons if row == 0 else self.auxButtons\n labels = ['N', 'S', 'T', 'F']\n for i in ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('-p', type=str, default='default', help= 'name of a a policy file') parser.add_argument('-n', type=int, default=100000, help='number of patients') <|reserved_special_token_0|> if len(matchingPolicies) == 0:...
flexible
{ "blob_id": "894ce07c6443208483be2d3ef1409f12f24d99f3", "index": 2852, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-p', type=str, default='default', help=\n 'name of a a policy file')\nparser.add_argument('-n', type=int, default=100000, help='number of patients')\n<mask token>\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calcula_elongacao(A, φ, ω, t): x = A * m.cos(φ + φ * t) return x <|reserved_special_token_1|> import math as m def calcula_elongacao(A, φ, ω, t): x = A * m.cos(φ + φ * t) return x <|reserved_special_to...
flexible
{ "blob_id": "225687729b64f455bcc841e83105c7444efdfad3", "index": 5545, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef calcula_elongacao(A, φ, ω, t):\n x = A * m.cos(φ + φ * t)\n return x\n", "step-3": "import math as m\n\n\ndef calcula_elongacao(A, φ, ω, t):\n x = A * m.cos(φ + φ * t)\...
[ 0, 1, 2, 3 ]
import renderdoc as rd from typing import List import rdtest class D3D12_Resource_Mapping_Zoo(rdtest.TestCase): demos_test_name = 'D3D12_Resource_Mapping_Zoo' def test_debug_pixel(self, x, y, test_name): pipe: rd.PipeState = self.controller.GetPipelineState() if not pipe.GetShaderReflection(...
normal
{ "blob_id": "565888d771f53934805555390e48d4886a43bdb6", "index": 189, "step-1": "<mask token>\n\n\nclass D3D12_Resource_Mapping_Zoo(rdtest.TestCase):\n <mask token>\n <mask token>\n\n def check_capture(self):\n if not self.controller.GetAPIProperties().shaderDebugging:\n rdtest.log.suc...
[ 2, 3, 4, 5, 6 ]
__author__ = 'christopher' import fabio import pyFAI import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from pims.tiff_stack import TiffStack_tifffile as TiffStack from skxray.io.save_powder_output import save_output from xpd_workflow.mask_tools import * geo = pyFAI.load( '/mnt/bulk-data/researc...
normal
{ "blob_id": "50f6bcb4d2223d864cca92778ab3483a2d2c3214", "index": 5283, "step-1": "__author__ = 'christopher'\nimport fabio\nimport pyFAI\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\nfrom pims.tiff_stack import TiffStack_tifffile as TiffStack\nfrom skxray.io.save_powder_output import s...
[ 0 ]
import logging import os import callbacks import commands import dice import echo import inline import keyboards import mybot import myenigma import poll import rocketgram import send import unknown # avoid to remove "unused" imports by optimizers def fix_imports(): _ = callbacks _ = commands _ = echo ...
normal
{ "blob_id": "fd904c70b350c650362c55ccb3b915371f24e267", "index": 9623, "step-1": "import logging\nimport os\n\nimport callbacks\nimport commands\nimport dice\nimport echo\nimport inline\nimport keyboards\nimport mybot\nimport myenigma\nimport poll\nimport rocketgram\nimport send\nimport unknown\n\n\n# avoid to ...
[ 0 ]
<|reserved_special_token_0|> def calculate_data_list(): counter = 0 btc = 'BTC' symbols = [] all_positions = [] positions_final = [] volume = [] c = [] price_change = [] data = client.get_ticker() for x in range(len(data)): if btc in data[x]['symbol'] and data[x]['symbo...
flexible
{ "blob_id": "dcc85b143f2394b7839f2fb9c2079a7dd9fa8e88", "index": 4733, "step-1": "<mask token>\n\n\ndef calculate_data_list():\n counter = 0\n btc = 'BTC'\n symbols = []\n all_positions = []\n positions_final = []\n volume = []\n c = []\n price_change = []\n data = client.get_ticker()\...
[ 5, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class TestFunctionalHumannEndtoEndBiom(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_humann_gene_families_biom_input(self): """ Test the standard humann flow on a gene families output fi...
flexible
{ "blob_id": "27702f72ae147c435617acaab7dd7e5a5a737b13", "index": 8152, "step-1": "<mask token>\n\n\nclass TestFunctionalHumannEndtoEndBiom(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_humann_gene_families_biom_input(self):\n \"\"\"\n Test the standard hu...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "21c8078a18ee4579fa9b4b1b667d6ea0c1ce99b3", "index": 6005, "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 = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in lines: strpline = line.rstrip() arr = strpline.split(',') newline = [] for i in range(len(arr)): if arr[i] == 'y': newline.append(i) if arr[0] == 'republican': newline.ap...
flexible
{ "blob_id": "07b05093b630fc0167532884ec69a00420ed70b4", "index": 4021, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in lines:\n strpline = line.rstrip()\n arr = strpline.split(',')\n newline = []\n for i in range(len(arr)):\n if arr[i] == 'y':\n newline.append(i)\...
[ 0, 1, 2, 3, 4 ]
#-*- coding: utf-8 -*- import argparse import pickle def str2bool(v): return v.lower() in ('true', '1') arg_lists = [] parser = argparse.ArgumentParser() def add_argument_group(name): arg = parser.add_argument_group(name) arg_lists.append(arg) return arg # Network net_arg = add_argument_group('Network') n...
normal
{ "blob_id": "dfaea1687238d3d09fee072689cfdea392bc78f9", "index": 8967, "step-1": "<mask token>\n\n\ndef str2bool(v):\n return v.lower() in ('true', '1')\n\n\n<mask token>\n\n\ndef add_argument_group(name):\n arg = parser.add_argument_group(name)\n arg_lists.append(arg)\n return arg\n\n\n<mask token>\...
[ 2, 3, 5, 6, 7 ]
#!ipython3 pi_f = 0.1415926 pi = [] for i in range(10): pi.append(str(pi_f * i*16)[0]) print(pi) def convertBase(digits, baseA, baseB, precisionB): return output #0.56 b8 to b10 #(1/base) ^ (i+1) *x to10('56') test = list(str(56)) test 27 9 3 33 0.3212 * 3 4*1.5 0.3212* 4/6 3*3**-1 2*3**-2 1*3**...
normal
{ "blob_id": "cffc64970cb82072e5fb949f62e9778942b2be96", "index": 8269, "step-1": "#!ipython3\n\npi_f = 0.1415926\npi = []\nfor i in range(10):\n pi.append(str(pi_f * i*16)[0])\n\nprint(pi)\n\n\ndef convertBase(digits, baseA, baseB, precisionB):\n return output\n\n#0.56 b8 to b10\n#(1/base) ^ (i+1) *x\n\n\n...
[ 0 ]
<|reserved_special_token_0|> class ToolBusiness(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ToolBusiness(object): @classmethod def get_tool_ip(cls): ip = request.args.get('ip') url = 'http://ap...
flexible
{ "blob_id": "bf45349a9fdfcef7392c477e089c5e3916cb4c8e", "index": 8502, "step-1": "<mask token>\n\n\nclass ToolBusiness(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ToolBusiness(object):\n\n @classmethod\n def get_tool_ip(cls):\n ip = request.args.get('ip')\n ...
[ 1, 2, 3, 4, 5 ]
vocales = "aeiou" resultado = [] frase = input("Por favor ingrese la frase que desea verificar").lower() print(frase) for vocal in vocales: conteo_vocales = frase.count(vocal) mensaje = (f"En la frase hay {conteo_vocales} veces, la vocal{vocal}") resultado.append(mensaje) for elemento in resultado: p...
normal
{ "blob_id": "f0a03f9a6dc78d01455913f7db3ab1948b19ea63", "index": 6250, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(frase)\nfor vocal in vocales:\n conteo_vocales = frase.count(vocal)\n mensaje = f'En la frase hay {conteo_vocales} veces, la vocal{vocal}'\n resultado.append(mensaje)\nfor ...
[ 0, 1, 2, 3 ]
from __future__ import annotations from functools import cache class Solution: def countArrangement(self, n: int) -> int: cache = {} def helper(perm): digits = len(perm) if digits == 1: return 1 if perm in cache: return cache[per...
normal
{ "blob_id": "e6acc7b022001d8419095ad6364a6ae9504ec7aa", "index": 508, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\nclass Solution:\n\n def countArrangement(self, n: int) ->int:\n\n @cache\n def dfs(bm, i):\n if i == 0:\n return 1\n cnt ...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m'): a = random.randint(1, maxHeight) b = random.randint(1, maxRadius) slopingHeight = math.sqrt(a ** 2 + b ** 2) problem = ( f'Surface area of cone w...
flexible
{ "blob_id": "3e19ede2112a109a776b607e927e2f0a095ba5cc", "index": 7677, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m'):\n a = random.randint(1, maxHeight)\n b = random.randint(1, maxRadius)\n slopingHeight = math.sqrt(a ** 2 + b ** 2)\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UploadFileForm(forms.ModelForm): class Meta: model = Submit fields = ['email', 'student_no', 'file'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class...
flexible
{ "blob_id": "dabc38db6a5c4d97e18be2edc9d4c6203e264741", "index": 3849, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UploadFileForm(forms.ModelForm):\n\n\n class Meta:\n model = Submit\n fields = ['email', 'student_no', 'file']\n\n\n<mask token>\n", "step-3": "<mask token>\n...
[ 0, 1, 2, 3, 4 ]
import unittest from traceback import print_tb from ml_base.utilities.model_manager import ModelManager from tests.mocks import MLModelMock class ModelManagerTests(unittest.TestCase): def test_model_manager_will_return_same_instance_when_instantiated_many_times(self): """Testing that the ModelManager wi...
normal
{ "blob_id": "8355faf7c0d3742be34a56ddc982cb389c80d0a9", "index": 1063, "step-1": "<mask token>\n\n\nclass ModelManagerTests(unittest.TestCase):\n\n def test_model_manager_will_return_same_instance_when_instantiated_many_times(\n self):\n \"\"\"Testing that the ModelManager will return the same i...
[ 9, 13, 14, 15, 16 ]
n=int(input("please enter the number : ")) for i in range(11): print(n," X ",i," = ",n*i)
normal
{ "blob_id": "ea4a55ed17c5cc2c6f127112af636ca885159c86", "index": 5768, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(11):\n print(n, ' X ', i, ' = ', n * i)\n", "step-3": "n = int(input('please enter the number : '))\nfor i in range(11):\n print(n, ' X ', i, ' = ', n * i)\n", "...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def busca_dfs(nodo_inicial, custo_maximo_atual): objetivo = '12345678_' custo_maximo_absoluto = 100 explorados = set() fronteira = deque() fronteira.append(nodo_inicial) if custo_maximo_atual > custo_maximo_absoluto: return -1 while True: if not...
flexible
{ "blob_id": "a85a7ad6ffb2b9aa5f5326d11c75ddbee680fac4", "index": 673, "step-1": "<mask token>\n\n\ndef busca_dfs(nodo_inicial, custo_maximo_atual):\n objetivo = '12345678_'\n custo_maximo_absoluto = 100\n explorados = set()\n fronteira = deque()\n fronteira.append(nodo_inicial)\n if custo_maxim...
[ 2, 3, 4, 5, 6 ]
#Program to create and store Employee Salary Records in a file import os def appendEmployee(eno,name,basic): fh=open("Employee.txt","a") hra=basic*0.10 da=basic*0.73 gross=basic+hra+da tax=gross*0.3 net=gross-tax line=str(eno)+","+name+","+str(basic)+","+str(hra)+","+str(da)+","+str(gross)+","+str(tax)+","+str...
normal
{ "blob_id": "5b6241907cc97f82d6c6e0a461f4f71a9a567204", "index": 5395, "step-1": "<mask token>\n\n\ndef displayEmployees():\n fh = open('Employee.txt', 'r')\n for line in fh:\n emp = line.split(',')\n print('\\nEmployee No:', emp[0], '\\nEmployee Name:', emp[1],\n '\\nBasic:', emp[...
[ 3, 5, 6, 7, 8 ]
from nltk.tokenize import sent_tokenize, word_tokenize from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.classify import NaiveBayesClassifier from nltk.probability import FreqDist import csv f = open('trolls.csv', 'r') file = csv.reader(f) sentences=[] remarks=[] psObject = PorterStemmer(...
normal
{ "blob_id": "0dbdd7f7adffed850f126a2054c764b421c6ab84", "index": 6799, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor kk in file:\n paragraph += kk[0]\nf.close()\n<mask token>\nprint('most commons below...')\nprint(most_common_words)\n<mask token>\nfor i, j in most_common_words:\n most_cm_1.app...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Thu Apr 4 12:47:30 2019 Title: MP4-Medical Image Processing @author: MP4 Team """ # Validate window controller class ValidateWindowCtr(object): # Initialization def __init__(self, fig, im_trans, im_truth, im_segmen, vol_trans, vol_truth, vol_segmen, ax_trans,...
normal
{ "blob_id": "e0b28fdcbc3160bcccbb032949317a91a32eeb1b", "index": 5394, "step-1": "<mask token>\n\n\nclass ValidateWindowCtr(object):\n\n def __init__(self, fig, im_trans, im_truth, im_segmen, vol_trans,\n vol_truth, vol_segmen, ax_trans, ax_truth, ax_segmen, index_trans,\n index_truth, index_seg...
[ 4, 5, 6, 7, 8 ]
<|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|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ...
flexible
{ "blob_id": "118380f58cd173d2de5572a1591766e38ca4a7f8", "index": 8846, "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", "step-2": "<mask token>\n\n\nclass Config(object):\n SQLALCHEMY_DATABASE_U...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def song_inference(): sp_total_model_path = 'sp_total' train = pd.read_json('./dataset/train.json', typ='frame', encoding='utf-8') song = pd.read_json('./dataset/song_meta.json', typ='frame', encoding= 'utf-8...
flexible
{ "blob_id": "05573b4ff68ca8638f8e13946b410df2a012840a", "index": 1829, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef song_inference():\n sp_total_model_path = 'sp_total'\n train = pd.read_json('./dataset/train.json', typ='frame', encoding='utf-8')\n song = pd.read_json('./dataset/song_m...
[ 0, 1, 2, 3, 4 ]
import requests as r import re class web_scrap: seed="" result="" tag_attr=[] def __init__(self,seed): self.seed=seed self.set_tag() self.set_attr() self.fetch_web(self.seed) self.crawl() def fetch_web(self,link): ...
normal
{ "blob_id": "f26dc3139413c4ed4b04484c095a433e53039cdb", "index": 3028, "step-1": "<mask token>\n\n\nclass web_scrap:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, seed):\n self.seed = seed\n self.set_tag()\n self.set_attr()\n self.fetch_web(self.seed)...
[ 8, 10, 11, 12, 13 ]
n = int(input("Please input the number of 1's and 0's you want to print:")) for i in range (1, n+1): if i%2 == 1: print ("1 ", end = "") else: print ("0 ", end = "")
normal
{ "blob_id": "bd96b31c5de2f0ad4bbc28c876b86ec238db3184", "index": 9108, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n if i % 2 == 1:\n print('1 ', end='')\n else:\n print('0 ', end='')\n", "step-3": "n = int(input(\"Please input the number of 1's and 0's ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_logger(): return current_app.logger <|reserved_special_token_0|> def info(msg, *args, **kwargs): get_logger().info(msg, *args, **kwargs) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "355e2799e89dfea4f775480ea7d829a075f92473", "index": 4241, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_logger():\n return current_app.logger\n\n\n<mask token>\n\n\ndef info(msg, *args, **kwargs):\n get_logger().info(msg, *args, **kwargs)\n\n\n<mask token>\n", "step-3": ...
[ 0, 2, 3, 4, 6 ]
# -*- coding: utf-8 -*- """ Created on Mon Jan 25 12:07:32 2021 @author: yashv """ import numpy as np X= [0.7, 1.5] Y= [3.9,0.2] def f(w,b,x): #sigmoid logistic function return 1.0/(1.0 + np.exp(-(w*x +b))) def error(w,b): #loss function err=0.0 for x,y in zip(X,Y): fx= f(w,b,...
normal
{ "blob_id": "2387856757ad1c3ff911cf2a7537ca6df7786997", "index": 9244, "step-1": "<mask token>\n\n\ndef f(w, b, x):\n return 1.0 / (1.0 + np.exp(-(w * x + b)))\n\n\ndef error(w, b):\n err = 0.0\n for x, y in zip(X, Y):\n fx = f(w, b, x)\n err += 0.5 * (fx - y) ** 2\n return err\n\n\ndef...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def standard_env() ->Env: """An environment with some scheme standard procedures""" env = Env() env.update(vars(math)) env.update({'+': op.add, '-': op.sub, '*': op.mul, '/': op.truediv, '>': op.gt, '>': op.lt, '>=': op.ge, '<=': op.le, '=': op.eq, 'abs': abs, ...
flexible
{ "blob_id": "88862d6bee5d83dd5f1c656a06a9dc46a5254b10", "index": 3608, "step-1": "<mask token>\n\n\ndef standard_env() ->Env:\n \"\"\"An environment with some scheme standard procedures\"\"\"\n env = Env()\n env.update(vars(math))\n env.update({'+': op.add, '-': op.sub, '*': op.mul, '/': op.truediv, ...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Coin(object): def __init__(self): self.sideup = 'Heads' def toss(self): if random.randint(0, 1) == 0: self.sideup = 'Heads' else: self.sideup = 'Tails' def get_sideup(self): return self.sideup <|reserved_specia...
flexible
{ "blob_id": "eb246beb05249f5dfde019b773698ba3bb1b1118", "index": 544, "step-1": "<mask token>\n\n\nclass Coin(object):\n\n def __init__(self):\n self.sideup = 'Heads'\n\n def toss(self):\n if random.randint(0, 1) == 0:\n self.sideup = 'Heads'\n else:\n self.sideup...
[ 4, 5, 6, 7, 8 ]
import datetime if __name__ == "__main__" : keys = {'a','e','i', 'o', 'u', 'y'} values = [1] dictionnaire = {cle : list(values) for cle in keys} print("dictionnaire : ", dictionnaire) values.append(2) #for cle in keys : dictionnaire.update({cle:values}) #dictionnaire.update({cle2 ...
normal
{ "blob_id": "468c070aebff3124927c5595d68bb94321dd75e5", "index": 4406, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n keys = {'a', 'e', 'i', 'o', 'u', 'y'}\n values = [1]\n dictionnaire = {cle: list(values) for cle in keys}\n print('dictionnaire : ', dictionnaire...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CabbageController: <|reserved_special_token_0|> def service(self): X = tf.placeholder(tf.float32, shape=[None, 4]) W = tf.Variable(tf.random_normal([4, 1]), name='weight') b = tf.Variable(tf.random_normal([1]), name='bias') saver = tf.train.S...
flexible
{ "blob_id": "90a220775efcc8ff9e83f1a1f011f424ddc3476d", "index": 4487, "step-1": "<mask token>\n\n\nclass CabbageController:\n <mask token>\n\n def service(self):\n X = tf.placeholder(tf.float32, shape=[None, 4])\n W = tf.Variable(tf.random_normal([4, 1]), name='weight')\n b = tf.Varia...
[ 2, 3, 4, 5, 6 ]
from glob import glob from PIL import Image import numpy as np from tqdm import tqdm import cv2 import os import matplotlib.pyplot as plt np.set_printoptions(precision=3, suppress=True) def get_index(path): """ get the length of index for voc2012 dataset. path: the index of train,val or test path """...
normal
{ "blob_id": "b1b478965ad939a98478b19b4a94f3250167e25a", "index": 2189, "step-1": "<mask token>\n\n\ndef show_examples(images_base, labels_base, index_list, output_path):\n results = []\n for index in tqdm(index_list):\n img = cv2.imread(os.path.join(images_base, index + '.jpg'))\n lab = np.ar...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def blackbox(name, backend, targets, params, target='target', path='/probe', labels=None): labels = {} if labels is None else labels banned_oses = ['debian'] filtered_targets = [x for x in targets if lib.get_os(x) not in banned_oses] return {'job_name': name, 'metrics_...
flexible
{ "blob_id": "f489058c922d405754ad32a737f67bc03c08772b", "index": 701, "step-1": "<mask token>\n\n\ndef blackbox(name, backend, targets, params, target='target', path='/probe',\n labels=None):\n labels = {} if labels is None else labels\n banned_oses = ['debian']\n filtered_targets = [x for x in targe...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ VorRun Runs Vorlax and plots wireframe output from Vorlax (https://github.com/GalaxyHobo/VORLAX) NOTE! Type: "%matplotlib auto" in iPython console to switch to interactive plots, or "%matplotlib inline" to switch to inline, in the console. NOTE! Reads path to Vorlax .exe in "...
normal
{ "blob_id": "9aee715e976db632f0829a06cb9e0101c90512be", "index": 2150, "step-1": "<mask token>\n", "step-2": "<mask token>\nfout.close()\n<mask token>\nif not drive:\n drive = 'C:'\n<mask token>\nos.system(runString)\n<mask token>\nfout.close()\n<mask token>\nfor index, line in enumerate(lines):\n panelD...
[ 0, 1, 2, 3, 4 ]
''' Created on Sep 23, 2016 @author: Andrew ''' from pymongo import MongoClient import re client = MongoClient() atMentions = re.compile(ur"@\w+", flags=re.I|re.U) atMidnight = re.compile(u"@midnight", flags=re.I|re.U) hashtag = re.compile(ur"#\w+", flags=re.I|re.U) features = [("usf fwa forward most", ...
normal
{ "blob_id": "eb2bb06afb9aeb46ad02cbac145ccd817131074d", "index": 1753, "step-1": "'''\r\nCreated on Sep 23, 2016\r\n\r\n@author: Andrew\r\n'''\r\nfrom pymongo import MongoClient\r\nimport re\r\n\r\nclient = MongoClient()\r\n\r\natMentions = re.compile(ur\"@\\w+\", flags=re.I|re.U)\r\natMidnight = re.compile(u\"@...
[ 0 ]
# !usr/bin/env python # -*- coding: utf-8 -*- # # Licensed under a 3-clause BSD license. # # @Author: Brian Cherinka # @Date: 2018-08-16 11:43:42 # @Last modified by: Brian Cherinka # @Last Modified time: 2018-08-16 11:58:06 from __future__ import print_function, division, absolute_import import pytest import os f...
normal
{ "blob_id": "bd00644b9cf019fe8c86d52494389b7f0f03d3c3", "index": 1276, "step-1": "<mask token>\n\n\n@contextmanager\ndef captured_templates(app):\n \"\"\" Records which templates are used \"\"\"\n recorded = []\n\n def record(app, template, context, **extra):\n recorded.append((template, context)...
[ 5, 6, 7, 8, 9 ]
class Solution: def isPalindrome(self, x: int) ->bool: num_str = str(x) i, j = 0, len(num_str) - 1 while i < j: if num_str[i] == num_str[j]: i += 1 j -= 1 continue return False return True def isPalindrome1...
flexible
{ "blob_id": "40f57ccb1e36d307b11e367a2fb2f6c97051c65b", "index": 6759, "step-1": "class Solution:\n\n def isPalindrome(self, x: int) ->bool:\n num_str = str(x)\n i, j = 0, len(num_str) - 1\n while i < j:\n if num_str[i] == num_str[j]:\n i += 1\n j ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Frame filtering ''' import numpy as np import cv2 def filter_frames(frames, method=cv2.HISTCMP_CORREL, target_size=(64, 64), threshold=0.65): """Filter noisy frames out Args: frames (list<numpy.ndarray[H, W, 3]>): video frames method (int, o...
normal
{ "blob_id": "1da93e9113089f1a2881d4094180ba524d0d4a86", "index": 8531, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef filter_frames(frames, method=cv2.HISTCMP_CORREL, target_size=(64, 64),\n threshold=0.65):\n \"\"\"Filter noisy frames out\n\n Args:\n frames (list<numpy.ndarray[H,...
[ 0, 1, 2, 3 ]
import numpy as np class LinearRegressor(): def __init__(self, alpha=0.1, epochs=1): self.alpha = alpha self.epochs = epochs self.costs = [] self.theta = None def _cost_function(self, y_pred, y, m): """ Gets the cost for the predicted values when contrasted wit...
normal
{ "blob_id": "d805a1290c107a8d768417a432e338b182b7cd6b", "index": 5524, "step-1": "<mask token>\n\n\nclass LinearRegressor:\n <mask token>\n\n def _cost_function(self, y_pred, y, m):\n \"\"\"\n Gets the cost for the predicted values when contrasted with the correct ones.\n y_pred: An (1...
[ 4, 5, 6, 8, 9 ]
# file /home/hep/ss4314/cmtuser/Gauss_v45r10p1/Gen/DecFiles/options/16303437.py generated: Wed, 25 Jan 2017 15:25:22 # # Event Type: 16303437 # # ASCII decay Descriptor: [Xi_b- -> (rho- -> pi- pi0) K- p+]cc # from Configurables import Generation Generation().EventType = 16303437 Generation().SampleGenerationTool = "Si...
normal
{ "blob_id": "7cc9d445d712d485eaebd090d2485dac0c38b3fb", "index": 5918, "step-1": "<mask token>\n", "step-2": "<mask token>\nGeneration().addTool(SignalRepeatedHadronization)\n<mask token>\nToolSvc().addTool(EvtGenDecay)\n<mask token>\n", "step-3": "<mask token>\nGeneration().EventType = 16303437\nGeneration(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def word_count(s): cache = {} ignore = '":;,.-+=/\\|[]{}()*^&' lower = s.lower() for i in lower: if i in ignore: lower = lower.replace(i, '') words = lower.split() for j in words: if j not in cache: ...
flexible
{ "blob_id": "97d84f99264afa5e7df4b5d22cf4c49b2d14ff7a", "index": 8291, "step-1": "<mask token>\n", "step-2": "def word_count(s):\n cache = {}\n ignore = '\":;,.-+=/\\\\|[]{}()*^&'\n lower = s.lower()\n for i in lower:\n if i in ignore:\n lower = lower.replace(i, '')\n words = l...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(a) print(b) <|reserved_special_token_0|> print(a) print(b) <|reserved_special_token_0|> print(USER_NAME) print(USER_NAME) <|reserved_special_token_1|> a = 1 b = a print(a) print(b) a = 2 print(a) print(b) USER_NAME = '常量'...
flexible
{ "blob_id": "1cc9a7bbe1bda06ce76fa8ec1cdc17c7b2fde73b", "index": 4051, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(USER_NAME)\nprint(USER_NAME)\n", "step-3": "a = 1\nb = a\nprint(a)\nprint(b)\na = 2\nprint(a)\nprint(b)\nUSER_N...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def colorPrint(color, str): print(color + str + '\x1b[0m') def main(): if sys.argv.__len__() < 2: print('Wrong usage, exit') return colorPrint(YELLOW, sys.argv[1]) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> d...
flexible
{ "blob_id": "a49c00dab8d445ce0b08fd31a4a41d6c8976d662", "index": 2263, "step-1": "<mask token>\n\n\ndef colorPrint(color, str):\n print(color + str + '\\x1b[0m')\n\n\ndef main():\n if sys.argv.__len__() < 2:\n print('Wrong usage, exit')\n return\n colorPrint(YELLOW, sys.argv[1])\n\n\n<mask...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def check_exsit(process_name): WMI = win32com.client.GetObject('winmgmts:') processCodeCov = WMI.ExecQuery( 'select * from Win32_Process where Name="%s"' % process_name) if len(processCodeCov) > 0: re...
flexible
{ "blob_id": "bb6d6061365fad809448d09a1c031b984423b5e0", "index": 8658, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_exsit(process_name):\n WMI = win32com.client.GetObject('winmgmts:')\n processCodeCov = WMI.ExecQuery(\n 'select * from Win32_Process where Name=\"%s\"' % proces...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class LGBModel(ModelFT, LightGBMFInt): <|reserved_special_token_0|> def __init__(self, loss='mse', early_stopping_rounds=50, num_boost_round=1000, **kwargs): if loss not in {'mse', 'binary'}: raise NotImplementedError self.params = {'objective'...
flexible
{ "blob_id": "d37187f067ddff94015e639a1759dddced817945", "index": 6205, "step-1": "<mask token>\n\n\nclass LGBModel(ModelFT, LightGBMFInt):\n <mask token>\n\n def __init__(self, loss='mse', early_stopping_rounds=50,\n num_boost_round=1000, **kwargs):\n if loss not in {'mse', 'binary'}:\n ...
[ 5, 6, 7, 8, 9 ]
""" view.py: Contains the View class. """ import random import config from graphics import * class View: """ The view class which handles the visual component of the application. """ def __init__(self, pygame, master): """ Set up and initialise the view. Does not start the display. "...
normal
{ "blob_id": "2168d10a1b4796576cc7ebb6893e0dc8b58085ca", "index": 4435, "step-1": "<mask token>\n\n\nclass View:\n <mask token>\n\n def __init__(self, pygame, master):\n \"\"\" Set up and initialise the view. Does not start the display. \"\"\"\n self._pygame = pygame\n self._master = ma...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def car(env): while True: print('The car will start parking at: ', env.now) parking_timeout = 5 yield env.timeout(parking_timeout) print('The car will start driving at: ', env.now) driving_timeout = 2 yield env.timeout(driving_timeout) ...
flexible
{ "blob_id": "892eb8d1802b01c035993232cc80c710211ab102", "index": 802, "step-1": "<mask token>\n\n\ndef car(env):\n while True:\n print('The car will start parking at: ', env.now)\n parking_timeout = 5\n yield env.timeout(parking_timeout)\n print('The car will start driving at: ', e...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(decoded_predictions) <|reserved_special_token_1|> <|reserved_special_token_0|> model = ResNet50(weights='imagenet', include_top=True) img_input = image.load_img('my_picture.jpg', target_size=(224, 224)) img_input = image....
flexible
{ "blob_id": "1af6e66c19078a9ee971f608daa93247911d8406", "index": 5881, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(decoded_predictions)\n", "step-3": "<mask token>\nmodel = ResNet50(weights='imagenet', include_top=True)\nimg_input = image.load_img('my_picture.jpg', target_size=(224, 224))\nimg...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: UTF-8 -*- # 可写函数说明 def sum(arg1, arg2): # 返回2个参数的和." total = arg1 + arg2 print "函数内 : ", total return total; # 调用sum函数 total = sum(10, 20); def nop(): pass a = nop();
normal
{ "blob_id": "9761070a75b043f6cc9e6134e09810b215ccd0c0", "index": 6430, "step-1": "#!/usr/bin/python\n# -*- coding: UTF-8 -*-\n\n# 可写函数说明\ndef sum(arg1, arg2):\n # 返回2个参数的和.\"\n total = arg1 + arg2\n print \"函数内 : \", total\n return total;\n\n\n# 调用sum函数\ntotal = sum(10, 20);\n\ndef nop():\n pass\n...
[ 0 ]
something1 x = session.query(x).filter(y).count() something2 y = session.query( models.User, models.X, ).filter( models.User.time > start_time, models.User.id == user_id, ).count() def something3(): x = session.query( models.Review, ).filter( models.Review.time < end_time, ).coun...
normal
{ "blob_id": "5b91b7025b0e574d45f95a0585128018d83c17ea", "index": 563, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef something3():\n x = session.query(models.Review).filter(models.Review.time < end_time\n ).count()\n\n\n<mask token>\n", "step-3": "something1\n<mask token>\nsomething2\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Game: def __init__(self): pygame.init() global CLOCK, SURFACE CLOCK = pygame.time.Clock() SURFACE = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) self.mouse_x = 0 self.mouse_y = 0 pygame.display.set_caption('Mines...
flexible
{ "blob_id": "030bc0c7bdbbb09f722ffe4c82866726062f5317", "index": 1962, "step-1": "<mask token>\n\n\nclass Game:\n\n def __init__(self):\n pygame.init()\n global CLOCK, SURFACE\n CLOCK = pygame.time.Clock()\n SURFACE = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))\n ...
[ 10, 16, 17, 21, 22 ]
<|reserved_special_token_0|> class SwitchingBatchSampler(Sampler): <|reserved_special_token_0|> def __iter__(self): second_size = self.data_len - self.first_size self.first_iter = iter(torch.randperm(self.first_size)) self.second_iter = iter(torch.randperm(second_size) + self.first_si...
flexible
{ "blob_id": "6b7bc40ba842ff565e7141fb1d51def99d9ab96a", "index": 1124, "step-1": "<mask token>\n\n\nclass SwitchingBatchSampler(Sampler):\n <mask token>\n\n def __iter__(self):\n second_size = self.data_len - self.first_size\n self.first_iter = iter(torch.randperm(self.first_size))\n s...
[ 2, 3, 4, 5, 6 ]
from django.urls import path from .views import MainView app_name = "bio" # app_name will help us do a reverse look-up latter. urlpatterns = [ path('get_mtx_data', MainView.as_view()), ]
normal
{ "blob_id": "e3a984294cad5830358df50fa00111017cbe226d", "index": 3678, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'bio'\nurlpatterns = [path('get_mtx_data', MainView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import MainView\napp_name = 'bio'\nurlpatterns = [pat...
[ 0, 1, 2, 3 ]
import sys class Bus: def __init__(self): self.seats=0 self.dict_seats={} self.num_passenger = 0 def conctructor(self,seats): self.seats=seats for i in range(1,self.seats+1): self.dict_seats.update({i:"Free"}) return self.dict_seats def getOn(sel...
normal
{ "blob_id": "1396509f65d194eeaefa3841e152b7078abf0032", "index": 5549, "step-1": "<mask token>\n\n\nclass Bus:\n <mask token>\n <mask token>\n <mask token>\n\n def getOn_2(self, *names):\n str_names = str(names)\n str_names.strip('')\n list_names = str_names.split(' ')\n f...
[ 3, 6, 7, 8, 9 ]
# Generated by Django 3.2.7 on 2021-10-01 08:36 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0005_alter_users_is_active'), ] operations = [ migrations.AlterModelManagers( name='users', managers=[ ],...
normal
{ "blob_id": "6670295241516664e30c7db5cd3b5e2fb6c4fb05", "index": 1985, "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 = [('app', '0005...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MyBot(BaseAgent): <|reserved_special_token_0|> def initialize_agent(self): self.boost_pad_tracker.initialize_boosts(self.get_field_info()) self.info = MyInfo(self.team, self.index) self.strat = Strategy(self.info) self.car = Car() def ge...
flexible
{ "blob_id": "1a0d4e77f09b4ce752631ae36a83ff57f96b89b1", "index": 600, "step-1": "<mask token>\n\n\nclass MyBot(BaseAgent):\n <mask token>\n\n def initialize_agent(self):\n self.boost_pad_tracker.initialize_boosts(self.get_field_info())\n self.info = MyInfo(self.team, self.index)\n self...
[ 5, 6, 7, 8, 9 ]
# Stanley H.I. Lio # hlio@hawaii.edu # All Rights Reserved. 2018 import logging, time, sys from serial import Serial from . import aanderaa_3835 from . import aanderaa_4330f from . import aanderaa_4531d from . import aanderaa_4319a logger = logging.getLogger(__name__) # works with 3835 (DO), 4330F (DO), 4531D (DO),...
normal
{ "blob_id": "c52ad4040c14471319939605c400ff4d4ad982a7", "index": 5213, "step-1": "<mask token>\n\n\ndef aanderaa_read_universal(port, max_retry=3, parsers=[aanderaa_4531d.\n parse_4531d, aanderaa_4330f.parse_4330f, aanderaa_3835.parse_3835,\n aanderaa_4319a.parse_4319a]):\n logger.debug('aanderaa_read_u...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_stock_time_series(data_df, stock_id): curr_ID_data = data_df.loc[stock_id] output = np.array(curr_ID_data[0]) for i in range(1, len(curr_ID_data.index)): output = np.vstack((output, curr_ID_data[i])) return output <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "6a7e5a78f516cecf083ca3900bdaaf427bedd497", "index": 756, "step-1": "<mask token>\n\n\ndef get_stock_time_series(data_df, stock_id):\n curr_ID_data = data_df.loc[stock_id]\n output = np.array(curr_ID_data[0])\n for i in range(1, len(curr_ID_data.index)):\n output = np.vstack((output, ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> hbar = 1.0 m_e = 1.0 h22m = hbar ** 2 / (2 * m_e) pi = np.pi eV = 1 / 27.21138505 eV_Ha = eV nm = 18.89726124565 kB_eV = 8.6173324e-05 kB = kB_eV * eV_Ha <|reserved_special_token_1|> <|reserved_special_token_0|> import numpy as...
flexible
{ "blob_id": "f9f835b24aa8fc77109db9e2d89a3f43bcb4b181", "index": 7079, "step-1": "<mask token>\n", "step-2": "<mask token>\nhbar = 1.0\nm_e = 1.0\nh22m = hbar ** 2 / (2 * m_e)\npi = np.pi\neV = 1 / 27.21138505\neV_Ha = eV\nnm = 18.89726124565\nkB_eV = 8.6173324e-05\nkB = kB_eV * eV_Ha\n", "step-3": "<mask to...
[ 0, 1, 2, 3 ]
import tkinter as tk import Widgets as wg import Logic as lgc from tkinter.ttk import Separator from tkinter.messagebox import showerror, showinfo # Fonts that we can utilise FONTS = {"large":("Helvetica", 20), "medium":("Helvetica", 16), "small":("Helvetica", 12)} class Handler: # Handles the window and...
normal
{ "blob_id": "9b8f3962172d4a867a3a070b6139bb302fd7e2f5", "index": 9934, "step-1": "<mask token>\n\n\nclass Window(tk.Tk):\n <mask token>\n <mask token>\n <mask token>\n\n def Get_Current_Player(self) ->str:\n return self.Handler.Get_Current_Player()\n <mask token>\n\n\nclass Pregame(tk.Frame...
[ 39, 40, 41, 52, 59 ]
import numpy as np class Element(object): def __init__(self): self.ndof = 0 self.nn = 0 self.ng = 0 self.element_type = 0 self.coord_position = np.array([]) self.setup() def setup(self): pass def shape_function_value(self): pass def s...
normal
{ "blob_id": "ed2ae166c4881289b27b7e74e212ba2d6164998b", "index": 2981, "step-1": "<mask token>\n\n\nclass Element(object):\n\n def __init__(self):\n self.ndof = 0\n self.nn = 0\n self.ng = 0\n self.element_type = 0\n self.coord_position = np.array([])\n self.setup()\n...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> def read_input_RS(): low = np.loadtxt('LowerArray.csv', delimiter=',', skiprows=1) lower_bound = np.ravel(low) upper_bound = np.ravel(np.transpose(np.loadtxt('UpperArray.csv', delimiter=',', skiprows=1))) return lower_bound, upper_bound, low[0, :].size <|reserved...
flexible
{ "blob_id": "4b44f4343da1677b5436ec2b153e573fda3c0cee", "index": 2280, "step-1": "<mask token>\n\n\ndef read_input_RS():\n low = np.loadtxt('LowerArray.csv', delimiter=',', skiprows=1)\n lower_bound = np.ravel(low)\n upper_bound = np.ravel(np.transpose(np.loadtxt('UpperArray.csv',\n delimiter=','...
[ 2, 3, 4, 5, 6 ]
import math import turtle wn = turtle.Screen() wn.bgcolor('lightblue') PI=3.14 R_outer=50 R_inner=200 fred = turtle.Turtle() fred.speed(99999) def cycloid(r, k, nos_cycle, direction): n=36 angle=2*PI/n x=1 y=0 for i in range(nos_cycle*n): beta = i * angle x = r*(beta-math.sin(beta)) ...
normal
{ "blob_id": "a62dd287f9fc6f79ef95a3de83f52c794efe00a7", "index": 7407, "step-1": "\nimport math\nimport turtle\n\nwn = turtle.Screen()\nwn.bgcolor('lightblue')\nPI=3.14\nR_outer=50\nR_inner=200\n\nfred = turtle.Turtle()\nfred.speed(99999)\n\ndef cycloid(r, k, nos_cycle, direction):\n n=36\n angle=2*PI/n\n ...
[ 0 ]
<|reserved_special_token_0|> def send_value(value): port = create_port() status = get_mov_parameters()[0] if port_status(port): if status == '1' or status == 'True': string = ''.join([str(value), ' \n']) port.write(string.encode()) print('True') else: ...
flexible
{ "blob_id": "72cda573bf9c744213a2957d51171f437f211353", "index": 3467, "step-1": "<mask token>\n\n\ndef send_value(value):\n port = create_port()\n status = get_mov_parameters()[0]\n if port_status(port):\n if status == '1' or status == 'True':\n string = ''.join([str(value), ' \\n'])\...
[ 1, 3, 4, 5, 6 ]
import gdalnumeric #Input File src = "../dati/islands/islands.tif" #Output tgt = "../dati/islands/islands_classified.jpg" srcArr = gdalnumeric.LoadFile(src) classes = gdalnumeric.numpy.histogram(srcArr,bins=2)[1] print classes #Color look-up table (LUT) - must be len(classes)+1. #Specified as R,G,B tuples lut = [[...
normal
{ "blob_id": "f29d377e8a8fd6d2e156da665478d7a4c167f7d5", "index": 3601, "step-1": "import gdalnumeric\n\n#Input File\nsrc = \"../dati/islands/islands.tif\"\n\n#Output\ntgt = \"../dati/islands/islands_classified.jpg\"\n\nsrcArr = gdalnumeric.LoadFile(src)\n\nclasses = gdalnumeric.numpy.histogram(srcArr,bins=2)[1]\...
[ 0 ]
from django.shortcuts import render from django.shortcuts import redirect # Create your views here. from .forms import AddBookForm ,UpdateBookForm,BookCreateModelForm,SearchForm,RegistrationForm,SignInForm from book.models import Books from django.contrib.auth import authenticate,login,logout def book_add(reques...
normal
{ "blob_id": "aba2a0a262c14f286c278f21ba42871410c174f0", "index": 953, "step-1": "<mask token>\n\n\ndef book_add(request):\n if request.user.is_authenticated:\n context = {}\n if request.method == 'GET':\n form = BookCreateModelForm()\n context['form'] = form\n re...
[ 4, 6, 7, 8, 10 ]
import chainer import chainer.functions as F import numpy as np import argparse from model import Generator, Discriminator from chainer import cuda, serializers from pathlib import Path from utils import set_optimizer from dataset import DatasetLoader xp = cuda.cupy cuda.get_device(0).use() class CycleGANVC2LossCal...
normal
{ "blob_id": "32105a245f6945dbe8749140d811b20d634289bc", "index": 2481, "step-1": "<mask token>\n\n\nclass CycleGANVC2LossCalculator:\n\n def __init__(self):\n pass\n <mask token>\n\n @staticmethod\n def gen_loss(discriminator, y):\n y_dis = discriminator(y)\n return F.mean(F.soft...
[ 3, 7, 8, 9, 11 ]
# -- coding: utf-8 -- from django.conf.urls import url from myapp.view import views from myapp.view import story from myapp.view import img # 添加 from myapp.view import login from myapp.view import tuling from myapp.view import utilView from myapp.view.wechat import wechat_modules from myapp.view import router urlpatt...
normal
{ "blob_id": "373c102018fdcc5211263304c368c2e8beef3257", "index": 720, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('get_img_api$', router.get_img_api), url('add_book$',\n views.add_book), url('show_books$', views.show_books), url('add_story$',\n story.add_story), url('show_stor...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python """ Otsu method for automatic estimation of $T$ threshold value - assumes two maxima of grayscale histogram & searches for optimal separation Parameters Usage Example $ python <scriptname>.py --image ../img/<filename>.png ## Explain """ import numpy as np import argparse import mahota...
normal
{ "blob_id": "0547751af7bbac42351476dde591d13d40fb37eb", "index": 7811, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n ap = argparse.ArgumentParser()\n ap.add_argument('-i', '--image', required=True, help='Path to the image')\n args = vars(ap.parse_args())\n image = cv2.imrea...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from flask import jsonify from flask.views import MethodView class Users(MethodView): def get(self): return jsonify( { 'status': 'OK', 'users': [ {'name': 'Pepe', 'age': 35, 'ocupation': "Engineer"}, ...
normal
{ "blob_id": "781ce153d5053078ee11cecc13d055a67999a651", "index": 3800, "step-1": "<mask token>\n\n\nclass Users(MethodView):\n <mask token>\n <mask token>\n\n def put(self):\n pass\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Users(MethodView):\n\n def get(self):\n return ...
[ 2, 4, 5, 6, 7 ]
from utils import * EvinceRelation("different from")
normal
{ "blob_id": "4f15e2743b33e2f672cd258172da852edb7e4118", "index": 2103, "step-1": "<mask token>\n", "step-2": "<mask token>\nEvinceRelation('different from')\n", "step-3": "from utils import *\nEvinceRelation('different from')\n", "step-4": "from utils import *\n\nEvinceRelation(\"different from\")\n\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from simple_avk.AVK import SimpleAVK from simple_avk.exceptions import MethodError, LongpollError
flexible
{ "blob_id": "2bccfba2448059a41185b117b224813e344b50f8", "index": 5673, "step-1": "<mask token>\n", "step-2": "from simple_avk.AVK import SimpleAVK\nfrom simple_avk.exceptions import MethodError, LongpollError\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.execute('SET NAMES utf8;') cursor.execute('SET CHARACTER SET utf8;') cursor.execute('SET character_set_connection=utf8;') <|reserved_special_token_0|> cursor.execute(sql) <|reserved_special_token_0|> for row in results: ...
flexible
{ "blob_id": "1d29ce58ca626155d626216fbbd70d7b241efa25", "index": 6363, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute('SET NAMES utf8;')\ncursor.execute('SET CHARACTER SET utf8;')\ncursor.execute('SET character_set_connection=utf8;')\n<mask token>\ncursor.execute(sql)\n<mask token>\nfor ro...
[ 0, 1, 2, 3, 4 ]