code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> @app.route('/') def interactive_input(): return render_template('main.html') @app.route('/food_1_star') def food_1_star(): return render_template('food_1.html') <|reserved_special_token_0|> @app.route('/general_5_star') def general_5_star(): return render_template('gener...
flexible
{ "blob_id": "1e41cc5d2661f1fb4f3a356318fabcb2b742cbdf", "index": 1826, "step-1": "<mask token>\n\n\n@app.route('/')\ndef interactive_input():\n return render_template('main.html')\n\n\n@app.route('/food_1_star')\ndef food_1_star():\n return render_template('food_1.html')\n\n\n<mask token>\n\n\n@app.route('...
[ 6, 7, 9, 11, 13 ]
from flask import Flask, app from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() DBNAME = 'database.db' def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT' app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}' db.init_app(app) from .views import v...
normal
{ "blob_id": "c6fdb9c405427a3583a59065f77c75c4aa781405", "index": 5417, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT'\n app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}'\n db.init_app(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def glInitYuvTargetEXT(): """Return boolean indicating whether this extension is available""" from OpenGL import extensions return extensions.hasGLExtension(_EXTENSION_NAME) <|reserved_special_token_1|> <|reserved...
flexible
{ "blob_id": "08420d31713859946b2f19cebf68c333331cb80e", "index": 1494, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef glInitYuvTargetEXT():\n \"\"\"Return boolean indicating whether this extension is available\"\"\"\n from OpenGL import extensions\n return extensions.hasGLExtension(_EXTE...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(N): c, t = map(int, input().split()) if nm > c and T >= t: nm = c if nm == 1000000: print('TLE') else: print(nm) <|reserved_special_token_1|> N, T = map(int, input().split()) nm = 1000000 ...
flexible
{ "blob_id": "8a0e781f29c426161240e33b9d2adc7537b3d352", "index": 2513, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n c, t = map(int, input().split())\n if nm > c and T >= t:\n nm = c\nif nm == 1000000:\n print('TLE')\nelse:\n print(nm)\n", "step-3": "N, T = map(...
[ 0, 1, 2, 3 ]
def test_{{ project_name }}(): assert True
normal
{ "blob_id": "1c1f1dab1ae2e8f18536784a5dec9de37c8a8582", "index": 3995, "step-1": "def test_{{ project_name }}():\n assert True\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.parametrize('path', glob.glob(join(data_dir('structure'), '*.cif'))) def test_array_conversion(path): pdbx_file = pdbx.PDBxFile.read(path) ref_structure = pdbx.get_structure(pdbx_file, model=1, extra_fie...
flexible
{ "blob_id": "cc637d14ce2106fcc3b8bbb54e497691e72a3f65", "index": 2858, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize('path', glob.glob(join(data_dir('structure'),\n '*.cif')))\ndef test_array_conversion(path):\n pdbx_file = pdbx.PDBxFile.read(path)\n ref_structure =...
[ 0, 1, 2, 3 ]
#!/usr/bin/python try: from Queue import Queue except ImportError: # Python 3 from queue import Queue class BFSWithQueue: """Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) ...
normal
{ "blob_id": "0bce5d590b96e434cd8aee7531a321bc648c1981", "index": 8722, "step-1": "<mask token>\n\n\nclass BFSWithQueue:\n <mask token>\n <mask token>\n\n def run(self, source=None, pre_action=None, post_action=None):\n \"\"\"Executable pseudocode.\"\"\"\n if source is not None:\n ...
[ 8, 10, 11, 12, 14 ]
<|reserved_special_token_0|> @app.route('/predict', methods=['POST']) def predict(): arr = [int(x) for x in request.form.values()] arr2 = [np.array(arr)] output = model.predict(arr2) return render_template('index.html', prediction_text=output) <|reserved_special_token_0|> <|reserved_special_token_...
flexible
{ "blob_id": "02b760b16cdcd42f8d8d7222b439da87fb8076a3", "index": 4959, "step-1": "<mask token>\n\n\n@app.route('/predict', methods=['POST'])\ndef predict():\n arr = [int(x) for x in request.form.values()]\n arr2 = [np.array(arr)]\n output = model.predict(arr2)\n return render_template('index.html', p...
[ 1, 3, 4, 5, 6 ]
import glob pyfiles = glob.glob('*.py') modulenames = [f.split('.')[0] for f in pyfiles] # print(modulenames) for f in pyfiles: contents = open(f).read() for m in modulenames: v1 = "import " + m v2 = "from " + m if v1 or v2 in contents: contents = contents.replace(v1, "im...
normal
{ "blob_id": "d6a73365aa32c74798b6887ff46c0ed2323ed1a6", "index": 2324, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor f in pyfiles:\n contents = open(f).read()\n for m in modulenames:\n v1 = 'import ' + m\n v2 = 'from ' + m\n if v1 or v2 in contents:\n contents =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LoginForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LoginForm(forms.Form): usuario = forms.CharField(label='Usua...
flexible
{ "blob_id": "7da5a7476c807619bed805cb892774c23c04c6f7", "index": 4917, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LoginForm(forms.Form):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LoginForm(forms.Form):\n usuario = forms.CharField(label='Usuario', max_le...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DLModeler(object): def __init__(self, model_path, hf_path, num_examples, class_percentages, predictors, model_args, model_type): self.model_path = model_path self.hf_path = hf_path self.num_examples = num_examples self.class_percentages =...
flexible
{ "blob_id": "a0a6bd5de39a7599f7872639cdf3a59b8cda5498", "index": 5230, "step-1": "<mask token>\n\n\nclass DLModeler(object):\n\n def __init__(self, model_path, hf_path, num_examples, class_percentages,\n predictors, model_args, model_type):\n self.model_path = model_path\n self.hf_path = ...
[ 8, 9, 10, 12, 13 ]
from datetime import date def diff_in_date(first, second): value = str(second - first) if value.__contains__(','): generated_sum = value.split(',') return generated_sum[0] else: return value first_date = date(2014, 7, 2) second_date = date(2014, 7, 11) current_date = date.today()...
normal
{ "blob_id": "9b6d30a40bafa0e9e4760843d6a2f750f0f88a57", "index": 6106, "step-1": "<mask token>\n\n\ndef diff_in_date(first, second):\n value = str(second - first)\n if value.__contains__(','):\n generated_sum = value.split(',')\n return generated_sum[0]\n else:\n return value\n\n\n<...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NormalizeImageDict(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def __call__(self, sample): for key in self.image_keys: if self.normalizeRange: sample[key] /= 255.0 sample[key] = self.normalize(sample...
flexible
{ "blob_id": "4293ad0b2a4a352d6bdc4b860448c4a3b14ca629", "index": 8648, "step-1": "<mask token>\n\n\nclass NormalizeImageDict(object):\n <mask token>\n <mask token>\n\n def __call__(self, sample):\n for key in self.image_keys:\n if self.normalizeRange:\n sample[key] /= 25...
[ 2, 3, 4, 5 ]
from torch.utils.data.sampler import Sampler import torch import random class SwitchingBatchSampler(Sampler): def __init__(self, data_source, batch_size, drop_last=False): self.data_source = data_source self.batch_size = batch_size self.drop_last = drop_last # Divide the indices into two indices groups se...
normal
{ "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 ]
# -*- coding: utf-8 -*- ''' ======================================================================= AutoTest Team Source File. Copyright(C), Changyou.com ----------------------------------------------------------------------- Created: 2017/3/2 by ChengLongLong ----------------------------------------------------...
normal
{ "blob_id": "38f7c529cd0a8d85de266c6a932e6c8342aee273", "index": 4969, "step-1": "<mask token>\n", "step-2": "# -*- coding: utf-8 -*-\n'''\n=======================================================================\nAutoTest Team Source File.\nCopyright(C), Changyou.com\n------------------------------------------...
[ 0, 1 ]
import time from helpers.handler import port_handler from helpers.functions import fetch_all class ascii_handler(port_handler): """ Serve ASCII server list """ def handle_data(self): """ Show a nicely formatted server list and immediately close connection """ self.ls....
normal
{ "blob_id": "cbf93eb96f40ff0aedc4b8d9238669da72934b27", "index": 2400, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ascii_handler(port_handler):\n <mask token>\n\n def handle_data(self):\n \"\"\"\n Show a nicely formatted server list and immediately close connection\n ...
[ 0, 2, 3, 4, 5 ]
class NlpUtility: <|reserved_special_token_0|> def get_nouns(self, tokens): nouns = [] for word, pos in tokens: if pos == 'NN': nouns.push(word) <|reserved_special_token_0|> <|reserved_special_token_0|> def get_nouns(self, tokens): nouns = [] ...
flexible
{ "blob_id": "c6502ea2b32ad90c76b6dfaf3ee3218d029eba15", "index": 56, "step-1": "class NlpUtility:\n <mask token>\n\n def get_nouns(self, tokens):\n nouns = []\n for word, pos in tokens:\n if pos == 'NN':\n nouns.push(word)\n <mask token>\n <mask token>\n\n d...
[ 4, 5, 6, 7, 8 ]
''' Implement GreedyMotifSearch http://rosalind.info/problems/ba2d/ Given: Integers k and t, followed by a collection of strings Dna. Return: A collection of strings BestMotifs resulting from running GreedyMotifSearch(Dna, k, t). If at any step you find more than one Profile-most probable k-mer in a given string, use...
normal
{ "blob_id": "ed7fa6e6f30eb06400cb38128617967a597f6c04", "index": 2450, "step-1": "<mask token>\n\n\ndef greedy_motif_search(dnas, k, t):\n best_motifs = [dna[:k] for dna in dnas]\n best_score = score_motifs(best_motifs)\n for i in range(len(dnas[0]) - k + 1):\n print(i)\n motifs = [dnas[0]...
[ 3, 5, 6, 7, 8 ]
# joiner = '+' # seq = ["Sushil","Bahadur","KC"] # txt = joiner.join(seq) # txt # txt = " Sam " # ljus = txt.ljust(7,"*") # ljus # txtstrip = txt.strip().strip('S') # txtstrip # txt = "This is my world." # txtSplit = txt.split(maxsplit=1) # txtSplit # name = input("Enter your full name") # name = name.strip() # txt = ...
normal
{ "blob_id": "32b22cccac75c87b8638c76c0c6d27db0de4d750", "index": 8480, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(type(list1))\nprint(list1[0])\nprint(list1[len(list1) - 1])\n<mask token>\nprint(list1)\n<mask token>\nlist4\n<mask token>\nlist4\n<mask token>\nlist4\n<mask token>\nlist4\n<mask to...
[ 0, 1, 2, 3 ]
import pygame from .Coin import Coin from .Snake import Snake, Block from .Bomb import Bomb from .Rocket import Rocket from pygame.math import Vector2 cell_size = 16 cell_number = 30 sprite_cell = pygame.image.load("Assets/Cell.png") bg = pygame.image.load("Assets/BG.png") bg2 = pygame.image.load("Assets/BG2.png") c...
normal
{ "blob_id": "2b14607aa2527f5da57284917d06ea60e89f784c", "index": 1659, "step-1": "<mask token>\n\n\nclass GAME:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def check_timer(self):\n if self.count >= self.crowd:\n self.game_timer += 1\n if self.game_t...
[ 5, 7, 9, 10, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ba0563.pngMap = [ '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' , '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
flexible
{ "blob_id": "dab1adcd185092fc425b5d87150f27e7b67bff6c", "index": 151, "step-1": "<mask token>\n", "step-2": "ba0563.pngMap = [\n '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\n ,\n '00000000000000000000000000000000000...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_template(): assert True <|reserved_special_token_1|> import pytest def test_template(): assert True
flexible
{ "blob_id": "e7fa84dbc037253c7f852aa618e6ea88d1fda909", "index": 1939, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_template():\n assert True\n", "step-3": "import pytest\n\n\ndef test_template():\n assert True\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
import sys byte = int(sys.argv[1]) qlty = float(sys.argv[2]) n = 0 while True: o = sys.stdin.read(byte) if qlty>(qlty*n)%1: oo = o sys.stdout.write(o) else: sys.stdout.write(oo) if not o: break n=n+1
normal
{ "blob_id": "70845ab4aab80d988a5c01d0b4fb76e63b800527", "index": 6484, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n o = sys.stdin.read(byte)\n if qlty > qlty * n % 1:\n oo = o\n sys.stdout.write(o)\n else:\n sys.stdout.write(oo)\n if not o:\n break\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class cGAN: def __init__(self, input_dim1, input_dim2, input_dim3, latent_size): self.input_dim1 = input_dim1 self.input_dim2 = input_dim2 self.input_dim3 = input_dim3 self.latent_size = latent_size def discriminator(self): input_shape = s...
flexible
{ "blob_id": "fc6c220f8a3a0e9dd1d6e6e1ca131136db8f8a58", "index": 9155, "step-1": "<mask token>\n\n\nclass cGAN:\n\n def __init__(self, input_dim1, input_dim2, input_dim3, latent_size):\n self.input_dim1 = input_dim1\n self.input_dim2 = input_dim2\n self.input_dim3 = input_dim3\n se...
[ 10, 11, 12, 13, 14 ]
<|reserved_special_token_0|> def version_info(): return 'dansfunctions version %s (%s)' % (fg.__version__, fg.__date__) <|reserved_special_token_0|> def check_general_functions(): print('dansfunctions/functions_general.py') print('Version: %s (%s)' % (fg.__version__, fg.__date__)) print('Methods:'...
flexible
{ "blob_id": "0f266db39988cfce475380036f4f4f5b1a1fee1a", "index": 3647, "step-1": "<mask token>\n\n\ndef version_info():\n return 'dansfunctions version %s (%s)' % (fg.__version__, fg.__date__)\n\n\n<mask token>\n\n\ndef check_general_functions():\n print('dansfunctions/functions_general.py')\n print('Ve...
[ 4, 5, 6, 7, 8 ]
import os from flask import Flask,render_template,request,redirect,url_for from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session,sessionmaker app = Flask(__name__) engine = create_engine("postgres://lkghylsqhggivp:d827f6dc5637928e95e060761de590b7d9514e9463c5241ed3d652d777a4a3a9@ec2-5...
normal
{ "blob_id": "af9430caff843242381d7c99d76ff3c964915700", "index": 6753, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('a.html')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('a.html')\n\n\n@app.route('/insert...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> vals -= vals[:, np.newaxis].mean(-1) vals /= vals[:, np.newaxis].std(-1) <|reserved_special_token_0|> km.fit(vals) <|reserved_special_token_0|> for ii in range(len(zips)): tzip = int(zips.ZIPCODE[ii]) if tzip in dzips: ...
flexible
{ "blob_id": "2c181a33c84ce262404c192abdc515924a1916a9", "index": 6165, "step-1": "<mask token>\n", "step-2": "<mask token>\nvals -= vals[:, np.newaxis].mean(-1)\nvals /= vals[:, np.newaxis].std(-1)\n<mask token>\nkm.fit(vals)\n<mask token>\nfor ii in range(len(zips)):\n tzip = int(zips.ZIPCODE[ii])\n if ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def info(msg): if config['log_level'] not in ('ERROR', 'WARNING', 'WARN'): print(config['prefix'] + 'INFO> ' + msg) log_count['INFO'] += 1 <|reserved_special_token_0|> def warning(msg): if config.get('log_level') != 'ERROR': print(config['prefix'] + 'WA...
flexible
{ "blob_id": "e15ea7d167aad470d0a2d95a8a328b35181e4dc3", "index": 7832, "step-1": "<mask token>\n\n\ndef info(msg):\n if config['log_level'] not in ('ERROR', 'WARNING', 'WARN'):\n print(config['prefix'] + 'INFO> ' + msg)\n log_count['INFO'] += 1\n\n\n<mask token>\n\n\ndef warning(msg):\n if co...
[ 2, 4, 8, 9, 10 ]
<|reserved_special_token_0|> def prepare_output_directory(config: ConfigSchema) ->None: formatted = datetime.now().strftime(config.output_path_format) output_path = Path(formatted) output_path.mkdir(parents=True, exist_ok=False) config.output_path = output_path.as_posix() <|reserved_special_token_1|...
flexible
{ "blob_id": "d8fb5aeb5453b986cc698165749992e4a7677257", "index": 1506, "step-1": "<mask token>\n\n\ndef prepare_output_directory(config: ConfigSchema) ->None:\n formatted = datetime.now().strftime(config.output_path_format)\n output_path = Path(formatted)\n output_path.mkdir(parents=True, exist_ok=False...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def load_image(filename): return mpimg.imread(filename) def calibrate_camera(rows=6, cols=9): mtx = None dist = None save_file = 'calibration.npz' try: data = np.load(save_file) mtx = data['mtx'] dist = data['dist'] print('using saved ...
flexible
{ "blob_id": "3ac30240577eda08343796abbd051d5d3b45beaf", "index": 3416, "step-1": "<mask token>\n\n\ndef load_image(filename):\n return mpimg.imread(filename)\n\n\ndef calibrate_camera(rows=6, cols=9):\n mtx = None\n dist = None\n save_file = 'calibration.npz'\n try:\n data = np.load(save_fi...
[ 14, 17, 18, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(int(h7 * i)) <|reserved_special_token_1|> g7 = int(input()) h7 = g7 / 2 i = g7 - 1 print(int(h7 * i))
flexible
{ "blob_id": "abb08956f55fd1e8af27ce12fa94a4137d7d908e", "index": 7251, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(int(h7 * i))\n", "step-3": "g7 = int(input())\nh7 = g7 / 2\ni = g7 - 1\nprint(int(h7 * i))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
'''import pyttsx3 #engine = pyttsx3.init() #Conficuração das vozes #voices = engine.getProperty('voices') #engine.setProperty('voice', voices[2].id) engine=pyttsx3.init() voices=engine.getProperty('voices') engine.setProperty('voice',voices[3].id) #Falar texto engine.say('Olá meu nome é Jarvis. Sou uma inteligênci...
normal
{ "blob_id": "d9bf58dc76d4e8d7146fac3bb2bdfb538ebf78a5", "index": 7102, "step-1": "<mask token>\n", "step-2": "'''import pyttsx3\n\n#engine = pyttsx3.init()\n\n#Conficuração das vozes\n#voices = engine.getProperty('voices')\n#engine.setProperty('voice', voices[2].id)\n\nengine=pyttsx3.init()\n\nvoices=engine.ge...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('#1 map') <|reserved_special_token_0|> print(new_list) print('\n#2 reduce') <|reserved_special_token_0|> print(reduce_data) <|reserved_special_token_1|> <|reserved_special_token_0|> print('#1 map') a_list = [2, 18, 9, 22,...
flexible
{ "blob_id": "8e3b26826752b6b3482e8a29b9b58f5025c7ef58", "index": 4758, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('#1 map')\n<mask token>\nprint(new_list)\nprint('\\n#2 reduce')\n<mask token>\nprint(reduce_data)\n", "step-3": "<mask token>\nprint('#1 map')\na_list = [2, 18, 9, 22, 17, 24, 8, ...
[ 0, 1, 2, 3, 4 ]
import tkinter as tk import tkinter.messagebox as tkmb import psutil import os import re import subprocess from subprocess import Popen, PIPE, STDOUT, DEVNULL import filecmp import re import time import threading import datetime import re debian = '/etc/debian_version' redhat = '/etc/redhat-release' def PrintaLog(tex...
normal
{ "blob_id": "fde62dd3f5ee3cc0a1568b037ada14835c327046", "index": 6298, "step-1": "<mask token>\n\n\ndef PrintaLog(texto):\n t = time.time()\n logtime = time.ctime(t)\n stringprint = '%s %s\\n' % (logtime, texto)\n f = open('/var/log/patriot', 'a')\n f.write(stringprint)\n f.flush()\n f.close...
[ 4, 6, 9, 10, 11 ]
def merge(items, temp, low, mid, high): i = low j = mid + 1 for k in range(low, high+1): if i > mid: # 왼쪽 리스트의 순회를 마쳤음 # 남은 오른쪽 리스트의 원소들은 모두 왼쪽 리스트 원소보다 작음 temp[k] = items[j] # 뒤에 나머지는 정렬되어있으니 그대로 넣기 j += 1 elif j > high: ...
normal
{ "blob_id": "9ab119b32ceac370b744658e5fa679292609373a", "index": 2517, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef merge_sort(items, temp, low, high):\n if high <= low:\n return None\n mid = low + (high - low) // 2\n merge_sort(items, temp, low, mid)\n merge_sort(items, temp...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Movie: def __init__(self, id: int): self.actors = set() self.name = '' self.id = id self.year = 0 def getName(self): return self.name def getActors(self): return self.actors def getId(self): return self.id ...
flexible
{ "blob_id": "0934163fc6461e30a73c06e74b3a5e983ed2fa02", "index": 4211, "step-1": "<mask token>\n\n\nclass Movie:\n\n def __init__(self, id: int):\n self.actors = set()\n self.name = ''\n self.id = id\n self.year = 0\n\n def getName(self):\n return self.name\n\n def get...
[ 7, 11, 17, 22, 26 ]
<|reserved_special_token_0|> def scrape(event_id, event_cost): page = get(event_id, resource='events').json() venue = get(page['venue_id'], resource='venues').json() start = datetime.strptime(page['start']['local'], '%Y-%m-%dT%H:%M:%S') end = datetime.strptime(page['end']['local'], '%Y-%m-%dT%H:%M:%S'...
flexible
{ "blob_id": "edfc8794fab2c95e01ae254f9f13d446faafe6fd", "index": 9213, "step-1": "<mask token>\n\n\ndef scrape(event_id, event_cost):\n page = get(event_id, resource='events').json()\n venue = get(page['venue_id'], resource='venues').json()\n start = datetime.strptime(page['start']['local'], '%Y-%m-%dT%...
[ 5, 7, 8, 9, 10 ]
import thumt.utils.bleu as bleu import argparse parser = argparse.ArgumentParser("Compute sentence bleu.") parser.add_argument("-pred_path", type=str, required=True) parser.add_argument("-n_list_path", type=str, required=True) parser.add_argument("-refer_path", type=str, required=True) args = parser.parse_args() n_l...
normal
{ "blob_id": "4437075901751adeaf3df63345e270a9b0090c14", "index": 1918, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-pred_path', type=str, required=True)\nparser.add_argument('-n_list_path', type=str, required=True)\nparser.add_argument('-refer_path', type=str, required=True)\n<mas...
[ 0, 1, 2, 3, 4 ]
import logging import terrestrial.config as config logger = logging.getLogger(f'{__name__}.common') def health(): return 'OK', 200 def verify_token(token): """ Verifies Token from Authorization header """ if config.API_TOKEN is None: logger.error('API token is not configured, auth will f...
normal
{ "blob_id": "167bd2c405171443c11fbd13575f8c7b20877289", "index": 8470, "step-1": "<mask token>\n\n\ndef health():\n return 'OK', 200\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef health():\n return 'OK', 200\n\n\ndef verify_token(token):\n \"\"\"\n Verifies Token from Authorization header\...
[ 1, 2, 3, 4 ]
Easy = [["4 + 12 = ?", 16], ["45 -34 = ?", 11], ["27 + 12 -18 = ?", 21], ['25 - 5 * 4 = ?', 5], ["18 + 45 / 5 - 3 * 2 = ?", 21], ["5! = ?", 120], ["3! + 2! = ?", 8], ["7 + 5! / 4! - 6 / 3 = ?", 10], ["(25 + 5) / 6 * 4 = ?", 20], ["4(3+c)...
normal
{ "blob_id": "66edf0d2f7e25e166563bdb1063a1ed45ecda0e6", "index": 541, "step-1": "<mask token>\n", "step-2": "Easy = [['4 + 12 = ?', 16], ['45 -34 = ?', 11], ['27 + 12 -18 = ?', 21], [\n '25 - 5 * 4 = ?', 5], ['18 + 45 / 5 - 3 * 2 = ?', 21], ['5! = ?', 120],\n ['3! + 2! = ?', 8], ['7 + 5! / 4! - 6 / 3 = ?...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class NearestStudents(Task): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def output(self): return luigi.LocalTarget('/Users/adcxdpf/Downloads/pset_03/sd.csv') def requires(self): return {'data': HashedStudent...
flexible
{ "blob_id": "15eed401728e07bfe9299edd12add43ad8b9cb71", "index": 3802, "step-1": "<mask token>\n\n\nclass NearestStudents(Task):\n <mask token>\n <mask token>\n <mask token>\n\n def output(self):\n return luigi.LocalTarget('/Users/adcxdpf/Downloads/pset_03/sd.csv')\n\n def requires(self):\n...
[ 5, 6, 7, 8, 9 ]
species( label = 'C=C([CH]C)C(=C)[CH]C(24182)', structure = SMILES('[CH2]C(=CC)C([CH2])=CC'), E0 = (249.687,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([325,375,415,465,420,450,1700,1750,2750,2770,2790,2810,2830,2850,1350,1400,1450,1500,700,800,1000,1100,1350,1400,900,1100,3000,3033.33,...
normal
{ "blob_id": "63093190ee20e10698bd99dcea94ccf5d076a006", "index": 8921, "step-1": "<mask token>\n", "step-2": "species(label='C=C([CH]C)C(=C)[CH]C(24182)', structure=SMILES(\n '[CH2]C(=CC)C([CH2])=CC'), E0=(249.687, 'kJ/mol'), modes=[\n HarmonicOscillator(frequencies=([325, 375, 415, 465, 420, 450, 1700, ...
[ 0, 1, 2 ]
import pygame # import random # import text_scroll from os import path img_dir = path.join(path.dirname(__file__), 'img') # define screen and refresh rate WIDTH = 720 HEIGHT = 720 FPS = 30 # define colors RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) BLACK = (0, 0, 0) YELLOW = (255, 255, 0) BROWN = (165, ...
normal
{ "blob_id": "88dfb422b1c9f9a9a8f497e1dbba5598c2710e9b", "index": 5718, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.display.set_caption('Space Force Prime')\n<mask token>\n", "step-3": "<mask token>\nimg_dir = path.join(path.dirname(__file__), 'img')\nWIDTH = 720\nHEIGHT = 720\nFPS = 30\nRED =...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from .models import Client, Adress # Register your models here. class ClientInline(admin.StackedInline): model = Adress can_delete = False extra = 1 class ClientAdmin(admin.ModelAdmin): inlines = [ClientInline] admin.site.register(Client, ClientAdmin)
normal
{ "blob_id": "ffd7aef2e72e64ac5b9f85b9d12845479187d89b", "index": 2010, "step-1": "<mask token>\n\n\nclass ClientInline(admin.StackedInline):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ClientAdmin(admin.ModelAdmin):\n inlines = [ClientInline]\n\n\n<mask token>\n", "step-2": "<mask token...
[ 3, 4, 5, 6, 7 ]
# #1 # def bi_search(l, r, arr, x): # # Code Here # if(l == r): # return arr[r] == x # mid = (l + r)//2 + 1 # if(arr[mid] > x): # return bi_search(l,mid-1,arr,x) # else: # return bi_search(mid,r,arr,x) # inp = input('Enter Input : ').split('/') # arr, k = list(map(int, ...
normal
{ "blob_id": "883b4de18dddede97f850e3a184a0e1072bda99e", "index": 814, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solve(dpArr, list, box, i):\n global boxes\n global ans\n if box == boxes:\n s = 0\n for j in list:\n s += len(j)\n if s == len(dpArr):\n ...
[ 0, 1, 2, 3, 4 ]
import torch import torch.nn as nn import torch.optim as optim import torchtext import absl.flags import absl.app import pickle import yaml import numpy as np from tqdm import tqdm from core import model import core.dnc.explanation from core import functions from core.config import ControllerConfig, MemoryConfig, Train...
normal
{ "blob_id": "00dbcae2d3941c9ef4c8b6753b8f6f7a46417400", "index": 5110, "step-1": "<mask token>\n\n\ndef run_explanations(network, explanation_module, data_iterator):\n network.eval()\n best_accuracy = 0\n worst_accuracy = 0\n best_correct = 0\n worst_correct = 0\n covered = 0\n total = 0\n ...
[ 3, 5, 6, 7, 9 ]
<|reserved_special_token_0|> def test_creating_objects(): teacher = Teacher('Daniil', 'Shadrin') student = Student('Roman', 'Petrov') homework = teacher.create_homework('Learn OOP', 1) homework_result = student.do_homework(homework, 'I have done this hw') assert isinstance(teacher, Teacher) as...
flexible
{ "blob_id": "8f971ee3b98691a887ee0632afd613bbf4f19aa0", "index": 3505, "step-1": "<mask token>\n\n\ndef test_creating_objects():\n teacher = Teacher('Daniil', 'Shadrin')\n student = Student('Roman', 'Petrov')\n homework = teacher.create_homework('Learn OOP', 1)\n homework_result = student.do_homework...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class bcolors: HEADER = '\x1b[95m' OKBLUE = '\x1b[94m' OKGREEN = '\x1b[92m' WARNING = '\x1b[93m' FAIL = '\x1b[91m' ENDC = '\x1b[0m' BOLD = '\x1b[1m' UNDERLINE = '\x1b[4m' def get_image(f_sdss): img = f_sdss[0].data return img <|reserved_special_...
flexible
{ "blob_id": "736fee6f9a46b8568b2dd217b81d54d689306630", "index": 970, "step-1": "<mask token>\n\n\nclass bcolors:\n HEADER = '\\x1b[95m'\n OKBLUE = '\\x1b[94m'\n OKGREEN = '\\x1b[92m'\n WARNING = '\\x1b[93m'\n FAIL = '\\x1b[91m'\n ENDC = '\\x1b[0m'\n BOLD = '\\x1b[1m'\n UNDERLINE = '\\x1b...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class VertexArrayObject: def __init__(self, primitive): self._primitive = primitive self._buffers: List[pxng.BufferObject] = [] self._indices = pxng.BufferObject(data_type=self.index_data_type, array_type=gl.GL_ELEMENT_ARRAY_BUFFER) self._v...
flexible
{ "blob_id": "7530c2c85f83d1714840ba97c1ec702f063658c5", "index": 379, "step-1": "<mask token>\n\n\nclass VertexArrayObject:\n\n def __init__(self, primitive):\n self._primitive = primitive\n self._buffers: List[pxng.BufferObject] = []\n self._indices = pxng.BufferObject(data_type=self.ind...
[ 9, 11, 12, 13, 17 ]
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2018, q2-chemistree development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------...
normal
{ "blob_id": "4296dc5b79fd1d2c872eb1115beab52a0f067423", "index": 4816, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PluginSetupTests(unittest.TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PluginSetupTests(unittest.TestCase):\n\n def test_plugin_setup(self):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserClusters(JsonView): logger = logging.getLogger('mliyweb.views.UserClusters') cluster_service = ClusterService() @log_enter_exit(logger) def get_data(self, context): username = self.request.user.username try: if session_is_okay(self.re...
flexible
{ "blob_id": "f882b73645c6a280a17f40b27c01ecad7e4d85ae", "index": 5860, "step-1": "<mask token>\n\n\nclass UserClusters(JsonView):\n logger = logging.getLogger('mliyweb.views.UserClusters')\n cluster_service = ClusterService()\n\n @log_enter_exit(logger)\n def get_data(self, context):\n usernam...
[ 9, 11, 12, 13, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('...starting export') <|reserved_special_token_0|> logging.basicConfig(filename=timestr + '-export.log') <|reserved_special_token_0|> matCursor.execute(select_all_mat) <|reserved_special_token_0|> for m in materialTypes: ...
flexible
{ "blob_id": "d81e8478d60c9ee778e1aeb0dd7b05f675e4ecad", "index": 2306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('...starting export')\n<mask token>\nlogging.basicConfig(filename=timestr + '-export.log')\n<mask token>\nmatCursor.execute(select_all_mat)\n<mask token>\nfor m in materialTypes:\n ...
[ 0, 1, 2, 3, 4 ]
from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models import User, Group class UserTests(APITestCase): def test_user_list(self): # must be rejected without validation response = self.client.get('/api/us...
normal
{ "blob_id": "ca7b0553e55e1c5e6cd23139a158101e72456a50", "index": 8844, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserTests(APITestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UserTests(APITestCase):\n\n def test_user_list(self):\n response = self.client.get('...
[ 0, 1, 2, 3, 4 ]
from xai.brain.wordbase.verbs._essay import _ESSAY #calss header class _ESSAYED(_ESSAY, ): def __init__(self,): _ESSAY.__init__(self) self.name = "ESSAYED" self.specie = 'verbs' self.basic = "essay" self.jsondata = {}
normal
{ "blob_id": "dc2cbbaca3c35f76ac09c93a2e8ad13eb0bdfce6", "index": 4086, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass _ESSAYED(_ESSAY):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass _ESSAYED(_ESSAY):\n\n def __init__(self):\n _ESSAY.__init__(self)\n self.name = 'ES...
[ 0, 1, 2, 3, 4 ]
import os import sys try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup, find_packages setup( name='stripe-requests', version='1.9.1-dev', description='Stripe python bindings using requests', author='Allan Lei', author_email='allanlei@hel...
normal
{ "blob_id": "a6ee2be7bed59b419fa66fd6cfe4b5fff3fac260", "index": 2596, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup, find_packages\nsetup(name='stripe-requests', version='1.9.1-dev', descrip...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 18 13:36:13 2019 @author: gennachiaro """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set() import pyrolite.plot from pyrolite.plot.spider import spider #read in data df = pd.read_csv('/users/ge...
normal
{ "blob_id": "f6fee18898636ad6b0dc6d96d28dead4e09b8035", "index": 1650, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.set()\n<mask token>\nMG.pyroplot.spider(color='green', alpha=0.5, mode='fill')\nVCCR.pyroplot.spider(color='red', alpha=0.5, mode='fill')\nFG.pyroplot.spider(color='purple', alpha=0.5...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> default_app_config = 'reman.apps.RemanConfig'
flexible
{ "blob_id": "0b0b928aef9a4e9953b02639bf5e7769cc4389d7", "index": 2488, "step-1": "<mask token>\n", "step-2": "default_app_config = 'reman.apps.RemanConfig'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- class Solution: """ @param head: The first node of the linked list. @return: The node where the cycle begins. if there is no cycle, return null """ def detectCycle(self, head): # write your code here # 先确定是否有环,然后确定环的大小,再遍历确定位置。 cycle_...
normal
{ "blob_id": "3319614d154b16190f3cd8f4f65c3b0e0da277e9", "index": 9751, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def detectCycle(self, head):\n cycle_len = -1\n one_node, two_node = head, he...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('country', Country_Data, name='country_data'), path( 'tours', Scrape_Data, name='scrape_data'), path('draws', Draw_Data, name='Draw_data')] <|reserved_special_token_1|> from django.urls import path f...
flexible
{ "blob_id": "b39c783cbaff2915c8864ce0b081b5bf052baee5", "index": 6731, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('country', Country_Data, name='country_data'), path(\n 'tours', Scrape_Data, name='scrape_data'), path('draws', Draw_Data,\n name='Draw_data')]\n", "step-3": "...
[ 0, 1, 2 ]
import cv2 img = cv2.imread('imgs/1.png') pixel = img[100, 100] img[100, 100] = [57, 63, 99] # 设置像素值 b = img[100, 100, 0] # 57, 获取(100, 100)处, blue通道像素值 g = img[100, 100, 1] # 63 r = img[100, 100, 2] # 68 r = img[100, 100, 2] = 99 # 设置red通道 # 获取和设置 piexl = img.item(100, 100, 2) img.itemset((100, 100, 2), 99)
normal
{ "blob_id": "d13f06afeac938fc2cf4d3506b3f68c6de9de210", "index": 6596, "step-1": "<mask token>\n", "step-2": "<mask token>\nimg.itemset((100, 100, 2), 99)\n", "step-3": "<mask token>\nimg = cv2.imread('imgs/1.png')\npixel = img[100, 100]\nimg[100, 100] = [57, 63, 99]\nb = img[100, 100, 0]\ng = img[100, 100, ...
[ 0, 1, 2, 3, 4 ]
""" Estructuras que extraen valores de una función y se almacenan en objetos iterables (que se pueden recorrer Son mas eficientes que las funciones tradicionales muy útiles con listas de valores infinitos Bajos determinados escenarios, será muy útil que un generador devuelva los valores de uno en uno Un generador ...
normal
{ "blob_id": "29abcfc010453e3a67346ea2df238e07b85502a8", "index": 3107, "step-1": "<mask token>\n\n\ndef generarPares(limite):\n num = 1\n milista = []\n while num < limite:\n milista.append(num * 2)\n num += 1\n return milista\n\n\n<mask token>\n\n\ndef devuelveCiudades2(*ciudades):\n ...
[ 2, 5, 6, 7, 8 ]
""" - Define a new class Student which is derived from Human and has: grade field. do_hobby - print 'dancing' or some another hobby """ import andy.Lesson_7.exercise_1 class Student(andy.Lesson_7.exercise_1.Human): def __init__(self, firstname, lastname, grade): super().__init__(firstname, lastname) ...
normal
{ "blob_id": "497f56891670f635feff983058e86055e54be493", "index": 2618, "step-1": "<mask token>\n\n\nclass Student(andy.Lesson_7.exercise_1.Human):\n\n def __init__(self, firstname, lastname, grade):\n super().__init__(firstname, lastname)\n self.grade = grade\n\n def do_hobby(self):\n ...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class CnnArticleItem(scrapy.Item): title = scrapy.Field() developments = scrapy.Field() body = scrapy.Field() date = scrapy.Field() clas...
normal
{ "blob_id": "cf0eb9685cdfc412871d3b36270ddab3e520bb8f", "index": 104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CnnArticleItem(scrapy.Item):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass GoogleArticleItem(scrapy.Item):\n title = scrapy.Field()\n d...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Game(models.Model): gameName = models.CharField(max_length=100) genre = models.ForeignKey(GameGenre) def __str__(self): return '%s, %s' % (self.gameName, self.genre) class Players(models.Model): playerName = models.CharField(max_length=100) games = mod...
flexible
{ "blob_id": "092242cdb231e09ccf3dd4dccfb6d786c3e4aad2", "index": 8036, "step-1": "<mask token>\n\n\nclass Game(models.Model):\n gameName = models.CharField(max_length=100)\n genre = models.ForeignKey(GameGenre)\n\n def __str__(self):\n return '%s, %s' % (self.gameName, self.genre)\n\n\nclass Play...
[ 6, 8, 9, 10, 11 ]
from django import forms from .models import Profile class ImageForm(forms.ModelForm): userimage = forms.ImageField(required=False, error_messages={'invalid':("Image file only")}, widget=forms.FileInput) class Meta: model = Profile fields = ['userimage',]
normal
{ "blob_id": "9081d0f75ac53ab8d0bafb39cd46a2fec8a5135f", "index": 3813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ImageForm(forms.ModelForm):\n <mask token>\n\n\n class Meta:\n model = Profile\n fields = ['userimage']\n", "step-3": "<mask token>\n\n\nclass ImageForm(fo...
[ 0, 1, 2, 3, 4 ]
# program name: an2_colour.py # no optional arguments: Uses Wine data to display information about the relationship of # various attributes with colour and hue print('========================================================================================') print('===================================================...
normal
{ "blob_id": "594479c22cada665dcdc76737085ce342d7d5faf", "index": 1480, "step-1": "<mask token>\n\n\ndef convert_type(data_value):\n try:\n return int(data_value)\n except ValueError:\n try:\n return float(data_value)\n except ValueError:\n return data_value\n\n\n<...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('hello', end='!') print('python') print('010', '1234', '1111', sep='-') <|reserved_special_token_0|> print('입력한 숫자 :', num) print('num type :', type(num)) <|reserved_special_token_0|> print('result :', result) print('result ...
flexible
{ "blob_id": "cc628270a973866025a5e2a5d07e39b4dbdcd324", "index": 1718, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('hello', end='!')\nprint('python')\nprint('010', '1234', '1111', sep='-')\n<mask token>\nprint('입력한 숫자 :', num)\nprint('num type :', type(num))\n<mask token>\nprint('result :', resu...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "a917dd6171a78142fefa8c8bfad0110729fc1bb0", "index": 3190, "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 = [('aposta', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Migration(SchemaMigration): def forwards(self, orm): db.add_column(u'main_videoad', 'compress', self.gf( 'django.db.models.fields.BooleanField')(default=False), keep_default=False) <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "b4bcf9903f4a34c8b256c65cada29e952a436f74", "index": 2215, "step-1": "<mask token>\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n db.add_column(u'main_videoad', 'compress', self.gf(\n 'django.db.models.fields.BooleanField')(default=False),\n keep...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python from LCClass import LightCurve import matplotlib.pyplot as plt import niutils def main(): lc1821 = LightCurve("PSR_B1821-24/PSR_B1821-24_combined.evt") lc0218 = LightCurve("PSR_J0218+4232/PSR_J0218+4232_combined.evt") fig, ax = plt.subplots(2, 1, figsize=(8, 8)) ax[0], _ = lc18...
normal
{ "blob_id": "48311ee17a3f2eca8db32d7672f540fa45a7a900", "index": 3524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n lc1821 = LightCurve('PSR_B1821-24/PSR_B1821-24_combined.evt')\n lc0218 = LightCurve('PSR_J0218+4232/PSR_J0218+4232_combined.evt')\n fig, ax = plt.subplots(2, 1,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.home, name='park-home'), path('login/', views .login, name='park-login')] <|reserved_special_token_1|> from django.urls import path from . import views urlpatterns = [path('', views.home, name=...
flexible
{ "blob_id": "2fd490ca54f5d038997cec59a3e07c3f2c2d2538", "index": 6757, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home, name='park-home'), path('login/', views\n .login, name='park-login')]\n", "step-3": "from django.urls import path\nfrom . import views\nurlpattern...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AttentionAgent(object): <|reserved_special_token_0|> def __init__(self, num_in_pol, num_out_pol, hidden_dim=64, lr=0.01, onehot_dim=0): """ Inputs: num_in_pol (int): number of dimensions for policy input num_out_pol (int): num...
flexible
{ "blob_id": "845d04312abc0e64a7810b52bbee333d2bdf3dfb", "index": 7164, "step-1": "<mask token>\n\n\nclass AttentionAgent(object):\n <mask token>\n\n def __init__(self, num_in_pol, num_out_pol, hidden_dim=64, lr=0.01,\n onehot_dim=0):\n \"\"\"\n Inputs:\n num_in_pol (int): nu...
[ 4, 5, 6, 7 ]
/home/sbm367/anaconda3/lib/python3.5/types.py
normal
{ "blob_id": "720d37e35eb335cc68ff27763cfe5c52f76b98d2", "index": 5781, "step-1": "/home/sbm367/anaconda3/lib/python3.5/types.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
try: alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ" idx=eval(input("请输入一个整数")) print(alp[idx]) except NameError: print("输入错误,请输入一个整数") except: print("其他错误") else: print("没有发生错误") finally: print("程序执行完毕,不知道是否发生了异常")
normal
{ "blob_id": "99a6b450792d434e18b8f9ff350c72abe5366d95", "index": 153, "step-1": "<mask token>\n", "step-2": "try:\n alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n idx = eval(input('请输入一个整数'))\n print(alp[idx])\nexcept NameError:\n print('输入错误,请输入一个整数')\nexcept:\n print('其他错误')\nelse:\n print('没有发生错误')\...
[ 0, 1, 2 ]
import errno import os import shutil from calendar import monthrange from datetime import datetime, timedelta from pavilion import output from pavilion import commands from pavilion.status_file import STATES from pavilion.test_run import TestRun, TestRunError, TestRunNotFoundError class CleanCommand(commands.Command...
normal
{ "blob_id": "18aafb71d7e6f5caa2f282126c31eb052c08ad3c", "index": 4307, "step-1": "<mask token>\n\n\nclass CleanCommand(commands.Command):\n <mask token>\n\n def __init__(self):\n super().__init__('clean', 'Clean up Pavilion working directory.',\n short_help='Clean up Pavilion working dire...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.task def update_banner_list(): banner_query = Banner.objects.filter(is_delete=False, is_show=True ).order_by('-orders')[:BANNER_COUNT] banner_data = BannerModelSerializer(banner_query, many=True).data fo...
flexible
{ "blob_id": "8e85740123467889bdeb6b27d5eaa4b39df280ed", "index": 438, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.task\ndef update_banner_list():\n banner_query = Banner.objects.filter(is_delete=False, is_show=True\n ).order_by('-orders')[:BANNER_COUNT]\n banner_data = BannerMode...
[ 0, 1, 2, 3 ]
''' Created on May 17, 2016 @author: Shauryadeep Chaudhuri ''' import json import tornado from engine import Constants as c from engine.ResultGenerator import ResultGenerator from ..ServerLogger import ServerLogger class GetFromURL(tornado.web.RequestHandler): ''' This class fetches the d...
normal
{ "blob_id": "5a13c7e3be8a0b5f3baf7106a938fc97f078c5bc", "index": 7335, "step-1": "<mask token>\n\n\nclass GetFromURL(tornado.web.RequestHandler):\n <mask token>\n <mask token>\n\n def get(self, index=None, schema=None, entry=None, query=None):\n query = dict()\n resultGenerator = ResultGen...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while cont == 'y': print('--enter underlay color in r,g,b--') c2[0] = int(input('red: ')) c2[1] = int(input('green: ')) c2[2] = int(input('blue: ')) print('') print('--enter desired color in r,g,b--') c...
flexible
{ "blob_id": "5fa8ae36c4b4a5bffa64f4c65b74b74b29ba246f", "index": 4578, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile cont == 'y':\n print('--enter underlay color in r,g,b--')\n c2[0] = int(input('red: '))\n c2[1] = int(input('green: '))\n c2[2] = int(input('blue: '))\n print('')\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for k in range(1, 100): a = [] for i in range(1, 100): a.append([]) for j in range(1, 100): a[i - 1].append(partisan_symmetry([5 * i / 100, 0.2, 5 * j / 100], 1000, False)) ...
flexible
{ "blob_id": "cfa0937f1c49b52283c562d9ab1cb0542e71b990", "index": 5970, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in range(1, 100):\n a = []\n for i in range(1, 100):\n a.append([])\n for j in range(1, 100):\n a[i - 1].append(partisan_symmetry([5 * i / 100, 0.2, 5...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import numpy as np import rospy import tf from geometry_msgs.msg import PoseStamped, Twist, TwistStamped, Point from nav_msgs.msg import Odometry from visualization_msgs.msg import Marker from bebop_nmpc_solver import BebopNmpcFormulationParam, bebop_nmpc_casadi_solver # The frame by default is...
normal
{ "blob_id": "76d0dd2d6b2d580900283f2623f05dd02a70fcd8", "index": 6825, "step-1": "<mask token>\n\n\nclass BebopNmpcControl:\n <mask token>\n\n def set_bebop_odom(self, odom_msg):\n if self.received_first_odom_ is False:\n self.received_first_odom_ = True\n rospy.loginfo('First ...
[ 10, 12, 13, 15, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('{:>3}-й день: {:.3}'.format(day, distance)) while target > distance: day += 1 distance += distance / 10 print('{:>3}-й день: {:.3}'.format(day, distance)) print('Ответ: на {}-й день спортсмен достиг результата —...
flexible
{ "blob_id": "9033ba0a19d765a83737d59289735a9ffd02abb1", "index": 7519, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('{:>3}-й день: {:.3}'.format(day, distance))\nwhile target > distance:\n day += 1\n distance += distance / 10\n print('{:>3}-й день: {:.3}'.format(day, distance))\nprint('О...
[ 0, 1, 2, 3 ]
import os import h5py import numpy as np from keras import backend as K from keras.layers import Activation, BatchNormalization, Conv2D, Dense, Dot, \ Dropout, Flatten, Input, MaxPooling2D, GlobalAveragePooling2D from keras import regularizers from keras.layers import Average as KerasAverage from keras.models imp...
normal
{ "blob_id": "0eefae7e0d341d74154bbe480f5ed766829e3ce3", "index": 3734, "step-1": "<mask token>\n\n\nclass TotalReshape(Layer):\n\n def __init__(self, target_shape, **kwargs):\n self.target_shape = target_shape\n super(TotalReshape, self).__init__(**kwargs)\n\n def compute_output_shape(self, i...
[ 17, 20, 24, 29, 31 ]
from mikeio.spatial import GeometryPoint2D, GeometryPoint3D # https://www.ogc.org/standard/sfa/ def test_point2d_wkt(): p = GeometryPoint2D(10, 20) assert p.wkt == "POINT (10 20)" p = GeometryPoint2D(x=-5642.5, y=120.1) assert p.wkt == "POINT (-5642.5 120.1)" def test_point3d_wkt(): p = Geomet...
normal
{ "blob_id": "ae45a4967a8ee63c27124d345ad4dc0c01033c0e", "index": 6749, "step-1": "<mask token>\n\n\ndef test_point3d_wkt():\n p = GeometryPoint3D(10, 20, 30)\n assert p.wkt == 'POINT Z (10 20 30)'\n\n\ndef test_point2d_to_shapely():\n p = GeometryPoint2D(10, 20)\n sp = p.to_shapely()\n assert sp.x...
[ 2, 3, 4, 5, 6 ]
# Q. In How many ways N stair can be climb if allowesd steps are 1, 2 or 3. # triple Sort def noOfSteps(n, k): if n<0: return 0 if n == 0: return 1 t_steps = 0 for i in range(1, k+1): t_steps += noOfSteps(n-i, k) return t_steps def noOfStepsDP(n,k): dp = [0]*max((...
normal
{ "blob_id": "6c2699ff8e739595a2648d53745dc3c788536d7b", "index": 1907, "step-1": "<mask token>\n\n\ndef noOfStepsDP(n, k):\n dp = [0] * max(n + 1, 3)\n dp[0] = 1\n dp[1] = 1\n dp[2] = 2\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]\n return dp[n]\n\n\n<mask toke...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 2.2.7 on 2019-11-23 18:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ml', '0003_auto_20191123_1835'), ] operations = [ migrations.AlterField( model_name='ml', name='file', f...
normal
{ "blob_id": "2bf5ec4b4c0f0eed8364dcc9f1be599a804846f2", "index": 4981, "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 = [('ml', '0003_...
[ 0, 1, 2, 3, 4 ]
from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Div, Submit from django import forms from django.forms import RadioSelect from django.urls import reverse from core.models import Person, Datapackage from core.utils import cancel_button ...
normal
{ "blob_id": "5a59108084d943f6faa07ffea1467dc19c3dd790", "index": 1101, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DatapackageModelForm(forms.ModelForm):\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.helper = FormHelper(self)\n se...
[ 0, 2, 3, 5, 6 ]
import smtplib import requests import datetime import json import time from datetime import date from urllib.request import Request,urlopen today = date.today().strftime("%d-%m-%y") count = 0 pincodes = ["784164","781017","784161","787001"] date = 0 temp = str(14) + "-05-21" while True: for...
normal
{ "blob_id": "7c60ae58b26ae63ba7c78a28b72192373cc05a86", "index": 1211, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n for i in range(0, 8):\n temp = str(23 + i) + '-05-21'\n for pincode in pincodes:\n req = Request(\n 'https://cdn-api.co-vin.in/api...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Net(nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(Net, self).__init__() self.h1 = nn.Linear(input_size, hidden_size) self.h2 = nn.Linear(hidden_size, hidden_size_1) self.h3 = nn.Linear(hidden_size_1, hidden_size_2) ...
flexible
{ "blob_id": "a4deb67d277538e61c32381da0fe4886016dae33", "index": 85, "step-1": "<mask token>\n\n\nclass Net(nn.Module):\n\n def __init__(self, input_size, hidden_size, num_classes):\n super(Net, self).__init__()\n self.h1 = nn.Linear(input_size, hidden_size)\n self.h2 = nn.Linear(hidden_s...
[ 3, 4, 5, 6, 7 ]
import boto3 ec2 = boto3.resource('ec2') response = client.allocate_address(Domain='standard') print(response)
normal
{ "blob_id": "6424fccb7990b0a1722d5d787e7eb5acb4ff1a74", "index": 1863, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response)\n", "step-3": "<mask token>\nec2 = boto3.resource('ec2')\nresponse = client.allocate_address(Domain='standard')\nprint(response)\n", "step-4": "import boto3\nec2 = bot...
[ 0, 1, 2, 3 ]
import asyncio import logging import random from aiogram.dispatcher import FSMContext from aiogram.types import ContentTypes, Message, CallbackQuery from aiogram.utils.exceptions import BotBlocked import keyboards from data.config import ADMINS, ADMIN_CHAT_ID from keyboards.inline.activate_menu import active_menu_cal...
normal
{ "blob_id": "302accfd5001a27c7bbe6081856d43dbec704168", "index": 339, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dp.message_handler(commands='upload', user_id=ADMINS, state='*')\nasync def upload_profile(command_msg: Message, state: FSMContext):\n profile_msg = command_msg.reply_to_message\n ...
[ 0, 1, 2, 3 ]
from rest_framework import viewsets, mixins from .models import Comment, Post from .serializer import CommentSerializer, PostSerializer, AllCommentSerializer class PostViewSet(viewsets.ModelViewSet): serializer_class = PostSerializer queryset = Post.objects.all() class CommentViewSet(viewsets.GenericViewSet...
normal
{ "blob_id": "9bc13c608c079cbf23ed04f29edd1fd836214cde", "index": 282, "step-1": "<mask token>\n\n\nclass CommentViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, mixins\n .RetrieveModelMixin):\n queryset = Comment.objects.all()\n\n def get_serializer_class(self):\n if self.action == 'retrie...
[ 3, 4, 5, 6 ]
# Uses python3 import sys from operator import attrgetter from collections import namedtuple Segment = namedtuple('Segment', 'start end') def optimal_points(segments): segments = sorted(segments, key=attrgetter('end'), reverse=True) points = [] #write your code here while len(segments) > 0: ...
normal
{ "blob_id": "c007dc2416d3f7c883c44dea5471927ea6f816d6", "index": 3973, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef optimal_points(segments):\n segments = sorted(segments, key=attrgetter('end'), reverse=True)\n points = []\n while len(segments) > 0:\n segement = segments.pop()\n...
[ 0, 2, 3, 4, 5 ]
from flask import Flask, send_file import StringIO app = Flask(__name__) @app.route('/') def index(): strIO = StringIO.StringIO() strIO.write('Hello from Dan Jacob and Stephane Wirtel !') strIO.seek(0) return send_file(strIO, attachment_filename="testing.txt", ...
normal
{ "blob_id": "45335fa5d4773bdd0ef3e6c340fe06e84169be5e", "index": 8708, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n strIO = StringIO.StringIO()\n strIO.write('Hello from Dan Jacob and Stephane Wirtel !')\n strIO.seek(0)\n return send_file(strIO, attachment_filename='testing.txt',\n ...
[ 1, 2, 3, 4, 5 ]
from django.contrib.auth.models import User from django.db import models class Chat(models.Model): category = models.CharField(unique=True, max_length=100) def __str__(self): return self.category class ChatMessage(models.Model): context = models.CharField(max_length=1000) user = models.Fore...
normal
{ "blob_id": "61179dc734069017adaabd53804ed0102d9416e3", "index": 8865, "step-1": "<mask token>\n\n\nclass ChatMessage(models.Model):\n context = models.CharField(max_length=1000)\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n chat = models.ForeignKey(Chat, on_delete=models.CASCADE)\n ti...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ChatMembersFilterAdministrators(Object): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, **kwargs): pass @staticmethod def read(q: dict, *args) ->'ChatMembersFilterAdministrators': return ChatMembersFilterAdministrat...
flexible
{ "blob_id": "6dfd59bbab74a3a657d2200d62964578c296ee54", "index": 5713, "step-1": "<mask token>\n\n\nclass ChatMembersFilterAdministrators(Object):\n <mask token>\n <mask token>\n\n def __init__(self, **kwargs):\n pass\n\n @staticmethod\n def read(q: dict, *args) ->'ChatMembersFilterAdminist...
[ 3, 4, 5, 6, 7 ]
''' Aaditya Upadhyay oooo$$$$$$$$$$$ oo$$$$$$$$$$$$$$$$$$$$$$$o oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o o$ $$ o$ o $ oo o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o $$ $$ $o$ oo $ $ "$ o$$$$$$$$$ $$$$$$$$$...
normal
{ "blob_id": "9cd1cb84c457db64019fa542efcf6500aa8d6d42", "index": 9275, "step-1": "<mask token>\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef mp():\n return map(int, stdin.readline().split())\n\n\n<mask token>\n\n\ndef pr(n):\n return stdout.write(str(n) + '\\n')\n\n\n<mask to...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def tree(l): return max([(i + j + 2) for i, j in enumerate(l)]) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def tree(l): return max([(i + j + 2) for i, j in enumerate(l)]) <|reserved_special_token_0|> print(tree(t)) <|reserved_...
flexible
{ "blob_id": "e79cdd32977eb357c3f6709887b671c50eb1fa45", "index": 7071, "step-1": "<mask token>\n\n\ndef tree(l):\n return max([(i + j + 2) for i, j in enumerate(l)])\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef tree(l):\n return max([(i + j + 2) for i, j in enumerate(l)])\n\n\n<mask token>\npri...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: TopJSON driver test suite. # Author: Even Rouault # ############################################################################### # Copyr...
normal
{ "blob_id": "270dba92af583e37c35ed5365f764adfdc2f947d", "index": 2112, "step-1": "<mask token>\n\n\ndef test_ogr_toposjon_objects_is_dict():\n ds = ogr.Open('data/topojson/topojson2.topojson')\n lyr = ds.GetLayer(0)\n assert lyr.GetName() == 'a_layer'\n assert lyr.GetLayerDefn().GetFieldCount() == 2\...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render, HttpResponse from django.views.generic import TemplateView from .models import Person, Stock_history from django.http import Http404, HttpResponseRedirect from .forms import NameForm, UploadFileForm from .back import handle_uploaded_file, read_file class IndexView(TemplateView): ...
normal
{ "blob_id": "2d65ffa3fc8a5360702337d749884903b2cb0423", "index": 2353, "step-1": "<mask token>\n\n\nclass PersonView(TemplateView):\n\n def get(self, request):\n persons = Person.objects.all()\n context = {'persons': persons}\n return render(request, 'budget/person.html', context)\n\n\ncl...
[ 10, 11, 13, 14, 16 ]
<|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": "c6170678b523a105312d8ce316853859657d3c94", "index": 2235, "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 = [('user_detail...
[ 0, 1, 2, 3, 4 ]