code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from .alexnet import * from .lenet import * from .net import * from .vae import *
normal
{ "blob_id": "56d5915d30e85285da549cc69ef25714bacc6f3a", "index": 8304, "step-1": "<mask token>\n", "step-2": "from .alexnet import *\nfrom .lenet import *\nfrom .net import *\nfrom .vae import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class TrackwayDirectionStage(CurveOrderedAnalysisStage): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, key, owner, **kwargs): """Creates a new instance of TrackwayDirectio...
flexible
{ "blob_id": "a721adaaa69bf09c2ea259f12bea05515c818679", "index": 5327, "step-1": "<mask token>\n\n\nclass TrackwayDirectionStage(CurveOrderedAnalysisStage):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, key, owner, **kwargs):\n \"\"\"Creates a new instan...
[ 7, 9, 11, 13, 17 ]
<|reserved_special_token_0|> class BaseDataClass: def _create_insert_query(self): column_names = '' row_values = '' values = [] for column_name, row_value in self.__dict__.items(): if column_name.startswith('_'): continue if column_name == '...
flexible
{ "blob_id": "8339ac512d851ea20938a1fbeedcb751cb2b8a6a", "index": 4337, "step-1": "<mask token>\n\n\nclass BaseDataClass:\n\n def _create_insert_query(self):\n column_names = ''\n row_values = ''\n values = []\n for column_name, row_value in self.__dict__.items():\n if co...
[ 6, 12, 18, 19, 20 ]
# coding=utf8 def InsertSort(array_a, n): for i in range(1, n): temp = array_a[i] j = i - 1 while temp < array_a[j] and j >= 0: array_a[j + 1] = array_a[j] # 如果小于其前驱,则从后往前寻找插入位置并后移。 j -= 1 array_a[j + 1] = temp return array_a def ShellSort(array_a, n):...
normal
{ "blob_id": "a01783e3687278d1ec529c5123b9151721ba3364", "index": 3033, "step-1": "# coding=utf8\n\ndef InsertSort(array_a, n):\n for i in range(1, n):\n temp = array_a[i]\n j = i - 1\n while temp < array_a[j] and j >= 0:\n array_a[j + 1] = array_a[j] # 如果小于其前驱,则从后往前寻找插入位置并后移。\...
[ 0 ]
import main from pytest import approx def test_duration(): ins = main.convert() names = ins.multiconvert() for name in names: induration, outduration = ins.ffprobe(name[0], name[1]) assert induration == approx(outduration) induration, outduration = ins.ffprobe(name[0], name[2]) ...
normal
{ "blob_id": "92c247b827d2ca4dce9b631a2c09f2800aabe216", "index": 6129, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_duration():\n ins = main.convert()\n names = ins.multiconvert()\n for name in names:\n induration, outduration = ins.ffprobe(name[0], name[1])\n assert...
[ 0, 1, 2, 3, 4 ]
import os import sendgrid class Mail: def __init__(self, to, subject, msg): self.to = to self.subject = subject self.msg = msg def send(self): sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_KEY', '')) message = sendgrid.Mail() message.add_to(self.to) ...
normal
{ "blob_id": "bf60e34190f4c453c85baaf2fbbff027fb77b7c8", "index": 4512, "step-1": "import os\nimport sendgrid\n\n\nclass Mail:\n def __init__(self, to, subject, msg):\n self.to = to\n self.subject = subject\n self.msg = msg\n\n def send(self):\n sg = sendgrid.SendGridClient(os.en...
[ 0 ]
<|reserved_special_token_0|> def getTracks(result): data = json.loads(result.content.decode('utf-8')) tracks = data['response']['items'] tracks.reverse() return tracks def getMp3FromM3u8(url): if url.find('index.m3u8?') == -1: return url parts = url.split('/') newUrl = parts[0] +...
flexible
{ "blob_id": "47817d6cf58ac54e501ed24ae3ababc821bdd5c8", "index": 1949, "step-1": "<mask token>\n\n\ndef getTracks(result):\n data = json.loads(result.content.decode('utf-8'))\n tracks = data['response']['items']\n tracks.reverse()\n return tracks\n\n\ndef getMp3FromM3u8(url):\n if url.find('index....
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_score1() ->None: package = {'close': 13.92, 'high': 14.57, 'low': 12.45, 'open': 13.4584, 'symbol': 'FANG', 'timestamp': 1627493640000000000, 'trade_count': 602, 'volume': 213907, 'vwap': 8.510506} ...
flexible
{ "blob_id": "ec64ddd01034debadb6674e71125f673f5de8367", "index": 567, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_score1() ->None:\n package = {'close': 13.92, 'high': 14.57, 'low': 12.45, 'open': 13.4584,\n 'symbol': 'FANG', 'timestamp': 1627493640000000000, 'trade_count': \n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class HtmlButton(BaseButton): def render(self): print('Render html button') <|reserved_special_token_0|> class BaseDialog: @abstractmethod def create_button(self) ->BaseButton: pass def render(self): ok_btn = self.create_button() ok...
flexible
{ "blob_id": "003976d850e371e01e6d0a307d3cf366f962c53d", "index": 4358, "step-1": "<mask token>\n\n\nclass HtmlButton(BaseButton):\n\n def render(self):\n print('Render html button')\n <mask token>\n\n\nclass BaseDialog:\n\n @abstractmethod\n def create_button(self) ->BaseButton:\n pass\...
[ 14, 15, 19, 23, 24 ]
#!/usr/bin/env python # coding: utf-8 from unittest import TestCase from optimoida.logging import ( SUCCESS, FAILURE, logger) class LoggerTestCase(TestCase): def test_flag_value(self): self.assertEqual(SUCCESS, "\x1b[34mSUCCESS\x1b[0m") self.assertEqual(FAILURE, "\x1b[31mFAILURE\x1b[0m") ...
normal
{ "blob_id": "ac8c8dc4bcccef7942dd48d54902e13e811f950c", "index": 5059, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LoggerTestCase(TestCase):\n\n def test_flag_value(self):\n self.assertEqual(SUCCESS, '\\x1b[34mSUCCESS\\x1b[0m')\n self.assertEqual(FAILURE, '\\x1b[31mFAILURE\\...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/python3 ''' FileStorage module ''' import json from models.base_model import BaseModel import models from models.user import User from models.place import Place from models.state import State from models.city import City from models.amenity import Amenity from models.review import Review class FileStorage:...
normal
{ "blob_id": "5461d50d3c06bc4276044cc77bd804f6e7c16b3b", "index": 1278, "step-1": "<mask token>\n\n\nclass FileStorage:\n <mask token>\n <mask token>\n <mask token>\n\n def all(self):\n \"\"\"\n Return:\n the dictionary __objects\n \"\"\"\n return self.__objects\n ...
[ 3, 5, 7, 8, 9 ]
from tkinter import * from math import * #Raiz root=Tk() root.title('Calculadora LE-1409') root.iconbitmap('calculadora.ico') root.geometry('510x480') root.config(bg='gray42') root.resizable(False, False) #Pantalla screen=Entry(root, font=("arial",20, "bold"), width=22, borderwidth=10, background="CadetBlue1", justi...
normal
{ "blob_id": "1a42892095d820f1e91ba5e7f2804b5a21e39676", "index": 2107, "step-1": "<mask token>\n\n\ndef click(valor):\n global i\n screen.insert(i, valor)\n i += 1\n\n\n<mask token>\n\n\ndef hacer_operacion():\n ecuacion = screen.get()\n try:\n result = eval(ecuacion)\n screen.delete...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class IssueCreateSerializer(serializers.ModelSerializer): <|reserved_special_token_0|> class Meta: model = Issue fields = ['issueName', 'website', 'issueBody', 'impact', 'project', 'email'] class IssueStatusSerializer(serializers.ModelSerializer): ...
flexible
{ "blob_id": "e4422010337eade12226d84c79532cdbcae68d67", "index": 1495, "step-1": "<mask token>\n\n\nclass IssueCreateSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = Issue\n fields = ['issueName', 'website', 'issueBody', 'impact', 'project',\n 'em...
[ 3, 5, 6, 7 ]
<|reserved_special_token_0|> @dataclass() class Page(object): title: str keywords: str description: str content_file: str url: str language: str last_mod: datetime.datetime phone: str = '+420 603 217 867' email: str = 'katys@katys.cz' <|reserved_special_token_0|> def __get...
flexible
{ "blob_id": "5cc18af40befab444df44bf3da1f0175e5d18983", "index": 8206, "step-1": "<mask token>\n\n\n@dataclass()\nclass Page(object):\n title: str\n keywords: str\n description: str\n content_file: str\n url: str\n language: str\n last_mod: datetime.datetime\n phone: str = '+420 603 217 8...
[ 3, 5, 6, 9, 10 ]
movies = ["Abraham Lincoln", "Blue Steel", "Behind Office Doors", "Bowery at Midnight", "Captain Kidd", "Debbie Does Dallas", "The Emperor Jones", "Rain"] movies_tuple = [("Abraham Lincoln", 1993), ("Blue Steel", 1938), ("Behind Office Doors", 1999), ("Bowery at Midnight", 2000), ("Captain Kidd",2010), ("Debbie Does D...
normal
{ "blob_id": "8435a69ee9793435c7483df9bb15f01ef8051479", "index": 3340, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(selected_movies)\n<mask token>\nprint(selected_movies2)\n", "step-3": "movies = ['Abraham Lincoln', 'Blue Steel', 'Behind Office Doors',\n 'Bowery at Midnight', 'Captain Kidd',...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from qav5.http.client import BaseClient from qav5.http.helper import api from qav5.utils import Bunch, low_case_to_camelcase class AppusersClient(BaseClient): def __init__(self, base_url, access_token=None, **kwargs): super().__init__(base_url, kwargs) self.access_token = ...
normal
{ "blob_id": "1af6bda6eb4e7a46b22379180ea82e78c67ce771", "index": 4269, "step-1": "<mask token>\n\n\nclass AppusersClient(BaseClient):\n <mask token>\n\n @api(rule='/app_users/app_order_create_info', method='get', is_json_req\n =True)\n def app_order_create_info(self, order_id: int=None):\n ...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Answer(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Task(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|r...
flexible
{ "blob_id": "06e01dce7e2342be994569099ed51d1fe28eea1c", "index": 5784, "step-1": "<mask token>\n\n\nclass Answer(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Task(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token...
[ 1, 3, 4, 5, 6 ]
from __future__ import print_function # Python 2/3 compatibility import boto3 import json import decimal AWS_KEY = '****' AWS_SECRET = '****' def handler(event, context): dynamodb = boto3.resource('dynamodb', region_name='us-west-2', aws_access_key_id=AWS_KEY , aws_secret_access_key=AWS_SECRET) table = dynamo...
normal
{ "blob_id": "511ea9eb1dc234a488c19f9ee9fbd40f81955d54", "index": 5172, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef handler(event, context):\n dynamodb = boto3.resource('dynamodb', region_name='us-west-2',\n aws_access_key_id=AWS_KEY, aws_secret_access_key=AWS_SECRET)\n table = dyn...
[ 0, 1, 2, 3, 4 ]
import pygame import pygame.freetype import sys import sqlite3 from data.player_class import Player from data.explosion_class import Explosion from data.objects_class import Bullets, Damage from data.enemy_class import Enemy from data.enemy_class import Boss from data.death_animation import Smallexplosions from data.ex...
normal
{ "blob_id": "d00fa29c502cc0311c54deb657b37c3c3caac7ca", "index": 3755, "step-1": "<mask token>\n\n\ndef draw_text(text, font_u, color, surface, x, y):\n text_object = font_u.render(text, color)\n textrect = text_object[1]\n textrect.topleft = x, y\n surface.blit(text_object[0], textrect)\n\n\n<mask t...
[ 6, 10, 11, 12, 13 ]
import graph as Graph def BFS(graph: Graph.Graph, start, end): visited = set() parent = dict() parent[start] = None queue = [] queue.append(start) visited.add(start) while queue: current = queue.pop(0) if current == end: break for v in graph.neighbors(cu...
normal
{ "blob_id": "5c5f00084f37837b749e1fbb52a18d515e09ba06", "index": 773, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef BFS(graph: Graph.Graph, start, end):\n visited = set()\n parent = dict()\n parent[start] = None\n queue = []\n queue.append(start)\n visited.add(start)\n while...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in s: if i.isupper(): u += 1 elif i.islower(): l += 1 print(u, l, end='') <|reserved_special_token_1|> s = input('enter a string') u = 0 l = 0 for i in s: if i.isupper(): u += 1 eli...
flexible
{ "blob_id": "bbb23d606b081d2591699cb6b9336c8766eea5b2", "index": 2436, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in s:\n if i.isupper():\n u += 1\n elif i.islower():\n l += 1\nprint(u, l, end='')\n", "step-3": "s = input('enter a string')\nu = 0\nl = 0\nfor i in s:\n i...
[ 0, 1, 2, 3 ]
# ეს არის კოდი, რომელიც ქმნის აბსურდს import random def get_all_words(): words = [] # ეს არის ლისტი ყველა ისეთი სიტყვის with open("poem.txt") as poem: # რომლის ასოების სიმრავლეც 6-ზე ნაკლებია for line in poem: # გრძელ სიტყვებთან თამაში რთულ...
normal
{ "blob_id": "881d0c0808d8c0e656cdbf49450367553c100630", "index": 2100, "step-1": "<mask token>\n\n\ndef get_all_words():\n words = []\n with open('poem.txt') as poem:\n for line in poem:\n line = line.strip().split(' ')\n for word in line:\n if len(word) < 6:\n ...
[ 2, 3, 4, 5, 6 ]
from math import pi width = float(input("Enter the width of the tire in mm (ex 205): ")) aspectRatio = float(input("Enter the aspect ratio of the tire (ex 60): ")) diameter = float(input("Enter the diameter of the wheel in inches (ex 15): ")) approxVolume = (pi * (width ** 2) * aspectRatio * ((width * aspectRatio) + ...
normal
{ "blob_id": "65752c8ac50205df0fea105123935110e4a30aba", "index": 7913, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'The apporximate volume is {approxVolume:.2f} liters')\n", "step-3": "<mask token>\nwidth = float(input('Enter the width of the tire in mm (ex 205): '))\naspectRatio = float(inpu...
[ 0, 1, 2, 3, 4 ]
import scipy.constants as const import scipy.optimize as opt import numpy as np import pum.algorithms as alg from pum.lines import * from pum.net import * mu = 1 eps = 2.56 b = 2.8 * const.milli C = 13.0 Z0 = 50 f0 = 1.34 * const.giga k = 10 ** ( - np.abs(C) / 20) print 'k = {}' .format( k) Z0e = ...
normal
{ "blob_id": "f81e4c9a502855dca31c6c991a08a12af1c2e2a6", "index": 7745, "step-1": "import scipy.constants as const\nimport scipy.optimize as opt\nimport numpy as np\nimport pum.algorithms as alg\nfrom pum.lines import *\nfrom pum.net import *\n\nmu = 1\neps = 2.56\nb = 2.8 * const.milli \nC = 13....
[ 0 ]
<|reserved_special_token_0|> class Button(QtGui.QPushButton): def __init__(self, *__args): super().__init__(*__args) self.setAcceptDrops(True) def dragEnterEvent(self, e): """设置接受的类型""" if e.mimeData().hasFormat('text/plain'): e.accept() else: ...
flexible
{ "blob_id": "e4b0dc2e3d9310bbe462e746e21080d309dfed84", "index": 9640, "step-1": "<mask token>\n\n\nclass Button(QtGui.QPushButton):\n\n def __init__(self, *__args):\n super().__init__(*__args)\n self.setAcceptDrops(True)\n\n def dragEnterEvent(self, e):\n \"\"\"设置接受的类型\"\"\"\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in range(100, 1000, 2): x = str(x) if x[0] == x[1] or x[0] == x[2] or x[1] == x[2]: k += 1 print(k) <|reserved_special_token_1|> k = 0 for x in range(100, 1000, 2): x = str(x) if x[0] == x[1] or x[...
flexible
{ "blob_id": "af6dd7bde25453f25c0701e4ac246ff6bce29fa7", "index": 1141, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(100, 1000, 2):\n x = str(x)\n if x[0] == x[1] or x[0] == x[2] or x[1] == x[2]:\n k += 1\nprint(k)\n", "step-3": "k = 0\nfor x in range(100, 1000, 2):\n x ...
[ 0, 1, 2 ]
from kivy.uix.boxlayout import BoxLayout from kivy.graphics import * from kivy.clock import Clock from kivy.properties import StringProperty, BooleanProperty from kivy.uix.popup import Popup import time from math import sin, pi from kivy.lang import Builder from ui.custom_widgets import I18NPopup, I18NLabel Builder....
normal
{ "blob_id": "96086885e5353f3b4b3277c1daf4ee74831c3b73", "index": 8841, "step-1": "<mask token>\n\n\nclass Dripper(BoxLayout):\n\n def __init__(self, **kwargs):\n super(Dripper, self).__init__(**kwargs)\n self.index = 0.0\n self.sections = 20\n self.section_height = 1\n self....
[ 10, 12, 14, 15, 19 ]
<|reserved_special_token_0|> def mutate(genotype_in, mut_matrix): genotype_out = np.zeros(8) for i in range(8): rand_vec = np.random.choice(8, size=int(genotype_in[i]), p= mut_matrix[i, :]) genotype_out += np.bincount(rand_vec, minlength=8) return genotype_out <|reserved_spec...
flexible
{ "blob_id": "9065842a8e90c833278547310f027bc63c7a9a47", "index": 7557, "step-1": "<mask token>\n\n\ndef mutate(genotype_in, mut_matrix):\n genotype_out = np.zeros(8)\n for i in range(8):\n rand_vec = np.random.choice(8, size=int(genotype_in[i]), p=\n mut_matrix[i, :])\n genotype_ou...
[ 7, 8, 10, 11, 12 ]
from .base import * RAVEN_CONFIG = {} ALLOWED_HOSTS = ['*']
normal
{ "blob_id": "eee60a6f46549ededfbc7b0b294ab723e2e73f7e", "index": 4490, "step-1": "<mask token>\n", "step-2": "<mask token>\nRAVEN_CONFIG = {}\nALLOWED_HOSTS = ['*']\n", "step-3": "from .base import *\nRAVEN_CONFIG = {}\nALLOWED_HOSTS = ['*']\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from api.serializers.cart import CartSerializer from api.serializers.product import ProductSerializer, ProductPopular from api.serializers.type import TypeSerializer from api.serializers.user import UserCreationSerializer, UserSerializer from api.serializers....
flexible
{ "blob_id": "f0ff15a2392b439a54c5ec304192117c08978755", "index": 4930, "step-1": "<mask token>\n", "step-2": "from api.serializers.cart import CartSerializer\nfrom api.serializers.product import ProductSerializer, ProductPopular\nfrom api.serializers.type import TypeSerializer\nfrom api.serializers.user import...
[ 0, 1 ]
<|reserved_special_token_0|> @calculate_time def factorial(num): time.sleep(2) print(math.factorial(num)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calculate_time(func): def inner_fn(*args, **kwargs): start = time.time() func(*args, ...
flexible
{ "blob_id": "7c9c13974e1deeb55f08c9e251e8c876cedcad6b", "index": 2484, "step-1": "<mask token>\n\n\n@calculate_time\ndef factorial(num):\n time.sleep(2)\n print(math.factorial(num))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef calculate_time(func):\n\n def inner_fn(*args, **kwargs):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getBoxScoreLinks(): page = requests.get(nbaBoxUrl) soup = BeautifulSoup(page.content, 'html.parser') gameLinks = [] data = soup.findAll('td', {'class': 'right gamelink'}) for div in data: links = div.findAll('a') for a in links: gameLink...
flexible
{ "blob_id": "2b3983fd6a8b31604d6d71dfca1d5b6c2c7105e0", "index": 4818, "step-1": "<mask token>\n\n\ndef getBoxScoreLinks():\n page = requests.get(nbaBoxUrl)\n soup = BeautifulSoup(page.content, 'html.parser')\n gameLinks = []\n data = soup.findAll('td', {'class': 'right gamelink'})\n for div in da...
[ 8, 9, 11, 12, 15 ]
class RetModel(object): def __init__(self, code = 0, message = "success", data = None): self.code = code self.msg = message self.data = data
normal
{ "blob_id": "ec395b93cecf8431fd0df1aa0151ebd32244c367", "index": 4941, "step-1": "<mask token>\n", "step-2": "class RetModel(object):\n <mask token>\n", "step-3": "class RetModel(object):\n\n def __init__(self, code=0, message='success', data=None):\n self.code = code\n self.msg = message...
[ 0, 1, 2, 3 ]
""" 给定两个非空链表来代表两个非负整数,位数按照逆序方式存储,它们的每个节点只存储单个数字。将这两数相加会返回一个新的链表。 你可以假设除了数字 0 之外,这两个数字都不会以零开头。 输入:(2 -> 4 -> 3) + (5 -> 6 -> 4) 输出:7 -> 0 -> 8 原因:342 + 465 = 807 """ """ 解题思路: 先计算两个节点的值和与进位的和 然后将值对10取余存放到新的链表中 循环下去 直到l1 l2 进位都不存在 """ # Definition for singly-linked list. class ListNode: def __init__(self, x): ...
normal
{ "blob_id": "80f681eb99d1e3f64cacd23ce0a4b10a74a79fe8", "index": 4223, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNode\n :type l2: ListNode\n :rtype:...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def division_v2(dividend, divisor): def get_add_num(num, times): sum = 0 for i in range(times): sum += num return sum low = 0 up = dividend while low < up: mid = round...
flexible
{ "blob_id": "edb80652de641a1a6cbb37a60cc236cd7828a96e", "index": 8151, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef division_v2(dividend, divisor):\n\n def get_add_num(num, times):\n sum = 0\n for i in range(times):\n sum += num\n return sum\n low = 0\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def demo(): return render_template('home.html', hero_mapping=hero_mapping) @app.route('/predict', methods=['POST']) def predict(): valid, res = valid_input(list(request.json)) if not valid: return res else: feature = data_to_feature(res) ...
flexible
{ "blob_id": "06605bbd91c62a02a66770ca3f37a9d2d1401ccb", "index": 9929, "step-1": "<mask token>\n\n\n@app.route('/')\ndef demo():\n return render_template('home.html', hero_mapping=hero_mapping)\n\n\n@app.route('/predict', methods=['POST'])\ndef predict():\n valid, res = valid_input(list(request.json))\n ...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-01-15 17:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Person...
normal
{ "blob_id": "4acdde648b5ec32c078579e725e6ae035298f25a", "index": 3997, "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 ]
''' Create a dictionary of fasttext embedding, stored locally fasttext import. This will hopefully make it easier to load and train data. This will also be used to store the Steps to clean scripts (codify): 1) copy direct from website (space-delimited text) 2) remove actions in ...
normal
{ "blob_id": "9a6ceeb286bb6c3d5923fe3b53be90a097e16ef5", "index": 1078, "step-1": "<mask token>\n\n\ndef convert_lines_to_arrays(content):\n \"\"\"\n convert each line in scene to an array of text\n formating when not relevant\n \"\"\"\n lines = []\n for x in content:\n line = x.s...
[ 12, 13, 15, 16, 17 ]
#!/usr/bin/env python3 #coding=utf-8 import sys import os import tool class BrandRegBasic(object): def __init__(self, base_folder, log_instance): if not os.path.exists(base_folder): raise Exception("%s does not exists!" % base_folder) self._real_brand_p = base_folder + "/real_brand.txt...
normal
{ "blob_id": "845d1251497df61dd2c23241016a049c695ad940", "index": 9193, "step-1": "<mask token>\n\n\nclass BrandReg(BrandRegBasic):\n\n def __init__(self, base_folder, log_instance, input_lst=None):\n super(BrandReg, self).__init__(base_folder, log_instance)\n input_file = base_folder + '/dp_bran...
[ 6, 9, 12, 13, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FixedData: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FixedData: def get_data(self, id): data = self.get_data_from_mongodb(id) if data: ...
flexible
{ "blob_id": "b1530c664fa236e61ff50bca502bf79730c3386c", "index": 6647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FixedData:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FixedData:\n\n def get_data(self, id):\n data = self.get_data_from_mongodb(id)\n if data:\...
[ 0, 1, 2, 3, 4 ]
from .tokening import sign_profile_tokens, validate_token_record, \ get_profile_from_tokens from .zone_file import create_zone_file from .legacy import is_profile_legacy_format, get_person_from_legacy_format
normal
{ "blob_id": "de24b341102f5979cc48b22c3a07d42915b6dd18", "index": 7146, "step-1": "<mask token>\n", "step-2": "from .tokening import sign_profile_tokens, validate_token_record, get_profile_from_tokens\nfrom .zone_file import create_zone_file\nfrom .legacy import is_profile_legacy_format, get_person_from_legacy_...
[ 0, 1, 2 ]
<|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 productExceptSelf(self, nums: List[int]) ->List[int]: output = [] prod = 1 ...
flexible
{ "blob_id": "26ae44b5be1d78ed3fe9c858413ae47e163c5460", "index": 1282, "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 productExceptSelf(self, nums: List[int]) ->List[int]:\n output = []\n pro...
[ 0, 1, 2, 3, 4 ]
import os import random import cv2 import tensorflow as tf import tensorflow.contrib.slim as slim import tensorflow.contrib.slim.nets as nets from skimage.transform import resize import PIL import numpy as np import json # os.environ["CUDA_VISIBLE_DEVICES"] = "1" import matplotlib.pyplot as plt # plt.switch_backend('...
normal
{ "blob_id": "31d87b11f6a1f6304a2fef6dd1cd1c0ca292dfe8", "index": 3491, "step-1": "<mask token>\n\n\ndef inception(image, reuse):\n preprocessed = tf.multiply(tf.subtract(tf.expand_dims(image, 0), 0.5), 2.0)\n arg_scope = nets.inception.inception_v3_arg_scope(weight_decay=0.0)\n with slim.arg_scope(arg_s...
[ 5, 6, 7, 9, 10 ]
# pylint: disable=not-callable, no-member, invalid-name, missing-docstring, arguments-differ import argparse import itertools import os import torch import torch.nn as nn import tqdm import time_logging from hanabi import Game def mean(xs): xs = list(xs) return sum(xs) / len(xs) @torch.jit.script def swis...
normal
{ "blob_id": "070330f8d343ff65852c5fbb9a3e96fe1bfc55b5", "index": 8816, "step-1": "<mask token>\n\n\n@torch.jit.script\ndef swish_jit_fwd(x):\n return x * torch.sigmoid(x) * 1.6768\n\n\n<mask token>\n\n\nclass SwishJitAutoFn(torch.autograd.Function):\n\n @staticmethod\n def forward(ctx, x):\n ctx....
[ 6, 7, 9, 14, 16 ]
import time class DISTRICT: def __init__( self, cdcode, county, district, street, city, zipcode, state, mailstreet, mailcity, mailzip, mailstate, phone, extphone, faxnumber, email, admfname, admlname, admemail, lat, long, distrownercode, doctype, statustype, lastup...
normal
{ "blob_id": "462d73195680118d19a3d4e8a855e65aaeecb3c6", "index": 892, "step-1": "<mask token>\n\n\nclass DISTRICT:\n\n def __init__(self, cdcode, county, district, street, city, zipcode,\n state, mailstreet, mailcity, mailzip, mailstate, phone, extphone,\n faxnumber, email, admfname, admlname, a...
[ 5, 9, 10, 12, 13 ]
import os import yaml import sys import random import shutil import openpyxl import yaml import audioanalysis as aa import numpy as np import argparse import logging """ manualtest.py Script to create a listeneing test. The output, test case directory and answer_key.yml file, can be found in the root directory. m...
normal
{ "blob_id": "c6ef9154285dee3b21980801a101ad5e34a50cab", "index": 4656, "step-1": "<mask token>\n\n\nclass Answer:\n \"\"\"\n Wrapper for A_B_X directory containing all associated attributes. \n Populate all fields of the class and call grade to determine if the \n question was correct\n **user_ans...
[ 4, 10, 11, 13, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def merge_sort(mlist): if len(mlist) <= 1: return mlist mid = int(len(mlist) / 2) left = merge_sort(mlist[:mid]) right = merge_sort(mlist[mid:]) return merge(left, right) <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "a6192e39d86005882d0bde040a99f364bf701c3b", "index": 1266, "step-1": "<mask token>\n", "step-2": "def merge_sort(mlist):\n if len(mlist) <= 1:\n return mlist\n mid = int(len(mlist) / 2)\n left = merge_sort(mlist[:mid])\n right = merge_sort(mlist[mid:])\n return merge(left, rig...
[ 0, 1, 2, 3, 4 ]
from connection import Machine from credentials import get_credentials targets = ['45.32.13.245'] #targets = ['localhost'] input_file = 'cmd' def main(): global targets username, password = get_credentials('laozi') remote_host = Machine(username, password) for target in targets: remote_host.co...
normal
{ "blob_id": "18bc8a8b1cbb544cfbe581e32ee5e509d67beafd", "index": 1410, "step-1": "<mask token>\n\n\ndef main():\n global targets\n username, password = get_credentials('laozi')\n remote_host = Machine(username, password)\n for target in targets:\n remote_host.connect(target)\n stdin, st...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.chdir('test') for i in range(1000): t_frame = open('test_f' + str(i), 'w') t_frame.write('0' * 1000000) t_frame.close() os.chdir('..') <|reserved_special_token_1|> <|reserved_special_token_0|> import numpy as np ...
flexible
{ "blob_id": "281f2f47f9d7f0d87a354d37f9ff2c14a5598068", "index": 2893, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir('test')\nfor i in range(1000):\n t_frame = open('test_f' + str(i), 'w')\n t_frame.write('0' * 1000000)\n t_frame.close()\nos.chdir('..')\n", "step-3": "<mask token>\ni...
[ 0, 1, 2, 3 ]
def minutes to hours(minutes) : hours = minutes/60 return hours print(minutes to hours(70))
normal
{ "blob_id": "a1b33d0a8a074bc7a2a3e2085b1ff01267e00d3b", "index": 8815, "step-1": "def minutes to hours(minutes) :\r\n hours = minutes/60\r\n return hours\r\n\r\nprint(minutes to hours(70))\r\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> class QuoteesxtractorSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class QuoteesxtractorSpider(scrapy.Spider): <|...
flexible
{ "blob_id": "ce26ad27b7729164e27c845e2803a670b506bad8", "index": 580, "step-1": "<mask token>\n\n\nclass QuoteesxtractorSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass QuoteesxtractorSpider(scrapy.Spider):\n <mask token>\n...
[ 1, 2, 3, 4, 5 ]
traditional_investor_stage1 = \ "SELECT investor, investor_id, invest_amount, invest_change, security_id, isin, issue_date, maturity_date "\ "FROM "\ "(SELECT "\ "report_date, "\ "investor_holdings.investor_name AS investor,"\ "investor_id,"\ ...
normal
{ "blob_id": "1e168cf6ba785a08244f47eb490b54605a09e4b0", "index": 9433, "step-1": "<mask token>\n", "step-2": "traditional_investor_stage1 = (\n \"SELECT investor, investor_id, invest_amount, invest_change, security_id, isin, issue_date, maturity_date FROM (SELECT report_date, investor_holdings.investor_name...
[ 0, 1, 2 ]
from translit import convert_input def openfile(name): f = open(name, 'r', encoding = 'utf-8') text = f.readlines() f.close() return text def makedict(text): A = [] for line in text: if 'lex:' in line: a = [] a.append(line[6:].replace('\n','')) ...
normal
{ "blob_id": "29e54a9ec0d65965645ac4aabf8c247a8857a25f", "index": 3778, "step-1": "<mask token>\n\n\ndef openfile(name):\n f = open(name, 'r', encoding='utf-8')\n text = f.readlines()\n f.close()\n return text\n\n\ndef makedict(text):\n A = []\n for line in text:\n if 'lex:' in line:\n ...
[ 5, 6, 7, 8, 9 ]
"""Plotting functionality for ab_test_model.""" import matplotlib.pyplot as plt import numpy as np import seaborn as sns from itertools import combinations from ._ab_test_model_utils import _ab_test_utils # pylint: disable=no-member class _ab_test_plotting(_ab_test_utils): """Provide Funcs for class to plot Baye...
normal
{ "blob_id": "3eaa898d1428e48aeb0449c7216d0a994262f76a", "index": 9107, "step-1": "<mask token>\n\n\nclass _ab_test_plotting(_ab_test_utils):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def plot_positive_lift(self, variant_on...
[ 2, 5, 7, 10, 12 ]
from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import torch from datasets import concatenate_datasets from datasets.arrow_dataset import Dataset from transfer_classifier.dataset_preprocessor.classification_dataset_preprocessor import ( ClassificationDatasetPreprocessor, ) from transf...
normal
{ "blob_id": "4a88ce640b6680df925288b44232cf43d585c11c", "index": 669, "step-1": "<mask token>\n\n\nclass Augmentor:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Augmentor:\n\n def __init__(self) ->None:\n self.__AUGME...
[ 1, 5, 6, 7, 8 ]
# I Have Created this file -Nabeel from django.http import HttpResponse from django.shortcuts import render def index(request): return render(request,'index.html') def aboutme(request): return HttpResponse (" <a href='https://nb786.github.io/Ncoder/about.html' > Aboutme</a>") def contact(request): retur...
normal
{ "blob_id": "512d0a293b0cc3e6f7d84bb6958dc6693acde680", "index": 1612, "step-1": "<mask token>\n\n\ndef aboutme(request):\n return HttpResponse(\n \" <a href='https://nb786.github.io/Ncoder/about.html' > Aboutme</a>\")\n\n\n<mask token>\n\n\ndef analyze(request):\n djtext = request.POST.get('text', ...
[ 2, 3, 4, 5, 6 ]
#program, ktory zisti, ci zadany rok je prestupny rok=input("Zadaj rok: ") rok_int= int(rok) if rok_int% 4==0: if rok_int % 100 != 0: if rok_int % 400: print(f'Rok {rok_int} je priestupny') else: print("rok je neprestupny") else: print("rok je prestupny") else: ...
normal
{ "blob_id": "c9b1956d66f0b8ae8a7ce7e509259747c8b7709e", "index": 6088, "step-1": "<mask token>\n", "step-2": "<mask token>\nif rok_int % 4 == 0:\n if rok_int % 100 != 0:\n if rok_int % 400:\n print(f'Rok {rok_int} je priestupny')\n else:\n print('rok je neprestupny')\n ...
[ 0, 1, 2, 3 ]
class Car: __name="" __maxspeed = 0 def __init__(self): self.__updateSoftware() self.__name = "Supercar" self.__maxspeed=320 def drive(self): print("Driving") print("name of the car " + self.__name) def __updateSoftware(self): print("Updating So...
normal
{ "blob_id": "318556a6c327294986fcef938c254b8dfe66adaa", "index": 6375, "step-1": "class Car:\n <mask token>\n <mask token>\n\n def __init__(self):\n self.__updateSoftware()\n self.__name = 'Supercar'\n self.__maxspeed = 320\n\n def drive(self):\n print('Driving')\n ...
[ 5, 6, 7, 8, 9 ]
import os from src.model_manager import ModelManager dir_path = os.path.dirname(os.path.realpath(__file__)) config_file = '{}/data/config/config_1.json'.format(dir_path) model_dir = '{}/data/models'.format(dir_path) def test_init(): mm = ModelManager(config_file, model_dir) def test_predict(): pass
normal
{ "blob_id": "5da61b4cd8e4faf135b49396d3b346a219bf73f6", "index": 3851, "step-1": "<mask token>\n\n\ndef test_predict():\n pass\n", "step-2": "<mask token>\n\n\ndef test_init():\n mm = ModelManager(config_file, model_dir)\n\n\ndef test_predict():\n pass\n", "step-3": "<mask token>\ndir_path = os.path...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NoteFullForm(NoteForm): note_id = forms.IntegerField(required=False) images = forms.FileField(widget=forms.ClearableFileInput(attrs={ 'multiple': True}), required=False) tags = forms.CharField(max_lengt...
flexible
{ "blob_id": "e0fd9663a5635873f4ffc0f73aff5106c0933781", "index": 9180, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NoteFullForm(NoteForm):\n note_id = forms.IntegerField(required=False)\n images = forms.FileField(widget=forms.ClearableFileInput(attrs={\n 'multiple': True}), requ...
[ 0, 2, 3, 4 ]
#MenuTitle: Check for open paths in selected glyphs """ Checks for open paths in selected glyphs (or all glyphs if no selection). Output appears in Macro Window (Option-Command-M). """ # FIXME: test with masters and instances -- may not work Font = Glyphs.font Doc = Glyphs.currentDocument selectedGlyphs = [ x.parent f...
normal
{ "blob_id": "bf49893fee79b0c3e34340cf1633c1797ce1bf41", "index": 2282, "step-1": "#MenuTitle: Check for open paths in selected glyphs\n\"\"\"\nChecks for open paths in selected glyphs (or all glyphs if no selection).\nOutput appears in Macro Window (Option-Command-M).\n\"\"\"\n# FIXME: test with masters and inst...
[ 0 ]
def divide(file): index = 0 head = '' while True: if file[index].isnumeric(): head_index = index break if file[index].isalpha(): head += file[index].lower() else: head += file[index] index += 1 while True: if index >...
normal
{ "blob_id": "75837ab778e94693151de1c17b59e12f8b2336d3", "index": 8341, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(files):\n ans = []\n for i, file in enumerate(files):\n head, number, tail = divide(file)\n ans.append((head, number, i))\n ans.sort(key=lambda x: ...
[ 0, 1, 2 ]
from __future__ import unicode_literals import json class BaseModel(object): def get_id(self): return unicode(self.id) @classmethod def resolve(cls, id_): return cls.query.filter_by(id=id_).first() @classmethod def resolve_all(cls): return cls.query.all()
normal
{ "blob_id": "c9079f27e3c0aca09f99fa381af5f35576b4be75", "index": 4717, "step-1": "<mask token>\n\n\nclass BaseModel(object):\n <mask token>\n <mask token>\n\n @classmethod\n def resolve_all(cls):\n return cls.query.all()\n", "step-2": "<mask token>\n\n\nclass BaseModel(object):\n\n def ge...
[ 2, 3, 4, 5 ]
from django.db import models # Create your models here. class Covid(models.Model): states= models.CharField(max_length=100, null=True, blank=True) affected = models.IntegerField(null=True) cured = models.IntegerField(null=True) death = models.IntegerField(null=True)
normal
{ "blob_id": "284955a555ce1a727ba5041008cd0bac3c3bed49", "index": 1283, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Covid(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Covid(models.Model):\n states = models.C...
[ 0, 1, 2, 3, 4 ]
### we prepend t_ to tablenames and f_ to fieldnames for disambiguity import uuid crud.settings.formstyle="table2cols" ######################################## db.define_table('t_form', Field('id','id', represent=lambda id:SPAN(id,' ',A('view',_href=URL('form_read',args=id)))), Field('f_name', type=...
normal
{ "blob_id": "e2e275c48f28843931412f8e620f1be90289b40c", "index": 8184, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.define_table('t_form', Field('id', 'id', represent=lambda id: SPAN(id,\n ' ', A('view', _href=URL('form_read', args=id)))), Field('f_name', type\n ='string', label=T('Name')), Fi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in ran...
flexible
{ "blob_id": "87504fb88cbbf810ad8bab08bc59284d2cf37cce", "index": 850, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def findDisappearedNumbers(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: Li...
[ 1, 2, 3, 4, 5 ]
A = input("입력해주세요.\n") #입력값을 in_AAA로 칭한다 #\n은 문법의 줄바꾸기 print(A.upper()+" World!") #in_AAA를 출력 + "World!") #upper()는 앞의 값을 대문자화+"
normal
{ "blob_id": "8a54a71b08d10c5da9ca440e8e4f61f908e00d54", "index": 9496, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(A.upper() + ' World!')\n", "step-3": "A = input('입력해주세요.\\n')\nprint(A.upper() + ' World!')\n", "step-4": "A = input(\"입력해주세요.\\n\") #입력값을 in_AAA로 칭한다\r\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @dataclasses.dataclass class UserUpdateMessage: id: str name: Optional[str] = None age: Optional[int] = None <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @dataclasses....
flexible
{ "blob_id": "b2fb5564d44f7481c6de2a5d4af09df4903026b8", "index": 8222, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclasses.dataclass\nclass UserUpdateMessage:\n id: str\n name: Optional[str] = None\n age: Optional[int] = None\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@data...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MonitorTruck(AbstractObservable): """ Concrete Observable class """ def __init__(self, name): super().__init__() self.name = name self.__physical_properties = {'temperature': 0.0, 'humidity': 0.0} def set_value(self, measure_key, val...
flexible
{ "blob_id": "3b3f423cfb08413a4135646ea4d3d6dcb5d0cc10", "index": 662, "step-1": "<mask token>\n\n\nclass MonitorTruck(AbstractObservable):\n \"\"\"\n Concrete Observable class\n \"\"\"\n\n def __init__(self, name):\n super().__init__()\n self.name = name\n self.__physical_pro...
[ 13, 21, 23, 25, 26 ]
from django.shortcuts import render from .models import Team,ContactForm from cars.models import Car from django.contrib import messages # Create your views here. def index(request): teams=Team.objects.all() cars = Car.objects.order_by("-created_date").filter(is_featured=True) all_cars=Car.objects.order_by(...
normal
{ "blob_id": "eca40c37e0e437a5f4e5643f5fb7cd3e38605471", "index": 2417, "step-1": "<mask token>\n\n\ndef about(request):\n teams = Team.objects.all()\n return render(request, 'pages/about.html', {'teams': teams})\n\n\n<mask token>\n\n\ndef contact(request):\n if request.method == 'POST':\n name = ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Award(BaseModel): name: str count: int class Item(BaseModel): luckname: str = Field(..., title='抽奖规则名称', max_lenght=300) total: int = Field(..., title='抽奖总人数', gt=0) award: Optional[List[Award]] = Field(None, title='奖品列表') other: str = Field(..., title='参与奖...
flexible
{ "blob_id": "4550ed971eef36badf46a44adcc593324a5292cf", "index": 2637, "step-1": "<mask token>\n\n\nclass Award(BaseModel):\n name: str\n count: int\n\n\nclass Item(BaseModel):\n luckname: str = Field(..., title='抽奖规则名称', max_lenght=300)\n total: int = Field(..., title='抽奖总人数', gt=0)\n award: Opti...
[ 7, 8, 10, 11, 12 ]
from django.apps import AppConfig class TermserviceConfig(AppConfig): name = 'termservice'
normal
{ "blob_id": "f0168a737b9215520ce600470f9b27837dafb593", "index": 4183, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TermserviceConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TermserviceConfig(AppConfig):\n name = 'termservice'\n", "step-4": "from django.app...
[ 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": "9555e5f75e3045afff6da9228764fca542caf539", "index": 2448, "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 = []\n operat...
[ 0, 1, 2, 3, 4 ]
from discord import Message, ChannelType from discord.ext.commands import Bot, Cog, command, Context from ccbot import repo from shared import fetch_tools import os class Submissions(Cog): def __init__(self, bot: Bot) -> None: self.bot = bot @command() async def current(self, ctx: Context) -> None...
normal
{ "blob_id": "82bfdb46e1da96e5db91d66c3a060d8bf7747d07", "index": 2214, "step-1": "<mask token>\n\n\nclass Submissions(Cog):\n <mask token>\n\n @command()\n async def current(self, ctx: Context) ->None:\n await ctx.trigger_typing()\n repo.init()\n drafts = repo.drafts()\n if n...
[ 1, 2, 3, 4, 5 ]
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import sys import json import math from klpmln import MVPP dprogram = ''' img(i1). img(i2). addition(A,B,N) :- digit(A,1,N...
normal
{ "blob_id": "70b08b9e8c1510a9be48a4bc1de39c6c85b36eed", "index": 2426, "step-1": "<mask token>\n\n\nclass Net(nn.Module):\n\n def __init__(self):\n super(Net, self).__init__()\n self.encoder = nn.Sequential(nn.Conv2d(1, 6, 5), nn.MaxPool2d(2, 2),\n nn.ReLU(True), nn.Conv2d(6, 16, 5), ...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class RQOpenClient(object): def __init__(self, username, password, logger=None, log_level=logging. DEBUG, base_url='https://rqopen.ricequant.com', timeout=(5, 10), return_df=True): """ :param username: 登录账户 :param password: 密码 :param lo...
flexible
{ "blob_id": "bd2edd5139a9c5050c582a54cdacca2b0739f333", "index": 9151, "step-1": "<mask token>\n\n\nclass RQOpenClient(object):\n\n def __init__(self, username, password, logger=None, log_level=logging.\n DEBUG, base_url='https://rqopen.ricequant.com', timeout=(5, 10),\n return_df=True):\n ...
[ 11, 12, 14, 15, 17 ]
<|reserved_special_token_0|> def parse_hex3(hex3): """Example: #a3d""" if (m := re.match('^#?([0-9A-Fa-f]{3})$', hex3.strip())): h3 = m.group(1) return tuple(int(c * 2, 16) for c in h3) raise ValueError(f'String {hex3!r} does not match hex3 format.') <|reserved_special_token_0|> def pa...
flexible
{ "blob_id": "978f3979aee1c4361483fd61b54352e7fff8d3b3", "index": 697, "step-1": "<mask token>\n\n\ndef parse_hex3(hex3):\n \"\"\"Example: #a3d\"\"\"\n if (m := re.match('^#?([0-9A-Fa-f]{3})$', hex3.strip())):\n h3 = m.group(1)\n return tuple(int(c * 2, 16) for c in h3)\n raise ValueError(f...
[ 7, 10, 12, 13, 14 ]
import numpy as np from StudyCaseUdemy.Graph import Graph class OrderVector: def __init__(self, size): self.size = size self.last_pos = -1 self.values = np.empty(self.size, dtype=object) def insert(self, vertex): if self.last_pos == self.size - 1: print('Capacidad m...
normal
{ "blob_id": "87291d066b94aca1d94cbe5d9281fc72da1b0c35", "index": 9483, "step-1": "<mask token>\n\n\nclass OrderVector:\n <mask token>\n\n def insert(self, vertex):\n if self.last_pos == self.size - 1:\n print('Capacidad max do Vector atingida')\n return\n pos = 0\n ...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(T): even = '' odd = '' s = str(input()) for i in range(len(s)): if i % 2 == 0: even = even + s[i] else: odd = odd + s[i] print(even, odd) <|reserved_spec...
flexible
{ "blob_id": "f45313e4e8f3ecba0c7dc0288d9d5ec4e26f0ba6", "index": 5284, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(T):\n even = ''\n odd = ''\n s = str(input())\n for i in range(len(s)):\n if i % 2 == 0:\n even = even + s[i]\n else:\n odd ...
[ 0, 1, 2, 3 ]
import os import sys import json import logging import argparse from glob import glob from pricewatcher.tools import ensure_mkdir from pricewatcher.parser.f21 import ForeverParser from pricewatcher.parser.jcrew import JcrewParser from pricewatcher.utils.load_es import bulk_load_es BRAND_PARSERS={ 'forever21': Forever...
normal
{ "blob_id": "2c22f891f30825bcb97987c78a98988ad2a92210", "index": 385, "step-1": "<mask token>\n\n\ndef date_handler(obj):\n return obj.isoformat() if hasattr(obj, 'isoformat') else obj\n\n\ndef run():\n parser = argparse.ArgumentParser(description='Process some integers.')\n parser.add_argument('--input...
[ 2, 3, 4, 5, 6 ]
def modCount(n, m): if(m <= n): inBetween = n - m dividible = [] for x in range(m+1, n): if(x%m == 0): dividible.append(x) return 'There are {} numbers between {} and {} \nand the ones that are dividible by {} are {}'.format(inBetween, m, n, m, dividib...
normal
{ "blob_id": "0699c9f70f1c16b4cb9837edf7a4ef27f021faec", "index": 8318, "step-1": "<mask token>\n", "step-2": "def modCount(n, m):\n if m <= n:\n inBetween = n - m\n dividible = []\n for x in range(m + 1, n):\n if x % m == 0:\n dividible.append(x)\n retur...
[ 0, 1, 2, 3 ]
""" @file @brief Various function to clean files. """ from __future__ import print_function import os import re def clean_exts(folder=".", fLOG=print, exts=None, fclean=None): """ Cleans files in a folder and subfolders with a given extensions. @param folder folder to clean @param fLOG...
normal
{ "blob_id": "57972e6368aa5749edeab94e45d84f7897ca14ab", "index": 8751, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef clean_files(folder='.', posreg='.*[.]((py)|(rst))$', negreg=\n '.*[.]git/.*', op='CR', fLOG=print):\n \"\"\"\n Cleans ``\\\\r`` in files a folder and subfolders with a gi...
[ 0, 1, 2, 3, 4 ]
import time t0 = time.time() # ------------------------------ days_in_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def count_days(start_date, end_date, ref_date, target_day): # ref_date must be exactly 1 year before start_date month = start_date[0] day = start_date[1] year = start_date...
normal
{ "blob_id": "9843f957435b74e63a6fe4827cc17c824f11c7d6", "index": 5372, "step-1": "<mask token>\n\n\ndef count_days(start_date, end_date, ref_date, target_day):\n month = start_date[0]\n day = start_date[1]\n year = start_date[2]\n end_month = end_date[0]\n end_day = end_date[1]\n end_year = end...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestMethods(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def checkLinkedListsAreEqual(self, headNodeA, headNodeB): valuesA = self.linkedListToArray(headNodeA) valuesB = self.linkedListToAr...
flexible
{ "blob_id": "2a3f9c4518df337cfc5e4b1816e7b2b4af62c101", "index": 8020, "step-1": "<mask token>\n\n\nclass TestMethods(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def checkLinkedListsAreEqual(self, headNodeA, headNodeB):\n valuesA = self.linkedListToArray(headNodeA)\n ...
[ 6, 8, 9, 10, 12 ]
import arcade import os SPRITE_SCALING = 0.5 SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_TITLE = "Raymond Game" MOVEMENT_SPEED = 50 class Ball: def __init__(self, position_x, position_y, change_x, change_y, radius): # Take the parameters of the init function above, and create instance variables ou...
normal
{ "blob_id": "37d079ca6a22036e2660507f37442617d4842c4e", "index": 4060, "step-1": "<mask token>\n\n\nclass MyGame(arcade.Window):\n\n def __init__(self, width, height, title):\n super().__init__(width, height, title)\n self.drawer = 0\n self.wardrobe = 0\n self.bookshelves = 0\n ...
[ 6, 8, 12, 13, 15 ]
from numpy import pi,sqrt,cross,dot,zeros,linalg from defs import * ##from numba import njit, prange ## ##@njit(parallel=True) def engparallelb2(MU,NU,b1,b2,x1,x2,y1,y2,eta,a): #For use in enginteract below #HL p.154 Eq.(6-45) b1x=b1[0] b1y=b1[1] b1z=b1[2] b2x=b2[0] b2y=b2[1] b2z=b2[2] ...
normal
{ "blob_id": "2611d7dd364f6a027da29c005754ac2465faa8be", "index": 8667, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef engparallelb2(MU, NU, b1, b2, x1, x2, y1, y2, eta, a):\n b1x = b1[0]\n b1y = b1[1]\n b1z = b1[2]\n b2x = b2[0]\n b2y = b2[1]\n b2z = b2[2]\n Rab = Rp(x2, y2, ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> numpy.random.shuffle(ind) <|reserved_special_token_0|> pipe.fit(X, y) update_registered_converter(LGBMClassifier, 'LightGbmLGBMClassifier', calculate_linear_classifier_output_shapes, convert_lightgbm, options={ 'nocl': [Tr...
flexible
{ "blob_id": "32227029cb4e852536611f7ae5dec5118bd5e195", "index": 8324, "step-1": "<mask token>\n", "step-2": "<mask token>\nnumpy.random.shuffle(ind)\n<mask token>\npipe.fit(X, y)\nupdate_registered_converter(LGBMClassifier, 'LightGbmLGBMClassifier',\n calculate_linear_classifier_output_shapes, convert_ligh...
[ 0, 1, 2, 3, 4 ]
""" This module contains the class definitions for all types of BankAccount alongside BankAccountCreator as a supporting class to create an appropriate bank account for a given user type. """ from abc import ABC from abc import abstractmethod from transaction import Transaction from budget import Budget from budget im...
normal
{ "blob_id": "830ae4b6a6b2c4e1bbe6928b3a4b0be86d2ec7a3", "index": 3743, "step-1": "<mask token>\n\n\nclass AngelBankAccount(BankAccount):\n <mask token>\n <mask token>\n\n\nclass TroublemakerBankAccount(BankAccount):\n \"\"\"\n This bank account is designed for Troublemaker children. These\n childr...
[ 12, 17, 20, 25, 28 ]
from collections import defaultdict def solution(tickets): # 출발지가 키, 목적지가 value 인 딕셔너리 생성 routes = defaultdict(list) for t in tickets: routes[t[0]].append(t[1]) # 알파벳 빠른순으로 정렬해야함으로 reverse=True for r in routes: routes[r].sort(reverse=True) # 시작 위치 ICN stack = ['ICN'] ...
normal
{ "blob_id": "15c6841052882406d7c7b6cd05c0186c6a4a5924", "index": 2021, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(tickets):\n routes = defaultdict(list)\n for t in tickets:\n routes[t[0]].append(t[1])\n for r in routes:\n routes[r].sort(reverse=True)\n stack...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [m...
flexible
{ "blob_id": "38751da57ad7c786e9fc0722faf065380e5f7e60", "index": 4994, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # # Script written by Legoktm, 2011 # Released into the Public Domain on November, 16, 2011 # This product comes with no warranty of any sort. # Enjoy! # from commands import getoutput def notify(string, program=False): if not program: command = 'growlnotify Python -m "%s"' %string else: command...
normal
{ "blob_id": "4318c99b3de9bb9c44eed57525c9ccbe82a17276", "index": 5946, "step-1": "#!/usr/bin/python\n#\n# Script written by Legoktm, 2011\n# Released into the Public Domain on November, 16, 2011\n# This product comes with no warranty of any sort.\n# Enjoy!\n#\nfrom commands import getoutput\ndef notify(string, p...
[ 0 ]
import requests import json ROOT_URL = "http://localhost:5000" def get_all_countries(): response = requests.get("{}/countries".format(ROOT_URL)) return response.json()["countries"] def get_country_probability(countryIds): body = {"countryIds": countryIds} response = requests.get("{}/countries/probability".format...
normal
{ "blob_id": "6aa7114db66a76cfa9659f5537b1056f40f47bd2", "index": 3975, "step-1": "<mask token>\n\n\ndef get_all_countries():\n response = requests.get('{}/countries'.format(ROOT_URL))\n return response.json()['countries']\n\n\ndef get_country_probability(countryIds):\n body = {'countryIds': countryIds}\...
[ 11, 12, 15, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> include_rules = ['+apps', '+components/live_caption', '+services/device/public', '+components/device_reauth', '+remoting/host'] specific_include_rules = {'.*test.*': ['+chrome/browser/ui/views/frame', '+components/captive_portal', '+components/web_pac...
flexible
{ "blob_id": "728af8b07bc391b496709e54926f3f1f49897176", "index": 1992, "step-1": "<mask token>\n", "step-2": "include_rules = ['+apps', '+components/live_caption',\n '+services/device/public', '+components/device_reauth', '+remoting/host']\nspecific_include_rules = {'.*test.*': ['+chrome/browser/ui/views/fr...
[ 0, 1, 2 ]
class Solution(object): def gcdOfStrings(self, str1, str2): if str1 == str2: return str1 elif not str1 or not str2: return '' elif str1.startswith(str2): return self.gcdOfStrings(str1[len(str2):], str2) elif str2.startswith(str1): retu...
normal
{ "blob_id": "ab632c3c8a7f295a890de19af82fde87c6d600bc", "index": 1674, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def gcdOfStrings(self, str1, str2):\n if str1 == str2:\n return str1\n elif not str1 o...
[ 0, 1, 2 ]
import math3d import math import pygame import random class PBody(object): """ A physics-enabled object. """ def __init__(self, pos, mass=1, rad=10, vel=(0,0), color=(255,255,255)): self.pos = math3d.VectorN(pos) self.vel = math3d.VectorN(vel) self.rad = 10 # in pixe...
normal
{ "blob_id": "2238345a69c2d7a1958a23a470dcb2be6469caeb", "index": 6643, "step-1": "<mask token>\n\n\nclass PBody(object):\n <mask token>\n <mask token>\n <mask token>\n\n def update(self, dT):\n \"\"\" Updates our object:\n 1. Changes position due to current velocity.\n 2....
[ 8, 11, 12, 13, 16 ]
<|reserved_special_token_0|> def process_data(num11, den11, num21, den21): w11 = ctrl.tf(num11, den11) w21 = ctrl.tf(num21, den21) print('результат w11={} w21={}'.format(w11, w21)) TimeLine = [] for i in range(1, 3000): TimeLine.append(i / 1000) plt.figure(0, figsize=[7, 6]) [y11, ...
flexible
{ "blob_id": "c08e6cee61e9f32a9f067a9554c74bb2ddbd7cf3", "index": 2288, "step-1": "<mask token>\n\n\ndef process_data(num11, den11, num21, den21):\n w11 = ctrl.tf(num11, den11)\n w21 = ctrl.tf(num21, den21)\n print('результат w11={} w21={}'.format(w11, w21))\n TimeLine = []\n for i in range(1, 3000...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if r.status_code == requests.codes.ok: with open('currentPlayerDump.json', 'w') as f: for line in r.text: f.write(line) <|reserved_special_token_1|> <|reserved_special_token_0|> currentPlayerInfoUrl = ( ...
flexible
{ "blob_id": "68f8b301d86659f9d76de443b0afe93fd7f7e8c2", "index": 6588, "step-1": "<mask token>\n", "step-2": "<mask token>\nif r.status_code == requests.codes.ok:\n with open('currentPlayerDump.json', 'w') as f:\n for line in r.text:\n f.write(line)\n", "step-3": "<mask token>\ncurrentPl...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for folder in os.listdir(source_path): for filename in os.listdir(source_path + folder + '/'): if filename != '---.png': linename = filename.split('-') linename = linename[0] + '-' + linename[1]...
flexible
{ "blob_id": "ff1346060141ee3504aa5ee9de3a6ec196bcc216", "index": 3918, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor folder in os.listdir(source_path):\n for filename in os.listdir(source_path + folder + '/'):\n if filename != '---.png':\n linename = filename.split('-')\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('config', action=IsFile, help= 'configuration file used in simulation') parser.add_argument('log', action=IsFile, help= 'simulation log file to visualise') parser.add_argument('-f', '--failures', metava...
flexible
{ "blob_id": "1f953b20ff0eb868c2fbff367fafa8b651617e64", "index": 6131, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('config', action=IsFile, help=\n 'configuration file used in simulation')\nparser.add_argument('log', action=IsFile, help=\n 'simulation log file to visualise')\...
[ 0, 1, 2, 3, 4 ]
# socket_address_packing.py import binascii import socket import struct import sys for string_address in ['192.168.1.1', '127.0.0.1']: packed = socket.inet_aton(string_address) print('Originale :', string_address) print('Impacchettato:', binascii.hexlify(packed)) print('Spacchettato :', socket.inet...
normal
{ "blob_id": "01626772b0f47987157e9f92ba2ce66a0ec2dcb4", "index": 4379, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor string_address in ['192.168.1.1', '127.0.0.1']:\n packed = socket.inet_aton(string_address)\n print('Originale :', string_address)\n print('Impacchettato:', binascii.hexli...
[ 0, 1, 2, 3 ]