code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
class Node: def __init__(self,data): self.data = data self.next = None def Add(Head,data): Temp = Head while(Temp.next != None): Temp = Temp.next Temp.next = Node(data) # print(Temp.data) def create(data): Head = Node(data) return Head def printLL(Head): Temp ...
normal
{ "blob_id": "ff137b51ea5b8c21e335a38a3d307a3302921245", "index": 9993, "step-1": "class Node:\n\n def __init__(self, data):\n self.data = data\n self.next = None\n\n\n<mask token>\n\n\ndef Reverse(Head):\n Temp = Head\n TempNext = Head.next\n while TempNext != None:\n NextSaved =...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def Actual_Value(): global df print('The Actual Closing Value is Displayed below') df = data.DataReader(stockTicker, 'yahoo', '2017-01-28', '2017-02-5') ao = df['Close'] print(str(ao)) return <|reserved_special_token_0|> def Forcast_Values(): global forecas...
flexible
{ "blob_id": "9c4676edbeef3748a4947f827fefa29e95674bfa", "index": 121, "step-1": "<mask token>\n\n\ndef Actual_Value():\n global df\n print('The Actual Closing Value is Displayed below')\n df = data.DataReader(stockTicker, 'yahoo', '2017-01-28', '2017-02-5')\n ao = df['Close']\n print(str(ao))\n ...
[ 5, 12, 13, 14, 15 ]
<|reserved_special_token_0|> class NovelsSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def parse(self, response): path = '/Users/qx/Documents/小说/new/' all = response.xpath(".//div[@class='novellist']") for oneitem...
flexible
{ "blob_id": "af668751074df6f182c7121821587270734ea5af", "index": 1075, "step-1": "<mask token>\n\n\nclass NovelsSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n path = '/Users/qx/Documents/小说/new/'\n all = response.xpath(\".//div[@clas...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 3.0.5 on 2020-05-02 18:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('weatherData', '0001_initial'), ] operations = [ migrations.AddField( model_name='city', name='username', ...
normal
{ "blob_id": "6b6b734c136f3c4ed5b2789ab384bab9a9ea7b58", "index": 9368, "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 = [('weatherData...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def downgrade(): op.alter_column('run', 'polarion_id', type_=ty.String(1024)) op.alter_column('auto_result', 'skip', type_=ty.String(65535)) op.alter_column('auto_result', 'failure', type_=ty.String(65535)) op.alter_column('auto_result', 'comment', type_=ty.String(65535)) ...
flexible
{ "blob_id": "7badb7c9f1e00dfc379468b7bd73a3f09bffe6de", "index": 1191, "step-1": "<mask token>\n\n\ndef downgrade():\n op.alter_column('run', 'polarion_id', type_=ty.String(1024))\n op.alter_column('auto_result', 'skip', type_=ty.String(65535))\n op.alter_column('auto_result', 'failure', type_=ty.String...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TreePrinter: @addToClass(Node) def printTree(self, indent=0): raise Exception('printTree not defined in class ' + self.__class__. __name__) @addToClass(Instruction) def printTree(self, indent=0): print_intended(self.type, indent) <|r...
flexible
{ "blob_id": "1084478226777b9259274e053984ac34d461198d", "index": 42, "step-1": "<mask token>\n\n\nclass TreePrinter:\n\n @addToClass(Node)\n def printTree(self, indent=0):\n raise Exception('printTree not defined in class ' + self.__class__.\n __name__)\n\n @addToClass(Instruction)\n ...
[ 18, 21, 22, 24, 26 ]
STATUS_CHOICES = ( (-1, 'Eliminado'), (0, 'Inactivo'), (1, 'Activo'), ) USERTYPES_CHOICES = () #-- Activation Request Values ACTIVATION_CHOICES = ( (1, 'Activacion'), (2, 'Solicitud Password'), (3, 'Invitacion'), ) #-- Activation Status Values ACTIVATIONSTATUS_CHOICES = ( (-1, 'Expirado...
normal
{ "blob_id": "200552b638d6b1a6879b455837677b82689e0069", "index": 5479, "step-1": "<mask token>\n", "step-2": "STATUS_CHOICES = (-1, 'Eliminado'), (0, 'Inactivo'), (1, 'Activo')\nUSERTYPES_CHOICES = ()\nACTIVATION_CHOICES = (1, 'Activacion'), (2, 'Solicitud Password'), (3,\n 'Invitacion')\nACTIVATIONSTATUS_C...
[ 0, 1, 2 ]
import os import random import argparse from vapory import * from data import colors, object_types class Torus(POVRayElement): """""" def render_scene(filename, object_type, color, location, rotation): assert (object_type in object_types) assert (color in colors) color = colors[color] size = ...
normal
{ "blob_id": "f8972067fa88e7e74e05cdcc7bdec184116dec4a", "index": 7771, "step-1": "<mask token>\n\n\nclass Torus(POVRayElement):\n \"\"\"\"\"\"\n\n\ndef render_scene(filename, object_type, color, location, rotation):\n assert object_type in object_types\n assert color in colors\n color = colors[color]...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def load_setting(setting: str): with open(SETTINGS_FILE) as f: return json.load(f)[setting] @lru_cache() def get_bot_name(): return load_setting('bot_name') @lru_cache() def get_app_id(): return load_setting('app_id') @lru_cache() def get_app_hash(): return l...
flexible
{ "blob_id": "14e1af3d60efef842c72bf9b55143d0e14f3a7b8", "index": 5897, "step-1": "<mask token>\n\n\ndef load_setting(setting: str):\n with open(SETTINGS_FILE) as f:\n return json.load(f)[setting]\n\n\n@lru_cache()\ndef get_bot_name():\n return load_setting('bot_name')\n\n\n@lru_cache()\ndef get_app_...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Broker: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def liquidation(self, pos, price, date, commission): """ clean the last position ...
flexible
{ "blob_id": "ca0aedcfb997299240870649823fb872e0d9f99a", "index": 6023, "step-1": "<mask token>\n\n\nclass Broker:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def liquidation(self, pos, price, date, commission):\n \"\"\"\n clean the last position\...
[ 9, 11, 12, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RC165(IReg): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RC165(IReg): def __init__(self): self._header = ['REG', 'COD_PART', 'VEIC_ID', 'COD_AUT', 'NR_...
flexible
{ "blob_id": "bf73e2109f11b2214fae060bc343b01091765c2a", "index": 2325, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RC165(IReg):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass RC165(IReg):\n\n def __init__(self):\n self._header = ['REG', 'COD_PART', 'VEIC_ID', 'COD_AUT',...
[ 0, 1, 2, 3, 4 ]
# block-comments.py ''' Block comments generally apply to some (or all) code that follows them, and are indented to the same level as that code. Each line of a block comment starts with a # and a single space (unless it is indented text inside the comment). Paragraphs inside a block comment are separated by a line con...
normal
{ "blob_id": "83bac8176caafc5551089c4bef5c1f38e1e8d4da", "index": 5952, "step-1": "<mask token>\n", "step-2": "# block-comments.py\n'''\nBlock comments generally apply to some (or all) code that follows them, and are\nindented to the same level as that code. Each line of a block comment starts\nwith a # and a s...
[ 0, 1 ]
arr = [] for i in range(5): arr.append(int(input())) print(min(arr[0], arr[1], arr[2]) + min(arr[3], arr[4]) - 50)
normal
{ "blob_id": "8745855d86dcdabe55f8d1622b66b3613dbfe3e1", "index": 4015, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(5):\n arr.append(int(input()))\nprint(min(arr[0], arr[1], arr[2]) + min(arr[3], arr[4]) - 50)\n", "step-3": "arr = []\nfor i in range(5):\n arr.append(int(input()))...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='testspace-python', version='', packages=find_packages(include=[ 'testspace', 'testspace.*']), url='', license='MIT license', author= 'Jeffrey Schultz', author_email='jeffs@s2technologies.com', description =...
flexible
{ "blob_id": "7bc2a02d85c3b1a2b7ed61dc7567d1097b63d658", "index": 3559, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='testspace-python', version='', packages=find_packages(include=[\n 'testspace', 'testspace.*']), url='', license='MIT license', author=\n 'Jeffrey Schultz', author_email=...
[ 0, 1, 2, 3 ]
import re # regex module from ftplib import FTP, error_perm from itertools import groupby from typing import List, Tuple, Dict import requests # HTTP requests module from util import retry_multi, GLOBAL_TIMEOUT # from util.py class ReleaseFile: """! Class representing a Released file on Nebula `name`: str...
normal
{ "blob_id": "612b1851ba5a07a277982ed5be334392182c66ef", "index": 4064, "step-1": "<mask token>\n\n\nclass ReleaseFile:\n <mask token>\n <mask token>\n\n def __repr__(self):\n return repr(self.name)\n\n\nclass SourceFile:\n \"\"\"! Class represeting a source file\n\n `name`: str\n Fil...
[ 8, 10, 11, 12, 14 ]
<|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": "e296a5bea5465c2b84e37c7d83922adb01feab70", "index": 9828, "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 = [('blog', '000...
[ 0, 1, 2, 3, 4 ]
import random class Madlib: ''' This class generates the madlib from word lists. ''' def get_madlib(self): madlib = """ Once there was a {0}. It {1} at the {2}. Then because of its {3} it {4}. Wow! You sure are {5}! Thanks! I {6} you very much. """ nouns...
normal
{ "blob_id": "2b23237e697cb4ca8f1013d7be343c70fba9541d", "index": 6342, "step-1": "<mask token>\n\n\nclass Madlib:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Madlib:\n <mask token>\n\n def get_madlib(self):\n madlib = \"\"\"\n Once there was a {0}. It {1} at t...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 2.2.2 on 2019-07-09 20:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0015_auto_20190709_1543'), ] operations = [ migrations.CreateModel( name='ExampleModel', fields=[ ...
normal
{ "blob_id": "d6e06a78c9a5d8184e5adf9b99cc6030c3434558", "index": 8464, "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 = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for f in pyfiles: contents = open(f).read() for m in modulenames: v1 = 'import ' + m v2 = 'from ' + m if v1 or v2 in contents: contents = contents.replace(v1, 'import .' + m) ...
flexible
{ "blob_id": "d6a73365aa32c74798b6887ff46c0ed2323ed1a6", "index": 2324, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor f in pyfiles:\n contents = open(f).read()\n for m in modulenames:\n v1 = 'import ' + m\n v2 = 'from ' + m\n if v1 or v2 in contents:\n contents =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DojoBookAppConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DojoBookAppConfig(AppConfig): default_auto_field = 'd...
flexible
{ "blob_id": "314f6cc97f53fa5bd8bf0ec0e1e305ca6384f1a2", "index": 1559, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DojoBookAppConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass DojoBookAppConfig(AppConfig):\n default_auto_field = 'django.db.mod...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def chargeable_deposit(amount, months, charge=0): percent = get_percent(amount, months) if not percent: print('Нет подходящего тарифа') total = amount for month in range(months): profit = total * ...
flexible
{ "blob_id": "bf9e83591f737caec3060b72d86d56faec9bb23b", "index": 8079, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef chargeable_deposit(amount, months, charge=0):\n percent = get_percent(amount, months)\n if not percent:\n print('Нет подходящего тарифа')\n total = amount\n for...
[ 0, 1, 2, 3, 4 ]
import re import os import base64 os.popen("tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request") def evals(text): template = "{}\['__doc__'\]\[\d+\]" keys = map(str, range(10)) keys += ['\[\]','\(\)',"'...
normal
{ "blob_id": "c26bdc3f47aa9ac0cda0334e97bdaf3f9d56eb6c", "index": 437, "step-1": "import re\nimport os\nimport base64\n\nos.popen(\"tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request\")\n\ndef evals(text):\n ...
[ 0 ]
from PIL import Image, ImageStat import os import shutil # full white photo - 255.0 # full black photo - 0.0 class ImageSelection: def __init__(self, path): self.path = path def brightness_check(self, image): '''count function to set value of brightness, 0 - full black, 100 - fu...
normal
{ "blob_id": "897075810912e8360aa5cdedda3f12ce7c868263", "index": 4547, "step-1": "<mask token>\n\n\nclass ImageSelection:\n\n def __init__(self, path):\n self.path = path\n\n def brightness_check(self, image):\n \"\"\"count function to set value of brightness, 0 - full black, 100 - full brigh...
[ 5, 6, 7, 8, 9 ]
from django.shortcuts import render from rest_framework import viewsets from rest_framework.response import Response from crud.serializers import TodoListSerializer from crud.models import TodoList # Create your views here. class TodoListViewSet(viewsets.ModelViewSet): queryset = TodoList.objects.all() seri...
normal
{ "blob_id": "2d4680b63cdd05e89673c4bd6babda7ac6ebb588", "index": 8895, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TodoListViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n\n def delete(self, request, pk=None):\n instance = TodoList.objects.get(id=pk)\n i...
[ 0, 2, 3, 4, 5 ]
from selenium import webdriver import time import xlwt from JD_PhoneNo import get_phone_no book = xlwt.Workbook(encoding="utf-8") sheet1=book.add_sheet("Sheet 1") browser = webdriver.Firefox() browser.get("https://www.zomato.com/bhopal/dinner") z_hotel_list = [] z_address_list = [] z_phone_list = [] z_rating...
normal
{ "blob_id": "96425986305171a9d23231f60b35dcbcbbd12d2d", "index": 7995, "step-1": "<mask token>\n\n\ndef traverse(a, b):\n temp = []\n for i in range(a, b, 1):\n a = str(i)\n button = browser.find_element_by_link_text(a)\n button.click()\n name_list = browser.find_elements_by_cla...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from . import parsing from . import cleaning from .config import NATURAL_EMB_DIM <|reserved_special_token_1|> """Contains functionality for tokenizing, parsing, embedding language.""" from . import parsing from . import cleani...
flexible
{ "blob_id": "8a6c9fa67c02d69444c9c3a2e6811b982c49eb4e", "index": 5585, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom . import parsing\nfrom . import cleaning\nfrom .config import NATURAL_EMB_DIM\n", "step-3": "\"\"\"Contains functionality for tokenizing, parsing, embedding language.\"\"\"\n\nfrom...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(num_str) print(num_str1) print(num_str.isdecimal()) print(num_str1.isdecimal()) print(num_str.isdigit()) print(num_str1.isdigit()) print(num_str.isnumeric()) print(num_str1.isnumeric()) print(num_str2.isnumeric()) <|reserv...
flexible
{ "blob_id": "a7be2f43c6ec8d1576ed194a75762a36089cb052", "index": 4195, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num_str)\nprint(num_str1)\nprint(num_str.isdecimal())\nprint(num_str1.isdecimal())\nprint(num_str.isdigit())\nprint(num_str1.isdigit())\nprint(num_str.isnumeric())\nprint(num_str1.i...
[ 0, 1, 2, 3 ]
class ListNode: def __init__(self, val: int, next=None): self.val = val self.next = next def reverseKGroup(head: ListNode, k: int) -> ListNode: prev, cur, rs, successor = None, head, head, None def reverseK(node: ListNode, count: int) -> ListNode: nonlocal successor nonloc...
normal
{ "blob_id": "67904f3a29b0288a24e702f9c3ee001ebc279748", "index": 3542, "step-1": "class ListNode:\n <mask token>\n\n\n<mask token>\n", "step-2": "class ListNode:\n\n def __init__(self, val: int, next=None):\n self.val = val\n self.next = next\n\n\n<mask token>\n\n\ndef print_list(head: List...
[ 1, 3, 4, 5, 6 ]
# OSINT By FajarTheGGman For Google Code-in 2019© import urllib3 as url class GCI: def banner(): print("[---- OSINT By FajarTheGGman ----]\n") def main(): user = str(input("[!] Input Name Victim ? ")) init = url.PoolManager() a = init.request("GET", "https://facebook.com/" + user) b = init.re...
normal
{ "blob_id": "6c8180d24110045348d9c2041c0cca26fa9ea2d2", "index": 4318, "step-1": "<mask token>\n\n\nclass GCI:\n\n def banner():\n print('[---- OSINT By FajarTheGGman ----]\\n')\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass GCI:\n\n def banner():\n print('[---- ...
[ 2, 4, 5, 6, 7 ]
import re from typing import Any, Dict, List import aiosqlite from migri.elements import Query from migri.interfaces import ConnectionBackend, TransactionBackend class SQLiteConnection(ConnectionBackend): _dialect = "sqlite" @staticmethod def _compile(query: Query) -> dict: q = query.statement ...
normal
{ "blob_id": "191a57d3f13fcbe217ff6d0bd92dea163d5fb3cf", "index": 4822, "step-1": "<mask token>\n\n\nclass SQLiteConnection(ConnectionBackend):\n <mask token>\n <mask token>\n\n async def connect(self):\n self.db = await aiosqlite.connect(self.db_name)\n self.db.row_factory = aiosqlite.Row\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def run206_01(): print('Regular dict:') d = {} d['a'] = 'A' d['b'] = 'B' d['c'] = 'C' for k, v in d.items(): print(k, v) print('OrderedDict:') d = OrderedDict() d['a'] = 'A' d['b'] = 'B' d['c'] = 'C' for k, v in d.items(): pr...
flexible
{ "blob_id": "4a7d8db2bc3b753ea1a12120e1ad85f31d572dc7", "index": 4237, "step-1": "<mask token>\n\n\ndef run206_01():\n print('Regular dict:')\n d = {}\n d['a'] = 'A'\n d['b'] = 'B'\n d['c'] = 'C'\n for k, v in d.items():\n print(k, v)\n print('OrderedDict:')\n d = OrderedDict()\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GameStats: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GameStats: def __init__(self, setting): self.setting = setting self.ships_left = self.se...
flexible
{ "blob_id": "3ab26612111e3df59f41f5b5e0bf23398e015a8a", "index": 1595, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GameStats:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GameStats:\n\n def __init__(self, setting):\n self.setting = setting\n self.ships_left = s...
[ 0, 1, 2, 3 ]
class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ plus = True # In the last digit, we should add one as the quesiton requries indexList = range(len(digits)) indexList.reverse() for i in indexList: ...
normal
{ "blob_id": "02a228c479a6c94858f7e8ef73a7c8528def871e", "index": 9423, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def plusOne(self, digits):\n \"\"\"\n :type digits: List[int]\n :rtype: List[int]\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class UserCreateSerializer(serializers.ModelSerializer): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = CustomUser fields = '__al...
flexible
{ "blob_id": "b10a50ce649650542d176a2f6fb8c35c500fbc38", "index": 3644, "step-1": "<mask token>\n\n\nclass UserCreateSerializer(serializers.ModelSerializer):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = CustomUser\n fields =...
[ 7, 17, 18, 23, 26 ]
""" Author: Eric J. Ma Purpose: This is a set of utility variables and functions that can be used across the PIN project. """ import numpy as np from sklearn.preprocessing import StandardScaler BACKBONE_ATOMS = ["N", "CA", "C", "O"] AMINO_ACIDS = [ "A", "B", "C", "D", "E", "F", "G", ...
normal
{ "blob_id": "330df4f194deec521f7db0389f88171d9e2aac40", "index": 2384, "step-1": "<mask token>\n", "step-2": "<mask token>\nscaler.fit(np.array([v for v in ISOELECTRIC_POINTS.values()]).reshape(-1, 1))\n<mask token>\nfor k, v in ISOELECTRIC_POINTS.items():\n ISOELECTRIC_POINTS_STD[k] = scaler.transform(np.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from __future__ import absolute_import from . import utils from . import bert_model from . import transformer from .utils import * from .bert_model import * from .transformer import *
flexible
{ "blob_id": "6415b08795975698e8e2019cafb82561b35f8e71", "index": 2037, "step-1": "<mask token>\n", "step-2": "from __future__ import absolute_import\nfrom . import utils\nfrom . import bert_model\nfrom . import transformer\nfrom .utils import *\nfrom .bert_model import *\nfrom .transformer import *\n", "step...
[ 0, 1 ]
# e.g. 8-34 from tkinter import * from PP4E.launchmodes import PortableLauncher import os, sys demoModules = ['demoDlg', 'demoRadio', 'demoCheck', 'demoScale'] for demo in demoModules: pid = os.fork() filepath = './' + demo + '.py' if pid == 0: os.execvp('python3.5', (filepath, )) root = Tk() r...
normal
{ "blob_id": "d91dc850c293cf085e1be04b6e13e0a62cb0bcb1", "index": 9812, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor demo in demoModules:\n pid = os.fork()\n filepath = './' + demo + '.py'\n if pid == 0:\n os.execvp('python3.5', (filepath,))\n<mask token>\nroot.title('Progress')\nLab...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DoorTeleportActor(AreaTeleportActor): pass <|reserved_special_token_1|> from pirates.teleport.AreaTeleportActor import AreaTeleportActor class DoorTeleportActor(AreaTeleportActor): pass
flexible
{ "blob_id": "b679444fde7cd8eb819443922f37ee54c0f29de4", "index": 424, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DoorTeleportActor(AreaTeleportActor):\n pass\n", "step-3": "from pirates.teleport.AreaTeleportActor import AreaTeleportActor\n\n\nclass DoorTeleportActor(AreaTeleportActor):...
[ 0, 1, 2 ]
import os import requests import json from web import * from libs_support import * from rss_parser import * from database import * class Solr_helper: """ Ho tro He thong tu dong cap nhat du lieu - su dung post.jar de tu dong cap nhat du lieu moi vao he thong theo tung khoang thoi gian nhat dinh """ de...
normal
{ "blob_id": "deaaf7620b9eba32149f733cd543399bdc2813a1", "index": 6553, "step-1": "\nimport os\nimport requests\nimport json\n\nfrom web import *\nfrom libs_support import *\nfrom rss_parser import *\nfrom database import *\n\nclass Solr_helper:\n\n \"\"\" Ho tro He thong tu dong cap nhat du lieu - su dung pos...
[ 0 ]
<|reserved_special_token_0|> class web: def __init__(self, lnum=0, land_list=[], graph_money=GraphAL(), graph_time=GraphAL(), graph_line=GraphAL()): self.graph_money = graph_money self.graph_time = graph_time self.graph_line = graph_line self.lnum = lnum self.land_...
flexible
{ "blob_id": "b5ec6e0fc4239a53a882b455a113eaac4db6cef5", "index": 2331, "step-1": "<mask token>\n\n\nclass web:\n\n def __init__(self, lnum=0, land_list=[], graph_money=GraphAL(),\n graph_time=GraphAL(), graph_line=GraphAL()):\n self.graph_money = graph_money\n self.graph_time = graph_time...
[ 15, 21, 24, 29, 32 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .dispatch import dispatch_expts
flexible
{ "blob_id": "394ebfe25bbf8eaf427509f28a82a98b9b481b63", "index": 4957, "step-1": "<mask token>\n", "step-2": "from .dispatch import dispatch_expts\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
def getGC(st): n = 0 for char in st: if char == 'C' or char == 'G': n += 1 return n while True: try: DNA = input() ln = int(input()) maxLen = 0 subDNA = '' for i in range(len(DNA) - ln + 1): sub = DNA[i:i + ln] if getG...
normal
{ "blob_id": "afe63f94c7107cf79e57f695df8543e0786a155f", "index": 6556, "step-1": "<mask token>\n", "step-2": "def getGC(st):\n n = 0\n for char in st:\n if char == 'C' or char == 'G':\n n += 1\n return n\n\n\n<mask token>\n", "step-3": "def getGC(st):\n n = 0\n for char in st...
[ 0, 1, 2 ]
from django.contrib import admin # Register your models here. from registration.models import FbAuth class AllFieldsAdmin(admin.ModelAdmin): """ A model admin that displays all field in admin excpet Many to many and pk field """ def __init__(self, model, admin_site): self.list_display = [fi...
normal
{ "blob_id": "821afa85eb783b4bf1018800f598a3294c4cbcfb", "index": 9532, "step-1": "<mask token>\n\n\nclass AllFieldsAdmin(admin.ModelAdmin):\n <mask token>\n\n def __init__(self, model, admin_site):\n self.list_display = [field.name for field in model._meta.fields if \n field.name not in [...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(N - 1): a, b = map(int, input().split()) E.append((a, b)) adj_list[a].append(b) adj_list[b].append(a) <|reserved_special_token_0|> while q: v = q.popleft() V_number[v - 1] = C[i] i += 1 ...
flexible
{ "blob_id": "b93f6c3192f8dd58b96dfdc6ea2b17e12cce34d0", "index": 9752, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(N - 1):\n a, b = map(int, input().split())\n E.append((a, b))\n adj_list[a].append(b)\n adj_list[b].append(a)\n<mask token>\nwhile q:\n v = q.popleft()\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CheckoutIntegrationTest(BaseCheckoutTest): <|reserved_special_token_0|> def test_checkout_process(self): """Full checkout process using minimal api calls""" product = self.create_product() res = self.do_get_basket() self.assertEqual(res.statu...
flexible
{ "blob_id": "9155b3eed8ac79b94a033801dbf142392b50720b", "index": 5123, "step-1": "<mask token>\n\n\nclass CheckoutIntegrationTest(BaseCheckoutTest):\n <mask token>\n\n def test_checkout_process(self):\n \"\"\"Full checkout process using minimal api calls\"\"\"\n product = self.create_product(...
[ 19, 25, 29, 32, 33 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def AverageLeftRight(EyeData): for eyes in EyeData: eyes['avg_x'] = (eyes['left_x'] + eyes['right_x']) / 2 eyes['avg_y'] = (eyes['left_y'] + eyes['right_y']) / 2 eyes['avg_x'].loc[eyes.right_x < -100]...
flexible
{ "blob_id": "00ed68c68d51c5019fde0c489cd133be3d6985c3", "index": 9339, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef AverageLeftRight(EyeData):\n for eyes in EyeData:\n eyes['avg_x'] = (eyes['left_x'] + eyes['right_x']) / 2\n eyes['avg_y'] = (eyes['left_y'] + eyes['right_y']) / ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(catogory) print(data) print(catogory.dot(data)) print(data.T.dot(catogory)) <|reserved_special_token_1|> <|reserved_special_token_0|> catogory = np.array([50, 30, 40, 20]) data = np.array([[20, 50, 10, 15, 20], [30, 40, 2...
flexible
{ "blob_id": "e4b49faaad648c6e85274abb18f994083a74013d", "index": 7160, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(catogory)\nprint(data)\nprint(catogory.dot(data))\nprint(data.T.dot(catogory))\n", "step-3": "<mask token>\ncatogory = np.array([50, 30, 40, 20])\ndata = np.array([[20, 50, 10, 15...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from rest_framework import serializers from django.contrib.auth.models import User from core.models import Detalhe, Viagem, Hospital, Equipamento, Caixa class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = '__all__' class CaixaSeri...
normal
{ "blob_id": "b5c68211cfa255e47ee316dc5b0627719eacae78", "index": 8504, "step-1": "<mask token>\n\n\nclass ViagemSerializer(serializers.ModelSerializer):\n detalhes = DetalheSerializer(many=True, read_only=True)\n caixa = CaixaSerializer(read_only=True)\n localPartida = HospitalSerializer(read_only=True)...
[ 2, 6, 7, 8, 9 ]
num_str = "1" num_str1 = "\u00b2" num_str2 = "一千零一" # 判断字符串是否只包含数字 # 1.三种方法都不能判断小数 # 2.isdigit 和 isnumeric 比 isdecimal 强大一些,后者只能判断正常数字,前两者可以判断带有数字的符号,如平方 # isnumeric 还可以判断中文数字 print(num_str) print(num_str1) print(num_str.isdecimal()) print(num_str1.isdecimal()) print(num_str.isdigit()) print(num_str1.isdigit()) print(n...
normal
{ "blob_id": "a7be2f43c6ec8d1576ed194a75762a36089cb052", "index": 4195, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num_str)\nprint(num_str1)\nprint(num_str.isdecimal())\nprint(num_str1.isdecimal())\nprint(num_str.isdigit())\nprint(num_str1.isdigit())\nprint(num_str.isnumeric())\nprint(num_str1.i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BillListSerializer(BillBaseSerializer): id = serializers.SerializerMethodField() def get_id(self, object): return object.key.id() class BillCreateSerializer(BillBaseSerializer): line_items = serializers.JSONField(default=None) company = serializers.CharFie...
flexible
{ "blob_id": "23160c2f030b0bd862360e944fbbc283c6cb45b2", "index": 6625, "step-1": "<mask token>\n\n\nclass BillListSerializer(BillBaseSerializer):\n id = serializers.SerializerMethodField()\n\n def get_id(self, object):\n return object.key.id()\n\n\nclass BillCreateSerializer(BillBaseSerializer):\n ...
[ 9, 10, 11, 12 ]
# -*- coding: utf-8 -*- """ Animation practical output The code that follows builds on the "Communications.py" file Additional code that follows has in part been modified from that of https://www.geog.leeds.ac.uk/courses/computing/practicals/python/agent-framework/part8/index.html https://www.geog.leeds.ac.uk/courses...
normal
{ "blob_id": "4ea266d4f4c18efbba4204d7301652f8966c18a5", "index": 9724, "step-1": "<mask token>\n\n\ndef gen_function(b=[0]):\n a = 0\n global carry_on\n while (a < 100) & carry_on:\n yield a\n a = a + 1\n\n\n<mask token>\n", "step-2": "<mask token>\nwith open('in.txt', newline='') as ras...
[ 1, 3, 4, 5, 6 ]
from .lasot import Lasot from .got10k import Got10k from .tracking_net import TrackingNet from .imagenetvid import ImagenetVID from .imagenetdet import ImagenetDET from .coco_seq import MSCOCOSeq from .vot import VOT from .youtube_vos import YoutubeVOS from .youtube_bb import YoutubeBB
normal
{ "blob_id": "e12ca2c4592a629ce78cae7211fedaf02352a603", "index": 4700, "step-1": "<mask token>\n", "step-2": "from .lasot import Lasot\nfrom .got10k import Got10k\nfrom .tracking_net import TrackingNet\nfrom .imagenetvid import ImagenetVID\nfrom .imagenetdet import ImagenetDET\nfrom .coco_seq import MSCOCOSeq\...
[ 0, 1 ]
<|reserved_special_token_0|> def eff_param_string(): """ The parametrization of the efficiencies from AN-2015-11 as a string that can be used in a TF1 constructor. p0 * (1 - p1 * (Erf(pT + p2) - p1 / alpha * (pT - p3 * (pT^2 - p3 / beta * pT^3)))) """ return ( '[0] * (1 - [1] * (TMath...
flexible
{ "blob_id": "fd450b5454b65ed69b411028788c587f9674760c", "index": 966, "step-1": "<mask token>\n\n\ndef eff_param_string():\n \"\"\"\n The parametrization of the efficiencies from AN-2015-11 as a string that can\n be used in a TF1 constructor.\n\n p0 * (1 - p1 * (Erf(pT + p2) - p1 / alpha * (pT - p3 *...
[ 8, 9, 10, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> # coding=utf-8 """ author = jamon """
flexible
{ "blob_id": "00790b9d2648d19a37d1d1864e7fdeab0f59f764", "index": 4266, "step-1": "<mask token>\n", "step-2": "# coding=utf-8\n\"\"\"\nauthor = jamon\n\"\"\"", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- encoding: utf-8 -*- """ views: vistas sistema recomendador @author Camilo Ramírez @contact camilolinchis@gmail.com camilortte@hotmail.com @camilortte on Twitter @copyright Copyright 2014-2015, RecomendadorUD @license GPL @date 2014-10...
normal
{ "blob_id": "c6cbd4d18363f00b73fac873ba45d6063bee7e64", "index": 3074, "step-1": "# -*- encoding: utf-8 -*-\n\"\"\"\n \n views: vistas sistema recomendador\n\n @author Camilo Ramírez\n @contact camilolinchis@gmail.com \n camilortte@hotmail.com\n @camilortte on Twi...
[ 0 ]
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isBalanced(self, root: TreeNode) -> bool: self.mem = dict() if root is None: ...
normal
{ "blob_id": "9e98a361ef20049cba488b86ad06eb92b3d29d11", "index": 3584, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n\n def isBalanced(self, root: TreeNode) ->bool:\n self.mem = dict()\n if root is None:\n ...
[ 0, 1, 2, 3, 4 ]
import wikipedia input_ = input("Type in your question ") print(wikipedia.summary(input_))
normal
{ "blob_id": "5eb5388ffe7a7c880d8fcfaa137c2c9a133a0636", "index": 713, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(wikipedia.summary(input_))\n", "step-3": "<mask token>\ninput_ = input('Type in your question ')\nprint(wikipedia.summary(input_))\n", "step-4": "import wikipedia\ninput_ = input...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for val in theFile.read().split(): temp.append(int(val)) theFile.close() <|reserved_special_token_0|> for i in range(n): for j in range(n): arr[i, j] = temp[k] k = k + 1 <|reserved_special_token_0|> for i i...
flexible
{ "blob_id": "aa801bc8398cdf69a15d04188dd8429e4624150e", "index": 5574, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor val in theFile.read().split():\n temp.append(int(val))\ntheFile.close()\n<mask token>\nfor i in range(n):\n for j in range(n):\n arr[i, j] = temp[k]\n k = k + 1\n<...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3.8 # -*- coding: utf-8 -*- __version__ = "0.2.2" __author__ = 'Anton Vanke <f@hpu.edu.cn>' class Gobang: """ 五子棋 ===== 一个简单的五子棋类, 可以在控制台下五子棋. 提供以下函数 : new(): 新局 printcb(): 打印棋盘 player(): 获取当前应落子 ID (轮走方) sortstep(): 处理总步表 loadstep(): 将 step 步表...
normal
{ "blob_id": "e0394bfed51cd0af9bca06867e9b556b226f37d1", "index": 1720, "step-1": "<mask token>\n\n\nclass Gobang:\n <mask token>\n <mask token>\n\n def new(self):\n \"\"\"新局\"\"\"\n self.__init__()\n\n def printcb(self):\n \"\"\"打印棋盘\"\"\"\n print('\\x1b[7;32;40m+ ', end...
[ 8, 11, 14, 15, 16 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'FormHello.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, Qt...
normal
{ "blob_id": "fc20a2bf09d510892a4d144fbbd2cb2012c3ad98", "index": 8579, "step-1": "<mask token>\n\n\nclass Ui_FormHello(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_FormHello(object):\n\n def setupUi(self, FormHello):\n FormHello.setObjectName('FormHello')\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.scatter(x_int, y_int, c=y_int, cmap=plt.cm.Blues, s=40) plt.show() <|reserved_special_token_1|> <|reserved_special_token_0|> x_int = list(range(1, 5001)) y_int = [(i ** 3) for i in x_int] plt.scatter(x_int, y_int, c=y_int, ...
flexible
{ "blob_id": "40e2b695d8aaaa82cb90694b85d12061b4e6eca8", "index": 8034, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.scatter(x_int, y_int, c=y_int, cmap=plt.cm.Blues, s=40)\nplt.show()\n", "step-3": "<mask token>\nx_int = list(range(1, 5001))\ny_int = [(i ** 3) for i in x_int]\nplt.scatter(x_int, ...
[ 0, 1, 2, 3, 4 ]
# leetcode 718 最长重复子数组 # 给两个整数数组 A 和 B ,返回两个数组中公共的、长度最长的子数组的长度。 # # 示例 1: # 输入: # A: [1,2,3,2,1] # B: [3,2,1,4,7] # 输出: 3 # 解释: # 长度最长的公共子数组是 [3, 2, 1]。 # # 说明: # 1 <= len(A), len(B) <= 1000 # 0 <= A[i], B[i] < 100 class Solution: def findLength(self, A: [int], B: [int])->int: """ 动态规划, 维护...
normal
{ "blob_id": "b8219c21dc2cdd497d3de48c59c146a1fd1509ec", "index": 6673, "step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution:\n\n def findLength(self, A: [int], B: [int]) ->int:\n \"\"\"\n 动态规划, 维护一个公共子串长度表DP\n DP[i][j]表示A中以第i个元素,B中以第j个元素结尾的公共子串长度\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Ui_Tab(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_Tab(object): <|reserved_special_token_0|> def retranslateUi(self, Tab): _translate = QtCore.QCoreApplication.tra...
flexible
{ "blob_id": "ef85f94282bfd7c9491c4e28bab61aaab5c792a5", "index": 232, "step-1": "<mask token>\n\n\nclass Ui_Tab(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Tab(object):\n <mask token>\n\n def retranslateUi(self, Tab):\n _translate = QtCore.QCoreApplicatio...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-08-03 10:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Proce...
normal
{ "blob_id": "f15ce7cec032ace65604771fa56e3d9969c98209", "index": 1964, "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|> class Project(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_...
flexible
{ "blob_id": "ac1d38f550e548dff6ba226dbfc3dd1e5ff876a8", "index": 5563, "step-1": "<mask token>\n\n\nclass Project(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 ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ConfusionMatrix(Metric): <|reserved_special_token_0|> <|reserved_special_token_0|> def draw(self, size=400): index_label = 'Predicted' column_label = 'Actual' matrix = self.generate_data() min_val, max_val = matrix.Value.min(), matrix.Val...
flexible
{ "blob_id": "9a2002b5ff0fe41f2b5b568f4c278d4376bf4fb1", "index": 6117, "step-1": "<mask token>\n\n\nclass ConfusionMatrix(Metric):\n <mask token>\n <mask token>\n\n def draw(self, size=400):\n index_label = 'Predicted'\n column_label = 'Actual'\n matrix = self.generate_data()\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def install_mysql(package='mysql-server', sources=None, keys=None): if not sources: sources = [] if not keys: keys = [] from subprocess import Popen, PIPE for source in sources: add_source(source) if sources: apt_update() with open('...
flexible
{ "blob_id": "083a9555f8db586fbb065d59e4e333bb16ee3d2a", "index": 5521, "step-1": "<mask token>\n\n\ndef install_mysql(package='mysql-server', sources=None, keys=None):\n if not sources:\n sources = []\n if not keys:\n keys = []\n from subprocess import Popen, PIPE\n for source in source...
[ 9, 10, 11, 13, 14 ]
import sys from Node import Node from PriorityQueue import PriorityQueue def Print(text): if text is None or len(text) == 0: print('invalid text.') print('--------------------------------------------------------------') return text_set = set() for i in text: t...
normal
{ "blob_id": "bcdd36b534fd3551de9cb40efc11581f4d95a002", "index": 9717, "step-1": "<mask token>\n\n\ndef Print(text):\n if text is None or len(text) == 0:\n print('invalid text.')\n print('--------------------------------------------------------------')\n return\n text_set = set()\n ...
[ 5, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- """Test custom node separator.""" import six from helper import assert_raises, eq_ import anytree as at class MyNode(at.Node): separator = "|" def test_render(): """Render string cast.""" root = MyNode("root") s0 = MyNode("sub0", parent=root) MyNode("sub0B", parent=s0)...
normal
{ "blob_id": "a430b4629ee06dbfb267f839599383624e37451e", "index": 4582, "step-1": "<mask token>\n\n\nclass MyNode(at.Node):\n separator = '|'\n\n\ndef test_render():\n \"\"\"Render string cast.\"\"\"\n root = MyNode('root')\n s0 = MyNode('sub0', parent=root)\n MyNode('sub0B', parent=s0)\n MyNode...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def log_utility(curr_dr): """ More data rate increases the utility following a log function: High initial increase, then flattens. :param curr_dr: Current data rate :param factor: Factor to multiply the log function with :param add: Add to current data rate before pas...
flexible
{ "blob_id": "e3de072d6bce2ecc105306c06b9a9aa0362130ff", "index": 6234, "step-1": "<mask token>\n\n\ndef log_utility(curr_dr):\n \"\"\"\n More data rate increases the utility following a log function: High initial increase, then flattens.\n\n :param curr_dr: Current data rate\n :param factor: Factor t...
[ 1, 2, 3, 4, 5 ]
import paho.mqtt.client as paho import RPi.GPIO as GPIO import json, time, math import clearblade from clearblade import auth from clearblade import Client from urlparse import urlparse #Fill init values systemKey = ______ secretKey = ______ userName = _______ userPW = _______ edgeIP = "http://_______:9000" auth = au...
normal
{ "blob_id": "299d13fbcdb75673026db1e3a0352c8b19d453c1", "index": 6314, "step-1": "import paho.mqtt.client as paho\nimport RPi.GPIO as GPIO\nimport json, time, math\nimport clearblade\nfrom clearblade import auth\nfrom clearblade import Client\nfrom urlparse import urlparse\n\n#Fill init values\nsystemKey = _____...
[ 0 ]
# -*- coding:utf-8 -*- from flask import redirect, url_for, render_template from flask.globals import request, session from flask_admin import BaseView, expose from util import navigator, common class Billings(BaseView): @expose('/') def index(self): return redirect(url_for('.billingHistory')) ...
normal
{ "blob_id": "a9344151a997842972aa68c417a77b3ca80e6cfa", "index": 3174, "step-1": "<mask token>\n\n\nclass Billings(BaseView):\n\n @expose('/')\n def index(self):\n return redirect(url_for('.billingHistory'))\n <mask token>\n <mask token>\n <mask token>\n\n @expose('/billingsDetail')\n ...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('[') sys.stdout.close() for name in names: url = ('https://newsapi.org/v2/everything?sources=' + name + '&pageSize=100&language=en&from=2018-04-01&to=2018-04-01&apiKey=c0456841cb6a4dc794e3ec64e86b7e6e' ) ...
flexible
{ "blob_id": "590baf17d9fdad9f52869fa354112d3aa5f7d5f0", "index": 8943, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('[')\nsys.stdout.close()\nfor name in names:\n url = ('https://newsapi.org/v2/everything?sources=' + name +\n '&pageSize=100&language=en&from=2018-04-01&to=2018-04-01&apiK...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python ############################################################################### # \file # # $Id:$ # # Copyright (C) Brno University of Technology # # This file is part of software developed by Robo@FIT group. # # Author: Tomas Lokaj # Supervised by: Michal Spanel (spanel@fit.vutbr.cz) # Date: 12/...
normal
{ "blob_id": "3bf1b4cfce55820605653d9dc57bab839f2dea55", "index": 5864, "step-1": "#!/usr/bin/env python\n###############################################################################\n# \\file\n#\n# $Id:$\n#\n# Copyright (C) Brno University of Technology\n#\n# This file is part of software developed by Robo@FI...
[ 0 ]
<|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": "6285d1665bacbff746f44f42ce65981f937fff64", "index": 4189, "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 getCollapsedFastqDataframe(file): df = pd.read_table(file, header=None, delim_whitespace=True) df = df.dropna(axis=1, how='all') sample = file.split('/') sample = sample[len(sample) - 1] sample = sample.split('.')[0] df.columns = ['READS', 'SEQUENCE'] retur...
flexible
{ "blob_id": "ddabceb223f4e457a0f69af5abf793ae72e5f432", "index": 1465, "step-1": "<mask token>\n\n\ndef getCollapsedFastqDataframe(file):\n df = pd.read_table(file, header=None, delim_whitespace=True)\n df = df.dropna(axis=1, how='all')\n sample = file.split('/')\n sample = sample[len(sample) - 1]\n ...
[ 2, 3, 4, 5, 6 ]
import time import json from threading import Thread try: with open('file.json') as f: name = json.load(f) except: f = open("file.json", "w+") name = {} def create(k, v, t='0'): if k in name: print("ERROR:The data already exists") else: if k.isalpha(): ...
normal
{ "blob_id": "430dff54da986df4e3a68018d930735c757d49d0", "index": 6794, "step-1": "<mask token>\n\n\ndef create(k, v, t='0'):\n if k in name:\n print('ERROR:The data already exists')\n elif k.isalpha():\n if v.isnumeric() and t.isnumeric():\n v = int(v)\n t = int(t)\n ...
[ 2, 3, 4, 5, 6 ]
""" util - other functions """ import torch import numpy as np from common_labelme import Config from torch.autograd import Variable I = torch.FloatTensor(np.eye(Config.batch_size),) E = torch.FloatTensor(np.ones((Config.batch_size, Config.batch_size))) normalize_1 = Config.batch_size normalize_2 = Config.batch_size *...
normal
{ "blob_id": "be9179b33991ba743e6e6b7d5dd4dc85ffc09fc3", "index": 6331, "step-1": "<mask token>\n\n\ndef mig_loss_function(output1, output2, p):\n new_output = output1 / p\n m = new_output @ output2.transpose(1, 0)\n noise = torch.rand(1) * 0.0001\n m1 = torch.log(m * I + I * noise + E - I)\n m2 = ...
[ 10, 11, 12, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in doc_set: raw = i.lower() tokens = tokenizer.tokenize(raw) stopped_tokens = [i for i in tokens if not i in en_stop] stemmed_tokens = [p_stemmer.stem(i) for i in stopped_tokens] texts.append(stemmed_toke...
flexible
{ "blob_id": "3035ac8044b5629d0b5de7934e46890ad36ed551", "index": 7798, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in doc_set:\n raw = i.lower()\n tokens = tokenizer.tokenize(raw)\n stopped_tokens = [i for i in tokens if not i in en_stop]\n stemmed_tokens = [p_stemmer.stem(i) for i i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @pytest.fixture def home_page(getBrowser): aHome = HomePage(getBrowser) return aHome @pytest.fixture def overall_page(getBrowser): aOverall = OverallPage(getBrowser) return aOverall @pytest.fixture def page_component(getBrowser): aPage = PageComponent(getBrowser) ...
flexible
{ "blob_id": "2809ed3a5ea1e527609e169bca1440e0db2761b9", "index": 8408, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef home_page(getBrowser):\n aHome = HomePage(getBrowser)\n return aHome\n\n\n@pytest.fixture\ndef overall_page(getBrowser):\n aOverall = OverallPage(getBrowser)\n return aOverall\n\n\...
[ 14, 15, 17, 18, 19 ]
<|reserved_special_token_0|> class Transcoder: <|reserved_special_token_0|> def __init__(self): """Constructor.""" logger.info('__init__:Enter') self._token = None self.transcript = None self._queue = queue.Queue() def start(self, token): """Start recognit...
flexible
{ "blob_id": "421b0c1871350ff541b4e56d1e18d77016884552", "index": 5199, "step-1": "<mask token>\n\n\nclass Transcoder:\n <mask token>\n\n def __init__(self):\n \"\"\"Constructor.\"\"\"\n logger.info('__init__:Enter')\n self._token = None\n self.transcript = None\n self._qu...
[ 9, 10, 12, 14, 16 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2020, Lukas Bestle <project-ansible@lukasbestle.com> # Copyright: (c) 2017, Michael Heap <m@michaelheap.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_f...
normal
{ "blob_id": "8b965fd91396735e0153390b4eff540d3aac3aff", "index": 4916, "step-1": "<mask token>\n\n\nclass Mas(object):\n\n def __init__(self, module):\n self.module = module\n self.mas_path = self.module.get_bin_path('mas')\n self._checked_signin = False\n self._installed = None\n ...
[ 14, 15, 16, 17, 18 ]
# https://www.acmicpc.net/problem/2751 # n 개 수가 주어짐 # 목표 오름차순정렬 # 첫 줄 n개 # 둘째줄부터 n개의 줄에 수가 주어짐 세로로 # 출력 오름차순 정렬한 결과를 한 줄에 하나씩 출력한다? n=int(input()) n_list=[int(input()) for _ in range(n)] # print(n_list) nn_list = [] # 인덱스 2개 관리 mid_idx = len(n_list) //2 left_idx = 0 right_idx = mid_idx +1 while left_idx <= mid...
normal
{ "blob_id": "fb5508b1b5aa36c4921358d6ca7f96fc7d565241", "index": 5104, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile left_idx <= mid_idx and right_idx <= n - 1:\n if n_list[left_idx] < n_list[right_idx]:\n nn_list.append(n_list[left_idx])\n left_idx += 1\n elif n_list[left_idx]...
[ 0, 1, 2, 3 ]
import os import time from datetime import datetime from typing import List, Tuple from pyspark.sql import SparkSession from Chapter01.utilities01_py.helper_python import create_session from Chapter02.utilities02_py.domain_objects import WarcRecord from Chapter02.utilities02_py.helper_python import extract_raw_records,...
normal
{ "blob_id": "fccdf75fe83ad8388c12a63555c4132181fd349a", "index": 1646, "step-1": "<mask token>\n\n\ndef fall_asleep(record: WarcRecord):\n current_uri: str = record.target_uri\n start_time = str(datetime.now())\n process_id = str(os.getpid())\n print('@@1 falling asleep in process {} at {} processing...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class MRdegibbsInputSpec(CommandLineInputSpec): in_file = File(desc='input DWI image', exists=True, mandatory=True, position=0, argstr='%s') force = traits.Bool(desc='force overwrite of output files', position=-1, argstr='-force') out_file = File(name_template=...
flexible
{ "blob_id": "419aee3045a0d532afa0fc314df9cdef7aab5219", "index": 4181, "step-1": "<mask token>\n\n\nclass MRdegibbsInputSpec(CommandLineInputSpec):\n in_file = File(desc='input DWI image', exists=True, mandatory=True,\n position=0, argstr='%s')\n force = traits.Bool(desc='force overwrite of output f...
[ 20, 22, 24, 26, 29 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(set1) print(set2) print(set1.difference(set2)) print(set1 - set2) print(set2.difference(set1)) print(set2 - set1) print(set1) print(set2) print('*' * 40) <|reserved_special_token_0|> print(set3) set3.difference_update(set4) ...
flexible
{ "blob_id": "faf2f5da92cf45cfedda91955688b3ca1c7c0db9", "index": 8280, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(set1)\nprint(set2)\nprint(set1.difference(set2))\nprint(set1 - set2)\nprint(set2.difference(set1))\nprint(set2 - set1)\nprint(set1)\nprint(set2)\nprint('*' * 40)\n<mask token>\nprin...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Tue May 22 15:01:21 2018 @author: Weiyu_Lee """ import numpy as np import pandas as pd import pickle import matplotlib.pyplot as plt from datetime import datetime, timedelta import config as conf def get_stock_time_series(data_df, stock_id): curr_ID_dat...
normal
{ "blob_id": "6a7e5a78f516cecf083ca3900bdaaf427bedd497", "index": 756, "step-1": "<mask token>\n\n\ndef get_stock_time_series(data_df, stock_id):\n curr_ID_data = data_df.loc[stock_id]\n output = np.array(curr_ID_data[0])\n for i in range(1, len(curr_ID_data.index)):\n output = np.vstack((output, ...
[ 1, 2, 3, 4, 5 ]
""" Constant types in Python. 定数上書きチェック用 """ import os from common import const from datetime import timedelta from linebot.models import ( TemplateSendMessage, CarouselTemplate, CarouselColumn, MessageAction, QuickReplyButton, CameraAction, CameraRollAction, LocationAction ) const.API_PROFILE_URL = 'https://...
normal
{ "blob_id": "25fcf162306b3d6d6307e703a7d829754cba2778", "index": 2347, "step-1": "<mask token>\n", "step-2": "<mask token>\nconst.API_PROFILE_URL = 'https://api.line.me/v2/profile'\nconst.API_NOTIFICATIONTOKEN_URL = (\n 'https://api.line.me/message/v3/notifier/token')\nconst.API_ACCESSTOKEN_URL = 'https://a...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from optparse import make_option from django.core.management.base import BaseCommand, LabelCommand, CommandError from open_coesione import utils import sys import logging import csv import os class Command(LabelCommand): """ Task to extract data related to a sample of all projects. ...
normal
{ "blob_id": "f0444676d28be27ad2f0f7cdaa58a96b7facc546", "index": 2193, "step-1": "# -*- coding: utf-8 -*-\n\nfrom optparse import make_option\nfrom django.core.management.base import BaseCommand, LabelCommand, CommandError\nfrom open_coesione import utils\n\nimport sys\nimport logging\nimport csv\nimport os\n\nc...
[ 0 ]
# Generated by Django 2.2.5 on 2019-10-28 08:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0001_initial'), ] operations = [ migrations.AddField( model_name='user', name='my_resume', field...
normal
{ "blob_id": "32c28c7a1e1572744387b509fc6a448554ed565e", "index": 3445, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('user', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import wizard import report
flexible
{ "blob_id": "9d07fd14825ed1e0210fa1f404939f68a3bb039c", "index": 4762, "step-1": "<mask token>\n", "step-2": "import wizard\nimport report\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- from numpy import * def loadDataSet(fileName, delim = '\t'): fr = open(fileName) stringArr = [line.strip().split(delim) for line in fr.readlines()] datArr = [map(float,line) for line in stringArr] return mat(datArr) def pca(dataMat, topNfeat = 9999999): meanVals = mean(dat...
normal
{ "blob_id": "5f00cd446b219203c401799ba7b6205c7f1f8e9f", "index": 3510, "step-1": "<mask token>\n\n\ndef replaceNanWithMean():\n dataMat = loadDataSet('secom.data.txt', '')\n numFeat = shape(dataMat)[1]\n for i in range(numFeat):\n meanVal = mean(dataMat[nonzero(~isnan(dataMat[:, i].A))[0], i])\n ...
[ 1, 2, 3, 4, 5 ]
import os import shutil import argparse ap = argparse.ArgumentParser() ap.add_argument('-D', '--dir', required=False, help='Directory to sort') args = vars(ap.parse_args()) if args['dir'] == None: DIR = os.getcwd() elif os.path.exists(args['dir']): DIR = args['dir'] for file in os.listdir(DIR): if not os.pa...
normal
{ "blob_id": "93737e4c409d0efb1ae2263cb60d4b03d9aad0d8", "index": 247, "step-1": "<mask token>\n", "step-2": "<mask token>\nap.add_argument('-D', '--dir', required=False, help='Directory to sort')\n<mask token>\nif args['dir'] == None:\n DIR = os.getcwd()\nelif os.path.exists(args['dir']):\n DIR = args['d...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import rospy from nav_msgs.msg import Odometry from geometry_msgs.msg import Twist from std_srvs.srv import Empty, EmptyResponse import tf from math import radians, degrees, fabs class MovementNullifier: def __init__(self): rospy.Subscriber("odom", Odometry, self.OdomCallback) ...
normal
{ "blob_id": "c349fa484476e3195e0932e425cbe93d7a7e5394", "index": 1225, "step-1": "<mask token>\n\n\nclass MovementNullifier:\n\n def __init__(self):\n rospy.Subscriber('odom', Odometry, self.OdomCallback)\n rospy.Subscriber('cmd_vel', Twist, self.TwistCallback)\n self.cmd_vel_publisher = ...
[ 7, 8, 10, 11, 12 ]
#list,for replacing element we use {a[0='']}:for adding element we use {append()} a=['somesh','aakash','sarika','datta','rudra','4mridula'] a[2] = 'nandini' a.append('sarika') print(a[2]) print(a)
normal
{ "blob_id": "5c643dfce9cf7a9f774957ff4819d3be8ac4f1da", "index": 7376, "step-1": "<mask token>\n", "step-2": "<mask token>\na.append('sarika')\nprint(a[2])\nprint(a)\n", "step-3": "a = ['somesh', 'aakash', 'sarika', 'datta', 'rudra', '4mridula']\na[2] = 'nandini'\na.append('sarika')\nprint(a[2])\nprint(a)\n"...
[ 0, 1, 2, 3 ]
from PyQt5.QtWidgets import * from select_substituents_table import * from save_selection_dialog import * class SelectSubsDialog(QDialog): def __init__(self, r_group): super().__init__() self.r_group = r_group self.substituents = None self.new_set_saved = False self.setWi...
normal
{ "blob_id": "849db3a92e0544661dd465b3e7f6949f8de5633b", "index": 5099, "step-1": "<mask token>\n\n\nclass SelectSubsDialog(QDialog):\n <mask token>\n\n def enable_save_buttons(self):\n self.confirm_button.setEnabled(True)\n self.save_as_set_button.setEnabled(True)\n\n def get_substituents(...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sort(list): for i in range(len(list) - 1): if list[i] > list[i + 1]: a = list[i] list[i] = list[i + 1] list[i + 1] = a print(list) <|reserved_special_token_0|> <|re...
flexible
{ "blob_id": "219929d52b5f1a0690590e83b41d2b4f0b2b3a51", "index": 336, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sort(list):\n for i in range(len(list) - 1):\n if list[i] > list[i + 1]:\n a = list[i]\n list[i] = list[i + 1]\n list[i + 1] = a\n ...
[ 0, 1, 2, 3 ]
#-*- coding: utf8 -*- #Programa: 04-palindromo #Objetivo:Un Numero Palindromo es aquel numero que se lee igual, de izquierda a derecha y viceversa #El palindromo mas grande que se pued obtener por el producto de dos numeos de dos digitos # es: 9009 que es igual a 91x99. #Encuentre el pali...
normal
{ "blob_id": "45f9d5ac0fa7d9259c1d53b92c030559f3bfda89", "index": 7161, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef multiplicaciones():\n \"\"\"\n Funcion se encargara de crear las multiplicaciones entre 999 y 100\n\n mediante dos ciclos for.\n \"\"\"\n ultimo_palindromo = 0\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env conda-execute # conda execute # env: # - python >=3 # - requests # run_with: python from configparser import NoOptionError from configparser import SafeConfigParser import argparse import base64 import inspect import ipaddress import json import logging import logging.config import o...
normal
{ "blob_id": "dd91ba13177aefacc24ef4a004acae0bffafadf0", "index": 8889, "step-1": "#!/usr/bin/env conda-execute\r\n\r\n# conda execute\r\n# env:\r\n# - python >=3\r\n# - requests\r\n# run_with: python\r\n\r\nfrom configparser import NoOptionError\r\nfrom configparser import SafeConfigParser\r\nimport argparse\r...
[ 0 ]
from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Closes the specified poll for voting' def add_arguments(self, parser): # Positional arguments parser.add_argument('poll_id', nargs='+', type=int) # Named (optional arguments) ...
normal
{ "blob_id": "b2d5b16c287dc76a088f6e20eca4a16dd0aad00f", "index": 8797, "step-1": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n <mask token>\n\n def handle(self, *args, **options):\n s = ''\n result = 0\n tag = sum([options[i] for i in ['add', 'substract', 'multiply...
[ 2, 3, 4, 5, 6 ]