code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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": "e9659555938211d067919ee5e0083efb29d42d7b", "index": 8600, "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 = [('classroom',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def is_triangle_number(n): root = (-1 + math.sqrt(1 + 8.0 * n)) / 2 if root.is_integer(): return True return False def calculation(): count = 0 for word in string_list: sum = 0 for char in word: sum += char_dict[char] if is...
flexible
{ "blob_id": "61019a5439a6f0c1aee51db9b048a26fb9b5bf5d", "index": 8257, "step-1": "<mask token>\n\n\ndef is_triangle_number(n):\n root = (-1 + math.sqrt(1 + 8.0 * n)) / 2\n if root.is_integer():\n return True\n return False\n\n\ndef calculation():\n count = 0\n for word in string_list:\n ...
[ 2, 3, 4, 5, 6 ]
from netsec_2017.Lab_3.packets import RequestItem, RequestMoney, RequestToBuy, FinishTransaction, SendItem, SendMoney from netsec_2017.Lab_3.PLS.client import PLSClient, PLSStackingTransport from netsec_2017.Lab_3.peepTCP import PeepClientTransport, PEEPClient import asyncio import playground import random, logging fro...
normal
{ "blob_id": "a12f9435eb4b090bc73be14ad64fdf43c5caa4d2", "index": 7471, "step-1": "<mask token>\n\n\nclass ShopClientProtocol(asyncio.Protocol):\n <mask token>\n <mask token>\n\n def connection_made(self, transport):\n print('ShopClient connection_made is called\\n')\n self.transport = tran...
[ 5, 7, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood): dummy = tf.Print(dummy, [entropy], 'entropy: ') dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ') dummy = tf.Print(...
flexible
{ "blob_id": "4758d6efde21e3b5d91f107188f24b6ddf7cbbe4", "index": 7935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef debug_inference(inference, dummy, entropy, cross_entropy,\n expected_log_likelhood):\n dummy = tf.Print(dummy, [entropy], 'entropy: ')\n dummy = tf.Print(dummy, [cross_en...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def mapper(line): fields = line.split(',') return Row(ID=int(fields[0]), name=fields[1].encode('utf-8'), age=int( fields[2]), numFriends=int(fields[3])) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mapper(line): fiel...
flexible
{ "blob_id": "e4bc2e97b70e2dc91dc86457866ec6b3531ef803", "index": 8772, "step-1": "<mask token>\n\n\ndef mapper(line):\n fields = line.split(',')\n return Row(ID=int(fields[0]), name=fields[1].encode('utf-8'), age=int(\n fields[2]), numFriends=int(fields[3]))\n\n\n<mask token>\n", "step-2": "<mask ...
[ 1, 2, 3, 4, 5 ]
import requests from datetime import date from datetime import timedelta def get_offset_date(modifed_date, offset_in_days): return date.isoformat(modifed_date + timedelta(days=int(offset_in_days))) def get_trending_repositories(start_search_date, number_of_results=20): github_api_uri = 'https://api.github.c...
normal
{ "blob_id": "8a7536b998a6d122e2e7529af1ebe2a0f025303f", "index": 5620, "step-1": "<mask token>\n\n\ndef get_offset_date(modifed_date, offset_in_days):\n return date.isoformat(modifed_date + timedelta(days=int(offset_in_days)))\n\n\ndef get_trending_repositories(start_search_date, number_of_results=20):\n g...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> def checkLand(self, grid...
flexible
{ "blob_id": "cddd5deba0ddc59a604d2926bdc687716e08f226", "index": 1557, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n\n def checkLand(self, grid, x, y):\n print(f...
[ 1, 2, 3, 4, 5 ]
#inject shellcode from pwn import * shellcode =p32(0x8049000+0x4)\ +asm("mov eax,SYS_execve")\ +asm("xor ecx,ecx")\ +asm("xor edx,edx")\ +asm("mov ebx,0x8049014")\ +asm("int 0x80")\ +"/bin/sh" r=process("./stack0",aslr=True) r.sendline('A'*(0x4c)+p32(0x8049000-0x4)+p32(0x804840c)+p32(0x8049000)) r.sendline(shellcode)...
normal
{ "blob_id": "cf70d6064fd4a43bc17cd852aaf04afade73d995", "index": 9252, "step-1": "<mask token>\n", "step-2": "<mask token>\nr.sendline('A' * 76 + p32(134516736 - 4) + p32(134513676) + p32(134516736))\nr.sendline(shellcode)\nr.interactive()\n", "step-3": "<mask token>\nshellcode = p32(134516736 + 4) + asm('mo...
[ 0, 1, 2, 3, 4 ]
from Psql_Database_Setup import * import requests, json engine = create_engine('postgresql://myuser:mypass@localhost:5432/mydb') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) session = DBSession() response = requests.get("https://api.github.com/emojis") response = json.loads(response.te...
normal
{ "blob_id": "0aa95b6a72472e8e260c07f4c42a327384ca0da4", "index": 9173, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key, value in response.items():\n Emoji = Emojis(name=key, url=value)\n session.add(Emoji)\n session.commit()\n", "step-3": "<mask token>\nengine = create_engine('postgresq...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('%d시간에 %d%s 벌었습니다.' % (1, wage * 1, '달러')) print('%d시간에 %d%s 벌었습니다.' % (5, wage * 5, '달러')) print('%d시간에 %.1f%s 벌었습니다' % (1, 5710.8, '원')) print('%d시간에 %.1f%s 벌었습니다' % (5, 28554.0, '원')) <|reserved_special_token_1|> wage ...
flexible
{ "blob_id": "2092ead8b8f268a22711b8af8052241c1ac00c15", "index": 14, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('%d시간에 %d%s 벌었습니다.' % (1, wage * 1, '달러'))\nprint('%d시간에 %d%s 벌었습니다.' % (5, wage * 5, '달러'))\nprint('%d시간에 %.1f%s 벌었습니다' % (1, 5710.8, '원'))\nprint('%d시간에 %.1f%s 벌었습니다' % (5, 28554.0,...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CheckoutConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CheckoutConfig(AppConfig): <|reserved_special_token_0|> def ready(self): import checkout.signals <|res...
flexible
{ "blob_id": "74e3f4cd7b09d9b96feb3f927a509b113481eaed", "index": 7575, "step-1": "<mask token>\n\n\nclass CheckoutConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CheckoutConfig(AppConfig):\n <mask token>\n\n def ready(self):\n import checkout.signals\n...
[ 1, 2, 3, 4, 5 ]
from day6input import * groups = input.split('\n\n') count = 0 #1 groupanswers = [] #2 for group in groups: allananswers = set(list('abcdefghijklmnopqrstuvwxyz')) #2 answers = set() #1 people = group.split('\n') for person in people: allananswers = allananswers & set(list(person)) #2 ...
normal
{ "blob_id": "8f1ec65ca60605747f46f596e0b5848922bcd0b5", "index": 2127, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor group in groups:\n allananswers = set(list('abcdefghijklmnopqrstuvwxyz'))\n answers = set()\n people = group.split('\\n')\n for person in people:\n allananswers = a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def build_response(session_attributes, speechlet_response): return {'version': '1.0', 'sessionAttributes': session_attributes, 'response': speechlet_response} def get_welcome_response(): """ If we wanted to initialize the session to have some attributes we could add ...
flexible
{ "blob_id": "a5ef2adbf85b5ab80c59697340f94bc57d60952e", "index": 4463, "step-1": "<mask token>\n\n\ndef build_response(session_attributes, speechlet_response):\n return {'version': '1.0', 'sessionAttributes': session_attributes,\n 'response': speechlet_response}\n\n\ndef get_welcome_response():\n \"...
[ 9, 10, 12, 13, 14 ]
import pytest import os import pandas as pd import numpy as np import math import scipy from scipy import stats from sklearn import metrics, linear_model from gpmodel import gpkernel from gpmodel import gpmodel from gpmodel import gpmean from gpmodel import chimera_tools n = 200 d = 10 X = np.random.random(size=(n, ...
normal
{ "blob_id": "62c28b5eb31b90191dfbab4456fc5373ba51bf64", "index": 8869, "step-1": "<mask token>\n\n\ndef test_normalize():\n model = gpmodel.GPRegressor(kernel)\n m, s, normed = model._normalize(Y)\n assert np.isclose(m, Y.mean())\n assert np.isclose(s, Y.std())\n assert np.allclose(normed, (Y - m)...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def check_string(automaton, word): inicial = automata['s'].closure for i in word: inicial = state_list_delta(inicial, i) return automaton['f'] in inicial <|reserved_special_token_0|> <|reserved_special_to...
flexible
{ "blob_id": "9cf0174a8bd2bccbd8e5d0be1f0b031a1a23c9df", "index": 4691, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_string(automaton, word):\n inicial = automata['s'].closure\n for i in word:\n inicial = state_list_delta(inicial, i)\n return automaton['f'] in inicial\n\n\n...
[ 0, 1, 2, 3, 4 ]
PRECISAO = 3 MAX_ITER = 20 def gauss_jacobi(entrada,*valores_iniciais): tamanho = len(entrada[0]) variaveis = [*valores_iniciais[:tamanho]] variaveism1 = [None] * (tamanho-1) for _ in range(0,MAX_ITER): print(variaveis) for linha in range(tamanho-1): soma = 0 for coluna in range(...
normal
{ "blob_id": "842f8b4de0378a2c83d22f3fd54ba4857d249597", "index": 9323, "step-1": "<mask token>\n\n\ndef gauss_jacobi(entrada, *valores_iniciais):\n tamanho = len(entrada[0])\n variaveis = [*valores_iniciais[:tamanho]]\n variaveism1 = [None] * (tamanho - 1)\n for _ in range(0, MAX_ITER):\n prin...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- """ Created on Thu Nov 15 06:50:48 2018 @author: Tony """ import glob import pandas as pd path =r'C:\Users\Tony\Downloads\daily_dataset\daily_dataset' # use your path frame = pd.DataFrame() list_ = [] def aggSumFn(path,grpByCol): allFiles = glob.glob(path + "/*.csv") ...
normal
{ "blob_id": "252d6b381af09dbafb1d10c188eb154e53213033", "index": 8845, "step-1": "<mask token>\n\n\ndef aggSumFn(path, grpByCol):\n allFiles = glob.glob(path + '/*.csv')\n for file_ in allFiles:\n df = pd.read_csv(file_, index_col=None, header=0)\n list_.append(df)\n frame = pd.concat(list...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> readFiles.extend([ '/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START53_V7A-v1/00000/FE26AAB2-D90B-E211-AD0F-0025902009B8.root' , '/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/A...
flexible
{ "blob_id": "965bb4c8e7d6650dab7f002645dceacab59a0c5c", "index": 7298, "step-1": "<mask token>\n", "step-2": "<mask token>\nreadFiles.extend([\n '/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START53_V7A-v1/00000/FE26AAB2-D90B-E211-AD0F-0025902009B8.root'\n ,\n '/store/mc/Sum...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def find_color(img, color_value, myColors): hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) count = 0 new_points = [] for color in myColors: lower = np.array(color[0:3]) upper = np.array(color[3:6]) mask = cv2.inRange(hsv, lower, upper) x, y = co...
flexible
{ "blob_id": "836c1d2083d18c68fe551278d2df4155edc64c8c", "index": 5298, "step-1": "<mask token>\n\n\ndef find_color(img, color_value, myColors):\n hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\n count = 0\n new_points = []\n for color in myColors:\n lower = np.array(color[0:3])\n upper = np...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class BaseTenderCriteriaRGRequirementResource(APIResource): <|reserved_special_token_0|> @json_view(permission='view_tender') def collection_get(self): return {'data': [i.serialize('view') for i in self.request.context. requirements]} <|reserved_specia...
flexible
{ "blob_id": "6194079dd506553b4e5b66f1fb92bb8642704b59", "index": 6893, "step-1": "<mask token>\n\n\nclass BaseTenderCriteriaRGRequirementResource(APIResource):\n <mask token>\n\n @json_view(permission='view_tender')\n def collection_get(self):\n return {'data': [i.serialize('view') for i in self....
[ 4, 5, 6, 7, 8 ]
class Node: def __init__(self,data): self.data = data self.next = None self.prev = None class dequeue: def __init__(self): self.front = None self.last = None self.count = 0 def add_front(self, data): new_nodef = Node(data) if(self.front ==...
normal
{ "blob_id": "2f6e0b6a7e14ac9c5a38db6fd2b1cf23cff7144e", "index": 172, "step-1": "<mask token>\n\n\nclass dequeue:\n\n def __init__(self):\n self.front = None\n self.last = None\n self.count = 0\n\n def add_front(self, data):\n new_nodef = Node(data)\n if self.front == Non...
[ 8, 10, 12, 13, 15 ]
#!/usr/bin/env python import rospy from geometry_msgs.msg import Twist from sensor_msgs.msg import Joy import serial from sys import platform if platform == "linux" or platform == "linux2": ser = serial.Serial('/dev/ttyACM0') elif platform == "darwin": pass elif platform == "win32": # Windows... ser = ...
normal
{ "blob_id": "14a357f3dfb3d59f1d8cfd566edeaf8b0e5bb56d", "index": 374, "step-1": "<mask token>\n\n\ndef callback(data):\n global first_a\n global first_d\n global oldvar\n global base_throttle\n global peak_throttle\n global base_brake\n global peak_brake\n global button\n axis1 = -data...
[ 2, 3, 4, 5, 6 ]
# coding=utf-8 """ author = jamon """
normal
{ "blob_id": "00790b9d2648d19a37d1d1864e7fdeab0f59f764", "index": 4266, "step-1": "<mask token>\n", "step-2": "# coding=utf-8\n\"\"\"\nauthor = jamon\n\"\"\"", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import os import math from collections import defaultdict __author__ = 'steven' question='qb' fs={'t1','small.in','large'} def getmincost(n,c,f,x): t=0.0 for i in range(0,n): t+=1/(2+f*i) t=t*c t+=x/(2+f*n) ct=getmincostnshift(n,c,f,x) return min(t,ct); def getmincostnshift(n,c,f,x): ...
normal
{ "blob_id": "8fee548466abf6d35ea180f8de4e52a9b8902d3f", "index": 1025, "step-1": "import os\nimport math\nfrom collections import defaultdict\n__author__ = 'steven'\n\nquestion='qb'\nfs={'t1','small.in','large'}\ndef getmincost(n,c,f,x):\n t=0.0\n\n for i in range(0,n):\n t+=1/(2+f*i)\n t=t*c\n ...
[ 0 ]
from django.shortcuts import render, redirect from django.contrib import messages from django.contrib.auth import authenticate, login, logout from .models import Post from django.shortcuts import redirect from django.core.exceptions import ObjectDoesNotExist def index(request): blogs = Post.objects.filter(status=...
normal
{ "blob_id": "aec374ffa368755350d0d75c96860f760e8524e1", "index": 7301, "step-1": "<mask token>\n\n\ndef index(request):\n blogs = Post.objects.filter(status=1).order_by('-created_on')[:10]\n context = {'Post': blogs}\n return render(request, 'blogapp/index.html', context)\n\n\ndef blogs(request):\n r...
[ 6, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- from .log_config import LogBase import os __all__ = ['MyLog'] class MyLog(LogBase): """ 功能: 将日志分日志等级记录,并自动压缩2019-11-11.info.log.gz 参数: :param dir_path: 日志记录的路径,默认是当前路径下的log文件夹 :param logger_name: logger对象的名字 :param info_name: 保存inf...
normal
{ "blob_id": "3a9987ac326131878b80cb819e3d06ce2f4cb054", "index": 8461, "step-1": "<mask token>\n\n\nclass MyLog(LogBase):\n <mask token>\n <mask token>\n\n def get_logger(self):\n return self._get_logger()\n\n @staticmethod\n def type_need(parm, type_):\n if not isinstance(parm, type...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def redirect(url, status=None): """Raise a redirect to the specified address. """ raise cherrypy.HTTPRedirect(url, status) def require_method(*allowed_methods): allowed_methods = list(allowed_methods) if 'GET' in allowed_methods: if 'HEAD' not in allowed_met...
flexible
{ "blob_id": "dc28d8aa17347f07041ae218bbe4e1b0add27c24", "index": 5669, "step-1": "<mask token>\n\n\ndef redirect(url, status=None):\n \"\"\"Raise a redirect to the specified address.\n\n \"\"\"\n raise cherrypy.HTTPRedirect(url, status)\n\n\ndef require_method(*allowed_methods):\n allowed_methods = l...
[ 11, 13, 16, 19, 20 ]
<|reserved_special_token_0|> def upgrade(): bind = op.get_bind() urls = bind.execute( 'SELECT p.id as pid, r.id as rid, r.uri as uri FROM oauth2_identity_provider p JOIN resource r ON p.api_resource_id = r.id' ) op.add_column('oauth2_identity_provider', sa.Column('uri', sa.String(), ...
flexible
{ "blob_id": "c185a88332e39c561649f087f01fd3b704e7010b", "index": 1959, "step-1": "<mask token>\n\n\ndef upgrade():\n bind = op.get_bind()\n urls = bind.execute(\n 'SELECT p.id as pid, r.id as rid, r.uri as uri FROM oauth2_identity_provider p JOIN resource r ON p.api_resource_id = r.id'\n )\n ...
[ 1, 2, 3, 4, 5 ]
# python imports import re # django imports from django.core.management.base import BaseCommand # module level imports from utils.spells import SPELLS from spells.models import Spell SPELL_SCHOOL = { 'Abjuration': 'Abjuration', 'Conjuration': 'Conjuration', 'Divination': 'Divination', ...
normal
{ "blob_id": "010f78d952657b3d7c11fbf8e46912d0294f6cc1", "index": 9103, "step-1": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n help = (\n 'Will auto populate the database with all the Spells from 5th Edition Dungeons and Dragons.'\n )\n\n def handle(self, *args, **kwargs)...
[ 3, 4, 5, 6, 7 ]
__author__ = 'susperius' """ Abstract class used to implement own fuzzers """ class Fuzzer: NAME = [] CONFIG_PARAMS = [] @classmethod def from_list(cls, params): raise NotImplementedError("ABSTRACT METHOD") @property def prng_state(self): raise NotImplementedError("ABSTRACT M...
normal
{ "blob_id": "aa2a268143856d8f33b1aaf24f4e28ffd95cab01", "index": 4658, "step-1": "<mask token>\n\n\nclass Fuzzer:\n <mask token>\n <mask token>\n\n @classmethod\n def from_list(cls, params):\n raise NotImplementedError('ABSTRACT METHOD')\n\n @property\n def prng_state(self):\n rai...
[ 7, 8, 9, 10, 11 ]
# Generated by Django 2.1.3 on 2019-01-06 06:53 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
normal
{ "blob_id": "a91d42764fa14111afca4551edd6c889903ed9bd", "index": 8056, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
import Adafruit_GPIO.SPI as SPI import Adafruit_SSD1306 # Raspberry Pi pin configuration: RST = 24 # Note the following are only used with SPI: DC = 23 SPI_PORT = 0 SPI_DEVICE = 0 # Beaglebone Black pin configuration: # RST = 'P9_12' # Note the following are only used with SPI: # DC = 'P9_15' # SPI_PORT = 1 # SPI_DEV...
normal
{ "blob_id": "d8cbed25f4c97be5a74a6e1f097fcb9fa9439a9a", "index": 8160, "step-1": "<mask token>\n", "step-2": "<mask token>\ndisp.begin()\ndisp.clear()\ndisp.display()\n", "step-3": "<mask token>\nRST = 24\nDC = 23\nSPI_PORT = 0\nSPI_DEVICE = 0\ndisp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.S...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BoardTests(unittest.TestCase): def test_get_neighbours(self): board = create_test_board(3) self.assertListEqual(board.get_neighbour_states(1, 0), [None, None, ALIVE, ALIVE, DEAD, ALIVE, DEAD, None]) def test_simple_update(self): alive_ce...
flexible
{ "blob_id": "f644ff322d1268092dbdcbfc1a3c76006424184b", "index": 1482, "step-1": "<mask token>\n\n\nclass BoardTests(unittest.TestCase):\n\n def test_get_neighbours(self):\n board = create_test_board(3)\n self.assertListEqual(board.get_neighbour_states(1, 0), [None, None,\n ALIVE, ALI...
[ 10, 11, 14, 15, 16 ]
import dnf_converter def parse(query): print("parsing the query...") query = dnf_converter.convert(query) cp_clause_list = [] clause_list = [] for cp in query["$or"]: clauses = [] if "$and" in cp: for clause in cp["$and"]: clauses.append(clause) clause_list.append(clause) else: clause = cp ...
normal
{ "blob_id": "999de0965efa3c1fe021142a105dcf28184cd5ba", "index": 43, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse(query):\n print('parsing the query...')\n query = dnf_converter.convert(query)\n cp_clause_list = []\n clause_list = []\n for cp in query['$or']:\n claus...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def change(self, amount: int, coins: List[int]) ->int: coins = sorted(coins, reverse=True) @lru_cache(None) ...
flexible
{ "blob_id": "332c530d221c9441d6ff3646f8e9226dc78067f9", "index": 2902, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def change(self, amount: int, coins: List[int]) ->int:\n coins = sorted(coins, reverse=True)\n\n...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> def save_pool(): for i in range(total_models): current_pool[i].save_weights(save_location + str(i) + '.keras') print('Pool saved') def create_model(): """ Create Neural Network as a keras model """ model = Sequential() model.add(Dense(12, input_dim=8,...
flexible
{ "blob_id": "fc1b9ab1fb1ae71d70b3bf5c879a5f604ddef997", "index": 9969, "step-1": "<mask token>\n\n\ndef save_pool():\n for i in range(total_models):\n current_pool[i].save_weights(save_location + str(i) + '.keras')\n print('Pool saved')\n\n\ndef create_model():\n \"\"\"\n Create Neural Network...
[ 13, 15, 16, 20, 21 ]
# Generated by Django 3.2.3 on 2021-06-01 07:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('info', '0002_auto_20210531_1958'), ] operations = [ migrations.AddField( model_name='well', name='well_status', ...
normal
{ "blob_id": "a3239bbe4f85c9f0e1bc845245f024c3feb64923", "index": 7476, "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 = [('info', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def lucas(): yield 2 a = 2 b = 1 while True: yield b a, b = b, a + b <|reserved_special_token_0|> <|reserved_special_token_1|> def lucas(): yield 2 a = 2 b = 1 while True: yield b a, b = b, ...
flexible
{ "blob_id": "4745c00ca0f3ca4316117228a9d44bdb5df02877", "index": 7799, "step-1": "<mask token>\n", "step-2": "def lucas():\n yield 2\n a = 2\n b = 1\n while True:\n yield b\n a, b = b, a + b\n\n\n<mask token>\n", "step-3": "def lucas():\n yield 2\n a = 2\n b = 1\n while ...
[ 0, 1, 2, 3 ]
def print_duplicates(arr): uniques = set() for elem in arr: if elem in uniques: print(elem, end=' ') else: uniques.add(elem)
normal
{ "blob_id": "420c3944de0a5436a9824604fd6caf27706eb99c", "index": 4102, "step-1": "<mask token>\n", "step-2": "def print_duplicates(arr):\n uniques = set()\n for elem in arr:\n if elem in uniques:\n print(elem, end=' ')\n else:\n uniques.add(elem)\n", "step-3": null, ...
[ 0, 1 ]
import os, datetime import urllib from flask import (Flask, flash, json, jsonify, redirect, render_template, request, session, url_for) import util.database as db template_path=os.path.dirname(__file__)+"/templates" file="" if template_path!="/templates": app = Flask("__main__",tem...
normal
{ "blob_id": "5c20eefe8111d44a36e69b873a71377ee7bfa23d", "index": 6768, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n if 'username' in session:\n id_num = db.search_user_list(session['username'], is_usrname=True)[0][2\n ]\n finavail = db.search_finance_list(id_num)\n ...
[ 14, 15, 16, 18, 19 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, request, jsonify from app import Node from dbm2 import filemanager fm = filemanager() node = Node(fm) app = Flask(__name__) @app.route("/transactions/isfull",methods=['GET']) def isFull(): return jsonify(node.isFull()), 200 @app.route("/tra...
normal
{ "blob_id": "45b46a08d8b304ac12baf34e0916b249b560418f", "index": 7459, "step-1": "<mask token>\n\n\n@app.route('/transactions/isfull', methods=['GET'])\ndef isFull():\n return jsonify(node.isFull()), 200\n\n\n@app.route('/transactions/new', methods=['POST'])\ndef newTransaction():\n transaction = request.g...
[ 8, 11, 12, 13, 14 ]
# Generated by Django 2.2.1 on 2019-06-01 09:56 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Participant', fields=[ ('username', models....
normal
{ "blob_id": "58b12418a2a6b1ef9b63800b89e7f0b9fffd908c", "index": 9223, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def gprimo(nmax): for x in range(1, nmax): for i in range(2, x): if x % i != 0: continue else: break else: yield x <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_toke...
flexible
{ "blob_id": "732886306d949c4059b08e1bc46de3ad95ba56cb", "index": 1685, "step-1": "<mask token>\n\n\ndef gprimo(nmax):\n for x in range(1, nmax):\n for i in range(2, x):\n if x % i != 0:\n continue\n else:\n break\n else:\n yield x\n\...
[ 1, 2, 3, 4, 5 ]
from app import config from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker engine = create_engine(config.DB_URI) Session = scoped_session(sessionmaker(bind=engine))
normal
{ "blob_id": "86c1aee21639958f707f99bc2468e952ad6c1859", "index": 9352, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine = create_engine(config.DB_URI)\nSession = scoped_session(sessionmaker(bind=engine))\n", "step-3": "from app import config\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.o...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def get_pos_name(code, name='parent', english=True, pos_tags=POS_MAP): """Gets the part of speech name for *code*. :param str code: The part of speech code to lookup, e.g. ``'nsf'``. :param str name: Which part of speech name to include in the output. Must be one of `...
flexible
{ "blob_id": "093b2afef7cdfb7070eb5e94e84624afe495db66", "index": 1948, "step-1": "<mask token>\n\n\ndef get_pos_name(code, name='parent', english=True, pos_tags=POS_MAP):\n \"\"\"Gets the part of speech name for *code*.\n\n :param str code: The part of speech code to lookup, e.g. ``'nsf'``.\n :param str...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getNextFile(files): return random.choice(files) <|reserved_special_token_0|> def getRandomFile(folder='test/'): files = listFiles(folder) filename = getNextFile(files) return filename def play(filename): f = wave.open(filename, 'rb') p = pyaudio.PyAudio()...
flexible
{ "blob_id": "a3bcd383656284a2236e79b5d5d7acdfe433a13b", "index": 8409, "step-1": "<mask token>\n\n\ndef getNextFile(files):\n return random.choice(files)\n\n\n<mask token>\n\n\ndef getRandomFile(folder='test/'):\n files = listFiles(folder)\n filename = getNextFile(files)\n return filename\n\n\ndef pl...
[ 3, 4, 5, 6, 7 ]
from eth_account.account import Account from nucypher.characters.lawful import Alice, Bob, Ursula from nucypher.network.middleware import RestMiddleware from nucypher.data_sources import DataSource from umbral.keys import UmbralPublicKey import sys import os import binascii import shutil import maya import datetime te...
normal
{ "blob_id": "bc843abecfc076c9413498f9ebba0da0857ad3cc", "index": 4103, "step-1": "<mask token>\n\n\nclass Author(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Book(object):\n\n def __init__(self, author):\n self.author = author\n self.content = b'PlainText of the book...
[ 14, 19, 20, 22, 23 ]
""" Question 39: Define a function which can generate a list where the values are square of numbers between 1 and 20 (both included). Then the function needs to print the last 5 elements in the list. """ #To get a value from console input. input_num = input("Write number:") lis1=[] lis2=[] def lis(n1,n2): """ Gener...
normal
{ "blob_id": "24c1f5195bad17f995fb97a03218fc9bbe5ce4cd", "index": 2476, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lis(n1, n2):\n \"\"\"\n\tGenerate and print last 5 element in list.\n\tparam:n1,n2\n\t\"\"\"\n i = 0\n if n1 and n2 <= 20:\n for x in range(n1, n2 + 1):\n ...
[ 0, 1, 2, 3, 4 ]
def assert_shapes(shape, other): assert len(shape) == len(other), "Dimensions are different" for s, o in zip(shape, other): if s is not None and o is not None: assert s == o, "Shapes {} and {} are not equal".format(shape, other)
normal
{ "blob_id": "337311c3fbb6a8baab7a237d08152f0db9822527", "index": 2931, "step-1": "<mask token>\n", "step-2": "def assert_shapes(shape, other):\n assert len(shape) == len(other), 'Dimensions are different'\n for s, o in zip(shape, other):\n if s is not None and o is not None:\n assert s ...
[ 0, 1, 2 ]
from .__init__ import * 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 with height = {a}{unit} and radius = {b}{unit} is" ans = int(math.pi * b * s...
normal
{ "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 ]
from . import views from django.conf.urls import url,re_path enquiryUrlPattern = [ url(r'daily-rate-enquiry', views.daily_rate_enquiry_form), re_path(r'^contact-us-landing-page/$', views.contact_us_landing_page), ]
normal
{ "blob_id": "ccf1710cff972eaa06e1ccb5ebedc70d946e3215", "index": 4906, "step-1": "<mask token>\n", "step-2": "<mask token>\nenquiryUrlPattern = [url('daily-rate-enquiry', views.\n daily_rate_enquiry_form), re_path('^contact-us-landing-page/$', views.\n contact_us_landing_page)]\n", "step-3": "from . im...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class GerberCanvas: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, frame): self.x_format = '' self.y_format = '' self.units...
flexible
{ "blob_id": "6b2f10449909d978ee294a502a376c8091af06e0", "index": 1285, "step-1": "<mask token>\n\n\nclass GerberCanvas:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, frame):\n self.x_format = ''\n self.y_format = ''\n self...
[ 18, 19, 20, 23, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class InterpFrontExtractor(FrontExtractorOp): <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def extract(cls, node): proto_layer = node.pb param = proto_layer.interp_param...
flexible
{ "blob_id": "ce28462621a423c6661c672cf92d7e9c91875cfa", "index": 8247, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass InterpFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token>\n\n @classmethod\n def extract(cls, node):\n proto_layer = node.pb\n param = prot...
[ 0, 2, 3, 4, 5 ]
##Arithmatic Progression a = int(input ('Enter first number: ')) d = int(input('Enter common difference: ')) n = int(input('Number of term: ')) tn = a while tn <= a + (n - 1) * d: print(tn, end=" ") tn += d
normal
{ "blob_id": "e748261d1e5fd7921a022afefe5a5bea1fbfc67c", "index": 9095, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile tn <= a + (n - 1) * d:\n print(tn, end=' ')\n tn += d\n", "step-3": "a = int(input('Enter first number: '))\nd = int(input('Enter common difference: '))\nn = int(input('Numb...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> arrayMapPath = 'C:\\Python27\\Lib\\site-packages\\ticketpitcher\\data' tempPath = 'd:\\temp\\' <|reserved_special_token_1|> # -*- coding: utf-8 -*- """ Created on Fri Nov 14 22:09:56 2014 @author: duhan """ #arrayMapPath = r'/...
flexible
{ "blob_id": "9627e8a468d3a75787c5a9e01856913fc8beb3c4", "index": 1868, "step-1": "<mask token>\n", "step-2": "<mask token>\narrayMapPath = 'C:\\\\Python27\\\\Lib\\\\site-packages\\\\ticketpitcher\\\\data'\ntempPath = 'd:\\\\temp\\\\'\n", "step-3": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Nov 14 22:09...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Model(nn.Module): <|reserved_special_token_0|> def forward(self, input_seq, target_seq=None): input_seq = self.fc_embedding(input_seq.unsqueeze(-1)) _, encoding_result = self.encoder(input_seq) encoding_result = torch.transpose(encoding_result, 0, 1)...
flexible
{ "blob_id": "188f82b0fb04d6814d77617fa9148113d0e6ef01", "index": 2170, "step-1": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n\n def forward(self, input_seq, target_seq=None):\n input_seq = self.fc_embedding(input_seq.unsqueeze(-1))\n _, encoding_result = self.encoder(input_seq)...
[ 4, 5, 6, 7, 8 ]
from django.conf.urls import url from .views import LoginView, logout_user, delete_user from .views import NewUserView urlpatterns = [ url(r'newuser/', NewUserView.as_view(), name='newuser'), url(r'login/', LoginView.as_view(), name='login'), url(r'logout/', logout_user, name='logout'), url(r'delete/$'...
normal
{ "blob_id": "9b4bc7f8f9c96f503a5ed79827430963e21718c4", "index": 3733, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('newuser/', NewUserView.as_view(), name='newuser'), url(\n 'login/', LoginView.as_view(), name='login'), url('logout/',\n logout_user, name='logout'), url('delete...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def scheduleMultipoint(driver): driver.find_element_by_id('com.dentist.android:id/calendarBt').click() driver.find_element_by_id('com.dentist.android:id/addIb').click() def time(driver): driver.find_element_by_id('com.dentist.android:id/cureHourLl').click() driver.find_e...
flexible
{ "blob_id": "02bc97b963b970993fc947cfa41c73230dd4d9e4", "index": 2649, "step-1": "<mask token>\n\n\ndef scheduleMultipoint(driver):\n driver.find_element_by_id('com.dentist.android:id/calendarBt').click()\n driver.find_element_by_id('com.dentist.android:id/addIb').click()\n\n\ndef time(driver):\n driver...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) ->ListNode: ret = itr = ListNode(-sys.maxsize) while l1 and l2: v1 = l1.val ...
flexible
{ "blob_id": "2730b2a1016f306936dcac3c3b44a3fd7194bac6", "index": 7216, "step-1": "<mask token>\n\n\nclass ListNode:\n\n def __init__(self, val=0, next=None):\n self.val = val\n self.next = next\n\n\nclass Solution:\n\n def mergeTwoLists(self, l1: ListNode, l2: ListNode) ->ListNode:\n r...
[ 4, 6, 7, 8, 9 ]
from django.contrib.auth.models import User from django.test import Client from django.utils.timezone import localdate from pytest import fixture from operations.models import ToDoList @fixture def user(db): return User.objects.create( username='test', email='saidazimovaziza@gmail.com', password=...
normal
{ "blob_id": "347d468f15dee8a8219d201251cedffe21352f7c", "index": 8813, "step-1": "<mask token>\n\n\n@fixture\ndef authenticated_author_client(user, client: Client) ->Client:\n token = Token.objects.get_or_create(user=user)[0].key\n client.defaults['HTTP_AUTHORIZATION'] = f'Token {token}'\n print(client)...
[ 1, 2, 3, 4, 5 ]
# This file is part of the printrun suite. # # printrun is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # printrun is distributed in ...
normal
{ "blob_id": "3cc473f6bb4b2e1dd806edb8b096a6118fe7056a", "index": 7202, "step-1": "<mask token>\n\n\nclass NoViz:\n <mask token>\n <mask token>\n <mask token>\n\n def addfile(self, *a, **kw):\n pass\n\n def addgcode(self, *a, **kw):\n pass\n\n def addgcodehighlight(self, *a, **kw):...
[ 9, 10, 11, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(citations): citations.sort() for i in range(len(citations)): if citations[i] >= len(citations) - i: return len(citations) - i <|reserved_special_token_0|> <|reserved_special_token_1|> def solution(citations): ...
flexible
{ "blob_id": "0b3d6339faf9d66d4e1338599e4784fac0f63d3f", "index": 5310, "step-1": "<mask token>\n", "step-2": "def solution(citations):\n citations.sort()\n for i in range(len(citations)):\n if citations[i] >= len(citations) - i:\n return len(citations) - i\n\n\n<mask token>\n", "step-...
[ 0, 1, 2, 3 ]
import pandas as pd import pyranges as pr import numpy as np import sys import logging from methplotlib.utils import file_sniffer import pysam class Methylation(object): def __init__(self, table, data_type, name, called_sites): self.table = table self.data_type = data_type self.name = name...
normal
{ "blob_id": "d654aea3da3e36ccde8a5f4e03798a0dea5aad8a", "index": 510, "step-1": "<mask token>\n\n\nclass Methylation(object):\n\n def __init__(self, table, data_type, name, called_sites):\n self.table = table\n self.data_type = data_type\n self.name = name\n self.called_sites = cal...
[ 5, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> s3_resource.create_bucket(Bucket=YOUR_BUCKET_NAME, CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'}) s3_resource.Bucket(first_bucket_name).upload_file(Filename=first_file_name, Key=first_file_name) s3_resource...
flexible
{ "blob_id": "44097da54a0bb03ac14196712111a1489a956689", "index": 5387, "step-1": "<mask token>\n", "step-2": "<mask token>\ns3_resource.create_bucket(Bucket=YOUR_BUCKET_NAME,\n CreateBucketConfiguration={'LocationConstraint': 'eu-west-1'})\ns3_resource.Bucket(first_bucket_name).upload_file(Filename=first_fi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def square_matrix_simple(matrix=[]): """This function will compute the square root of all integers in a matrix. """ new_matrix = [] for index in matrix: jndex = 0 new_row = [] ...
flexible
{ "blob_id": "b090e92fe62d9261c116529ea7f480daf8b3e84e", "index": 6543, "step-1": "<mask token>\n", "step-2": "def square_matrix_simple(matrix=[]):\n \"\"\"This function will compute the square root of all integers in\n a matrix. \"\"\"\n new_matrix = ...
[ 0, 1, 2 ]
__author__ = 'tomer' import sqlite3 from random import randint import test_data def init_database(conn): c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS catalogs (id INTEGER PRIMARY KEY AUTOINCREMENT, catalog_name TEXT)''') c.execute('''CREATE TABLE IF NOT EXISTS products ...
normal
{ "blob_id": "46b1e5adbd956c35820d7d2b17628364388cdcd7", "index": 3638, "step-1": "<mask token>\n\n\ndef init_database(conn):\n c = conn.cursor()\n c.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS catalogs\n (id INTEGER PRIMARY KEY AUTOINCREMENT, catalog_name TEXT)\"\"\"\n )\n ...
[ 9, 17, 19, 20, 21 ]
import itertools import numpy as np import pandas as pd from scipy.sparse import coo_matrix def merge_and_split(inputs, labels): df = inputs.reset_index().merge(labels.reset_index(), on='utterance', how='inner').set_index('utterance') return df.feat, df.label def list_to_sparse(inputs): """Conve...
normal
{ "blob_id": "912928cea0f96e601eecfcb6dba695ef26a3c6e2", "index": 9618, "step-1": "<mask token>\n\n\nclass BatchGenerator(object):\n\n def __init__(self, data, batch_size=1):\n self.inputs, self.labels = data\n self.batch_size = batch_size\n self.data_length = len(self.inputs)\n sel...
[ 5, 6, 7, 8 ]
# aitoff projection # see: # https://en.wikipedia.org/wiki/Aitoff_projection def aitoff_projection(theta, phi): import numpy as np # theta, phi in radian theta = theta - np.pi cos_phi = np.cos(phi) denom = np.sqrt(1 + cos_phi * np.cos(theta/2)) x = 180 * cos_phi * np.sin(theta/2) / denom x =...
normal
{ "blob_id": "0dcf90514543a1ca801e82cd402b3e1002b1f5d0", "index": 9262, "step-1": "<mask token>\n", "step-2": "def aitoff_projection(theta, phi):\n import numpy as np\n theta = theta - np.pi\n cos_phi = np.cos(phi)\n denom = np.sqrt(1 + cos_phi * np.cos(theta / 2))\n x = 180 * cos_phi * np.sin(th...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in a: for j in b: for k in c: if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2: print(i) print(j) print(k) break <|res...
flexible
{ "blob_id": "34947b7ed300f2cbcbf9042fee3902458921d603", "index": 2912, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n for j in b:\n for k in c:\n if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2:\n print(i)\n print(j)\n ...
[ 0, 1, 2 ]
import time from tests.test_base import BaseTest from pages.campo_de_treinamento_page import CampoDeTreinamentoPage class TestCadastro(BaseTest): def test_cadastro_com_sucesso(self): self.campoDeTreinamento = CampoDeTreinamentoPage(self.driver) self.campoDeTreinamento.fill_name("Everton") ...
normal
{ "blob_id": "4e50a7a757bacb04dc8f292bdaafb03c86042e6c", "index": 1633, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestCadastro(BaseTest):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestCadastro(BaseTest):\n\n def test_cadastro_com_sucesso(self):\n self.campoDeTrein...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in range(1, 5): for y in range(1, 5): for z in range(1, 5): if (x != y) & (x != z) & (y != z): print(x, y, z) <|reserved_special_token_1|> ''' 简述:这里有四个数字,分别是:1、2、3、4 提问:能组成多少个互不相同且无...
flexible
{ "blob_id": "caac877bf6c42217ea41f51717f6a704a3a9774b", "index": 6838, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(1, 5):\n for y in range(1, 5):\n for z in range(1, 5):\n if (x != y) & (x != z) & (y != z):\n print(x, y, z)\n", "step-3": "''' 简述:这里有...
[ 0, 1, 2 ]
from __future__ import annotations import math from abc import abstractmethod from pytown_core.patterns.behavioral import Command from pytown_core.serializers import IJSONSerializable from .buildings import BuildingProcess, BuildingTransaction from .buildings.factory import BuildingFactory from .check import ( A...
normal
{ "blob_id": "22b9868063d6c5fc3f8b08a6e725fff40f4a1a03", "index": 3886, "step-1": "<mask token>\n\n\nclass BuildCommand(ServerCommand):\n\n def __init__(self, tile: tuple, building_name: str):\n ServerCommand.__init__(self)\n self._tile = tile\n self._building_name = building_name\n <ma...
[ 72, 74, 84, 86, 98 ]
<|reserved_special_token_0|> @app.errorhandler(404) def not_found(error): return make_response(jsonify({'error': 'Not found'}), 404) <|reserved_special_token_0|> @app.route('/api/{}/reason/apply'.format(VERSION_STRING), methods=['GET', 'POST']) def reason_apply(): rule_id = request.args.get('id') ...
flexible
{ "blob_id": "49e1dc98ecc2e5c12c6e520721a6c0a7c2665cca", "index": 3450, "step-1": "<mask token>\n\n\n@app.errorhandler(404)\ndef not_found(error):\n return make_response(jsonify({'error': 'Not found'}), 404)\n\n\n<mask token>\n\n\n@app.route('/api/{}/reason/apply'.format(VERSION_STRING), methods=['GET',\n '...
[ 4, 5, 9, 10, 11 ]
<|reserved_special_token_0|> def get_center(res_list): coord = [] for atom in residue: at = atom.coord x = at[0] y = at[1] z = at[2] atcord = [x, y, z] coord.append(atcord) x = 0 y = 0 z = 0 i = 0 for point in coord: i = i + 1 ...
flexible
{ "blob_id": "8b29c12c294a8614d8be96c312ecffa9d3bcb3f8", "index": 4575, "step-1": "<mask token>\n\n\ndef get_center(res_list):\n coord = []\n for atom in residue:\n at = atom.coord\n x = at[0]\n y = at[1]\n z = at[2]\n atcord = [x, y, z]\n coord.append(atcord)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for k in data: for key in correlation_dict: if data[k] in key: data[k] = correlation_dict[key] print(data) <|reserved_special_token_1|> dict1 = [{'a': 1}, {'a': 2}, {'a': 3}] a = dict1[1]['a'] correlatio...
flexible
{ "blob_id": "9c05b39a12ab29db99397e62315efddd8cdf1df4", "index": 456, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in data:\n for key in correlation_dict:\n if data[k] in key:\n data[k] = correlation_dict[key]\nprint(data)\n", "step-3": "dict1 = [{'a': 1}, {'a': 2}, {'a': 3...
[ 0, 1, 2, 3 ]
mlt = 1 mlt_sum = 0 num_sum = 0 for i in range(1,101): mlt = (i ** 2) mlt_sum += mlt num_sum += i print((num_sum ** 2) - mlt_sum)
normal
{ "blob_id": "6f877dccab8d62e34b105bbd06027cbff936e3aa", "index": 6885, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 101):\n mlt = i ** 2\n mlt_sum += mlt\n num_sum += i\nprint(num_sum ** 2 - mlt_sum)\n", "step-3": "mlt = 1\nmlt_sum = 0\nnum_sum = 0\nfor i in range(1, 101):\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ShopClientProtocol(asyncio.Protocol): <|reserved_special_token_0|> <|reserved_special_token_0|> def connection_made(self, transport): print('ShopClient connection_made is called\n') self.transport = transport startbuy = RequestToBuy() pri...
flexible
{ "blob_id": "a12f9435eb4b090bc73be14ad64fdf43c5caa4d2", "index": 7471, "step-1": "<mask token>\n\n\nclass ShopClientProtocol(asyncio.Protocol):\n <mask token>\n <mask token>\n\n def connection_made(self, transport):\n print('ShopClient connection_made is called\\n')\n self.transport = tran...
[ 5, 7, 9, 10, 12 ]
#!/usr/bin/env python3 import sys from pathlib import Path def print_usage(): sys.stderr.write(''' Find the length of the biggest line in the file. Usage: ./biggestLine <delimiter> <field number - first element is 0> <file path> ''') def main(): if len(sys.argv) != 4: print_usage() ...
normal
{ "blob_id": "c84175edb88f5b9219c22ec717ec30bb530982a2", "index": 2861, "step-1": "<mask token>\n\n\ndef print_usage():\n sys.stderr.write(\n \"\"\"\nFind the length of the biggest line in the file.\nUsage: ./biggestLine <delimiter> <field number - first element is 0> <file path>\n \"\"\"\n ...
[ 1, 2, 3, 4, 5 ]
prompt = "Enter a message and I will repeat it to you: " message = " " while message != 'quit': message = input(prompt) if message != 'quit': print(message) # using the 'flag' variable prompt = "Enter a message and I will repeat it to you: " # active is the variable used in this case as flag activ...
normal
{ "blob_id": "1a6f84835ec2f5fbbb064aef2cd872c24eb3839d", "index": 8717, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile message != 'quit':\n message = input(prompt)\n if message != 'quit':\n print(message)\n<mask token>\nwhile active:\n message = input(prompt)\n if message == 'quit...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> source = cms.Source('PoolSource', fileNames=cms.untracked.vstring( '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/sherpaevents_10_1_Kji.root' , '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mg...
flexible
{ "blob_id": "aaeca18f3771a6032c0fe51b75502f730c888888", "index": 9383, "step-1": "<mask token>\n", "step-2": "<mask token>\nsource = cms.Source('PoolSource', fileNames=cms.untracked.vstring(\n '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/sherpaevents_10_1_Kji.root'\n ,\n '/stor...
[ 0, 1, 2, 3 ]
# Visit 2.12.3 log file ScriptVersion = "2.12.3" if ScriptVersion != Version(): print "This script is for VisIt %s. It may not work with version %s" % (ScriptVersion, Version()) visit.ShowAllWindows() visit.ShowAllWindows() visit.OpenDatabase("test.vtk", 0) # The UpdateDBPluginInfo RPC is not supported in the VisIt...
normal
{ "blob_id": "6d0cfc9d5bbc45bfa356c45a7cdb9f4822b03e0a", "index": 2983, "step-1": "# Visit 2.12.3 log file\nScriptVersion = \"2.12.3\"\nif ScriptVersion != Version():\n print \"This script is for VisIt %s. It may not work with version %s\" % (ScriptVersion, Version())\nvisit.ShowAllWindows()\nvisit.ShowAllWind...
[ 0 ]
<|reserved_special_token_0|> class CrawlerDetail: def __init__(self): self.proxy = Proxies() def start_consume(self): channel = connection.channel() channel.queue_declare(queue='usual_article') channel.basic_qos(prefetch_count=1) channel.basic_consume(self.consume_art...
flexible
{ "blob_id": "cd1d8a73b6958775a212d80b50de74f4b4de18bf", "index": 6319, "step-1": "<mask token>\n\n\nclass CrawlerDetail:\n\n def __init__(self):\n self.proxy = Proxies()\n\n def start_consume(self):\n channel = connection.channel()\n channel.queue_declare(queue='usual_article')\n ...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in sys.stdin: m = re_entry_begin.match(line) if m: if first_line_met: sys.stdout.write(signature_format.format(date=current_date)) version = m.group('version') sys.stdout.write(...
flexible
{ "blob_id": "03677f02473019fcc6a40d91569a85be78ca0a87", "index": 7179, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n m = re_entry_begin.match(line)\n if m:\n if first_line_met:\n sys.stdout.write(signature_format.format(date=current_date))\n versio...
[ 0, 1, 2, 3, 4 ]
def bfs(graph, start): queue = [start] queued = list() path = list() while queue: print('Queue is: %s' % queue) vertex = queue.pop(0) print('Processing %s' % vertex) for candidate in graph[vertex]: if candidate not in queued: queued.append(cand...
normal
{ "blob_id": "7bb49712c4ef482c64f3c2a457a766de691ba7c3", "index": 9427, "step-1": "<mask token>\n", "step-2": "def bfs(graph, start):\n queue = [start]\n queued = list()\n path = list()\n while queue:\n print('Queue is: %s' % queue)\n vertex = queue.pop(0)\n print('Processing %s...
[ 0, 1 ]
'''CLASS message_unpacker Message bodies sent through RabbitMQ may take various forms. They were packed accordingly by the message_packager. This class reverses the process. Currently, only implemented for message bodies represented as strings, but could also handle various image formats in a real use ...
normal
{ "blob_id": "2afc1027c6866e8ab9584a5f7feef4470661f763", "index": 4246, "step-1": "<mask token>\n\n\nclass MessageUnpacker:\n <mask token>\n <mask token>\n\n def unpack_json_to_dict(self, incoming_json):\n record_as_dict = json.loads(incoming_json)\n return record_as_dict\n <mask token>\...
[ 2, 4, 5, 6, 7 ]
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
normal
{ "blob_id": "445e91edbeb88a3e300761342b28369fd9833fbb", "index": 5727, "step-1": "<mask token>\n\n\nclass TestCases(unittest.TestCase):\n\n def test_chart_cell(self):\n t = [{'country': 'US', 'quantity': 100}, {'country': 'ZA',\n 'quantity': 50}]\n IPython.get_ipython().user_ns = {}\n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(int(first_digit) + int(second_digit)) <|reserved_special_token_1|> two_digit_number = input('Type a two digit number: ') first_digit = two_digit_number[0] second_digit = two_digit_number[1] print(int(first_digit) + int(se...
flexible
{ "blob_id": "7d65e4e925e90d6b013ae2c059cde58538884d22", "index": 7239, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(int(first_digit) + int(second_digit))\n", "step-3": "two_digit_number = input('Type a two digit number: ')\nfirst_digit = two_digit_number[0]\nsecond_digit = two_digit_number[1]\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='discord-ext-menus', author='TierGamerpy', url= 'https://github.com/TierGamerpy/discord-ext-menus', version=0.1, packages=['discord.ext.menus'], description= 'An extension module to make reaction based menus...
flexible
{ "blob_id": "daa287eeb967d47c9a8420beccf531d9c157e925", "index": 3217, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='discord-ext-menus', author='TierGamerpy', url=\n 'https://github.com/TierGamerpy/discord-ext-menus', version=0.1,\n packages=['discord.ext.menus'], description=\n 'An...
[ 0, 1, 2 ]
from django.contrib import admin # from .models import Usuario # from .models import Lote # from .models import Fornecedor # from .models import Cliente # from .models import Medicamento # from .models import Medicamento_Entrada # from .models import Medicamento_Saida # Register your models here. # # class UsuarioAdmin...
normal
{ "blob_id": "63a2258bf0ed779254b68a683e3d30e9fb356b1f", "index": 139, "step-1": "<mask token>\n", "step-2": "from django.contrib import admin\n", "step-3": "from django.contrib import admin\n# from .models import Usuario\n# from .models import Lote\n# from .models import Fornecedor\n# from .models import Cli...
[ 0, 1, 2 ]
from selenium import webdriver from selenium.webdriver.common.keys import Keys def test_register_new_accont(self): cos = self.cos cos.get("https://wizzair.com/pl-pl#/") cos.find_elements_by_class_name('navigation__button navigation__button--simple').click() cos.find_elements_by_class_name('content__lin...
normal
{ "blob_id": "6efd22feb4f96de74633276b1ec8550f8d853075", "index": 2657, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_register_new_accont(self):\n cos = self.cos\n cos.get('https://wizzair.com/pl-pl#/')\n cos.find_elements_by_class_name(\n 'navigation__button navigation__butt...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if a >= 0: if c >= 0: ans = b * d elif d >= 0: ans = b * d else: ans = a * d elif b >= 0: if c >= 0: ans = b * d elif d >= 0: ans = max(b * d, a * c) else: an...
flexible
{ "blob_id": "be37a7596850050af58f735e60bdf13594715caf", "index": 4928, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a >= 0:\n if c >= 0:\n ans = b * d\n elif d >= 0:\n ans = b * d\n else:\n ans = a * d\nelif b >= 0:\n if c >= 0:\n ans = b * d\n elif d >= 0:...
[ 0, 1, 2, 3 ]
from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import PowerTransformer from sklearn.preprocessing import RobustScaler from sklearn.preprocessing import Normalizer from sklearn.preprocessing import MinMaxScaler import pandas as pd import numpy as np def preprocess_transformers(y_train, tra...
normal
{ "blob_id": "890d50c741ffd576312c63dc450e274b4517bf12", "index": 9856, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef preprocess_transformers(y_train, transf):\n if transf != 'ln':\n if transf == 'minmax':\n scaler = MinMaxScaler()\n scaler2 = MinMaxScaler()\n ...
[ 0, 2, 3, 4, 5 ]
# OpenWeatherMap API Key api_key = "078c8443640961d5ce547c8269db5fd7"
normal
{ "blob_id": "4eb3d94a5fd22fc29000ec32475de9cbae1c183a", "index": 5255, "step-1": "<mask token>\n", "step-2": "api_key = '078c8443640961d5ce547c8269db5fd7'\n", "step-3": "# OpenWeatherMap API Key\napi_key = \"078c8443640961d5ce547c8269db5fd7\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
# coding: utf-8 """ Created on Mon Oct 29 12:57:40 2018 @authors Jzhu, Lrasmy , Xin128 @ DeguiZhi Lab - UTHealth SBMI Last updated Feb 20 2020 """ #general utilities from __future__ import print_function, division from tabulate import tabulate import numpy as np import random import matplotlib.pyplot as plt try: ...
normal
{ "blob_id": "0cef70b8d661fe01ef4a1eda83a21e1186419a0d", "index": 5038, "step-1": "<mask token>\n\n\nclass EHRdataFromPickles(Dataset):\n\n def __init__(self, root_dir, file=None, transform=None, sort=True,\n model='RNN', test_ratio=0, valid_ratio=0):\n \"\"\"\n Args:\n 1) root_...
[ 15, 16, 17, 18, 19 ]
class Action(dict): def __init__(self, action, player=None, target=None): self['action'] = action self['player'] = player if target != None: self['target'] = target
normal
{ "blob_id": "1c9345923fe83aa0ee7165ce181ce05ac55e2b2f", "index": 7773, "step-1": "<mask token>\n", "step-2": "class Action(dict):\n <mask token>\n", "step-3": "class Action(dict):\n\n def __init__(self, action, player=None, target=None):\n self['action'] = action\n self['player'] = player...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(config_path, 'r', encoding='utf-8') as f: conf = yaml.load(f.read(), Loader=yaml.FullLoader) <|reserved_special_token_1|> <|reserved_special_token_0|> config_path = os.path.join(os.path.dirname(os.path.abspath(__f...
flexible
{ "blob_id": "8834548f6180fc864d73a71194125b22d230a393", "index": 6882, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(config_path, 'r', encoding='utf-8') as f:\n conf = yaml.load(f.read(), Loader=yaml.FullLoader)\n", "step-3": "<mask token>\nconfig_path = os.path.join(os.path.dirname(os.pa...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def buddyStrings(self, A: str, B: str) ->bool: if len(A) != len(B): return ...
flexible
{ "blob_id": "dd902f99ee8dc23f56641b8e75544a2d4576c19a", "index": 4437, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def buddyStrings(self, A: str, B: str) ->bool:\n if len(A) != len(B):\n r...
[ 0, 1, 2, 3 ]
__author__ = 'Administrator' # 抓取IP的主要逻辑 from urllib import request import urllib.parse import logging from multiprocessing import pool from time import sleep import random from lxml import etree def getRandomUserAgnet(): user_agents=[ "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Ge...
normal
{ "blob_id": "911631e96d21bdf22a219007f1bdc04a5e6965dc", "index": 739, "step-1": "<mask token>\n\n\ndef getRandomUserAgnet():\n user_agents = [\n 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 QIHU 360S'\n ]\n userAgent = random.ch...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def minDominoRotations(self, A: List[int], B: List[int]) ->int: if not A or not B: ...
flexible
{ "blob_id": "069d85370d8358aa884b5195a1b52c0014efd161", "index": 7637, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def minDominoRotations(self, A: List[int], B: List[int]) ->int:\n if not A or not B:...
[ 0, 1, 2, 3 ]
import json import urllib while True: # Get input URL url = raw_input("Enter URL: ") # Check valid input if len(url) < 1: break # Get data print("Retrieving", url) connection = urllib.urlopen(url) data = connection.read() print("Retrieved", len(data), "characters") # P...
normal
{ "blob_id": "4cdd5fc15096aac01ad6d97d38ef7397859de18b", "index": 5470, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n url = raw_input('Enter URL: ')\n if len(url) < 1:\n break\n print('Retrieving', url)\n connection = urllib.urlopen(url)\n data = connection.read()\n ...
[ 0, 1, 2, 3 ]