code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from django.db import models from django.contrib.auth.models import User from django.utils.encoding import smart_unicode from django.core.validators import MinValueValidator from django.utils import timezone from concurrency.fields import IntegerVersionField class ProductCategory(models.Model): name = models.Char...
normal
{ "blob_id": "9bb15842b39c7fd3e6f6c0048a51c2b2112ddb94", "index": 8082, "step-1": "<mask token>\n\n\nclass Auction(models.Model):\n title = models.CharField(max_length=20)\n current_price = models.DecimalField(max_digits=10, decimal_places=2,\n default=0, null=True, blank=True, verbose_name='current ...
[ 15, 20, 23, 25, 26 ]
from django.db import models # Create your models here. class Products(models.Model): title = models.CharField(max_length=255) year = models.IntegerField(default=0) feature = models.CharField(max_length=30) usage_status = models.CharField(max_length=25) kms_driven = models.CharField(max_length=10)...
normal
{ "blob_id": "5b0252dd862fe1e46c0c1df41935db16ae691dff", "index": 7277, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Products(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Prod...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def game(): for i in range(1000): request = input('Auto-Bot at your service. Please state your request. ' ) if request == 'google': query = input('Search: ') print(search(query, num_results=3)) elif request == 'stocks': ...
flexible
{ "blob_id": "60354f25f55136d4e873d118cfe048cf08c06e39", "index": 1587, "step-1": "<mask token>\n\n\ndef game():\n for i in range(1000):\n request = input('Auto-Bot at your service. Please state your request. '\n )\n if request == 'google':\n query = input('Search: ')\n ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals import pytest from unittest import TestCase from pydsf.exceptions import DSFServiceError from pydsf.service.response import parse_response from pydsf.service.translations import translate_input_fields, translate_output_fields class MockMessage(object):...
normal
{ "blob_id": "bbff797fab4ac7dc7e6adb81c0eeda561f8ee147", "index": 9603, "step-1": "<mask token>\n\n\nclass MockResponseError(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MockResponseParsed(object):\n HOV = list()\n\n def __init__(self):\n self.HOV.append(('FODT', '010107'...
[ 17, 24, 26, 29, 30 ]
<|reserved_special_token_0|> def parse_args(): """ parse args """ parser = argparse.ArgumentParser(description='ternarybert evaluation') parser.add_argument('--device_target', type=str, default='Ascend', choices=['Ascend', 'GPU'], help= 'Device where the code will be implemented. (...
flexible
{ "blob_id": "883d2efeb6d7d43cf82eef2e0397110fd8e3ea03", "index": 4368, "step-1": "<mask token>\n\n\ndef parse_args():\n \"\"\"\n parse args\n \"\"\"\n parser = argparse.ArgumentParser(description='ternarybert evaluation')\n parser.add_argument('--device_target', type=str, default='Ascend',\n ...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.1.7 on 2021-02-20 02:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('usuarios', '0001_initial'), ('plataforma', '0005_auto_20210219_2343'), ] operations = [ migrations....
normal
{ "blob_id": "3f9be81c86852a758440c6a144b8caba736b3868", "index": 972, "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 = [('usuarios', '...
[ 0, 1, 2, 3, 4 ]
import requests from pyrogram import Client as Bot from samantha.config import API_HASH, API_ID, BG_IMAGE, BOT_TOKEN from samantha.services.callsmusic import run response = requests.get(BG_IMAGE) file = open("./etc/tg_vc_bot.jpg", "wb") file.write(response.content) file.close() bot = Bot( ":memory:", API_ID,...
normal
{ "blob_id": "c5ac37ce09f7cd76ccd9b93c64e602209a04c55c", "index": 1824, "step-1": "<mask token>\n", "step-2": "<mask token>\nfile.write(response.content)\nfile.close()\n<mask token>\nbot.start()\nrun()\n", "step-3": "<mask token>\nresponse = requests.get(BG_IMAGE)\nfile = open('./etc/tg_vc_bot.jpg', 'wb')\nfi...
[ 0, 1, 2, 3, 4 ]
from django.db import models import django.utils.timezone as timezone # Create your models here. # Create your models here. class Categories(models.Model): # 文章分类 name = models.CharField(max_length=200, verbose_name = "分类名称") parent = models.ForeignKey('self', default=0, on_delete=models.DO_NOTHING, null = True...
normal
{ "blob_id": "512a13084a860e2784020664a3d5824d9dace6db", "index": 7764, "step-1": "<mask token>\n\n\nclass Images(models.Model):\n wordroot_text = models.CharField(max_length=255, verbose_name='词根')\n wordroot_id = models.IntegerField(default=0, null=True, blank=True,\n verbose_name='词根id, 可空')\n ...
[ 14, 20, 22, 26, 27 ]
import pytorch_lightning as pl from matplotlib import pyplot as plt class Model(pl.LightningModule): def __init__(self, net): super(Model, self).__init__() self.net = net self.save_hyperparameters() self.criterion = None self.optimizer = None self.batch_loss_collec...
normal
{ "blob_id": "324081eb4e133f6d16e716f3119e4cbc5e045ede", "index": 8526, "step-1": "<mask token>\n\n\nclass Model(pl.LightningModule):\n <mask token>\n\n def init_training_parameters(self, criterion, optimizer):\n self.criterion = criterion\n self.optimizer = optimizer\n\n def set_criterion(...
[ 8, 10, 12, 15 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "d2368ab243a0660cf98f1cf89d3d8f6cc85cefaa", "index": 6384, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def toggle_relay(value): session = subprocess.Popen('./relay ' + value, stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = session.communicate() if stderr: raise Exception('Error ' + str(stderr)) return stdout <|reserved_special_token_0|> @app.route...
flexible
{ "blob_id": "18d1722529a63f9a1696b09c40dabb1c68ed55f4", "index": 3423, "step-1": "<mask token>\n\n\ndef toggle_relay(value):\n session = subprocess.Popen('./relay ' + value, stdout=PIPE, stderr=PIPE,\n shell=True)\n stdout, stderr = session.communicate()\n if stderr:\n raise Exception('Err...
[ 2, 3, 4, 5, 6 ]
import ccxt import json import time from baglanti import mysql_baglan import datetime import requests from urllib.parse import urljoin import sys db = mysql_baglan("bingo") cursor = db.cursor() cursor.execute('SET NAMES utf8;') cursor.execute('SET CHARACTER SET utf8;') cursor.execute('SET character_set_co...
normal
{ "blob_id": "1d29ce58ca626155d626216fbbd70d7b241efa25", "index": 6363, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute('SET NAMES utf8;')\ncursor.execute('SET CHARACTER SET utf8;')\ncursor.execute('SET character_set_connection=utf8;')\n<mask token>\ncursor.execute(sql)\n<mask token>\nfor ro...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def homepage(): argslist = request.args faciltype = argslist.get('facil') facils = [] try: facils = db.getFacilitiesFromFacilityType(faciltype) facils = map(lambda facil: facil.toDictNoType(), facils) except: facils = [] retu...
flexible
{ "blob_id": "2424d667e1bb4ee75b5053eb6f9b002787a5317f", "index": 6391, "step-1": "<mask token>\n\n\n@app.route('/')\ndef homepage():\n argslist = request.args\n faciltype = argslist.get('facil')\n facils = []\n try:\n facils = db.getFacilitiesFromFacilityType(faciltype)\n facils = map(l...
[ 2, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class ActorsCreator(metaclass=SingletonMeta): <|reserved_special_token_0|> def __init__(self): self.consumers = ActorsCreator.create_consumers() self.agents = ActorsCreator.create_agents() def __del__(self): self.stop_all_agents() @staticmethod ...
flexible
{ "blob_id": "db31a69c57f773a79e5eaa8b3443b0366fd74861", "index": 8565, "step-1": "<mask token>\n\n\nclass ActorsCreator(metaclass=SingletonMeta):\n <mask token>\n\n def __init__(self):\n self.consumers = ActorsCreator.create_consumers()\n self.agents = ActorsCreator.create_agents()\n\n def...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def make_PieChart(country): global Data Data = [] client = MongoClient() db = client.mydb if country == 'China': tb = db.ChinaData else: tb = db.WorldData re = list(tb.find()) attrs = ['现存确诊', '死亡', '治愈'] values = [] currentConfirmed...
flexible
{ "blob_id": "f1c65fc4acafbda59aeea4f2dfca2cf5012dd389", "index": 8982, "step-1": "<mask token>\n\n\ndef make_PieChart(country):\n global Data\n Data = []\n client = MongoClient()\n db = client.mydb\n if country == 'China':\n tb = db.ChinaData\n else:\n tb = db.WorldData\n re = ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class atom: aid = 0 atype = '' x = 0.0 y = 0.0 z = 0.0 rid = 0 rtype = '' model = [] chainid = '' def getlen(atm1, atm2): dist = sqrt(pow(atm1.x - atm2.x, 2) + pow(atm1.y - atm2.y, 2) + pow( atm1.z - atm2.z, 2)) return dist <|reserve...
flexible
{ "blob_id": "78123c806e5a8c0cc7511a5024769f8c61621efa", "index": 9877, "step-1": "<mask token>\n\n\nclass atom:\n aid = 0\n atype = ''\n x = 0.0\n y = 0.0\n z = 0.0\n rid = 0\n rtype = ''\n model = []\n chainid = ''\n\n\ndef getlen(atm1, atm2):\n dist = sqrt(pow(atm1.x - atm2.x, 2) ...
[ 5, 6, 8, 9, 10 ]
#ribbon_a and ribbon_b are the two important variables here ribbon_a=None ribbon_b=None #Notes: # - As it turns out, the internal ADC in the Teensy is NOT very susceptible to fluctuations in the Neopixels' current...BUT...the ADS1115 IS. # Therefore, I think a better model would ditch the ADS1115 alltogether ...
normal
{ "blob_id": "06caee24b9d0bb78e646f27486b9a3a0ed5f2502", "index": 6796, "step-1": "<mask token>\n\n\nclass SingleTouchReading:\n <mask token>\n <mask token>\n\n def __init__(self, ribbon):\n self.ribbon = ribbon\n self.read_raw_lower()\n self.read_raw_upper()\n self.process_re...
[ 20, 32, 40, 43, 50 ]
import pathlib import sys import yaml from google.protobuf.json_format import ParseError sys.path = [p for p in sys.path if not p.endswith('bazel_tools')] from tools.config_validation.validate_fragment import validate_fragment def main(): errors = [] for arg in sys.argv[1:]: try: valid...
normal
{ "blob_id": "04097e63de5cd94ca8921be5cb6c2155c1e7bc20", "index": 7534, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n errors = []\n for arg in sys.argv[1:]:\n try:\n validate_fragment('envoy.config.bootstrap.v3.Bootstrap', yaml.\n safe_load(pathlib...
[ 0, 2, 3, 4, 5 ]
from .gunicorn import * from .server_app import *
normal
{ "blob_id": "ed5dd954dedb00bf645f9ca14b5ca9cd122b2adc", "index": 6183, "step-1": "<mask token>\n", "step-2": "from .gunicorn import *\nfrom .server_app import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Database: def __init__(self, context, db_filename='database.sqlite'): session_files = context['session_files'] db_filename = session_files.session_dir / db_filename database_exists = db_filename.is_file() def setup_connection(connection): ...
flexible
{ "blob_id": "45c1510d19af0979326a1b9975ec363b0b80a291", "index": 8123, "step-1": "<mask token>\n\n\nclass Database:\n\n def __init__(self, context, db_filename='database.sqlite'):\n session_files = context['session_files']\n db_filename = session_files.session_dir / db_filename\n database...
[ 8, 9, 12, 15, 16 ]
from django.db.models import Exists from django.db.models import OuterRef from django.db.models import QuerySet from django.utils import timezone class ProductQuerySet(QuerySet): def available(self): return self.filter(available_in__contains=timezone.now(), category__public=True) def annotate_subprod...
normal
{ "blob_id": "3fdf67c3e0e4c3aa8a3fed09102aca0272b5ff4f", "index": 6938, "step-1": "<mask token>\n\n\nclass OrderQuerySet(QuerySet):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ProductQuerySet(QuerySet):\n <mask token>\n <...
[ 1, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for r in restFiles: print(r) <|reserved_special_token_1|> <|reserved_special_token_0|> restFiles = [os.path.join(d[0], f) for d in os.walk('.') for f in d[2] if f .endswith('.java') and 'PythonInterpreter' in open(os.pa...
flexible
{ "blob_id": "61085eecc8fd0b70bc11e5a85c3958ba3b905eaf", "index": 3118, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor r in restFiles:\n print(r)\n", "step-3": "<mask token>\nrestFiles = [os.path.join(d[0], f) for d in os.walk('.') for f in d[2] if f\n .endswith('.java') and 'PythonInterpreter...
[ 0, 1, 2, 3, 4 ]
import pygame import os import random #Vx = float(input("Input Vx : ")) #Vy = float(input("Input Vy : ")) Vx = 20 Vy = 20 #GEOMETRY screen_width = 1000 screen_height = 600 FPS = 30 #COLOR BLUE = (0, 0, 255) BLACK = (0, 0, 0) GREEN = (204, 153, 255) RED = (255, 0, 0) WHITE = (155, 25, 0) colorLi...
normal
{ "blob_id": "0dd5511c0e39f113c46785be78a898e79bc45a21", "index": 5188, "step-1": "<mask token>\n\n\nclass projectile(pygame.sprite.Sprite):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass enemy(pygame.sprite.Sprite):\n im = pygame.image.load(os.path.join(path, 'Gallery', 'stateczek.png'))\n ...
[ 6, 9, 13, 14, 18 ]
<|reserved_special_token_0|> class TestAudiobookResponse(unittest.TestCase): def test_audiobook_can_insert(self): """ test that audiobook can be inserted into db """ data = {'audiotype': 'Audiobook', 'metadata': {'duration': 37477, 'title': 'another', 'author': 'Solomon', 'narrator': ...
flexible
{ "blob_id": "e651edcbe68264e3f25180b10dc8e9d5620ecd6b", "index": 3656, "step-1": "<mask token>\n\n\nclass TestAudiobookResponse(unittest.TestCase):\n\n def test_audiobook_can_insert(self):\n \"\"\" test that audiobook can be inserted into db \"\"\"\n data = {'audiotype': 'Audiobook', 'metadata':...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class FizzBuzz: <|reserved_special_token_0|> <|reserved_special_token_1|> class FizzBuzz: def convert(self, number): if number % 3 == 0 and number % 5 != 0: return 'Fizz' elif number % 3 != 0 and number % 5 == 0: ...
flexible
{ "blob_id": "fb9d639bca59ecb081e7d9f30f97bdcd35627d34", "index": 6124, "step-1": "<mask token>\n", "step-2": "class FizzBuzz:\n <mask token>\n", "step-3": "class FizzBuzz:\n\n def convert(self, number):\n if number % 3 == 0 and number % 5 != 0:\n return 'Fizz'\n elif number % 3...
[ 0, 1, 2, 3 ]
# Importing datasets wrangling libraries import numpy as np import pandas as pd incd_data = pd.read_csv('data/Cancer/incd.csv', usecols=['State', 'FIPS', 'Age-Adjusted Incidence Rate([rate note]) - cases per 100,000', 'Average Annual Count', 'Recent Trend']) print(incd_data.columns)
normal
{ "blob_id": "1deab16d6c574bf532c561b8d6d88aac6e5d996c", "index": 8355, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(incd_data.columns)\n", "step-3": "<mask token>\nincd_data = pd.read_csv('data/Cancer/incd.csv', usecols=['State', 'FIPS',\n 'Age-Adjusted Incidence Rate([rate note]) - cases pe...
[ 0, 1, 2, 3, 4 ]
class Anagram(object): def __init__(self, word): self.word = word self.canonical = self._canonicalize(word) def _canonicalize(self, word): return sorted(word.lower()) def _is_anagram(self, word): return word != self.word and self._canonicalize(word) == self.canonical ...
normal
{ "blob_id": "44224985dbfa6234eff406149ce25e1d00b512e9", "index": 620, "step-1": "class Anagram(object):\n <mask token>\n <mask token>\n <mask token>\n\n def match(self, words):\n return filter(self._is_anagram, words)\n", "step-2": "class Anagram(object):\n\n def __init__(self, word):\n ...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def test_str_fit_transformr(): assert fit_transform(['Moscow', 'New York', 'Moscow', 'London']) == [( 'Moscow', [0, 0, 1]), ('New York', [0, 1, 0]), ('Moscow', [0, 0, 1] ), ('London', [1, 0, 0])] def test_int_fit_str_transformr(): assert fit_transform([1, 2, 1, 3...
flexible
{ "blob_id": "b236abaa5e206a8244083ee7f9dcdb16741cb99d", "index": 3072, "step-1": "<mask token>\n\n\ndef test_str_fit_transformr():\n assert fit_transform(['Moscow', 'New York', 'Moscow', 'London']) == [(\n 'Moscow', [0, 0, 1]), ('New York', [0, 1, 0]), ('Moscow', [0, 0, 1]\n ), ('London', [1, 0,...
[ 3, 4, 6, 7, 8 ]
from types import MappingProxyType from typing import Any, Dict, Mapping, Type, TypeVar, Union import yaml from typing_extensions import Protocol from mashumaro.serializer.base import DataClassDictMixin DEFAULT_DICT_PARAMS = { "use_bytes": False, "use_enum": False, "use_datetime": False, } EncodedData = ...
normal
{ "blob_id": "15edb1c051ccbc6f927c0a859288511f94a3d853", "index": 986, "step-1": "<mask token>\n\n\nclass Encoder(Protocol):\n <mask token>\n\n\nclass Decoder(Protocol):\n\n def __call__(self, packed: EncodedData, **kwargs) ->Dict[Any, Any]:\n ...\n\n\nclass DataClassYAMLMixin(DataClassDictMixin):\n\...
[ 6, 7, 8, 9, 10 ]
def format_amount(a): return a.replace(",","").strip().replace("%","").replace("$","") def create_json(gdp, coords): # ------------ Split gdp data ------------ # line_list=gdp.split('\n') column_list = [x.split('\t') for x in line_list if x!=""] # ------------ Split coord data ------------ # line_list=coords.s...
normal
{ "blob_id": "1cbc37655e28ab3082fc31baf119cb2bab96379b", "index": 3661, "step-1": "def format_amount(a):\n return a.replace(',', '').strip().replace('%', '').replace('$', '')\n\n\n<mask token>\n", "step-2": "def format_amount(a):\n return a.replace(',', '').strip().replace('%', '').replace('$', '')\n\n\nd...
[ 1, 3, 4, 5, 6 ]
from basetest import simtest import testutil import logging, random from nitro_parts.lib.imager import ccm as CCM import numpy ############################################################################### class DotProductTest(simtest): def _set_coeff(self, c): cq = (c * 32).astype(numpy.uint8) ...
normal
{ "blob_id": "53110d6e7923cf65c514d54950a0be165582e9a0", "index": 4909, "step-1": "<mask token>\n\n\nclass DotProductTest(simtest):\n <mask token>\n <mask token>\n\n def _check(self, c, d):\n d = numpy.array(d)\n ds = d.copy()\n ds[d > 511] = d[d > 511] - 1024\n c = numpy.arra...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TunnelManagerError(Error): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TunnelManagerError(Error): def __init__(self, expression, message): self.expression = expression self.message = message <|reserved_...
flexible
{ "blob_id": "661b622708692bd9cd1b3399835f332c86e39bf6", "index": 8835, "step-1": "<mask token>\n\n\nclass TunnelManagerError(Error):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TunnelManagerError(Error):\n\n def __init__(self, expression, message):\n self.expression = expression\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python #!-*-coding:utf-8 -*- """ @version: python3.7 @author: ‘v-enshi‘ @license: Apache Licence @contact: 123@qq.com @site: @software: PyCharm @file: Images_fade.py @time: 2019/1/16 17:17 """ from PIL import Image import numpy as np filename = "hw0_data/westbrook.jpg" im=Image.open(filename) #open th...
normal
{ "blob_id": "6e78d1fb2364d334f47fea89b065d859c025ca2f", "index": 5648, "step-1": "<mask token>\n", "step-2": "<mask token>\nfinalImg.save('Q2.jpg')\n", "step-3": "<mask token>\nfilename = 'hw0_data/westbrook.jpg'\nim = Image.open(filename)\nimgs = np.array(im)\nimgsDiv2 = np.trunc(imgs / 2)\nimgInt = imgsDiv...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python2.7 import os, sys COMPILER = "gcc" SRC_DIR = "../src" INCLUDE_DIR = "../src" BIN_DIR = "../bin" BIN_NAME = False CFLAGS = ["-O3", "-Wall", "-Wextra", "--std=c89", "-pedantic"] DLIBS = ["ws2_32"] if os.name == "nt" else [] DEFINES = [] def strformat(fmt, var): for k in...
normal
{ "blob_id": "1b4c86fe3aae25aeec6cd75fa8177983ce9d14a2", "index": 1819, "step-1": "#!/usr/bin/python2.7\nimport os, sys\n\nCOMPILER = \"gcc\"\nSRC_DIR = \"../src\"\nINCLUDE_DIR = \"../src\"\nBIN_DIR = \"../bin\"\nBIN_NAME = False\nCFLAGS = [\"-O3\", \"-Wall\", \"-Wextra\", \"--std=c89\", \"-ped...
[ 0 ]
from django.db import models class Subscribe(models.Model): mail_subscribe = models.EmailField('Пошта', max_length=40) def __str__(self): return self.mail_subscribe class Meta: verbose_name = 'підписку' verbose_name_plural = 'Підписки'
normal
{ "blob_id": "3c22b187f8538e16c0105706e6aac2875ea3a25c", "index": 6162, "step-1": "<mask token>\n\n\nclass Subscribe(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_name = 'підписку'\n verbose_name_plural = 'Підписки'\n", "step-2": "<mask token>\n\n\nclass Subscri...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def index(): strIO = StringIO.StringIO() strIO.write('Hello from Dan Jacob and Stephane Wirtel !') strIO.seek(0) return send_file(strIO, attachment_filename='testing.txt', as_attachment=True) <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "45335fa5d4773bdd0ef3e6c340fe06e84169be5e", "index": 8708, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n strIO = StringIO.StringIO()\n strIO.write('Hello from Dan Jacob and Stephane Wirtel !')\n strIO.seek(0)\n return send_file(strIO, attachment_filename='testing.txt',\n ...
[ 1, 2, 3, 4, 5 ]
import requests import csv from bs4 import BeautifulSoup reservoirs = [["LVQ"], ["HTH"], ["APN"], ["KNT"], ["SHA"]] for reservoir in reservoirs: storageURL = "https://cdec.water.ca.gov/dynamicapp/QueryMonthly?s=" + reservoir[0] storagePage = requests.get(storageURL) storageSoup = BeautifulSoup(storagePage...
normal
{ "blob_id": "ebe7c245e3e14116a37020971e67ada054e0b434", "index": 1171, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor reservoir in reservoirs:\n storageURL = ('https://cdec.water.ca.gov/dynamicapp/QueryMonthly?s=' +\n reservoir[0])\n storagePage = requests.get(storageURL)\n storageSou...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def groupby_count(df, groupby_column, count_column): new_df = pd.DataFrame(df.groupby(groupby_column)[count_column].count()) new_df.columns = ['count'] new_df[groupby_column] = new_df.index.get_level_values(0) new_df.reset_index(drop=True, inplace=True) return new_df ...
flexible
{ "blob_id": "30b07e57737ac29643769c4773591199b2ba8656", "index": 2184, "step-1": "<mask token>\n\n\ndef groupby_count(df, groupby_column, count_column):\n new_df = pd.DataFrame(df.groupby(groupby_column)[count_column].count())\n new_df.columns = ['count']\n new_df[groupby_column] = new_df.index.get_leve...
[ 2, 3, 4, 5, 6 ]
import os import json basedir = os.path.abspath(os.path.dirname(__file__)) # CHECK IF PRODUCTION CONFIG EXISTS if os.path.exists('/etc/config.json'): with open('/etc/config.json') as config_file: config = json.load(config_file) else: with open('dev_config.json') as config_file: config = json.l...
normal
{ "blob_id": "1f7147c914eee37776c0418575e93e3d36ee3aa5", "index": 7099, "step-1": "<mask token>\n\n\nclass Config:\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 <mask token>\n...
[ 7, 9, 10, 11, 13 ]
import pdb from django.db.models import Count from django.shortcuts import render_to_response, redirect from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.template import RequestContext from models import * from forms import * from django.htt...
normal
{ "blob_id": "565e994576a57f8bbdcb201f2439bd7e595fa53e", "index": 9679, "step-1": "<mask token>\n\n\ndef list(request):\n techniques = Technique.objects.annotate(num_images=Count('images')\n ).order_by('-num_images')\n return render_to_response('technique/list.html', {'techniques':\n technique...
[ 1, 2, 3, 4 ]
import sys import os import cv2 def write_video(fps, input_folder="output",video_name="video.mp4"): fourcc = cv2.VideoWriter_fourcc("m","p","4","v") video = cv2.VideoWriter(video_name, fourcc, fps, (1280,720)) path = os.getcwd() files = os.listdir(path+"/"+input_folder) count = len(files) ...
normal
{ "blob_id": "ca0c38cf2a55b2311a254b09cb693516c3d0ab10", "index": 1763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef write_video(fps, input_folder='output', video_name='video.mp4'):\n fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')\n video = cv2.VideoWriter(video_name, fourcc, fps, (12...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(open_name_file, dir_path, kmer_length, x_set): groups = [] DNA.generate_kmer_hash(kmer_length) for line in open_name_file: if line[0:12] == 'family_name:': family = line.split('\t')[1].st...
flexible
{ "blob_id": "b9a262bd6ddbca3b214825a473d870e70e8b5e57", "index": 9443, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(open_name_file, dir_path, kmer_length, x_set):\n groups = []\n DNA.generate_kmer_hash(kmer_length)\n for line in open_name_file:\n if line[0:12] == 'family_na...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def convert_lines_to_arrays(content): """ convert each line in scene to an array of text formating when not relevant """ lines = [] for x in content: line = x.strip() if len(line) > 0: if 'scene:' in x: lines.appe...
flexible
{ "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/python # # @name = 'fmsrutil.py' # # @description = "F-MSR utilities module." # # @author = ['YU Chiu Man', 'HU Yuchong', 'TANG Yang'] # import sys import os import random from finitefield import GF256int from coeffvector import CoeffVector from coeffvector import CoeffMatrix import common #Check if C l...
normal
{ "blob_id": "0ebd19079a16a6e3da34da2ecfda0d159b8580b2", "index": 9527, "step-1": "<mask token>\n\n\ndef getNativeBlockNum(n, k):\n \"\"\"Get number of native blocks.\"\"\"\n return k * (n - k)\n\n\n<mask token>\n\n\ndef getNodeIdList(n, k):\n \"\"\"Find the node id for a segment of blocks.\"\"\"\n \"...
[ 10, 12, 13, 15, 16 ]
from collections import Counter from enum import auto, Enum class Category(Enum): ONES = 1 TWOS = 2 THREES = 3 FOURS = 4 FIVES = 5 SIXES = 6 YACHT = auto() FULL_HOUSE = auto() FOUR_OF_A_KIND = auto() LITTLE_STRAIGHT = auto() BIG_STRAIGHT = auto() CHOICE = auto() def s...
normal
{ "blob_id": "40bc8122d98d407341a56251f9abfab019e0acd8", "index": 625, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Category(Enum):\n ONES = 1\n TWOS = 2\n THREES = 3\n FOURS = 4\n FIVES = 5\n SIXES = 6\n YACHT = auto()\n FULL_HOUSE = auto()\n FOUR_OF_A_KIND = auto()...
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in old_file.readlines(): cleaned_line = line.replace(',', '.') new_file.write(cleaned_line) old_file.close new_file.close <|reserved_special_token_1|> old_file = open('new.csv', 'r') new_file = open('new1,csv',...
flexible
{ "blob_id": "b3d26d01d45c073192d06c8e94c06f7eae267b14", "index": 968, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in old_file.readlines():\n cleaned_line = line.replace(',', '.')\n new_file.write(cleaned_line)\nold_file.close\nnew_file.close\n", "step-3": "old_file = open('new.csv', '...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> engine.say('Hello from Eliq.') engine.runAndWait() <|reserved_special_token_0|> print(power_str) if power_value_int > level_warning: engine.say(power_str) engine.say('Warning.') engine.runAndWait() else: engine.say...
flexible
{ "blob_id": "72abba6fa40441ab172bccb9065aaa0af5fefd64", "index": 7209, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine.say('Hello from Eliq.')\nengine.runAndWait()\n<mask token>\nprint(power_str)\nif power_value_int > level_warning:\n engine.say(power_str)\n engine.say('Warning.')\n engine...
[ 0, 1, 2, 3, 4 ]
# hi :) import numpy as np import random from copy import deepcopy # initialization.... # see also prepare.sh header = np.loadtxt("header.txt", dtype=int) TIME = header[2] CARS = header[3] STARTPOINT = header[4] GRAPH = np.loadtxt("links.txt",dtype=int) number_of_links = GRAPH.shape[0] N = len(GRAPH[:,1]) VOI...
normal
{ "blob_id": "9a9fdf0f3cfb876a384059f3dcf2508f960168c2", "index": 2167, "step-1": "# hi :)\nimport numpy as np\nimport random\nfrom copy import deepcopy\n\n\n# initialization....\n# see also prepare.sh\n\nheader = np.loadtxt(\"header.txt\", dtype=int)\nTIME = header[2]\nCARS = header[3]\nSTARTPOINT = header[...
[ 0 ]
# coding: utf-8 # Aluno: Héricles Emanuel # Matrícula: 117110647 # Atividade: É quadrado Mágico? def eh_quadrado_magico(m): somas_all = [] eh_magico = True soma = 0 for e in range(len(m[0])): soma += m[0][e] # Linhas for i in range(len(m)): somados = 0 for e in range(len(m[i])): somados += (m[i][e]) s...
normal
{ "blob_id": "f039ab104093eb42c3f5d3c794710a0997e85387", "index": 8371, "step-1": "# coding: utf-8\n# Aluno: Héricles Emanuel\n# Matrícula: 117110647\n# Atividade: É quadrado Mágico?\n\ndef eh_quadrado_magico(m):\n\tsomas_all = []\n\teh_magico = True\n\tsoma = 0\n\tfor e in range(len(m[0])):\n\t\tsoma += m[0][e]\...
[ 0 ]
from e19_pizza import * print("\n----------导入模块中的所有函数----------") # 由于导入了每个函数,可通过名称来调用每个函数,无需使用句点表示法 make_pizza(16, 'pepperoni') make_pizza(12, 'mushrooms', 'green peppers', 'extra cheese') # 注意: # 使用并非自己编写的大型模块时,最好不要采用这种导入方法,如果模块中 # 有函数的名称与你的项目中使用的名称相同,可能导致意想不到的结果。 # Python可能遇到多个名称相同的函数或变量,进而覆盖函数,而不是分别导 # 入所有...
normal
{ "blob_id": "c54a046ebde1be94ec87061b4fba9e22bf0f4d0a", "index": 3508, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"\"\"\n----------导入模块中的所有函数----------\"\"\")\nmake_pizza(16, 'pepperoni')\nmake_pizza(12, 'mushrooms', 'green peppers', 'extra cheese')\n", "step-3": "from e19_pizza import *\npr...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.6 on 2020-07-06 17:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('s1app', '0004_auto_20200706_0753'), ] operations = [ migrations.AlterField( model_name='gall', name='date', ...
normal
{ "blob_id": "a7d7408808f28343a51ff6522c5e14747c8c6e43", "index": 9819, "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 = [('s1app', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class _RegressionModelTable(object): def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None): if not isinstance(regression_models, list): regression_models = [regression_models] self._check_model_inputs...
flexible
{ "blob_id": "94264e121bb31a08cbd9766be1ff16173d2838ed", "index": 5331, "step-1": "<mask token>\n\n\nclass _RegressionModelTable(object):\n\n def __init__(self, regression_models, function_to_evaluate_model=None,\n function_to_select_model=None):\n if not isinstance(regression_models, list):\n ...
[ 6, 7, 8, 13, 14 ]
name = raw_input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) x = list() for line in handle: line.split() ## unnesssecary if line.startswith("From "): x.append(line[line.find(" ")+1:line.find(" ",line.find(" ")+1)]) counts = dict() for name in x: if name not in co...
normal
{ "blob_id": "28091b7251f980f3f63abdb03140edd0d789be8f", "index": 6414, "step-1": "name = raw_input(\"Enter file:\")\nif len(name) < 1 : name = \"mbox-short.txt\"\nhandle = open(name)\nx = list()\nfor line in handle:\n line.split() ## unnesssecary\n if line.startswith(\"From \"):\n x.append(line[line...
[ 0 ]
import os from django.conf import settings from chamber.importers import BulkCSVImporter, CSVImporter from .models import CSVRecord class BulkCSVRecordImporter(BulkCSVImporter): model_class = CSVRecord fields = ('id', 'name', 'number') csv_path = os.path.join(settings.PROJECT_DIR, 'data', 'all_fields_f...
normal
{ "blob_id": "559bd0c1821f405d21cdacba55f129ee5220bb5d", "index": 3751, "step-1": "<mask token>\n\n\nclass CSVRecordImporter(CSVImporter):\n model_class = CSVRecord\n fields = 'id', 'name', 'number'\n csv_path = os.path.join(settings.PROJECT_DIR, 'data',\n 'all_fields_filled.csv')\n\n def clean...
[ 3, 4, 6, 7, 8 ]
from django.urls import path from . import views from .views import propertyForRent, propertyForSale, PropertyDetailView app_name = "core" urlpatterns = [ path("", views.index, name="home"), path("property_for_rent/", views.propertyForRent, name="property_rent"), path("property_for_sale/", views.propertyF...
normal
{ "blob_id": "e2671911894871c32ad933fde8e05c913a4cc942", "index": 7149, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'core'\nurlpatterns = [path('', views.index, name='home'), path(\n 'property_for_rent/', views.propertyForRent, name='property_rent'),\n path('property_for_sale/', views....
[ 0, 1, 2, 3 ]
from time import strftime from Stats.SQL.Compteur import compteurSQL from Stats.SQL.Rapports import rapportsSQL from Stats.SQL.Daily import dailySQL from Stats.SQL.CompteurP4 import compteurJeuxSQL from Stats.SQL.Historique import histoSQL, histoSQLJeux from Stats.SQL.ConnectSQL import connectSQL tableauMois={"01":"ja...
normal
{ "blob_id": "19ff064f8c27b9796eb435c7d2b9ebf87ee90ad6", "index": 7982, "step-1": "<mask token>\n\n\ndef exeObj(count, idObj, id, obj, guild, nom):\n dateID = int(strftime('%y') + strftime('%m') + strftime('%d'))\n connexionGL, curseurGL = connectSQL(guild.id, nom, 'Stats', 'GL', '')\n connexion, curseur...
[ 2, 3, 4, 5, 6 ]
import sys import os sys.path.insert(0, "main") import main workspace = os.path.abspath(sys.argv[1]) main.hammer(workspace)
normal
{ "blob_id": "4e1f7fddb6bd3413dd6a8ca21520d309af75c811", "index": 931, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, 'main')\n<mask token>\nmain.hammer(workspace)\n", "step-3": "<mask token>\nsys.path.insert(0, 'main')\n<mask token>\nworkspace = os.path.abspath(sys.argv[1])\nmain.ham...
[ 0, 1, 2, 3, 4 ]
w=int(input()) lst=[i+1 for i in range(100)] for i in range(2,100): lst.append(i*100) lst.append(i*10000) lst.append(10000) print(297) print(*lst)
normal
{ "blob_id": "1d004ec0f4f5c50f49834f169812737d16f22b96", "index": 3967, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, 100):\n lst.append(i * 100)\n lst.append(i * 10000)\nlst.append(10000)\nprint(297)\nprint(*lst)\n", "step-3": "w = int(input())\nlst = [(i + 1) for i in range(10...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_file(): print('\n[*] === file ===') name_libmagic_so = 'libmagic.so.1' inspector = Inspector('./sample/file', debug=True) find_addr = 95224 cond = inspector.get_condition_at(Tactic.near_path_constrai...
flexible
{ "blob_id": "a25fb9b59d86de5a3180e4257c4e398f22cdbb05", "index": 6947, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_file():\n print('\\n[*] === file ===')\n name_libmagic_so = 'libmagic.so.1'\n inspector = Inspector('./sample/file', debug=True)\n find_addr = 95224\n cond = i...
[ 0, 1, 2, 3, 4 ]
"""This module runs cdb on a process and !exploitable on any exceptions. """ import ctypes import logging import os from pprint import pformat from subprocess import Popen from threading import Timer import time from certfuzz.debuggers.debugger_base import Debugger as DebuggerBase from certfuzz.debuggers.ou...
normal
{ "blob_id": "706f8d83bc9b4fab6f6d365c047c33913daece61", "index": 5014, "step-1": "<mask token>\n\n\nclass MsecDebugger(DebuggerBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def debugger_app(self):\n \"\"\"\n Returns the name of the debugger ...
[ 8, 9, 12, 15, 16 ]
# https://www.hackerrank.com/challenges/bon-appetit n, k = map(int, input().split()) prices = [int(temp) for temp in input().split()] taken = int(input()) if (sum(prices) - prices[k]) // 2 == taken: print("Bon Appetit") else: print(taken - (sum(prices) - prices[k])// 2)
normal
{ "blob_id": "aa15f684d23d97a45a416b1fdcfb192710ebb56f", "index": 2151, "step-1": "<mask token>\n", "step-2": "<mask token>\nif (sum(prices) - prices[k]) // 2 == taken:\n print('Bon Appetit')\nelse:\n print(taken - (sum(prices) - prices[k]) // 2)\n", "step-3": "n, k = map(int, input().split())\nprices =...
[ 0, 1, 2, 3 ]
# -*- encoding: utf-8 -*- class BaseException(object): """ Common base class for all exceptions """ def with_traceback(self, tb): # real signature unknown; restored from __doc__ """ Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self. """ p...
normal
{ "blob_id": "3d01910ae1c163067f4a23b3cca109a7d9e193d5", "index": 5251, "step-1": "class BaseException(object):\n <mask token>\n\n def with_traceback(self, tb):\n \"\"\"\n Exception.with_traceback(tb) --\n set self.__traceback__ to tb and return self.\n \"\"\"\n pass\n...
[ 9, 10, 11, 12, 15 ]
<|reserved_special_token_0|> class ResnetEncoder(nn.HybridBlock): <|reserved_special_token_0|> def __init__(self, backbone, pretrained, num_input_images=1, root=os. path.join(os.path.expanduser('~'), '.mxnet/models'), ctx=cpu(), ** kwargs): super(ResnetEncoder, self).__init__() ...
flexible
{ "blob_id": "62601eca767800f00b461ef46d72bddc5cf75de0", "index": 1400, "step-1": "<mask token>\n\n\nclass ResnetEncoder(nn.HybridBlock):\n <mask token>\n\n def __init__(self, backbone, pretrained, num_input_images=1, root=os.\n path.join(os.path.expanduser('~'), '.mxnet/models'), ctx=cpu(), **\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LaughsappConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LaughsappConfig(AppConfig): name = 'laughsApp' <|reserved_special_token_1|> from djan...
flexible
{ "blob_id": "6b785502e8a8983c164ebdffdd304da47c926acb", "index": 774, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n name = 'laughsApp'\n", "step-4": "from django.apps impor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def build_recursive_traversal_spec(client_factory): rp_to_rp = client_factory.create('ns0:TraversalSpec') rp_to_rp.name = 'rpToRp' rp_to_rp.type = 'ResourcePool' rp_to_rp.path = 'resourcePool' rp_to_rp.skip = False rp_to_vm = client_factory.create('ns0:TraversalSpe...
flexible
{ "blob_id": "de704bffe2e23a8a83d34204e325b7fb2454ef66", "index": 133, "step-1": "<mask token>\n\n\ndef build_recursive_traversal_spec(client_factory):\n rp_to_rp = client_factory.create('ns0:TraversalSpec')\n rp_to_rp.name = 'rpToRp'\n rp_to_rp.type = 'ResourcePool'\n rp_to_rp.path = 'resourcePool'\n...
[ 14, 18, 20, 22, 23 ]
<|reserved_special_token_0|> class QueueManager(BaseManager): pass def start_request(): QueueManager.register('get_task_queue') QueueManager.register('get_result_queue') server_add = '127.0.0.1' print('Connect to server %s...' % server_add) manager = QueueManager(address=(server_add, 5000), ...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(skill, skill_trees): answer = 0 for tree in skill_trees: able = True for i in range(len(skill) - 1, 0, -1): index = tree.find(skill[i]) if index != -1 and i > 0: if tree[:index].find...
flexible
{ "blob_id": "a72d878d246a459038640bf9c1deff562994b345", "index": 7338, "step-1": "<mask token>\n", "step-2": "def solution(skill, skill_trees):\n answer = 0\n for tree in skill_trees:\n able = True\n for i in range(len(skill) - 1, 0, -1):\n index = tree.find(skill[i])\n ...
[ 0, 1, 2, 3 ]
import random from . import WaiterInterface class RandomIPv4Waiter(WaiterInterface): """ HostPortWaiter which generates random ipv4 adresses """ def __init__(self, options): self.ports = options['ports'] self.limit_generate = options.get('limit_generate', -1) def generator(self): ...
normal
{ "blob_id": "bd3b1263d7d657fe2edd3c7198f63821a3d1d1e5", "index": 319, "step-1": "<mask token>\n\n\nclass RandomIPv4Waiter(WaiterInterface):\n <mask token>\n <mask token>\n\n def generator(self):\n while self.limit_generate != 0:\n randomIPv4 = generateRandomIPv4()\n yield ra...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @bot.message_handler(commands=['new_game']) def new_game(message): print(f'try new game with message: {message.text}') answer = '' try: answer = get_challenge_text(message.text) print('Challenge successfully created') except ValueError as exception: ...
flexible
{ "blob_id": "f9f66452756cb67689d33aeb2e77535086355a7d", "index": 5115, "step-1": "<mask token>\n\n\n@bot.message_handler(commands=['new_game'])\ndef new_game(message):\n print(f'try new game with message: {message.text}')\n answer = ''\n try:\n answer = get_challenge_text(message.text)\n p...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def show(): oled = Display() for image in images: oled.clear(0, 1) oled.draw_graphic(image, 35, 2) time.sleep(5) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def show(): oled = Display() for image in ...
flexible
{ "blob_id": "1930aa258ac4fbcdb2972e19bdb2625d2dae4114", "index": 9403, "step-1": "<mask token>\n\n\ndef show():\n oled = Display()\n for image in images:\n oled.clear(0, 1)\n oled.draw_graphic(image, 35, 2)\n time.sleep(5)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef show()...
[ 1, 2, 3, 4, 5 ]
# -*- coding:utf-8 -*- import easygui as eg import time as tm import numpy as np import thread import os from urllib2 import urlopen, Request import json from datetime import datetime, timedelta URL_IFENG='http://api.finance.ifeng.com/akmin?scode=%s&type=%s' NUM_PER_THREAD=100#单线程监控的股票数 SCAN_INTERVAL=10 FILE_PATH=u'.\...
normal
{ "blob_id": "57027cd638a01a1e556bcde99bcbe2a3b2fa0ef8", "index": 2388, "step-1": "# -*- coding:utf-8 -*-\nimport easygui as eg\nimport time as tm\nimport numpy as np\nimport thread\nimport os\nfrom urllib2 import urlopen, Request\nimport json\nfrom datetime import datetime, timedelta\n\nURL_IFENG='http://api.fin...
[ 0 ]
# Generated by Django 2.2.8 on 2019-12-10 10:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fieldsapp', '0003_pole_avatar'), ] operations = [ migrations.AddField( model_name='pole', name='email', ...
normal
{ "blob_id": "9d6516ea099e035fb97e5165071103698a7ec140", "index": 5812, "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 = [('fieldsapp',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def run_smac(max_fun=30): from smac.facade.func_facade import fmin_smac x, cost, smac = fmin_smac(func=test_func, x0=[-0], bounds=[(-5, 5)], maxfun=max_fun, rng=1234) runhistory = smac.get_runhistory() x_smac = [] y_smac = [] for entry in runhistory.data: ...
flexible
{ "blob_id": "90218168841dc76febab67d1e992dfc993730ea4", "index": 2455, "step-1": "<mask token>\n\n\ndef run_smac(max_fun=30):\n from smac.facade.func_facade import fmin_smac\n x, cost, smac = fmin_smac(func=test_func, x0=[-0], bounds=[(-5, 5)],\n maxfun=max_fun, rng=1234)\n runhistory = smac.get_...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.index, name='index'), path('about/', views. about, name='about'), path('contact/', views.contact, name='contact'), path('category/', views.category, name='category'), path( 'product/<str:i...
flexible
{ "blob_id": "0588aad1536a81d047a2a2b91f83fdde4d1be974", "index": 3869, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('about/', views.\n about, name='about'), path('contact/', views.contact, name='contact'),\n path('category/', views.category...
[ 0, 1, 2, 3 ]
#!/usr/bin/python """ Create a 1024-host network, and run the CLI on it. If this fails because of kernel limits, you may have to adjust them, e.g. by adding entries to /etc/sysctl.conf and running sysctl -p. Check util/sysctl_addon. This is a copy of tree1024.py that is using the Containernet constructor. Containernet...
normal
{ "blob_id": "9c3ca2fa43c6a34d7fe06517812a6d0bf5d6dbe1", "index": 4029, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n setLogLevel('info')\n network = TreeContainerNet(depth=2, fanout=100, switch=OVSSwitch)\n network.run(CLI, network)\n", "step-3": "<mask token>\nfr...
[ 0, 1, 2, 3 ]
from urllib.parse import urlencode from urllib.request import urlopen, Request from datetime import datetime #пользовательские переменные period=7 # задаём период. Выбор из: 'tick': 1, 'min': 2, '5min': 3, '10min': 4, '15min': 5, '30min': 6, 'hour': 7, 'daily': 8, 'week': 9, 'month': 10 start = "01.01.2021" #с какой д...
normal
{ "blob_id": "9d22a90835f5cf293808ab359244fe1bde81f3e1", "index": 2171, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor ticker in tickers:\n params = urlencode([('market', market), ('em', tickers[ticker]), (\n 'code', ticker), ('apply', 0), ('df', start_date.day), ('mf', \n start_date....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PageInfoAjaxSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def start_requests(self): url = ( 'https://s.search.bilibili.com/cate/search?callback=jqueryCallback_bili_8995260575257822&m...
flexible
{ "blob_id": "cdcb2710291e9897b874f63840193470ed58be49", "index": 825, "step-1": "<mask token>\n\n\nclass PageInfoAjaxSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://s.search.bilibili.com/cate/search?callback=jque...
[ 2, 3, 4, 5, 6 ]
from django.db import models # Create your models here. class Airlines(models.Model): flight_number=models.CharField(max_length=8,unique=True) airlines_id=models.CharField(max_length=10) source=models.CharField(max_length=20) destination=models.CharField(max_length=20) departure=models.TimeField() arrival=models...
normal
{ "blob_id": "e57b30a7a1cf987918abfb3cb7d612bdead2ddcd", "index": 406, "step-1": "<mask token>\n\n\nclass Bookings(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Airlines(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask ...
[ 1, 6, 7, 9, 10 ]
# Kipland Melton import psutil import math def convert_size(size_bytes): if size_bytes == 0: return "0B" size_name = ("%", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") i = int(math.floor(math.log(size_bytes, 1024))) p = math.pow(1024, i) s = round(size_bytes / p, 2) return "%s %s" % (s, siz...
normal
{ "blob_id": "d960d3d1680f825f0f68fc6d66f491bbbba805ce", "index": 5004, "step-1": "<mask token>\n\n\ndef RetrieveMemory():\n ram_info = psutil.virtual_memory()\n typePresented = 'Total : ', 'Used : ', 'Free : ', 'Usage : '\n counter = 0\n print()\n for info in ram_info:\n try:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestScope: @pytest.mark.run(order=1) def test_create_scope(self, host, port): url = 'http://' + host + ':' + port + '/scope' r = requests.post(url=url) print(r.text) assert r.status_code == 200 global SCOPE SCOPE = r.json()['s...
flexible
{ "blob_id": "65a9f732fc8c7b9c63f6ef0d7b2172bb4138a895", "index": 2761, "step-1": "<mask token>\n\n\nclass TestScope:\n\n @pytest.mark.run(order=1)\n def test_create_scope(self, host, port):\n url = 'http://' + host + ':' + port + '/scope'\n r = requests.post(url=url)\n print(r.text)\n ...
[ 10, 14, 17, 18, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> club_info = {'club_url': 'https://www.futbin.com///18/leagues/Major%20League%20Soccer?page=1&club=101112' , 'club_logo': 'https://cdn.futbin.com/content/fifa18/img/clubs/101112.png', 'club_name': 'Vancouver Whitecaps FC'} players = {} players[...
flexible
{ "blob_id": "35c4e26acbe99ca7f37b63b67f38d5c40fbf0ea4", "index": 2503, "step-1": "<mask token>\n", "step-2": "club_info = {'club_url':\n 'https://www.futbin.com///18/leagues/Major%20League%20Soccer?page=1&club=101112'\n , 'club_logo':\n 'https://cdn.futbin.com/content/fifa18/img/clubs/101112.png',\n ...
[ 0, 1 ]
import math # 1 long_phrase = 'Насколько проще было бы писать программы, если бы не заказчики' short_phrase = '640Кб должно хватить для любых задач. Билл Гейтс (по легенде)' def compare (long, short): print(len(long)>len(short)) compare(long_phrase, short_phrase) # 2.1 text = 'Если программист в 9-00 утра на работе...
normal
{ "blob_id": "f29637cd670524baebac6549962a1c50fc1b91c6", "index": 6835, "step-1": "<mask token>\n\n\ndef compare(long, short):\n print(len(long) > len(short))\n\n\n<mask token>\n\n\ndef exchange(a, b):\n b = b - a\n a = a + b\n b = a - b\n print('a=', a, 'b=', b)\n\n\n<mask token>\n", "step-2": "...
[ 2, 3, 4, 5, 6 ]
from enum import Enum class VariableType(Enum): uint8 = "uint8", int8 = "int8" uint16 = "uint16" int16 = "int16" uint32 = "uint32" int32 = "int32" float = "float" double = "double" bool = "bool" custom = "custom" class Variable: def __init__(self, type_str: str, name:...
normal
{ "blob_id": "434ec7791345ad869d8ce86aa1cdc08344203171", "index": 2028, "step-1": "<mask token>\n\n\nclass Variable:\n\n def __init__(self, type_str: str, name: str):\n self.original_type = type_str\n self.__map_variable_type(type_str)\n self.name = name\n\n def __str__(self):\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> socket.bind('tcp://*:5555') if not os.path.exists('db'): print('db not found, creating') ct = bcolz.ctable([np.empty(0, dtype='i8')], names=['data'], rootdir='db') else: print('db found, initializing') ct = bcolz.o...
flexible
{ "blob_id": "71ac7240287b83be6ec1f2d98e3ee531a8a219e0", "index": 9879, "step-1": "<mask token>\n", "step-2": "<mask token>\nsocket.bind('tcp://*:5555')\nif not os.path.exists('db'):\n print('db not found, creating')\n ct = bcolz.ctable([np.empty(0, dtype='i8')], names=['data'], rootdir='db')\nelse:\n ...
[ 0, 1, 2, 3, 4 ]
"""Plot the output data. """ # Standard library import os import json import math import matplotlib as maplot import matplotlib.pyplot as pyplot from datetime import datetime # User library from sub.inputprocess import CONSTANTS as CONS # **json.loads(json_data) def get_data(): """Read output file to get data."...
normal
{ "blob_id": "f4f08015b7638f4d6ea793350d5d19a3485978cd", "index": 53, "step-1": "<mask token>\n\n\ndef get_objectives(data):\n \"\"\"Get a list of all first chromosomes' objective values.\"\"\"\n objectives = [math.log(population[0]['objective']) for population in data]\n return objectives\n\n\ndef get_n...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: UTF-8 -*- # from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict import os import torch import numpy as np import pickle from sklearn.linear_model import Ridge, Lasso from biplnn.log import getLogger from biplnn.utils...
normal
{ "blob_id": "9f86ff37d3a72364b5bd83e425d8151136c07dd3", "index": 6294, "step-1": "<mask token>\n\n\ndef fit_linear_model(x, y):\n logger.info('Using Lasso')\n lr = Lasso(alpha=0.01)\n lr.fit(x, y)\n return SharedScalerModel(lr)\n\n\nclass SharedScalerModel:\n\n def __init__(self, lm):\n sel...
[ 7, 8, 10, 11, 12 ]
# Generated by Django 2.1.1 on 2019-11-20 12:34 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sandbox_report', '0006_sandboxreportlink_sandboxreportval'), ] operations = [ migrations.DeleteModel( name='SandboxReportLink', ...
normal
{ "blob_id": "b92497396e711d705760db547b43cc65beba6cfd", "index": 6172, "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 = [('sandbox_rep...
[ 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 = [(...
flexible
{ "blob_id": "eb75f6e959e9153e6588a0322d1ebc75e21e73ef", "index": 8153, "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 = [('candidate',...
[ 0, 1, 2, 3, 4 ]
def watch(): print("시청하다") watch() print("tv.py의 module 이름은",__name__) #name은 __main__으로 나옴
normal
{ "blob_id": "b9622bede471c76ae36d3f59130d2be113310d4c", "index": 7045, "step-1": "<mask token>\n", "step-2": "def watch():\n print('시청하다')\n\n\n<mask token>\n", "step-3": "def watch():\n print('시청하다')\n\n\nwatch()\nprint('tv.py의 module 이름은', __name__)\n", "step-4": "def watch():\n print(\"시청하다\")\...
[ 0, 1, 2, 3 ]
import unittest from FileFeatureReader.featurereaders import RFEFeatureReader, DTFeatureReader from FileFeatureReader.featurereader import FeatureReader from unittest import mock from unittest.mock import patch import builtins class TestFeatureReader(unittest.TestCase): def setUp(self): self.rfe_feat_reade...
normal
{ "blob_id": "5436e9270e61f5f9ab41fc1f35a80f4b8def65ee", "index": 2048, "step-1": "<mask token>\n\n\nclass TestFeatureReader(unittest.TestCase):\n <mask token>\n\n def testRFEFull(self):\n feat = ['column1', 'column2', 'column3']\n read_data = 'Header\\n---- column1\\n---- column2\\n---- colum...
[ 14, 16, 17, 18, 19 ]
""" Generate test pads for padder. """ # usage: python gen.py > pads.txt import random pad = "" count = 0 # The pad chars MUST match the character set used by padder. # See the 'characters' variable in 'main.hpp' for more # information. chars = "abcdefghijklmnopqrstuvwxyz0123456789-" print "#", "Pad" while count...
normal
{ "blob_id": "2cdcd6976a1ec99b927adcedc48c36bbda1b4e18", "index": 1005, "step-1": "\"\"\" Generate test pads for padder. \"\"\"\n\n# usage: python gen.py > pads.txt\n\nimport random\n\npad = \"\"\ncount = 0\n\n# The pad chars MUST match the character set used by padder.\n# See the 'characters' variable in 'main...
[ 0 ]
<|reserved_special_token_0|> class DescribeDomainResponseBodyDomainCloudNativeInstancesProtocolPortConfigs( TeaModel): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class DescribeDomainResponseBodyDomainCloudNativeInstances(Te...
flexible
{ "blob_id": "addf92a3d4060fa9464a802a4a4378cf9eeadde4", "index": 2545, "step-1": "<mask token>\n\n\nclass DescribeDomainResponseBodyDomainCloudNativeInstancesProtocolPortConfigs(\n TeaModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DescribeDomainResponseBodyDomainClo...
[ 426, 429, 443, 447, 577 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def search(nums, target): left = 0 right = len(nums) - 1 while left <= right: mid = int((left + right) / 2) if target > nums[mid]: left = mid + 1 elif target < nums[mid]: ...
flexible
{ "blob_id": "3eeed39bf775e2ac1900142b348f20d15907c6e6", "index": 4972, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef search(nums, target):\n left = 0\n right = len(nums) - 1\n while left <= right:\n mid = int((left + right) / 2)\n if target > nums[mid]:\n left =...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(20): re = random.randint(1, 100) if re >= 90: dict1['A'].append(re) elif re >= 80: dict1['B'].append(re) print(dict1) <|reserved_special_token_1|> <|reserved_special_token_0|> dict1 = ...
flexible
{ "blob_id": "4a223cdd3c957af2f54e33c910ce70d2b5e6c963", "index": 7705, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(20):\n re = random.randint(1, 100)\n if re >= 90:\n dict1['A'].append(re)\n elif re >= 80:\n dict1['B'].append(re)\nprint(dict1)\n", "step-3": "<ma...
[ 0, 1, 2, 3, 4 ]
class Background(object): def __init__(self, name): self.name = name self.description = '' self.prTraits = [] self.ideals = [] self.bonds = [] self.flaws = [] def getBackName(self): return self.name def setBackDesc(self, desc): self.descript...
flexible
{ "blob_id": "45449e728dadd241b00f5c4bfb3fd3950f04037c", "index": 2627, "step-1": "class Background(object):\n\n def __init__(self, name):\n self.name = name\n self.description = ''\n self.prTraits = []\n self.ideals = []\n self.bonds = []\n self.flaws = []\n\n def ...
[ 11, 13, 14, 15, 16 ]
from flask import Flask, render_template serious12 = Flask(__name__) @serious12.route("/") def home(): return "HOME" @serious12.route("/user/<username>") def user(username): user = { "trung": { "name": "Trung", "age": 19, "birthplace": "Hanoi" }, "n...
normal
{ "blob_id": "db1b6c545555116a334061440614e83e62994838", "index": 4440, "step-1": "<mask token>\n\n\n@serious12.route('/')\ndef home():\n return 'HOME'\n\n\n@serious12.route('/user/<username>')\ndef user(username):\n user = {'trung': {'name': 'Trung', 'age': 19, 'birthplace': 'Hanoi'},\n 'nguyenvana'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def firmware_pack_create(handle, org_name, name, rack_bundle_version, blade_bundle_version, descr='', mode='staged', org_parent='org-root'): """ This method creates Host Firmware pack. Args: handle (UcsHandle) org_name (string): Name of the organization ...
flexible
{ "blob_id": "21cfe1ca606d18763fbfb8ff6862c382b3321adc", "index": 8511, "step-1": "<mask token>\n\n\ndef firmware_pack_create(handle, org_name, name, rack_bundle_version,\n blade_bundle_version, descr='', mode='staged', org_parent='org-root'):\n \"\"\"\n This method creates Host Firmware pack.\n\n Arg...
[ 2, 3, 4, 5, 6 ]
""" Guess the number! """ import random, generic def check_answer(player_guess, guess_value): """ Compares a player's guess and the number to guess Returns True if the player guessed correctly Returns False by default """ end_game = False if player_guess > guess_value: print('guess too high!') elif playe...
normal
{ "blob_id": "a1e54a0f593149c1d97e64342c99f0ab8aa28fa9", "index": 6215, "step-1": "<mask token>\n\n\ndef check_answer(player_guess, guess_value):\n \"\"\"\n\tCompares a player's guess and the number to guess\n\tReturns True if the player guessed correctly\n\tReturns False by default\n\t\"\"\"\n end_game = F...
[ 3, 5, 6, 7, 8 ]
# coding:utf-8 __author__ = 'yinzishao' # dic ={} class operation(): def GetResult(self): pass class operationAdd(operation): def GetResult(self): return self.numberA + self.numberB class operationDev(operation): def GetResult(self): # if(self.numberB!=0): # return sel...
normal
{ "blob_id": "7e33c6ada3d141ba8067dbf88c2e85a91802a067", "index": 8446, "step-1": "# coding:utf-8\n__author__ = 'yinzishao'\n# dic ={}\n\nclass operation():\n def GetResult(self):\n pass\n\nclass operationAdd(operation):\n def GetResult(self):\n return self.numberA + self.numberB\n\nclass oper...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def binary_values_to_bit_duration(binary_values): """連続する0/1の長さを測る""" previous_binary_value = SPACE previous_time = 0 current_binary_value = SPACE current_time = 0 for binary_value, time in binary_values:...
flexible
{ "blob_id": "ff67ef77958e78335dc1dc2c7e08bf42998387c6", "index": 2374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef binary_values_to_bit_duration(binary_values):\n \"\"\"連続する0/1の長さを測る\"\"\"\n previous_binary_value = SPACE\n previous_time = 0\n current_binary_value = SPACE\n curre...
[ 0, 3, 4, 5, 7 ]