code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# encoding=utf8 import json import time from util import http_util available = 1 disable = 0 # 交易所域名 REST_URL = "https://api.bithumb.com" PAYMENT_CURRENCY_BTC = "BTC" PAYMENT_CURRENCY_KRW = "KRW" # 成功码 SUCCESS_CODE = "0000" # 没有交易对的错误码 NO_SYMBOL_CODE = ["5600", "5500"] # bithumb提现的最小值,获取地址:https://apidocs.bithumb...
normal
{ "blob_id": "f268dc4c2ae2c17e7d0d3921d29e6b952fc63c7d", "index": 9802, "step-1": "<mask token>\n\n\ndef get_ticker(order_currency, payment_currency):\n \"\"\"\n 获取指定交易对的ticker信息:https://apidocs.bithumb.com/docs/ticker\n https://api.bithumb.com/public/ticker/BTC_KRW\n :return:\n {\n \"status\":\...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> @app.route('/') def index(): return os.getenv('DB_HOST') <|reserved_special_token_1|> <|reserved_special_token_0|> load_dotenv(verbose=True) <|reserved_special_token_0|> if bool(os.getenv('IS_DEV')): logger = logging.getLogger('orator.connection.queries') logger.setLevel(lo...
flexible
{ "blob_id": "f20e2227821c43de17c116d8c11233eda53ab631", "index": 9967, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return os.getenv('DB_HOST')\n", "step-2": "<mask token>\nload_dotenv(verbose=True)\n<mask token>\nif bool(os.getenv('IS_DEV')):\n logger = logging.getLogger('orator.connecti...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def puissance(x, n): if n == 0: return 1 else: return x * puissance(x, n - 1) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def puissance(x, n): if n ==...
flexible
{ "blob_id": "beccae96b3b2c9dcd61bb538d07b85441a73662e", "index": 9968, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef puissance(x, n):\n if n == 0:\n return 1\n else:\n return x * puissance(x, n - 1)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef puissance(x, n):\n ...
[ 0, 1, 2, 3, 4 ]
import os import sys import socket __target__ = '${EXTERNAL_HOST}' sources = {} def process_the_source(fname, dest=None, host_ip=None, verbose=False): assert (os.path.exists(fname) and os.path.isfile(fname)), 'Cannot proceed without the fname in process_the_source().' the_lines = [] with open(fname, 'r')...
normal
{ "blob_id": "d6af9a75fbe8bdf1a81a352cee71ac81fb373b86", "index": 9926, "step-1": "<mask token>\n\n\ndef process_the_source(fname, dest=None, host_ip=None, verbose=False):\n assert os.path.exists(fname) and os.path.isfile(fname\n ), 'Cannot proceed without the fname in process_the_source().'\n the_li...
[ 1, 2, 3, 4, 5 ]
# Turn off bytecode generation import sys from asgiref.sync import sync_to_async from django.core.wsgi import get_wsgi_application sys.dont_write_bytecode = True # Django specific settings import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") import django django.setup() from db import models de...
normal
{ "blob_id": "4afb556ceca89eb90ba800db4f383afad1cd42a5", "index": 3765, "step-1": "<mask token>\n\n\ndef print_all_models():\n return models.Sample.objects.all()\n\n\n@sync_to_async\ndef _create_record(name):\n return models.Sample.objects.create(name=name)\n\n\n<mask token>\n", "step-2": "<mask token>\no...
[ 2, 3, 4, 5, 6 ]
"""""" import random import nbformat from textwrap import dedent from pybryt.preprocessors import IntermediateVariablePreprocessor def test_preprocessor(): """ """ nb = nbformat.v4.new_notebook() nb.cells.append(nbformat.v4.new_code_cell(dedent("""\ a = True b = False f = la...
normal
{ "blob_id": "d9f08e770dacaa86a03d553afd78fdcd725efb62", "index": 5204, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_preprocessor():\n \"\"\"\n \"\"\"\n nb = nbformat.v4.new_notebook()\n nb.cells.append(nbformat.v4.new_code_cell(dedent(\n \"\"\" a = True\n b...
[ 0, 1, 2, 3 ]
from abc import ABCMeta, abstractmethod from datetime import datetime from enum import Enum from application.response import ResponseError class ModelBase: __metaclass__ = ABCMeta @classmethod @abstractmethod def _get_cls_schema(cls): pass def __new__(cls, schema): if schema is ...
normal
{ "blob_id": "5917c891d2885f779dc33f189f1a875efbd0c302", "index": 163, "step-1": "<mask token>\n\n\nclass ModelBase:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, schema):\n self.schema = schema\n <mask token>\n\n @property\n def uid(self):\n return self.sc...
[ 6, 8, 9, 12, 13 ]
<|reserved_special_token_0|> class BondCover(CoverEntity): <|reserved_special_token_0|> def __init__(self, bond: Bond, device: BondDevice): """Create HA entity representing Bond cover.""" self._bond = bond self._device = device @property def device_class(self) ->Optional[str]...
flexible
{ "blob_id": "ba9d7b877eda3f7469db58e2ee194b601e3c3e08", "index": 4227, "step-1": "<mask token>\n\n\nclass BondCover(CoverEntity):\n <mask token>\n\n def __init__(self, bond: Bond, device: BondDevice):\n \"\"\"Create HA entity representing Bond cover.\"\"\"\n self._bond = bond\n self._d...
[ 10, 11, 12, 14, 15 ]
<|reserved_special_token_0|> class Memory: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class DesignTracker: def __init__(self, epochs, **kwargs): """ This class tracks the best designs discovered. """ if epochs == -1: ...
flexible
{ "blob_id": "f23bc0c277967d8e7a94a49c5a81ed5fb75d36cc", "index": 9327, "step-1": "<mask token>\n\n\nclass Memory:\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass DesignTracker:\n\n def __init__(self, epochs, **kwargs):\n \"\"\"\n This class tracks the best designs discovered.\n ...
[ 11, 16, 20, 22, 26 ]
<|reserved_special_token_0|> class Ticket(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0...
flexible
{ "blob_id": "64fd597918fe8133d53d1df741512cd2e49a111d", "index": 1252, "step-1": "<mask token>\n\n\nclass Ticket(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 20, 22, 27, 29, 32 ]
count = 0 maximum = -1 m = -1 while m != 0: m = int(input()) if m > maximum: maximum = m count = 1 elif m == maximum: count += 1 print(count)
normal
{ "blob_id": "0e1ea8c7fba90c1b5d18eaa399b91f237d4defee", "index": 2568, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile m != 0:\n m = int(input())\n if m > maximum:\n maximum = m\n count = 1\n elif m == maximum:\n count += 1\nprint(count)\n", "step-3": "count = 0\nmaxi...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def _load_credentials(creds_file=None): """Loads the credentials from a credentials.json file or by prompting for authentication. Returns a credentials object to be used by the Google Sheets API. """ creds = None if not creds_file: creds_file = 'credentials.jso...
flexible
{ "blob_id": "0ed0fb6f9bcc768bb005222c9ae9b454f6d962ec", "index": 9148, "step-1": "<mask token>\n\n\ndef _load_credentials(creds_file=None):\n \"\"\"Loads the credentials from a credentials.json file or by prompting for authentication.\n Returns a credentials object to be used by the Google Sheets API.\n ...
[ 7, 10, 11, 12, 13 ]
with open("file.txt", 'r') as fh: data = fh.readline() lis= data.split(' ') my_dict={} for key in lis: if key in my_dict.keys(): my_dict[key] += 1 else: my_dict[key] = 1 print(my_dict)
normal
{ "blob_id": "8cd582915c5abd96a4ef8a3a5309311f2a73a156", "index": 460, "step-1": "<mask token>\n", "step-2": "with open('file.txt', 'r') as fh:\n data = fh.readline()\n<mask token>\nfor key in lis:\n if key in my_dict.keys():\n my_dict[key] += 1\n else:\n my_dict[key] = 1\nprint(my_dict)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PickleZLibHandler(IHandler): @staticmethod def dumps(obj, protocol=pickle.HIGHEST_PROTOCOL, level=zlib. Z_DEFAULT_COMPRESSION): pickled = pickle.dumps(obj, protocol=protocol) compressed = zlib.compress(pickled, level) return compressed @...
flexible
{ "blob_id": "60202758a0a42fc26dc1bca9f134a70f28967093", "index": 2728, "step-1": "<mask token>\n\n\nclass PickleZLibHandler(IHandler):\n\n @staticmethod\n def dumps(obj, protocol=pickle.HIGHEST_PROTOCOL, level=zlib.\n Z_DEFAULT_COMPRESSION):\n pickled = pickle.dumps(obj, protocol=protocol)\n ...
[ 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for d, dirs, files in os.walk(top): for f in files: i = f.find('.') if i == -1: i = 0 suf = f[i:] rec = cnts.setdefault(suf, [0, 0]) fn = d + '/' + f if os.path.islin...
flexible
{ "blob_id": "06aa2d261e31dfe2f0ef66dca01c1fe3db1ca94e", "index": 7940, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor d, dirs, files in os.walk(top):\n for f in files:\n i = f.find('.')\n if i == -1:\n i = 0\n suf = f[i:]\n rec = cnts.setdefault(suf, [0, 0])\...
[ 0, 1, 2, 3, 4 ]
import pytest import kdlc from shutil import rmtree import os # from .context import kdlc test_generated_dir = os.path.dirname(__file__) + "/generated/" @pytest.fixture(scope="session") def my_setup(request): print("\nDoing setup") def fin(): print("\nDoing teardown") if os.path.exists(tes...
normal
{ "blob_id": "7ff029e2f0054146e438f4e4f13269e83e28c469", "index": 8727, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture(scope='session')\ndef my_setup(request):\n print('\\nDoing setup')\n\n def fin():\n print('\\nDoing teardown')\n if os.path.exists(test_generated_d...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Augmentor: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Augmentor: def __init__(self) ->N...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> views = Blueprint('views', __name__) <|reserved_special_token_0|> <|reserved_special_token_1|> from flask import Blueprint views = Blueprint('views', __name__) from . import routes
flexible
{ "blob_id": "139ccdaf7acb2a2d74649f0c32217d1fe71a954a", "index": 4800, "step-1": "<mask token>\n", "step-2": "<mask token>\nviews = Blueprint('views', __name__)\n<mask token>\n", "step-3": "from flask import Blueprint\nviews = Blueprint('views', __name__)\nfrom . import routes\n", "step-4": null, "step-5...
[ 0, 1, 2 ]
import pygame import sys import time import random from snake_gym.envs.modules import * from pygame.locals import * import numpy as np class SnakeGame(object): def __init__(self): self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0, 32) self.surface = pygame.Surface...
normal
{ "blob_id": "6d61df9ac072100d01a1ce3cf7b4c056f66a163c", "index": 502, "step-1": "<mask token>\n\n\nclass SnakeGame(object):\n <mask token>\n\n def reset(self):\n return SnakeGame._get_image(self.surface)\n\n def step(self, key):\n length = self.snake.length\n for event in pygame.eve...
[ 3, 4, 5, 6 ]
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
normal
{ "blob_id": "8e26a6b50539fa5f498aa2079a2625214e5b4d03", "index": 5919, "step-1": "<mask token>\n\n\nclass DagRunnableReportingThread(StoppableThread, LoggingMixin):\n\n def __init__(self, async_mode: bool, dag_file_processor_agent, mailbox:\n Mailbox, *args, **kwargs):\n super(DagRunnableReporti...
[ 13, 19, 20, 22, 24 ]
"""Add uri on identity provider Revision ID: 52561c782d96 Revises: cdf9f34b764c Create Date: 2022-03-11 10:16:39.583434 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '52561c782d96' down_revision = 'cdf9f34b764c' branch_labels = None depends_on = None def up...
normal
{ "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 ]
<|reserved_special_token_0|> class JointModel(nn.Module): def __init__(self, d_v, d_e, d_t, encoder_layers, generator_layers, encoder_shortcut, generator_shortcut, generator_transform, num_word, emb_size, word_rnn_size, word_rnn_num_layer, word_rnn_dropout, word_rnn_bidirectional, word_at...
flexible
{ "blob_id": "4f3e297b6925f8d65aacaa59bb837e746747c33f", "index": 2608, "step-1": "<mask token>\n\n\nclass JointModel(nn.Module):\n\n def __init__(self, d_v, d_e, d_t, encoder_layers, generator_layers,\n encoder_shortcut, generator_shortcut, generator_transform, num_word,\n emb_size, word_rnn_siz...
[ 5, 6, 8, 11, 12 ]
from tkinter import * from tkinter import messagebox as mb from tkinter.scrolledtext import ScrolledText from tkinter import filedialog as fd from child_window import ChildWindow # from PIL import Image as PilImage # from PIL import ImageTk, ImageOps class Window: def __init__(self, width, height, title="MyWindow...
normal
{ "blob_id": "02d4e1ddb0b4cf75c9902e13263c5a80417de01b", "index": 6530, "step-1": "<mask token>\n\n\nclass Window:\n\n def __init__(self, width, height, title='MyWindow', resizable=(False, \n False), icon='resources/feather.ico'):\n self.root = Tk()\n self.root.title(title)\n self.r...
[ 8, 9, 10, 12, 14 ]
<|reserved_special_token_0|> def standev(vals): mean = avg(vals) var = sum([((x - mean) ** 2) for x in vals]) / float(len(vals) - 1) return sqrt(var) <|reserved_special_token_0|> def read_csv(file_name): data = list() with open(file_name, 'r') as file: csv = reader(file) for ro...
flexible
{ "blob_id": "f92a1398a27541557ec5bbf752d44ce40d1df94a", "index": 4131, "step-1": "<mask token>\n\n\ndef standev(vals):\n mean = avg(vals)\n var = sum([((x - mean) ** 2) for x in vals]) / float(len(vals) - 1)\n return sqrt(var)\n\n\n<mask token>\n\n\ndef read_csv(file_name):\n data = list()\n with ...
[ 9, 11, 12, 18, 19 ]
# -*- coding: utf-8 -*- from django.contrib.auth import logout, login, authenticate from django.contrib.auth.models import User from django.http import HttpResponse, Http404, HttpResponseRedirect from django.middleware.csrf import get_token from django.template.context import Context from django.utils.translation impor...
normal
{ "blob_id": "11163dc99ee65ab44494c08d81e110e9c42390ae", "index": 3130, "step-1": "<mask token>\n\n\ndef main(request):\n c = base_context(request)\n template = get_template('index.html')\n c['title'] = _('Request')\n form = RequestForm()\n user = request.user\n c['user'] = user\n if user.is_...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MacAgeTime(A10BaseClass): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MacAgeTime(A10BaseClass): <|reserved_special_token_0|> def __init__(self, **kwargs): self.ERROR_MSG = '' ...
flexible
{ "blob_id": "f08677430e54822abbce61d0cac5a6fea14d3872", "index": 6078, "step-1": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n\n def __init__(self, **kwargs):\n self.ERROR_MSG...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def normalise(image): dbl_image = image.astype(float) mean = np.mean(dbl_image) iplImage = cv2.cv.CreateImageHeader((image.shape[1], image.shape[0]), cv2.cv.IPL_DEPTH_8U, 1) cv2.cv.SetData(iplImage, image...
flexible
{ "blob_id": "f51d85ff352d9c84a8ded29ad94b24ca6dda46ad", "index": 7593, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef normalise(image):\n dbl_image = image.astype(float)\n mean = np.mean(dbl_image)\n iplImage = cv2.cv.CreateImageHeader((image.shape[1], image.shape[0]),\n cv2.cv.IP...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DuckList(generics.ListCreateAPIView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DuckList(generics.ListCreateAPIView): <|reserved_special_token_0|> <|...
flexible
{ "blob_id": "8334478c8b7fc7688477cdb837467e00e857c07c", "index": 1196, "step-1": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\...
[ 1, 2, 3, 4, 5 ]
# -* coding: utf-8 -*- # A headless media player based on gstreamer. from gi.repository import Gst Gst.init(None) class Player: def __init__(self, uri=None): # Creates a playbin (plays media from an uri). self.player = Gst.ElementFactory.make('playbin', 'player') self.uri = uri @pro...
normal
{ "blob_id": "01e9ceb516a323a2017c65e368da419c6570dce2", "index": 7304, "step-1": "<mask token>\n\n\nclass Player:\n <mask token>\n\n @property\n def uri(self):\n return self._uri\n\n @uri.setter\n def uri(self, value):\n self._uri = value\n self.player.set_state(Gst.State.NULL...
[ 3, 6, 8, 9, 10 ]
import sys import os.path root_dir = os.path.dirname(os.path.dirname(__file__)) jsondb_dir = os.path.join(root_dir, 'jsondb') sys.path.append(jsondb_dir)
normal
{ "blob_id": "eeb588a162fa222c0f70eb832a0026d0d8adbe9b", "index": 6769, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(jsondb_dir)\n", "step-3": "<mask token>\nroot_dir = os.path.dirname(os.path.dirname(__file__))\njsondb_dir = os.path.join(root_dir, 'jsondb')\nsys.path.append(jsondb_dir...
[ 0, 1, 2, 3 ]
from django.contrib import admin from pages.blog.models import Blog admin.site.register(Blog)
normal
{ "blob_id": "534aaf8371707089522af014a93f3ff6c4f913ff", "index": 8510, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Blog)\n", "step-3": "from django.contrib import admin\nfrom pages.blog.models import Blog\nadmin.site.register(Blog)\n", "step-4": null, "step-5": null, "step-...
[ 0, 1, 2 ]
import cherrypy import config try: from simplejson import json except ImportError: import json import routes import urllib import re def redirect(url, status=None): """Raise a redirect to the specified address. """ raise cherrypy.HTTPRedirect(url, status) def require_method(*allowed_methods): ...
normal
{ "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 ]
class Type(object): """Type of values.""" def __init__(self, jtype): self.jtype = jtype def __repr__(self): return self.jtype.toString() def __str__(self): return self.jtype.toPrettyString(False, False)
normal
{ "blob_id": "851162e6c40a9f4f82a983a84fd0b4d6a6a57412", "index": 3675, "step-1": "class Type(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.jtype.toPrettyString(False, False)\n", "step-2": "class Type(object):\n <mask token>\n\n def __init__(...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_parent(parent, x): if parent[x] == x: return x parent[x] = get_parent(parent, parent[x]) return parent[x] def union_parent(parent, a, b): a = get_parent(parent, a) b = get_parent(parent, b) if a != b: parent[b] = a <|reserved_special_tok...
flexible
{ "blob_id": "2e794e281c6f34858cd32725cdc454eb18c28892", "index": 3415, "step-1": "<mask token>\n\n\ndef get_parent(parent, x):\n if parent[x] == x:\n return x\n parent[x] = get_parent(parent, parent[x])\n return parent[x]\n\n\ndef union_parent(parent, a, b):\n a = get_parent(parent, a)\n b ...
[ 2, 3, 4, 5, 6 ]
class Bot(dict): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Bot(dict): def __init__(self): self['getRayon'] = 0 self['getPosition'] = -1000, ...
flexible
{ "blob_id": "d178818faf5fb18f5da48c1e2cf7991600731d06", "index": 4457, "step-1": "class Bot(dict):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Bot(dict):\n\n def __init__(self):\n self['getRayon'] = 0\n self['getPosition'] = -1...
[ 1, 4, 5, 6, 7 ]
from .slinklist import SingleLinkedList
normal
{ "blob_id": "2a5d498a386190bdd2c05bc2b14db0fecd707162", "index": 1128, "step-1": "<mask token>\n", "step-2": "from .slinklist import SingleLinkedList\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class ProjectTSEntry(models.Model): description = models.CharField(max_length=150, default='') project_time_sheet = models.ForeignKey(ProjectTS, related_name= 'project_time_sheet') project_leader = models.ForeignKey(User, related_name='pl', limit_choices_to={'i...
flexible
{ "blob_id": "df39a97db25f03aca8ebd501283fd6a7c486db8c", "index": 1243, "step-1": "<mask token>\n\n\nclass ProjectTSEntry(models.Model):\n description = models.CharField(max_length=150, default='')\n project_time_sheet = models.ForeignKey(ProjectTS, related_name=\n 'project_time_sheet')\n project_...
[ 3, 4, 5, 6, 7 ]
import turtle pen = turtle.Turtle() def curve(): for i in range(200): pen.right(1) pen.forward(1) def heart(): pen.fillcolor('yellow') pen.begin_fill() pen.left(140) pen.forward(113) curve() pen.left(120) curve() pen.forward(112) pen.end_fill() heart()
normal
{ "blob_id": "fa925d0ef4f9df3fdf9a51c7fcc88933609bc9e3", "index": 3980, "step-1": "<mask token>\n\n\ndef curve():\n for i in range(200):\n pen.right(1)\n pen.forward(1)\n\n\ndef heart():\n pen.fillcolor('yellow')\n pen.begin_fill()\n pen.left(140)\n pen.forward(113)\n curve()\n ...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'fs': {'eci': {'info': {'name': 'Example closed Interface extension', 'version': '1.0', 'date': 'Sept. 22, 2016', 'author': 'Jeff Teeters', 'contact': 'jteeters@berkeley.edu', 'description': 'Extension defining a new closed Interface'}, 'schema':...
flexible
{ "blob_id": "892f90edbd8bd54841b815a6bc29d136c5e84a38", "index": 7175, "step-1": "<mask token>\n", "step-2": "{'fs': {'eci': {'info': {'name': 'Example closed Interface extension',\n 'version': '1.0', 'date': 'Sept. 22, 2016', 'author': 'Jeff Teeters',\n 'contact': 'jteeters@berkeley.edu', 'description':...
[ 0, 1, 2 ]
""" dansfunctions - various useful functions in python usage: >>import dansfunctions >>dansfunctions.fg # module of general mathematical, vector and string format functions >>dansfunctions.fp # module of matplotlib shortcuts >>dansfunctions.widgets # module of tkinter shortcuts Requirements: numpy Optional requirem...
normal
{ "blob_id": "0f266db39988cfce475380036f4f4f5b1a1fee1a", "index": 3647, "step-1": "<mask token>\n\n\ndef version_info():\n return 'dansfunctions version %s (%s)' % (fg.__version__, fg.__date__)\n\n\n<mask token>\n\n\ndef check_general_functions():\n print('dansfunctions/functions_general.py')\n print('Ve...
[ 4, 5, 6, 7, 8 ]
class Virus: def __init__(self, _name, _age, _malignancy): self.name = _name self.age = _age self.malignancy = _malignancy def set_name(self, _name): self.name = _name def set_age(self, _age): self.age = _age def set_malignancy(self, _malignancy): ...
normal
{ "blob_id": "49c3c3b8c4b097f520456736e31ac306a9f73ac7", "index": 3544, "step-1": "class Virus:\n\n def __init__(self, _name, _age, _malignancy):\n self.name = _name\n self.age = _age\n self.malignancy = _malignancy\n\n def set_name(self, _name):\n self.name = _name\n\n def se...
[ 5, 6, 7, 8, 9 ]
# Copyright (c) 2019 Jannika Lossner # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, dis...
normal
{ "blob_id": "e30bd33ae18881307e7cf4f60d3c60eae91573bc", "index": 181, "step-1": "<mask token>\n\n\nclass MultiSpeakerBRIR(SimpleFreeFieldHRIR):\n <mask token>\n <mask token>\n <mask token>\n\n def add_metadata(self, database):\n super().add_metadata(database)\n database.Data.Type = 'FIR...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dot.edge('BaseException', 'SystemExit') dot.edge('BaseException', 'KeyboardInterrupt') dot.edge('BaseException', 'GeneratorExit') dot.edge('BaseException', 'Exception') dot.edge('Exception', 'StopIteration') dot.edge('Exception', ...
flexible
{ "blob_id": "a7db627c49b53cd3a073d866a0373336a46b4053", "index": 1088, "step-1": "<mask token>\n", "step-2": "<mask token>\ndot.edge('BaseException', 'SystemExit')\ndot.edge('BaseException', 'KeyboardInterrupt')\ndot.edge('BaseException', 'GeneratorExit')\ndot.edge('BaseException', 'Exception')\ndot.edge('Exce...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for seed in range(start_position, start_position + max_seeds): cur_wins = 0 max_wins = 0 cur_losses = 0 max_losses = 0 win_streak = [] loss_streak = [] np.random.seed(seed) start_time = timer() ...
flexible
{ "blob_id": "4c66ab6110e81bb88fc6916a1695e0f23e6e0e9d", "index": 6754, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor seed in range(start_position, start_position + max_seeds):\n cur_wins = 0\n max_wins = 0\n cur_losses = 0\n max_losses = 0\n win_streak = []\n loss_streak = []\n ...
[ 0, 1, 2, 3, 4 ]
from django import forms from django.utils.translation import gettext_lazy as _ import django_filters from elasticsearch_dsl.query import Q class BaseSearchFilterSet(django_filters.FilterSet): query_fields = ["content"] q = django_filters.CharFilter( method="auto_query", widget=forms.TextInp...
normal
{ "blob_id": "f225fbf363f1b170704418ed339f2e57ca790975", "index": 5317, "step-1": "<mask token>\n\n\nclass BaseSearchFilterSet(django_filters.FilterSet):\n <mask token>\n <mask token>\n\n def __init__(self, *args, **kwargs):\n self.facet_config = kwargs.pop('facet_config', {})\n self.view =...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': image = Image.open('../datas/xiaoren.png') img = np.asarray(image) print(img.shape) imageNew = np.zeros((600, 100, 3)) imageNew = imageNew.astype(np.uint8) misc.imsave('m.png', im...
flexible
{ "blob_id": "176120d4f40bc02b69d7283b7853b74adf369141", "index": 4726, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n image = Image.open('../datas/xiaoren.png')\n img = np.asarray(image)\n print(img.shape)\n imageNew = np.zeros((600, 100, 3))\n imageNew = image...
[ 0, 1, 2, 3 ]
import datetime import json import logging from grab import Grab from actions import get_course_gold, get_chat_type, get_indexes, group_chat_id # logging.basicConfig( # format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', # level=logging.DEBUG) # logger = logging.getLogger(__name__) results = None...
normal
{ "blob_id": "c4720eb5a42267970d3a98517dce7857c0ba8450", "index": 8938, "step-1": "<mask token>\n\n\ndef check_date():\n global results\n global date_post\n current_datetime = datetime.datetime.now()\n current_date = current_datetime.date()\n if date_post is not None:\n if date_post < curren...
[ 4, 5, 6, 7, 9 ]
from email import encoders from email.header import Header from email.mime.text import MIMEText from email.utils import parseaddr, formataddr import smtplib def _format_addr(s): name, addr = parseaddr(s) return formataddr((Header(name, 'UTF-8').encode(), addr)) from_addr = 'gaofeng4280@163.com' to_addr = '1...
normal
{ "blob_id": "4dd71d01e499f3d0ee49d3bf5204fb3bbb03ede5", "index": 2976, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef _format_addr(s):\n name, addr = parseaddr(s)\n return formataddr((Header(name, 'UTF-8').encode(), addr))\n\n\n<mask token>\nserver.set_debuglevel(1)\nserver.login()\nserver....
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class FixtureBittrex: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|...
flexible
{ "blob_id": "eba8e2bda786760898c10d3e75620144973d6236", "index": 9555, "step-1": "<mask token>\n", "step-2": "class FixtureBittrex:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in packings_str.strip().splitlines(): line_items = line.split(' | ') line_items = [s.strip() for s in line_items] name, material, size, N, a, eps, CS, CFl, Ch, CP0, CL, CV = line_items packings.append({'na...
flexible
{ "blob_id": "c4f656b96ddc86ab2575bd5ec646833cce95e6a9", "index": 1717, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in packings_str.strip().splitlines():\n line_items = line.split(' | ')\n line_items = [s.strip() for s in line_items]\n name, material, size, N, a, eps, CS, CFl, Ch, CP0...
[ 0, 1, 2, 3 ]
import pymongo import os,sys import re from db_User import * from db_Event import * class ClassRoom: # 链接本地客户端 __myclient = pymongo.MongoClient("mongodb://localhost:27017") # 创建数据库 __mydb = __myclient["MMKeyDB"] # 创建新的集合 __mycol = __mydb["ClassRoom"] # 判断是否输入id或是输入name,如果有输入则转译 def ...
normal
{ "blob_id": "8dae8a89d08bc522f9a5fdde8aeb9e322fafcbec", "index": 3251, "step-1": "<mask token>\n\n\nclass ClassRoom:\n <mask token>\n <mask token>\n <mask token>\n\n def Name2Id(room_id, name):\n bool_n = bool(re.match('教\\\\d{1}-\\\\d{3}', name))\n bool_id = bool(re.match('B\\\\d{1}R\\...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CommentSerializer(serializers.ModelSerializer): class Meta: model = Comment fields = '__all__' class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message ...
flexible
{ "blob_id": "536a67935527eb99bc0424613c9b931401db0b06", "index": 6461, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CommentSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Comment\n fields = '__all__'\n\n\nclass MessageSerializer(serializers.ModelSerialize...
[ 0, 2, 3, 4, 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": "09bf7460b2c928bf6e1346d9d1e2e1276540c080", "index": 3099, "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 = [('venue', '00...
[ 0, 1, 2, 3, 4 ]
# - *- coding: utf- 8 - *- import RPi.GPIO as io import time import math io.setmode(io.BOARD) hz = 50 dt = 1/hz kr = 48 enc_res = 0.01636246 num_samples = 100 special_words = ['BackSpace', 'Tab', 'Enter', 'Cap', 'Shift2', 'Ctrl1', 'WIN1', 'Alt1', 'Alt2', 'WIN2', 'MClick', 'Ctrl2', 'Shift1', '\\'] L1...
normal
{ "blob_id": "ce1ef1ce538b8753af9e4b3e8e88f4cde9a2d860", "index": 9620, "step-1": "# - *- coding: utf- 8 - *-\r\n\r\nimport RPi.GPIO as io\r\nimport time\r\nimport math\r\n\r\nio.setmode(io.BOARD)\r\n\r\nhz = 50\r\ndt = 1/hz\r\nkr = 48\r\nenc_res = 0.01636246\r\nnum_samples = 100\r\nspecial_words = ['BackSpace', ...
[ 0 ]
from os import walk from ccal import VERSION from setuptools import setup package_data = [] for directory_path, directory_names, file_names in walk("data"): for file_name in file_names: package_data.append("{}/{}".format(directory_path, file_name)) setup( name="ccal", version=VERSION, desc...
normal
{ "blob_id": "11d0e84767f7e9e4687962a3a5c58dc882cc4dd2", "index": 1934, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor directory_path, directory_names, file_names in walk('data'):\n for file_name in file_names:\n package_data.append('{}/{}'.format(directory_path, file_name))\nsetup(name='cca...
[ 0, 1, 2, 3, 4 ]
"""Admin module for Django.""" from django.contrib import admin from django.utils.translation import gettext_lazy as _ from django_q.conf import Conf, croniter from django_q.models import Failure, OrmQ, Schedule, Success from django_q.tasks import async_task class TaskAdmin(admin.ModelAdmin): """model admin for ...
normal
{ "blob_id": "5aebebb7f22e094a1a897b3266ff07d59400b76c", "index": 2209, "step-1": "<mask token>\n\n\nclass ScheduleAdmin(admin.ModelAdmin):\n \"\"\"model admin for schedules\"\"\"\n list_display = ('id', 'name', 'func', 'schedule_type', 'repeats',\n 'cluster', 'next_run', 'last_run', 'success')\n ...
[ 10, 21, 22, 23, 26 ]
import itertools def zbits(n,k): zeros = "0" * k ones = "1" * (n-k) binary = ones+zeros string = {''.join(i) for i in itertools.permutations(binary, n)} return(string) assert zbits(4, 3) == {'0100', '0001', '0010', '1000'} assert zbits(4, 1) == {'0111', '1011', '1101', '1110'} assert zbits(5, 4)...
normal
{ "blob_id": "a8d13c3fbf6051eba392bcdd6dcb3e946696585f", "index": 9065, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef zbits(n, k):\n zeros = '0' * k\n ones = '1' * (n - k)\n binary = ones + zeros\n string = {''.join(i) for i in itertools.permutations(binary, n)}\n return string\n\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for b in range(1, w + 1): print('*', end='') print('') for i in range(1, h - 1): print('*', end='') for j in range(1, w - 1): print(' ', end='') print('*', end='') print('') for b in range(1, w + 1): ...
flexible
{ "blob_id": "32b961f3971819fdbbe1a30fd7cf1883353c1854", "index": 2294, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor b in range(1, w + 1):\n print('*', end='')\nprint('')\nfor i in range(1, h - 1):\n print('*', end='')\n for j in range(1, w - 1):\n print(' ', end='')\n print('*', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, len(a)): if a[i] < 5: print(str(a[i]) + ' ') i += 1 else: i += 1 <|reserved_special_token_1|> a = [1, 1, 2, 3, 4, 4, 5, 7, 12, 30, 49] for i in range(0, len(a)): if a[i] < 5...
flexible
{ "blob_id": "24635989ccdb0f35f1e618dd8dc07f2cf84faddb", "index": 6621, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, len(a)):\n if a[i] < 5:\n print(str(a[i]) + ' ')\n i += 1\n else:\n i += 1\n", "step-3": "a = [1, 1, 2, 3, 4, 4, 5, 7, 12, 30, 49]\nfor i in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TCP: <|reserved_special_token_0|> def connect(self, host, port): server_address = host, port print('connecting to {} port {}'.format(*server_address)) self.sock.connect(server_address) def send(self, value, convergence=False): """Send on...
flexible
{ "blob_id": "cc66dcd34115e72479953ca24f4b2eaeb52cf313", "index": 7747, "step-1": "<mask token>\n\n\nclass TCP:\n <mask token>\n\n def connect(self, host, port):\n server_address = host, port\n print('connecting to {} port {}'.format(*server_address))\n self.sock.connect(server_address)...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def checkio(data): return True or False <|reserved_special_token_1|> ''' Given an expression with numbers, brackets and operators. But in this task only brackets are important. Brackets can be one of three types -- "{}" "...
flexible
{ "blob_id": "f69b4d022ebed5a0b660f55704bbe762d5d765d5", "index": 1332, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef checkio(data):\n return True or False\n", "step-3": "'''\nGiven an expression with numbers, brackets and operators. But in this task only brackets are important. Brackets can...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- from lxml import etree if __name__ == '__main__': # xpath可以解析网页中的内容,html或者xml类型的文件都是<>开头结尾,层次非常明显 # data = '''<div> # <ul> # <li class="item-0"><a href="http://www.baidu.com">百度</a></li> # <li class="item-1"><a href="http://www.baidu.com">百度</a></li> ...
normal
{ "blob_id": "52c356b903b1fbb8cbf24c899ed86d7bf134a821", "index": 6387, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n tree = etree.parse('./data.html')\n result = tree.xpath('//div[@id=\"p\"]//li')\n for r in result:\n print('--------', etree.tostring(r, encod...
[ 0, 1, 2, 3 ]
#Import Discord Package import discord from discord.ext import commands import asyncio import glob from dotenv import load_dotenv import os load_dotenv() # Load your Discord Token TOKEN = os.getenv("TOKEN") bot = commands.Bot(command_prefix='.',case_insensitive=True) print('Ready!') @bot.command() async def stop...
normal
{ "blob_id": "41842e8b75860c65e87e9db1f7ae058957e37e45", "index": 1822, "step-1": "<mask token>\n", "step-2": "<mask token>\nload_dotenv()\n<mask token>\nprint('Ready!')\n\n\n@bot.command()\nasync def stop(ctx):\n await ctx.message.delete()\n await ctx.voice_client.disconnect()\n\n\n@bot.command()\nasync ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': for i in range(10): print('here %s' % i) time.sleep(1) print('TEST SUCEEDED') <|reserved_special_token_1|> import time if __name__ == '__main__': for i in range(10): ...
flexible
{ "blob_id": "a159f9f9cc06bb9d22f84781fb2fc664ea204b64", "index": 6856, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n for i in range(10):\n print('here %s' % i)\n time.sleep(1)\n print('TEST SUCEEDED')\n", "step-3": "import time\nif __name__ == '__main__...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print() <|reserved_special_token_0|> driver.get('https://strawpoll.com/jhzd6qwjw') for i in range(0, n + 1): driver.delete_all_cookies() try: button = WebDriverWait(driver, 10).until(EC. presence_of_ele...
flexible
{ "blob_id": "0e2b4e8e8c5a728e5123dfa704007b0f6adaf1e1", "index": 4561, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint()\n<mask token>\ndriver.get('https://strawpoll.com/jhzd6qwjw')\nfor i in range(0, n + 1):\n driver.delete_all_cookies()\n try:\n button = WebDriverWait(driver, 10).unti...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Session: <|reserved_special_token_0|> class StateEnum: """ A class for defining session state. """ ACTIVE = 'Active' INACTIVE = 'Inactive' CLOSED = 'Closed' KILLED = 'Killed' EXPIRED = 'Expired' DISABL...
flexible
{ "blob_id": "80469fd945a21c1bd2b5590047016a4b60880c88", "index": 7006, "step-1": "<mask token>\n\n\nclass Session:\n <mask token>\n\n\n class StateEnum:\n \"\"\"\n A class for defining session state.\n \"\"\"\n ACTIVE = 'Active'\n INACTIVE = 'Inactive'\n CLOSED = '...
[ 18, 21, 25, 28, 31 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> st.set_option('deprecation.showfileUploaderEncoding', False) np.set_printoptions(suppress=True) <|reserved_special_token_0|> st.title('Leaf Disease Detection Using Machine Learning') <|reserved_special_token_0|> if uploaded_file i...
flexible
{ "blob_id": "746e0895f0fb971156e778cbff20317cc88441f1", "index": 2059, "step-1": "<mask token>\n", "step-2": "<mask token>\nst.set_option('deprecation.showfileUploaderEncoding', False)\nnp.set_printoptions(suppress=True)\n<mask token>\nst.title('Leaf Disease Detection Using Machine Learning')\n<mask token>\nif...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def welcome(request): return render(request, 'welcome.html') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def welcome(request): return render(request, 'welcome.html') de...
flexible
{ "blob_id": "d5f66d92371838c703abbf80e2b78717cdd4a4fb", "index": 7140, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef welcome(request):\n return render(request, 'welcome.html')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef welcome(request):\n return render(request, 'welcome.html'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def greedy_motif_search(dnas, k, t): best_motifs = [dna[:k] for dna in dnas] best_score = score_motifs(best_motifs) for i in range(len(dnas[0]) - k + 1): print(i) motifs = [dnas[0][i:i + k]] for j in range(1, t): motifs.append(profile_most_p...
flexible
{ "blob_id": "ed7fa6e6f30eb06400cb38128617967a597f6c04", "index": 2450, "step-1": "<mask token>\n\n\ndef greedy_motif_search(dnas, k, t):\n best_motifs = [dna[:k] for dna in dnas]\n best_score = score_motifs(best_motifs)\n for i in range(len(dnas[0]) - k + 1):\n print(i)\n motifs = [dnas[0]...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Parser(argparse.ArgumentParser): def error(self, message): sys.stderr.write(message + '\n\n') self.print_help() sys.exit(2) <|reserved_special_token_0|> class ParserCreator(object): def __init__(self): self.create_main() self.cre...
flexible
{ "blob_id": "539523f177e2c3c0e1fb0226d1fcd65463b68a0e", "index": 6576, "step-1": "<mask token>\n\n\nclass Parser(argparse.ArgumentParser):\n\n def error(self, message):\n sys.stderr.write(message + '\\n\\n')\n self.print_help()\n sys.exit(2)\n\n\n<mask token>\n\n\nclass ParserCreator(obje...
[ 17, 18, 29, 30, 32 ]
# -*- coding: utf-8 -*- """ ----------------------------------------- IDEA Name : PyCharm Project Name : HelloWorld ----------------------------------------- File Name : task_worker Description : Author : Edwin Date : 2018/1/4 23:38 ----------------------------------------- Cha...
normal
{ "blob_id": "be1bfa3e366d715d32613284924cf79abde06d41", "index": 582, "step-1": "<mask token>\n\n\nclass QueueManager(BaseManager):\n pass\n\n\ndef start_request():\n QueueManager.register('get_task_queue')\n QueueManager.register('get_result_queue')\n server_add = '127.0.0.1'\n print('Connect to ...
[ 2, 3, 4, 5, 6 ]
from typing import (Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union, overload) from pccm.stubs import EnumClassValue, EnumValue from cumm.tensorview import Tensor class ConvMainUnitTest: @staticmethod def implicit_gemm(input: Tensor, weight: Tensor, output: Tensor, padding: L...
normal
{ "blob_id": "a6f3c51d4115a6e0d6f01aa75bf5e6e367840d43", "index": 914, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ConvMainUnitTest:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ConvMainUnitTest:\n\n @staticmethod\n def implicit_gemm(input: Tensor, weight: Tensor, output: ...
[ 0, 1, 2, 3, 4 ]
import os import click import csv import sqlite3 from sqlite3.dbapi2 import Connection import requests import mimetypes from urllib.parse import urljoin, urlparse from lxml.html.soupparser import fromstring from lxml import etree from lxml.etree import tostring from analysis import lmdict, tone_count_with_negation_chec...
normal
{ "blob_id": "88e4e6647d4720d1c99f3e3438100790903921b5", "index": 9163, "step-1": "<mask token>\n\n\n@click.command()\n@click.option('-s', '--batch-size', 'batch_size', default=50)\ndef analyze(batch_size):\n db = db_connect()\n db_ensure_init(db)\n cmd = db.execute('SELECT id, url FROM reports WHERE is_...
[ 3, 6, 9, 10, 13 ]
"""Functions for updating and performing bulk inference using an Keras MPNN model""" from typing import List, Dict, Tuple import numpy as np import tensorflow as tf from molgym.mpnn.data import convert_nx_to_dict from molgym.mpnn.layers import custom_objects from molgym.utils.conversions import convert_smiles_to_nx ...
normal
{ "blob_id": "95ab8fce573ef959946d50d9af6e893cb8798917", "index": 6714, "step-1": "<mask token>\n\n\nclass MPNNMessage:\n \"\"\"Package for sending an MPNN model over pickle\"\"\"\n\n def __init__(self, model: tf.keras.Model):\n \"\"\"\n Args:\n model: Model to be sent\n \"\"...
[ 9, 11, 12, 13, 14 ]
##################### # Aufgabe 2, 13.7 # # v1.0 # # baehll # # 04.05.2018 # ##################### class Pinnwand: def __init__(self): self.__zettel = [] def hefteAn(self, notiz): #Analyse des Textes prio = notiz.count("!") self.__zettel.ap...
normal
{ "blob_id": "382a3b8bcd07c7098cecf2b770e46dfff50eeb98", "index": 2695, "step-1": "class Pinnwand:\n\n def __init__(self):\n self.__zettel = []\n\n def hefteAn(self, notiz):\n prio = notiz.count('!')\n self.__zettel.append((prio, notiz))\n <mask token>\n\n def __str__(self):\n ...
[ 4, 5, 6, 7, 8 ]
""" """ import cPickle as pickle def convert_cpu_stats_to_num_array(cpuStats): """ Given a list of statistics (tuples[timestamp, total_cpu, kernel_cpu, vm, rss]) Return five numarrays """ print "Converting cpus stats into numpy array" c0 = [] c1 = [] c2 = [] c3 = [] c4 = [] ...
normal
{ "blob_id": "85f5f9370896eac17dc72bbbf8d2dd1d7adc3a5b", "index": 7872, "step-1": "\"\"\"\n\n\"\"\"\nimport cPickle as pickle\n\n\ndef convert_cpu_stats_to_num_array(cpuStats):\n \"\"\"\n Given a list of statistics (tuples[timestamp, total_cpu, kernel_cpu, vm, rss])\n Return five numarrays\n \"\"\"\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def pantip(k, n, arr, path, len): if len == 0: if sum(path) == k: path.reverse() print(path) return path.append(arr[len - 1]) pantip(k, n, arr, path, len - 1) path.pop() pantip(k, n, arr, path, len -...
flexible
{ "blob_id": "6cdaf89d97be8f5ef37ab35f2916a36b4c75ddbe", "index": 7513, "step-1": "<mask token>\n", "step-2": "def pantip(k, n, arr, path, len):\n if len == 0:\n if sum(path) == k:\n path.reverse()\n print(path)\n return\n path.append(arr[len - 1])\n pantip(k, n, arr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CommentForm(ModelForm): class Meta: model = Comment <|reserved_special_token_1|> from django.forms import ModelForm from django import forms from models import * from django.forms.widgets import * class ...
flexible
{ "blob_id": "81535b43437f9bcb18973ceaa5c3340ad9bd4f0f", "index": 4170, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CommentForm(ModelForm):\n\n\n class Meta:\n model = Comment\n", "step-3": "from django.forms import ModelForm\nfrom django import forms\nfrom models import *\nfrom d...
[ 0, 1, 2, 3 ]
""" Implements BCFW for DIFFRAC objectives. """ import numpy as np import os from tqdm import tqdm from numpy.linalg import norm as matrix_norm import time def get_feat_block(feats, block_idx, memory_mode, bias_value=-1.0): """Get feature for a given block.""" if memory_mode == 'RAM': feat = feats[bl...
normal
{ "blob_id": "af02cd0778e19df7b11145c4863776a1afd1cca6", "index": 1484, "step-1": "\"\"\" Implements BCFW for DIFFRAC objectives. \"\"\"\n\nimport numpy as np\nimport os\nfrom tqdm import tqdm\nfrom numpy.linalg import norm as matrix_norm\nimport time\n\n\ndef get_feat_block(feats, block_idx, memory_mode, bias_va...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def merge_sort(items, temp, low, high): if high <= low: return None mid = low + (high - low) // 2 merge_sort(items, temp, low, mid) merge_sort(items, temp, mid + 1, high) merge(items, temp, low, mid, ...
flexible
{ "blob_id": "9ab119b32ceac370b744658e5fa679292609373a", "index": 2517, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef merge_sort(items, temp, low, high):\n if high <= low:\n return None\n mid = low + (high - low) // 2\n merge_sort(items, temp, low, mid)\n merge_sort(items, temp...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>) # Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) # # This program is f...
normal
{ "blob_id": "d9538c030c0225c4255100da70d6bf23f550a64f", "index": 734, "step-1": "<mask token>\n\n\nclass SaleOrderLine(osv.osv):\n <mask token>\n _inherit = 'sale.order.line'\n _columns = {'promotion_line': fields.boolean('Promotion Line', help=\n 'Indicates if the line was created by promotions'...
[ 2, 4, 6, 9, 10 ]
""" Copyright (C) 2014, Jill Huchital """ # test comment from flask import Flask from flask import render_template from flask import jsonify from flask import request from playlists import get_all_playlists, create_playlists, get_all_categories, add_new_category, add_new_topic, get_all_topics from db import connect_...
normal
{ "blob_id": "5193de15052f81460a23d993cfa039fa90c9de5e", "index": 897, "step-1": "<mask token>\n\n\n@app.route('/hello/')\ndef hello():\n return render_template('index.html', greeting='here we are')\n\n\n<mask token>\n\n\n@app.route('/api/1.0/create_playlists', methods=['POST'])\ndef do_create_playlists():\n ...
[ 6, 9, 11, 13, 14 ]
from PIL import Image from pdf2image import convert_from_path import glob from pathlib import Path import shutil, os from docx import Document import fnmatch import re import shutil def find_files_ignore_case(which, where='.'): '''Returns list of filenames from `where` path matched by 'which' shell patter...
normal
{ "blob_id": "a9876c61578a53f29865062c0915db622aaaba72", "index": 6916, "step-1": "<mask token>\n\n\ndef crop_image_center(file, crop_left, crop_right, crop_top, crop_bottom):\n img = Image.open(file)\n x, y = img.size\n box = (crop_left, crop_top, x - crop_left - crop_right, y - crop_top -\n crop...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): global window global _form print('You are using Python {}.{}.{}'.format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro)) window = tk.Tk() GUIForm.BuildInterface(win...
flexible
{ "blob_id": "ca5057a5fdfef0edf4cf0c3ff3e2a371907ca4ee", "index": 1270, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n global window\n global _form\n print('You are using Python {}.{}.{}'.format(sys.version_info.major,\n sys.version_info.minor, sys.version_info.micro))\n ...
[ 0, 1, 2, 3, 4 ]
import numpy as np import math import random from numpy.linalg import inv from scipy.optimize import minimize from Util import to_vector class TS_RLR: def __init__(self, alpha): self.d = 6 self.k = 6 self.alpha = alpha self.batch_size = 1000 self.training_size = 1000 self.impressions = 0 self.batch_...
normal
{ "blob_id": "49df9db508637ce5914aa6591178a03c609b6bc7", "index": 659, "step-1": "<mask token>\n\n\nclass TS_RLR:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TS_RLR:\n\n def __init__(self,...
[ 1, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def generate_hashes(seed): a = [] current_hash = seed for i in range(1000): current_hash = md5.new(current_hash).hexdigest() a.append(current_hash) return a def find_prev_hash(array, current_hash): return array[array.index(current_hash) - 1] <|reser...
flexible
{ "blob_id": "5e78992df94cbbe441495b7d8fb80104ec000748", "index": 6728, "step-1": "<mask token>\n\n\ndef generate_hashes(seed):\n a = []\n current_hash = seed\n for i in range(1000):\n current_hash = md5.new(current_hash).hexdigest()\n a.append(current_hash)\n return a\n\n\ndef find_prev...
[ 5, 7, 9, 10, 11 ]
<|reserved_special_token_0|> @app.route('/') def index(): return render_template('index.html') @app.route('/submit', methods=['POST']) def submit(): if request.method == 'POST': name = request.form['name'] email = request.form['email'] subject = request.form['subject'] messag...
flexible
{ "blob_id": "27d9e6a868cfc18780ec9615e8dbc3b5ea2fd0c3", "index": 1399, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/submit', methods=['POST'])\ndef submit():\n if request.method == 'POST':\n name = request.form['name']\n e...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def llanguage(msg): chat = msg.chat base.create_user(msg.chat.id, msg.text) markup = telebot.types.ReplyKeyboardMarkup(True, True) markup.row('ok') str = bot.send_message(msg.chat.id, base.get_text(msg.chat.id, 'confirm'), reply_markup=markup) bot.register_...
flexible
{ "blob_id": "7cc77de31adff5b4a394f117fc743cd6dd4bc06c", "index": 6065, "step-1": "<mask token>\n\n\ndef llanguage(msg):\n chat = msg.chat\n base.create_user(msg.chat.id, msg.text)\n markup = telebot.types.ReplyKeyboardMarkup(True, True)\n markup.row('ok')\n str = bot.send_message(msg.chat.id, base...
[ 19, 20, 30, 36, 37 ]
import urllib.request class GetData: key = 'fDs8VW%2BvtwQA8Q9LhBW%2BT2ETVBWWJaITjKfpzDsNJO8ugDsvdboInI16ZD295Txxtxwhc4G3PwMAvxd%2FWvz2gQ%3D%3D&pageNo=1&numOfRows=999' url = "http://apis.data.go.kr/B552657/ErmctInfoInqireService/getEgytBassInfoInqire?serviceKey=" + key def main(self): data = urllib...
normal
{ "blob_id": "58ca520a2f43cef26a95de446f9c7a82819b0b66", "index": 833, "step-1": "<mask token>\n\n\nclass GetData:\n key = (\n 'fDs8VW%2BvtwQA8Q9LhBW%2BT2ETVBWWJaITjKfpzDsNJO8ugDsvdboInI16ZD295Txxtxwhc4G3PwMAvxd%2FWvz2gQ%3D%3D&pageNo=1&numOfRows=999'\n )\n url = (\n 'http://apis.data.go...
[ 3, 4, 5, 6, 7 ]
from typing import List class Solution: def grayCode(self, n: int) ->List[int]: res = [0] * 2 ** n exp = 0 l = r = 1 for i in range(1, 2 ** n): res[i] += res[r - i] + 2 ** exp if i == r: exp += 1 l = r + 1 r =...
normal
{ "blob_id": "dc600763b12edda05820721098e7e5bc80f74c89", "index": 4798, "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 grayCode(self, n: int) ->List[int]:\n res = [0] * 2 ** n\n exp = 0\n ...
[ 0, 1, 2, 3 ]
import serial, time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.OUT) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.OUT) GPIO.setup(7, GPIO.OUT) pwm1 = GPIO.PWM(23,100) pwm2 = GPIO.PWM(24,100) pwm1.start(100) pwm2.start(100...
normal
{ "blob_id": "647aa37c53aac7c620e5095c7a9368f4ad038608", "index": 8209, "step-1": "import serial, time\nimport RPi.GPIO as GPIO\nGPIO.setmode(GPIO.BCM)\n\nGPIO.setup(4, GPIO.OUT)\nGPIO.setup(17, GPIO.OUT)\nGPIO.setup(27, GPIO.OUT)\nGPIO.setup(22, GPIO.OUT)\nGPIO.setup(23, GPIO.OUT)\nGPIO.setup(24, GPIO.OUT)\nGPIO...
[ 0 ]
# coding: utf-8 # 02. 「パトカー」+「タクシー」=「パタトクカシーー」 # 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ. s1 = "パトカー" s2 = "タクシー" ans = "" for c1, c2 in zip(s1, s2): ans += c1 + c2 print(ans) #パタトクカシーー
normal
{ "blob_id": "4d7e30714ae209e1d09d895dadf7a19928fe253f", "index": 6623, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\nprint(ans)\n", "step-3": "s1 = 'パトカー'\ns2 = 'タクシー'\nans = ''\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\nprint(ans)\n", "step-4": ...
[ 0, 1, 2, 3 ]
""" pyautogui 屏幕像素获取、屏幕像素匹配 @author : zhouhuajian @version : v1.0 """ from pyautogui import pixel, pixelMatchesColor, screenshot """ 主要内容: 1. pixel() - 获取屏幕像素; 2. pixelMatchesColor() - 屏幕像素匹配颜色。 """ def test_pixel_pixelMatchesColor(): """屏幕像素获取、屏幕像素匹配""" # img = screenshot() # print(img) # print(i...
normal
{ "blob_id": "c15faf9df8fa2e1ad89ea2c922ab0551eaa69d3f", "index": 1936, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_pixel_pixelMatchesColor():\n \"\"\"屏幕像素获取、屏幕像素匹配\"\"\"\n print(pixelMatchesColor(44, 107, (148, 212, 234), tolerance=20))\n print(pixelMatchesColor(44, 107, (100, 21...
[ 0, 1, 2, 3, 4 ]
for _ in range(int(input())): n = int(input()) s = input() cur = 0 for i in s[::-1]: if i==')': cur+=1 else: break print("Yes") if cur>n//2 else print("No")
normal
{ "blob_id": "31b420adebbe0d3ee6da2ed8236ece1526bdb063", "index": 6290, "step-1": "<mask token>\n", "step-2": "for _ in range(int(input())):\n n = int(input())\n s = input()\n cur = 0\n for i in s[::-1]:\n if i == ')':\n cur += 1\n else:\n break\n print('Yes') ...
[ 0, 1, 2 ]
#This models.py is under UserRegApp1 folder from django.db import models # Create your models here. class UserRegModel(models.Model): username = models.CharField(max_length=15) emailid = models.EmailField() password1= models.CharField(max_length=6) password2= models.CharField(max_length=6) mailse...
normal
{ "blob_id": "d0653dac8e7c8162070ed9fd191f7fb318f47c60", "index": 1719, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserRegModel(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UserRegModel(model...
[ 0, 1, 2, 3, 4 ]
import numpy as np import heapq class KdNode: """ node of kdtree. """ def __init__(self, depth, splitting_feature, splitting_value, idx, parent): """ :param depth: depth of the node. :param splitting_feature: split samples by which feature. :param splitting_value: split...
normal
{ "blob_id": "2f16c74e51789dd06bfc1fe1c6173fa5b0ac38cd", "index": 4747, "step-1": "<mask token>\n\n\nclass KdTree:\n <mask token>\n\n def __init__(self):\n self.root = None\n\n def create(self, X, dimensions=None):\n \"\"\"\n create a kd-tree on data X.\n :param X: shape is (n...
[ 6, 7, 10, 12, 13 ]
# -*- coding: utf-8 -*- # @Time : 2019/9/17 17:48 # @Author : ZhangYang # @Email : ian.zhang.88@outlook.com from functools import wraps def create_new_sequence_node(zk_client, base_path, prefix, is_ephemeral=False): if not zk_client.exists(base_path): zk_client.ensure_path(base_path) new_node =...
normal
{ "blob_id": "f9a0c3b643c2ee6bb6778477bf8fc21564812081", "index": 3373, "step-1": "<mask token>\n\n\nclass SetGetMixin:\n\n def get(path_variable):\n\n def decorator(func):\n\n @wraps(func)\n def wrapper(self, *args, **kwargs):\n if not self.zk_client.exists(getattr(...
[ 2, 3, 4, 5, 6 ]
# coding=utf-8 from smallinvoice.commons import BaseJsonEncodableObject, BaseService class Catalog(BaseJsonEncodableObject): def __init__(self, catalog_type, unit, name, cost_per_unit, vat=0): self.type = catalog_type self.unit = unit self.name = name self.cost_per_unit = cost_per_...
normal
{ "blob_id": "37feeba8ff682e5998fde4bcba8c37043cb593f2", "index": 5195, "step-1": "<mask token>\n\n\nclass CatalogService(BaseService):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CatalogService(BaseService):\n name = 'catalog'\n", "step-3": "<mask token>\n\n\nclass Catalog(BaseJsonEncodableOb...
[ 1, 2, 3, 5, 6 ]
# common methods to delete data from list fruits = ['orange', ' apple', 'pear', 'banana', 'kiwi'] #pop method # fruits.pop(1) # del # del fruits[1] # remove # fruits.remove('banana') # append, extend, insert # pop, remove, del print(fruits)
normal
{ "blob_id": "a245cb1f232b152edf40b6399686c6811c522d99", "index": 6458, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(fruits)\n", "step-3": "fruits = ['orange', ' apple', 'pear', 'banana', 'kiwi']\nprint(fruits)\n", "step-4": "# common methods to delete data from list\r\nfruits = ['orange', ' a...
[ 0, 1, 2, 3 ]
from django.shortcuts import render # Create your views here. def test_petite_vue(request): return render(request, 'petite_vue_app/test-form.html')
normal
{ "blob_id": "709f2425bc6e0b0b650fd6c657df6d85cfbd05fe", "index": 84, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_petite_vue(request):\n return render(request, 'petite_vue_app/test-form.html')\n", "step-3": "from django.shortcuts import render\n\n\ndef test_petite_vue(request):\n r...
[ 0, 1, 2, 3 ]