code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
h1 = l1
... | flexible | {
"blob_id": "0f3ecd0a7189f57fdbda2360f6e39bd6101e2fdb",
"index": 7435,
"step-1": "<mask token>\n\n\nclass ListNode(object):\n\n def __init__(self, x):\n self.val = x\n self.next = None\n\n\nclass Solution(object):\n\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNod... | [
4,
5,
6,
7
] |
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/web_client_api/__init__.py
from soft_exception import SoftException
class WebCommandException(SoftException):
def __init__(self, description):
super(WebCommandException, self).__init__(description)
| normal | {
"blob_id": "0f4864b745768994ea55a931e4d8b0681c058465",
"index": 2828,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass WebCommandException(SoftException):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass WebCommandException(SoftException):\n\n def __init__(self, description):\n ... | [
0,
1,
2,
3,
4
] |
from codecool_class import CodecoolClass
from mentor import Mentor
from student import Student
codecool_bp = CodecoolClass.create_local
| normal | {
"blob_id": "7e985f55271c8b588abe54a07d20b89b2a29ff0d",
"index": 8380,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncodecool_bp = CodecoolClass.create_local\n",
"step-3": "from codecool_class import CodecoolClass\nfrom mentor import Mentor\nfrom student import Student\ncodecool_bp = CodecoolClass.cre... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def generate_id(parameter, station_id):
meta_data = parameter + station_id
hash_id = hashlib.sha256(config.encryption_key)
hash_id.update(json.dumps(meta_data).encode())
return hash_id.hexdigest()
<|reserved_sp... | flexible | {
"blob_id": "2a5c6f442e6e6cec6c4663b764c8a9a15aec8c40",
"index": 6971,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef generate_id(parameter, station_id):\n meta_data = parameter + station_id\n hash_id = hashlib.sha256(config.encryption_key)\n hash_id.update(json.dumps(meta_data).encode()... | [
0,
1,
2,
3,
4
] |
import re
import pandas as pd
import pandas.io.formats.excel
from configparser import ConfigParser
from datetime import datetime
from termcolor import cprint
import os
import shutil
from openpyxl import load_workbook
import numpy as np
class pairtron():
def affiliation_cleaner(self, affiliation):
# print(... | normal | {
"blob_id": "fbab5826f47163cf82b534d311eae572c5fcd128",
"index": 3287,
"step-1": "<mask token>\n\n\nclass pairtron:\n\n def affiliation_cleaner(self, affiliation):\n affiliation = str(affiliation)\n affiliation = affiliation.strip(' ;').replace(' ', ' ').replace(' ',\n ' ')\n ... | [
9,
10,
12,
13,
15
] |
individual = html.Div([
html.Div([ # input container
html.Div([
dcc.RadioItems(id='view-radio',
options=[
{'label': i, 'value': i} for i in ['Players',
'Tea... | normal | {
"blob_id": "6c65d63ef07b6cdb2029e6a6e99f6ee35b448c4b",
"index": 3147,
"step-1": "individual = html.Div([\n\n html.Div([ # input container\n \n html.Div([\n dcc.RadioItems(id='view-radio',\n options=[\n {'label': i, 'value'... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('platform: ' + sys.platform + '\n' + 'maxsize: ' + str(sys.maxsize) +
'\n' + 'argv: ' + str(sys.argv))
print('Process ID: ' + str(os.getpid()) + '\n' + 'cwd: ' + os.getcwd() +
'\n' + 'login id: ' + os.getlogin())
<... | flexible | {
"blob_id": "3fed96e9bedb157a14cf9c441de5aae8b4f6edc8",
"index": 8664,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('platform: ' + sys.platform + '\\n' + 'maxsize: ' + str(sys.maxsize) +\n '\\n' + 'argv: ' + str(sys.argv))\nprint('Process ID: ' + str(os.getpid()) + '\\n' + 'cwd: ' + os.getcwd(... | [
0,
1,
2,
3
] |
from datetime import datetime
import cv2
import numpy as np
from sklearn.cluster import KMeans,MiniBatchKMeans
class FeatureGetter(object):
def __init__(self):
self.sift_det = cv2.xfeatures2d.SIFT_create()
def get_img(self, img_path):
img = cv2.imread(img_path)
return img
def get_fe... | normal | {
"blob_id": "630011b188548df9e55b6f1ddbefa08e322b9cba",
"index": 169,
"step-1": "<mask token>\n\n\nclass FeaturesBuilder(object):\n <mask token>\n\n def getClusterCentures(self):\n start_time = datetime.now()\n feature_getter = FeatureGetter()\n des_list = []\n des_matrix = np.z... | [
5,
7,
8,
10,
12
] |
<|reserved_special_token_0|>
class WellRepository:
<|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_1|>
<|reserved_special_token_0|>
class ... | flexible | {
"blob_id": "5a181b0c22faa47c6c887daac675dd7374037f30",
"index": 3056,
"step-1": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n\n d... | [
1,
5,
7,
8,
9
] |
aax=int(input("enter aa-x"))
aay=int(input("enter aa-y"))
bbx=int(input("enter bb-x"))
bby=int(input("enter bb-y"))
ccx=int(input("enter cc-x"))
ccy=int(input("enter cc-y"))
ddx=int(input("enter dd-x"))
ddy=int(input("enter dd-y"))
if aax==aay and aay==bbx and bby==ccx and ccx==ccy and ccy==ddx and ddy==aax:
print(... | normal | {
"blob_id": "bd0cc8cf059440f8fd7ad135894d82c9b18ebc80",
"index": 4583,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif aax == aay and aay == bbx and bby == ccx and ccx == ccy and ccy == ddx and ddy == aax:\n print('yes')\nelse:\n print('no')\n",
"step-3": "aax = int(input('enter aa-x'))\naay = ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def solution(A):
if not A:
return 1
elif len(A) == 1:
if A[0] == 1:
return 2
else:
return 1
A.sort()
prev = 0
for i in A:
if i != prev + 1:
return i - 1
else:
... | flexible | {
"blob_id": "8c3c066ed37fe0f67acfd2d5dc9d57ec2b996275",
"index": 5640,
"step-1": "<mask token>\n",
"step-2": "def solution(A):\n if not A:\n return 1\n elif len(A) == 1:\n if A[0] == 1:\n return 2\n else:\n return 1\n A.sort()\n prev = 0\n for i in A:\n... | [
0,
1,
2
] |
from datetime import datetime, timedelta
import os
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators import (StageToRedshiftOperator, LoadFactOperator,
LoadDimensionOperator, DataQualityOperator)
from helpers import SqlQueries
# AW... | normal | {
"blob_id": "7994d9605c8654053c9a85f8d37983da04f8003a",
"index": 2674,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nstart_operator >> stage_events_to_redshift >> load_songplays_table\nstart_operator >> stage_songs_to_redshift >> load_songplays_table\nload_songplays_table >> load_song_dimension_table >>... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def read_cfg(path, section=None, option=None):
config = SafeConfigParser()
config.read(path)
def get(section, option):
return config.get(section, option) if config.has_option(section, option
) else None
return get(section, option) if section else get
... | flexible | {
"blob_id": "0dd17d8872b251fbc59a322bf3c695bd8079aba4",
"index": 3338,
"step-1": "<mask token>\n\n\ndef read_cfg(path, section=None, option=None):\n config = SafeConfigParser()\n config.read(path)\n\n def get(section, option):\n return config.get(section, option) if config.has_option(section, opt... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python
"""
mahjong.playerhand
"""
from collections import Counter
from melds import (DiscardedBy, Chow, Pung, Kong)
from shanten import (
count_shanten_13_orphans,
count_shanten_seven_pairs,
count_shanten_std)
import tiles
from walls import TileWallAgent
class PlayerHand:
"""Player's... | normal | {
"blob_id": "5b860144a592505fea3a8849f5f5429a39ab9053",
"index": 7299,
"step-1": "<mask token>\n\n\nclass PlayerHand:\n <mask token>\n\n def __init__(self, concealed, exposed=None, initial_update=True):\n if isinstance(concealed, str):\n concealed = tiles.tiles(concealed)\n if isin... | [
18,
19,
21,
23,
25
] |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 30 22:01:06 2016
@author: George
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 24 23:22:16 2016
@author: George
"""
import os
import clr
import numpy as np
clr.AddReference(os.getcwd() + "\\libs\\MyMediaLite\\MyMediaLite.dll")
from MyMediaLite import IO, RatingP... | normal | {
"blob_id": "1292b894b75676abec3f97a8854fe406787baf1d",
"index": 7909,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Dec 30 22:01:06 2016\n\n@author: George\n\"\"\"\n\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Dec 24 23:22:16 2016\n\n@author: George\n\"\"\"\n\nimport os\nimport clr\nimport num... | [
0
] |
import http.cookies
import json
import os
import itertools
import types
from framework import helpers
from framework import security
class Model:
"""Manages the information received by the client"""
def __init__(self):
"""Puth the os.environ dict into the namespace"""
self.__dict__.update(
... | normal | {
"blob_id": "7f21ab8d332d169226ef17276abbdd373e3a62c2",
"index": 8544,
"step-1": "<mask token>\n\n\nclass Model:\n <mask token>\n <mask token>\n\n @property\n def form(self):\n \"\"\"Contains the data send from the client.\"\"\"\n return security.get_field_storage()\n\n @property\n ... | [
7,
8,
9,
10,
11
] |
student = []
while True:
name = str(input('Name: ')).capitalize().strip()
grade1 = float(input('Grade 1: '))
grade2 = float(input('Grade 2: '))
avgrade = (grade1 + grade2) / 2
student.append([name, [grade1, grade2], avgrade])
resp = ' '
while resp not in 'NnYy':
resp = str(input('Ano... | normal | {
"blob_id": "74028a7b317c02c90603ad24c1ddb35a1d5d0e9d",
"index": 8678,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n name = str(input('Name: ')).capitalize().strip()\n grade1 = float(input('Grade 1: '))\n grade2 = float(input('Grade 2: '))\n avgrade = (grade1 + grade2) / 2\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class course_form(report_sxw.rml_parse):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def _get_course(self, data):
training_category_obj = self.pool.get('hr.training.category')
training_category_id = data['training_category_id']
training_c... | flexible | {
"blob_id": "c4fcca61e560046c77046079fb305be8c883653b",
"index": 2077,
"step-1": "<mask token>\n\n\nclass course_form(report_sxw.rml_parse):\n <mask token>\n <mask token>\n\n def _get_course(self, data):\n training_category_obj = self.pool.get('hr.training.category')\n training_category_id... | [
4,
6,
7,
8,
9
] |
# -*- coding: utf-8 -*-
"""
===================================
Demo of DBSCAN clustering algorithm
===================================
Finds core samples of high density and expands clusters from them.
"""
import scipy as sp
import numpy as np
from scipy import spatial
print(__doc__)
from sklearn.cluster import D... | normal | {
"blob_id": "d2e3ac490ce5fdc20976567fa320a9e6a53cbe34",
"index": 1037,
"step-1": "<mask token>\n\n\ndef getDistanceByHaversine(loc1, loc2):\n \"\"\"Haversine formula - give coordinates as a 2D numpy array of\n (lat_denter link description hereecimal,lon_decimal) pairs\"\"\"\n lat1 = loc1[1]\n lon1 = ... | [
1,
2,
3,
4,
5
] |
from pyramid.view import view_config, view_defaults
from ecoreleve_server.core.base_view import CRUDCommonView
from .individual_resource import IndividualResource, IndividualsResource, IndividualLocationsResource
@view_defaults(context=IndividualResource)
class IndividualView(CRUDCommonView):
@view_config(name='... | normal | {
"blob_id": "a3cfd507e30cf232f351fbc66d347aaca99a0447",
"index": 4059,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@view_defaults(context=IndividualResource)\nclass IndividualView(CRUDCommonView):\n <mask token>\n",
"step-3": "<mask token>\n\n\n@view_defaults(context=IndividualResource)\nclas... | [
0,
1,
2,
3
] |
# Copyright 2021 Yegor Bitensky
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | normal | {
"blob_id": "5750fd4b59f75ea63b4214ee66b23602ed4d314d",
"index": 8909,
"step-1": "<mask token>\n\n\nclass DiceWrongFacesItemsTypeError(Exception):\n\n def __init__(self):\n super().__init__('Dice \"faces_items\" argsument need to be iterable.')\n\n\nclass DiceWrongFacesItemsCountError(Exception):\n\n ... | [
6,
7,
9,
12,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
setup(console=['pyscript.py'])
<|reserved_special_token_1|>
from distutils.core import setup
import py2exe
setup(console=['pyscript.py'])
<|reserved_special_token_1|>
# code below
#taking filename as pyscript.py
from dis... | flexible | {
"blob_id": "9fbf994cb99369ba0c20383007ce52c99248bacf",
"index": 8820,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(console=['pyscript.py'])\n",
"step-3": "from distutils.core import setup\nimport py2exe\nsetup(console=['pyscript.py'])\n",
"step-4": "\n# code below \n#taking filename as pyscr... | [
0,
1,
2,
3
] |
import os
import cv2
import numpy as np
import torch
import torch.utils.data
import torchvision
from torchvision import transforms
from utils.utils import loadYaml
from .base_datalayer import BaseDataLayer
import albumentations as albu
class Datalayer(BaseDataLayer):
def __init__(self, config, augmentation=None,... | normal | {
"blob_id": "9928eaa32468453f405d8bb650f3e0e85a7933bf",
"index": 5514,
"step-1": "<mask token>\n\n\nclass Datalayer(BaseDataLayer):\n <mask token>\n <mask token>\n\n def __getitem__(self, item):\n if np.random.random() > 0.5 and len(self.bg_masks_path) > 0:\n random_id_bg = np.random.r... | [
2,
3,
4,
5,
6
] |
print("""Hello world""")
print("Hello again")
print('Hello again') | normal | {
"blob_id": "fe82a46a7965b27729ff5bd61c1059416c96cae7",
"index": 8015,
"step-1": "<mask token>\n",
"step-2": "print('Hello world')\nprint('Hello again')\nprint('Hello again')\n",
"step-3": "print(\"\"\"Hello world\"\"\")\nprint(\"Hello again\")\nprint('Hello again')",
"step-4": null,
"step-5": null,
"s... | [
0,
1,
2
] |
def printall(s):
for i in s:
print i
n=str(raw_input("Enter Word:- "))
printall(n)
| normal | {
"blob_id": "de77fa677b3b200a41083e609d4da697f9e77f21",
"index": 8726,
"step-1": "def printall(s):\r\n for i in s:\r\n print i\r\n\r\nn=str(raw_input(\"Enter Word:- \"))\r\nprintall(n)\r\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
import os
from celery import Celery
import django
from django.conf import settings
from django.apps import apps
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'nightcrawler.settings')
#celery_app = Celery('nightcrawler.tasks.keep_it', broker=settings.CELERY_BROKER_URL)
celery_app = Celery('nightcrawler', broker=sett... | normal | {
"blob_id": "d4bc6bfe6bef730273db38f3c99352bbc3f48a5f",
"index": 7604,
"step-1": "<mask token>\n\n\n@celery_app.task(bind=True)\ndef debug_task(self):\n print('Request: {0!r}'.format(self.request))\n",
"step-2": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'nightcrawler.settings')\n<mask t... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def index(request):
return render(request, 'sau5081/sau5081.html')
<|reserved_special_token_1|>
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return render(request, 'sa... | flexible | {
"blob_id": "ac1ac80739bed0cebf7a89a7d55e1b4fa6c68cdf",
"index": 3428,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n return render(request, 'sau5081/sau5081.html')\n",
"step-3": "from django.shortcuts import render\nfrom django.http import HttpResponse\n\n\ndef index(reque... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Original sequence: ', sequence, '\n')
<|reserved_special_token_0|>
print('Amino Sequence: ')
while n < seqlength:
codon = sequence[n:n + 3]
for amino in aminotable:
for i in range(len(amino) - 1):
... | flexible | {
"blob_id": "d5a31e53444e2efa2eb972f1152b6d3e37d5ab79",
"index": 5321,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Original sequence: ', sequence, '\\n')\n<mask token>\nprint('Amino Sequence: ')\nwhile n < seqlength:\n codon = sequence[n:n + 3]\n for amino in aminotable:\n for i in... | [
0,
1,
2,
3
] |
"""
Batch viewset
Viewset to batch serializer
"""
# Django Rest Framework
from rest_framework import viewsets
# Inventory models
from apps.inventory.models import Batch
# Inventory serializers
from apps.inventory.serializers import BatchSerializer
class BatchViewSet(viewsets.ModelViewSet):
"""
Batch views... | normal | {
"blob_id": "3d0fe0c11e62a03b4701efb19e1c15272ccc985e",
"index": 3315,
"step-1": "<mask token>\n\n\nclass BatchViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n\n def perform_destroy(self, instance):\n \"\"\"\n perform_destroy is used to performance a logic ... | [
2,
3,
4,
5,
6
] |
import logging
from subprocess import Popen, PIPE
from .exceptions import VideoEncodingError, WrongVideoTypeError
# TODO: Create a switchable encoding engine.
logger = logging.getLogger('video.encoding')
cmd_ffmpeg = [
'ffmpeg',
'-i',
]
cmd_mp4 = [
'-vf', 'scale=640:360',
'-vcodec', 'h264',
'-a... | normal | {
"blob_id": "163475bbe8a5b6eb161e2bb7e9b9a9a3ea0879d2",
"index": 8138,
"step-1": "<mask token>\n\n\ndef encode_video_file(src_filname, dst_filename, file_type):\n logger.info('Source file: %s, Destination file: %s, File Type: %s',\n src_filname, dst_filename, file_type)\n try:\n cmd = codecs[... | [
1,
2,
3,
4,
5
] |
# vim:sw=4 ts=4 et:
# Copyright (c) 2015 Torchbox Ltd.
# tomasz.knapik@torchbox.com 2017-12-07
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely. This software is provided 'as-is', without any express or implied
# ... | normal | {
"blob_id": "6f271e6cfb03977d52c50562c3c394b962c9af83",
"index": 7538,
"step-1": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n\n def __init__(self, required=True, help_text=None, **kwargs):\n s... | [
1,
3,
4,
5,
6
] |
from yama.record import Record
class MongoStorage(object):
_collection = None
_connection = None
_root_id = None
_roots = None
def __init__(self, connection):
self._connection = connection
self._collection = connection.objects
self._roots = connection.roots
root_do... | normal | {
"blob_id": "816c11717c4f26b9013f7a83e1dfb2c0578cbcf8",
"index": 1269,
"step-1": "<mask token>\n\n\nclass MongoStorage(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, connection):\n self._connection = connection\n self._collection = connect... | [
7,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class IndexPage:
def login(self, username, password):
BasePage.open_url(self, self.base_url)
BasePage.send_key(self, 'css', '#username', username)
BasePage.send_key(self, 'css', '#password', password... | flexible | {
"blob_id": "463f50567c9dd4b7b47a84eea715541cec5d3cb5",
"index": 2110,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass IndexPage:\n\n def login(self, username, password):\n BasePage.open_url(self, self.base_url)\n BasePage.send_key(self, 'css', '#username', username)\n Ba... | [
0,
2,
3,
4,
5
] |
#Script to extract features from chess score data file stockfish.csv
import numpy as np
import pandas as pd
#Load in and format raw chess game scoring data
raw_scores = [line.strip().split(",")[1].split() for line in open("stockfish.csv")][1:]
#Initialize containers for features to extract
game_length = []
average_sc... | normal | {
"blob_id": "ad9bb34fdb05ab885f4871693729449f3618603a",
"index": 8321,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor game in raw_scores:\n game_len = len(game) + 1\n total = 0\n prev = None\n player = 1\n max_so_far = -100\n min_so_far = 100\n max_drop = 0\n max_gain = 0\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [m... | flexible | {
"blob_id": "c6c13ab24e4907eecf1db4fded28d4fc8126c834",
"index": 1170,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@app.route('/etude')
def etude():
return render_template('etude.html', titre=
'Portfolio Ludovic DELSOL - Etude')
@app.route('/experience')
def experience():
return render_template('experience.html', titre=
'Portfolio Ludovic DELSOL - Experiences Pros')
@app.ro... | flexible | {
"blob_id": "c7037b6a576374f211580b304f8447349bbbbea3",
"index": 9583,
"step-1": "<mask token>\n\n\n@app.route('/etude')\ndef etude():\n return render_template('etude.html', titre=\n 'Portfolio Ludovic DELSOL - Etude')\n\n\n@app.route('/experience')\ndef experience():\n return render_template('exper... | [
4,
6,
7,
8,
9
] |
import collections
import numpy
import pytest
import random
import conftest
from svviz2.io import readstatistics
from svviz2.remap import genotyping
from svviz2.utility.intervals import Locus
def get_read_stats(isize=400):
stats = readstatistics.ReadStatistics(None)
stats.insertSizes = numpy.random.normal(400... | normal | {
"blob_id": "97a362fc65731bb8fc3743c49a669b4cd3f0e155",
"index": 9426,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_read_stats(isize=400):\n stats = readstatistics.ReadStatistics(None)\n stats.insertSizes = numpy.random.normal(400, 20, 2000).astype(int)\n stats.orientations = ['+-'... | [
0,
1,
2,
3,
4
] |
class boxCar:
def __init__(self, *args, **kwargs):
print("print the keyword arguments dictionary {0} by {1}".format(kwargs, "WANGH"))
self.name = kwargs["name"]
self.domains = ["BODY","PWT","INFO","ADAS","INF"]
self.configuration = {}
def addEcu(self, ecu, domain):
i... | normal | {
"blob_id": "c3fae13b488a717419adb8292597746a383b332c",
"index": 7547,
"step-1": "class boxCar:\n\n def __init__(self, *args, **kwargs):\n print('print the keyword arguments dictionary {0} by {1}'.format(\n kwargs, 'WANGH'))\n self.name = kwargs['name']\n self.domains = ['BODY'... | [
4,
6,
7,
8,
9
] |
class car:
def info(self):
print(self.speed, self.color, self.model)
def increment(self):
print('increment')
def decrement(self):
print('decrement')
BMW = car()
BMW.speed = 320
BMW.color = 'red'
BMW.model = 1982
BMW.info()
Camry = car()
Camry.speed = 220
Camry.color = 'blue'
| normal | {
"blob_id": "022f588455d8624d0b0107180417f65816254cb1",
"index": 8687,
"step-1": "class car:\n\n def info(self):\n print(self.speed, self.color, self.model)\n\n def increment(self):\n print('increment')\n <mask token>\n\n\n<mask token>\n",
"step-2": "class car:\n\n def info(self):\n ... | [
3,
4,
5,
6
] |
import sys
def input(_type=str):
return _type(sys.stdin.readline().strip())
def main():
N, K, D = map(int, input().split())
rules = [tuple(map(int, input().split())) for _ in range(K)]
minv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules])
while minv + 1 < maxv:
midv = (minv + maxv)//2
cnt, max_... | normal | {
"blob_id": "f0b98a3d6015d57a49e315ac984cac1cccf0b382",
"index": 6084,
"step-1": "<mask token>\n\n\ndef main():\n N, K, D = map(int, input().split())\n rules = [tuple(map(int, input().split())) for _ in range(K)]\n minv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules])\n while minv + 1 <... | [
1,
2,
3,
4,
5
] |
import datastructure
import wordUri
class Question:
def __init__(self, nlp, otter, nounArray, verbArray):
self.nlp = nlp
self.nounArray = nounArray
self.verbArray = verbArray
self.file = otter
def findFirst(self, sentence):
sentenceDoc = self.nlp(sentence)
for... | normal | {
"blob_id": "4d63a5f09164b78faa731af6dce41969edc2c4f5",
"index": 848,
"step-1": "<mask token>\n\n\nclass Question:\n <mask token>\n <mask token>\n\n def findSecond(self, sentenceDoc, verb, children):\n for child in children:\n if child.dep_ == 'attr' or child.dep_ == 'nsubj':\n ... | [
3,
4,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(0, 10):
lista.append(int(input()))
while z < j:
c = lista[z]
lista[z] = lista[j]
lista[j] = c
z += 1
j -= 1
print(lista)
<|reserved_special_token_1|>
lista = []
z = 0
j = 9
for i in range(... | flexible | {
"blob_id": "01ede703e36268dc9b3331b21726c24674a43817",
"index": 1338,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(0, 10):\n lista.append(int(input()))\nwhile z < j:\n c = lista[z]\n lista[z] = lista[j]\n lista[j] = c\n z += 1\n j -= 1\nprint(lista)\n",
"step-3": "li... | [
0,
1,
2
] |
print('test 123123')
| normal | {
"blob_id": "c6d8b9faa610e817c449eee94d73c61cb62fa272",
"index": 8878,
"step-1": "<mask token>\n",
"step-2": "print('test 123123')\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
def possibleNumber(digitSet, n):
res = [[]]
pools = [digitSet] * n
for pool in pools:
res = [(x + [y]) for x in res for y in pool]
for prod in res:
yield prod
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def ... | flexible | {
"blob_id": "fcc6dd61b94d5fa7f088fc75b748d976d1b30fa5",
"index": 1781,
"step-1": "<mask token>\n\n\ndef possibleNumber(digitSet, n):\n res = [[]]\n pools = [digitSet] * n\n for pool in pools:\n res = [(x + [y]) for x in res for y in pool]\n for prod in res:\n yield prod\n\n\n<mask token... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class SyslogSeverity(TextualConvention, Integer32):
reference = 'The Syslog Protocol (RFC5424): Table 2'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(
SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))
namedValues = NamedValues(('emerg', 0)... | flexible | {
"blob_id": "46cdea08cab620ea099ad7fa200782717249b91b",
"index": 6741,
"step-1": "<mask token>\n\n\nclass SyslogSeverity(TextualConvention, Integer32):\n reference = 'The Syslog Protocol (RFC5424): Table 2'\n status = 'current'\n subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(\n SingleVal... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
ret = ListNo... | flexible | {
"blob_id": "80f681eb99d1e3f64cacd23ce0a4b10a74a79fe8",
"index": 4223,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNode\n :type l2: ListNode\n :rtype:... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def printIntro():
print('This program evaluates pi via Monte Carlo techniques')
<|reserved_special_token_0|>
def getDarts():
x = 2 * random() - 1
y = 2 * random() - 1
pt = Point(x, y)
return pt
def hitTarget(pt):
x = pt.getX()
y = pt.getY()
if x ** 2 ... | flexible | {
"blob_id": "0bf970a84911d29a8343575ef15f2765875b8b89",
"index": 9552,
"step-1": "<mask token>\n\n\ndef printIntro():\n print('This program evaluates pi via Monte Carlo techniques')\n\n\n<mask token>\n\n\ndef getDarts():\n x = 2 * random() - 1\n y = 2 * random() - 1\n pt = Point(x, y)\n return pt\... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('input.txt', 'r') as file:
for line in file:
nums.append(int(line))
<|reserved_special_token_0|>
for ini in nums:
target = 2020 - ini
for chk in nums:
if chk == target:
product = i... | flexible | {
"blob_id": "38504dae7b010c2df8c16b752c2179b6b3561c0e",
"index": 7770,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('input.txt', 'r') as file:\n for line in file:\n nums.append(int(line))\n<mask token>\nfor ini in nums:\n target = 2020 - ini\n for chk in nums:\n if chk ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def test_normalize():
model = gpmodel.GPRegressor(kernel)
m, s, normed = model._normalize(Y)
assert np.isclose(m, Y.mean())
assert np.isclose(s, Y.std())
assert np.allclose(normed, (Y - m) / s)
model.std = s
model.mean = m
assert np.allclose(Y, model.unnorm... | flexible | {
"blob_id": "62c28b5eb31b90191dfbab4456fc5373ba51bf64",
"index": 8869,
"step-1": "<mask token>\n\n\ndef test_normalize():\n model = gpmodel.GPRegressor(kernel)\n m, s, normed = model._normalize(Y)\n assert np.isclose(m, Y.mean())\n assert np.isclose(s, Y.std())\n assert np.allclose(normed, (Y - m)... | [
6,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
def plot_temperatures_by_country(values, country, start, end):
"""
Returns a plot for temperature values for a country
from a start point to an end point
"""
filtered = values.loc[(values['Country'] == country) & (values['dt'] >=
start) & (values['dt'] <= end)]... | flexible | {
"blob_id": "2b579c3def4c2d02d365f019518e8e0b25664460",
"index": 7436,
"step-1": "<mask token>\n\n\ndef plot_temperatures_by_country(values, country, start, end):\n \"\"\"\n Returns a plot for temperature values for a country\n from a start point to an end point\n \"\"\"\n filtered = values.loc[(v... | [
7,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while n > 0:
rev = n % 10
sum += rev ** 3
n = n // 10
if cp == sum:
print('the given no is amstrong ')
else:
print('the given no is not amstrong ')
<|reserved_special_token_1|>
n = int(input('enter a number'... | flexible | {
"blob_id": "a8190c7c8926df18ee9439922ce8e3241e9a6140",
"index": 4550,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile n > 0:\n rev = n % 10\n sum += rev ** 3\n n = n // 10\nif cp == sum:\n print('the given no is amstrong ')\nelse:\n print('the given no is not amstrong ')\n",
"step-... | [
0,
1,
2,
3
] |
num1 = 101
num2 = 20
add = num1 + num2
sub = num1 - num2
mul = num1 * num2
div = num1 / num2
mod = num1 % num2
exp = num1 ** num2
fd = num1 // num2
print(num1)
print(num2)
print(add)
print(sub)
print(mul)
print(div)
print(mod)
print(exp)
print(fd)
| normal | {
"blob_id": "3ffbef142d8fb53b734567ebea874f9c59ff9a9e",
"index": 1455,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(num1)\nprint(num2)\nprint(add)\nprint(sub)\nprint(mul)\nprint(div)\nprint(mod)\nprint(exp)\nprint(fd)\n",
"step-3": "num1 = 101\nnum2 = 20\nadd = num1 + num2\nsub = num1 - num2\nm... | [
0,
1,
2
] |
__author__ = 'zhaobin022'
class Cmd(object):
pass
| normal | {
"blob_id": "0eca1693caffcd9fe32a8a54ca3a33687763e5ce",
"index": 6809,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Cmd(object):\n pass\n",
"step-3": "__author__ = 'zhaobin022'\n\n\nclass Cmd(object):\n pass\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def bfs(graph, start):
result = []
queue = []
seen = set()
queue.append(start)
seen.add(start)
while len(queue):
vertex = queue.pop(0)
nodes = graph[vertex]
for node in nodes:
if node not in seen:
queue.append(nod... | flexible | {
"blob_id": "371762a6e3f8b8ed14742a70a709da224ae6712b",
"index": 305,
"step-1": "<mask token>\n\n\ndef bfs(graph, start):\n result = []\n queue = []\n seen = set()\n queue.append(start)\n seen.add(start)\n while len(queue):\n vertex = queue.pop(0)\n nodes = graph[vertex]\n ... | [
1,
2,
3,
4,
5
] |
import urllib.request, urllib.parse, urllib.error
from urllib.request import urlopen
import xml.etree.ElementTree as ET
import ssl
# # Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter a URL: ')
# if len(url) < 1 : url = 'ht... | normal | {
"blob_id": "3b8c4f19e28e54e651862ec9b88b091c9faff02b",
"index": 9525,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(url) < 1:\n url = 'http://py4e-data.dr-chuck.net/comments_70857.xml'\n<mask token>\nprint(len(xml))\n<mask token>\nprint('Comment count:', len(lst))\n<mask token>\nfor item in l... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
REGION_LIST = ['Центральный', 'Северо-Западный', 'Южный',
'Северо-Кавказский', 'Приволжский', 'Уральский', 'Сибирский',
'Дальневосточный']
CITY_LIST = {'Абакан': 7, 'Альметьевск': 5, 'Ангарск': 7, 'Архангельск': 2,
'Астрахань': 3, 'Барнаул': 7, 'Б... | flexible | {
"blob_id": "2101299d6f6bfcd4726591fc256317968373ca1f",
"index": 3071,
"step-1": "<mask token>\n",
"step-2": "REGION_LIST = ['Центральный', 'Северо-Западный', 'Южный',\n 'Северо-Кавказский', 'Приволжский', 'Уральский', 'Сибирский',\n 'Дальневосточный']\nCITY_LIST = {'Абакан': 7, 'Альметьевск': 5, 'Ангарс... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Leveling:
<|reserved_special_token_0|>
sid: int
channelID: int
message: str
noxpchannelIDs: list[int]
noxproleID: int
remove: bool
roles: list[list]
<|reserved_special_token_0|>
@property
def channel(self) ->discord.TextChannel:
g... | flexible | {
"blob_id": "346df9706dc222f43a77928964cd54e7d999a585",
"index": 8052,
"step-1": "<mask token>\n\n\nclass Leveling:\n <mask token>\n sid: int\n channelID: int\n message: str\n noxpchannelIDs: list[int]\n noxproleID: int\n remove: bool\n roles: list[list]\n <mask token>\n\n @property... | [
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class TestConfiglet(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def test_default_config(self):
""" Validate the default values
"""
registry = getUtility(IRegistry)
settings = registry.forInterface(IImageWatchDo... | flexible | {
"blob_id": "ce5f91aa04065aac4d4bc7bdbaab3b74c5a85a93",
"index": 8752,
"step-1": "<mask token>\n\n\nclass TestConfiglet(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_default_config(self):\n \"\"\" Validate the default values\n \"\"\"\n registry = getUtility(IRegistr... | [
4,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@stb.type
class Query:
@stb.field
async def ReadUser(self, info, username: str):
ses = await get_session()
fields = info.field_nodes[0].selection_set.selections[0]
return await cruduser.get_user(... | flexible | {
"blob_id": "0992297ffc19b1bc4dc3d5e8a75307009c837032",
"index": 5134,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@stb.type\nclass Query:\n\n @stb.field\n async def ReadUser(self, info, username: str):\n ses = await get_session()\n fields = info.field_nodes[0].selection_set.se... | [
0,
1,
2
] |
import sys
from PyQt4 import QtGui,QtCore
class Button(QtGui.QPushButton):
def __init__(self,*__args):
super().__init__(*__args)
self.setAcceptDrops(True) # 设置可以接受拖入事件
def dragEnterEvent(self, e):
"设置接受的类型"
#判断拖动的数据类型是否是:text/plain # 这两个一组表示一个类型
#查询方法是:e.mimeData().form... | normal | {
"blob_id": "e4b0dc2e3d9310bbe462e746e21080d309dfed84",
"index": 9640,
"step-1": "<mask token>\n\n\nclass Button(QtGui.QPushButton):\n\n def __init__(self, *__args):\n super().__init__(*__args)\n self.setAcceptDrops(True)\n\n def dragEnterEvent(self, e):\n \"\"\"设置接受的类型\"\"\"\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def import_handlers():
from deezer import handlers, callback_handlers
from spotify import handlers, integration, callback_handlers
from vk import handlers, callback_handlers
from soundcloud import handlers, callback_handlers
import handlers
import inline_handlers
... | flexible | {
"blob_id": "d957fd5fbcdcf2e549323677185eabb8a50536c6",
"index": 5716,
"step-1": "<mask token>\n\n\ndef import_handlers():\n from deezer import handlers, callback_handlers\n from spotify import handlers, integration, callback_handlers\n from vk import handlers, callback_handlers\n from soundcloud imp... | [
1,
2,
3,
4,
5
] |
import time
from junk.keyboard_non_blocking import NonBlockingKeyboard
TICK_DURATION = 0.05
INITIAL_FOOD_LEVEL = 100
FOOD_PER_TICK = -1
FOOD_PER_FEED = 10
MAX_FOOD_LEVEL = 100
INITIAL_ENERGY_LEVEL = 50
ENERGY_PER_TICK_AWAKE = -1
ENERGY_PER_TICK_ASLEEP = 5
MAX_ENERGY_LEVEL = 100
INITIAL_IS_AWAKE = False
INITIAL_PO... | normal | {
"blob_id": "1dd09a09f542099091d94d466ebd7cc149884eb4",
"index": 7385,
"step-1": "<mask token>\n\n\nclass UnknownCommand(Exception):\n pass\n\n\n<mask token>\n\n\nclass Tamagotchi:\n\n def __init__(self) ->None:\n self._age = 0\n self._food_level = INITIAL_FOOD_LEVEL\n self._energy_lev... | [
10,
11,
12,
13,
16
] |
# -*- coding: utf-8 -*-
"""overview.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/examples/style_transfer/overview.ipynb
##### Copyright 2019 The TensorFlow Authors.
"""
#@tit... | normal | {
"blob_id": "36ce0de4cb760632959392a9f982532436bd37b0",
"index": 7272,
"step-1": "<mask token>\n\n\ndef load_img(path_to_img):\n img = tf.io.read_file(path_to_img)\n img = tf.io.decode_image(img, channels=3)\n img = tf.image.convert_image_dtype(img, tf.float32)\n img = img[tf.newaxis, :]\n return ... | [
4,
5,
7,
8,
9
] |
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[... | normal | {
"blob_id": "7dd5ac1110f38c40f2fddf9d7175a5ac40303d73",
"index": 5796,
"step-1": "# Definition for an interval.\n# class Interval(object):\n# def __init__(self, s=0, e=0):\n# self.start = s\n# self.end = e\n\nclass Solution(object):\n def insert(self, intervals, newInterval):\n \"\"... | [
0
] |
#write a program that displays the wor "Hello!"
print("Hello!")
| normal | {
"blob_id": "b7a7941b3555b30ac7e743a5457df76f9eb7cb15",
"index": 9714,
"step-1": "<mask token>\n",
"step-2": "print('Hello!')\n",
"step-3": "#write a program that displays the wor \"Hello!\"\n\nprint(\"Hello!\")\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# Copyright 2014 The crabapple Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import abc
class Notifier(object):
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def config(self, kwa... | normal | {
"blob_id": "f25351a3cb7bf583152baa8e7ec47b0f2161cb9c",
"index": 761,
"step-1": "<mask token>\n\n\nclass Notifier(object):\n <mask token>\n\n def __init__(self):\n pass\n <mask token>\n\n @abc.abstractmethod\n def send(self, msg):\n pass\n",
"step-2": "<mask token>\n\n\nclass Notif... | [
3,
4,
5,
6,
7
] |
import configure
import connectify
import userlog
import dirlog
import time
def getUser(sock):
try:
userinfo = userlog.getInfo()
except:
userinfo = configure.init(sock)
userinfo = userinfo.split('^')[0]
# print userinfo
return userinfo
if __name__=="__main__":
sock = connectify.createCon()
userinfo = get... | normal | {
"blob_id": "2ca1b603b18316bc1d970b5e32389e10e4b532e2",
"index": 1071,
"step-1": "import configure\nimport connectify\nimport userlog\nimport dirlog\nimport time\n\n\ndef getUser(sock):\n\ttry:\n\t\tuserinfo = userlog.getInfo()\n\texcept:\t\n\t\tuserinfo = configure.init(sock)\n\tuserinfo = userinfo.split('^')[0... | [
0
] |
import torch
from torchvision import transforms
from torch.autograd import Variable
class NormalizeImageDict(object):
"""
Normalize image in dictionary
normalize range is True, the image is divided by 255
"""
def __init__(self, image_keys, normalizeRange=True):
self.image_keys = image_key... | normal | {
"blob_id": "4293ad0b2a4a352d6bdc4b860448c4a3b14ca629",
"index": 8648,
"step-1": "<mask token>\n\n\nclass NormalizeImageDict(object):\n <mask token>\n <mask token>\n\n def __call__(self, sample):\n for key in self.image_keys:\n if self.normalizeRange:\n sample[key] /= 25... | [
2,
3,
4,
5
] |
auto_duration_sec = 15
teleop_duration_sec = 135
| normal | {
"blob_id": "5229002103379ff10969e64289d5a0f36641c0a3",
"index": 3497,
"step-1": "<mask token>\n",
"step-2": "auto_duration_sec = 15\nteleop_duration_sec = 135\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import sys, os
sys.path.insert(0, os.path.abspath("adjust_schedule_function"))
| normal | {
"blob_id": "19126e5041841ab1320730ae82d66c6900cf31bd",
"index": 9145,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsys.path.insert(0, os.path.abspath('adjust_schedule_function'))\n",
"step-3": "import sys, os\nsys.path.insert(0, os.path.abspath('adjust_schedule_function'))\n",
"step-4": "import sy... | [
0,
1,
2,
3
] |
import pandas as pd
from pandas.io.json import json_normalize
import numpy as np
import warnings
import re
warnings.filterwarnings("ignore")
data_path = '/Users/trietnguyen/Documents/Thesis/Thesis-2020/References/Crawler/summaryDataJson.json'
weights = ['mg', 'ml', '%']
def formatName(name):
arr = re.split(' |-'... | normal | {
"blob_id": "b808daf8d1fbe3cc585db57e1049a502d3ca46f5",
"index": 857,
"step-1": "<mask token>\n\n\ndef formatName(name):\n arr = re.split(' |-', name)\n print(arr)\n gweight = ''\n gname = []\n gnumber = ''\n for word in arr:\n if any(str.isdigit(c) for c in word):\n for weigh... | [
5,
6,
7,
8,
9
] |
#!/usr/bin/python
#Title: ActFax 4.31 Local Privilege Escalation Exploit
#Author: Craig Freyman (@cd1zz)
#Discovered: July 10, 2012
#Vendor Notified: June 12, 2012
#Description: http://www.pwnag3.com/2012/08/actfax-local-privilege-escalation.html
#msfpayload windows/exec CMD=cmd.exe R | msfencode -e x86/alpha_u... | normal | {
"blob_id": "1b7048ef17b3512b9944ce7e197db27f4fd1aed0",
"index": 1687,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nf.write(\n 'User Name\\tEntire User Name\\tPassword\\tAlias-Names\\tGroup\\tDirect Dialing\\tCost Account\\tPermissions\\tComments\\tUser-Defined\\tPredefined Settings\\tName 1\\tName ... | [
0,
1,
2,
3
] |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | normal | {
"blob_id": "9fa1dab7cb0debf363ae0864af1407c87aad063a",
"index": 4926,
"step-1": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n\n def test_compare_multiple(s... | [
1,
2,
4,
5,
6
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('home_application', '0019_auto_20170809_1810'),
]
operations = [
migrations.CreateModel(
... | normal | {
"blob_id": "a1db566f4da16e7725212aeab29e946ef7c1672e",
"index": 5610,
"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 = [('home_applic... | [
0,
1,
2,
3,
4
] |
class Solution:
def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:
h = len(matrix)
w = len(matrix[0])
for curRow in range(h) :
val = matrix[curRow][0]
i = 0
while i < h-curRow and i < w :
# print(curRow+i,i)
if mat... | normal | {
"blob_id": "774f5d01cd274755626989c2b58bde68df349d8e",
"index": 5845,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def isToeplitzMatrix(self, matrix: List[List[int]]) ->bool:\n h = len(matrix)\n w = len(matrix[0])\n for c... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class SquareNormal(super_environment.Environment):
<|reserved_special_token_0|>
@staticmethod
def environment_type():
return 'square'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class SquareNormal(super_environment.E... | flexible | {
"blob_id": "919f1746bfdec61f5e81e6ce0e17bb3bf040230a",
"index": 2958,
"step-1": "<mask token>\n\n\nclass SquareNormal(super_environment.Environment):\n <mask token>\n\n @staticmethod\n def environment_type():\n return 'square'\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass SquareNorm... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def math_builtins():
assert abs(-123) == 123
assert abs(-123.456) == 123.456
assert abs(2 + 3.0j) == math.sqrt(2 ** 2 + 3 ** 2)
assert divmod(5, 2) == (2, 1)
assert max(1, 2, 3, 4) == 4
assert min(1, 2, 3, 4) == 1
a = 2
b = 3
c = 7
assert pow(a, b) ... | flexible | {
"blob_id": "c77db71844c65eb96946ac0cc384de43ad49ca99",
"index": 6007,
"step-1": "<mask token>\n\n\ndef math_builtins():\n assert abs(-123) == 123\n assert abs(-123.456) == 123.456\n assert abs(2 + 3.0j) == math.sqrt(2 ** 2 + 3 ** 2)\n assert divmod(5, 2) == (2, 1)\n assert max(1, 2, 3, 4) == 4\n ... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# Author:sen
# Date:2020/4/2 14:15
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def find(root, val):
if not root:
return None
if val < root.val:
return find(root.left, val)
elif val > root.va... | normal | {
"blob_id": "9e525eccbf10a710d6f37c903370cc10f7d2c62b",
"index": 8475,
"step-1": "class TreeNode:\n <mask token>\n\n\n<mask token>\n",
"step-2": "class TreeNode:\n\n def __init__(self, val):\n self.val = val\n self.left = None\n self.right = None\n\n\ndef find(root, val):\n if not... | [
1,
6,
7,
9,
10
] |
class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
<|reserved_special_token_0|>
@staticmethod
def makelist(values):
node = None
for i in range(len(values) - 1, -1, -1):
node = Node(values[i], node)
return node
<|r... | flexible | {
"blob_id": "599310cfd05be28445535bc72251128ed72a9069",
"index": 4372,
"step-1": "class Node:\n\n def __init__(self, value, next=None):\n self.value = value\n self.next = next\n <mask token>\n\n @staticmethod\n def makelist(values):\n node = None\n for i in range(len(value... | [
3,
4,
6,
7
] |
"""
Tests of neo.io.exampleio
"""
import pathlib
import unittest
from neo.io.exampleio import ExampleIO # , HAVE_SCIPY
from neo.test.iotest.common_io_test import BaseTestIO
from neo.test.iotest.tools import get_test_file_full_path
from neo.io.proxyobjects import (AnalogSignalProxy,
SpikeTrainProxy, E... | normal | {
"blob_id": "e51c0d8c6430603d989d55a64fdf77f9e1a2397b",
"index": 1081,
"step-1": "<mask token>\n\n\nclass TestExampleIO(BaseTestIO, unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def tearDown(self) ->None:\n super().tearDown()\n for entity in self... | [
6,
7,
8,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
super_tree.fit(df)
<|reserved_special_token_0|>
visualizer.export('tree')
<|reserved_special_token_0|>
print(input_row[supernode_features + features_list])
print()
<|reserved_special_token_0|>
if result is not None:
segment, s... | flexible | {
"blob_id": "0a42c54ef1412b7f3b8e95da1d65ee05dfa14089",
"index": 9709,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsuper_tree.fit(df)\n<mask token>\nvisualizer.export('tree')\n<mask token>\nprint(input_row[supernode_features + features_list])\nprint()\n<mask token>\nif result is not None:\n segment... | [
0,
1,
2,
3,
4
] |
__all__ = ["loading"]
from . import loading
| normal | {
"blob_id": "f633496f1a7cd562fd41d697a2e26831ceaef479",
"index": 8047,
"step-1": "<mask token>\n",
"step-2": "__all__ = ['loading']\n<mask token>\n",
"step-3": "__all__ = ['loading']\nfrom . import loading\n",
"step-4": "__all__ = [\"loading\"]\n\nfrom . import loading\n",
"step-5": null,
"step-ids": [... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
@pytest.fixture
def register_loginx2_create_invite():
"""
Registers, logs in 2 users, creates new channel
"""
req = urllib.request.Request(f'{BASE_URL}/workspace/reset', headers={
'Content-Type': 'application/json'}, method='POST')
load(urllib.request.urlopen(r... | flexible | {
"blob_id": "c22b37bff74de7ea99f2009652dd00e57bb316b8",
"index": 4383,
"step-1": "<mask token>\n\n\n@pytest.fixture\ndef register_loginx2_create_invite():\n \"\"\"\n Registers, logs in 2 users, creates new channel\n \"\"\"\n req = urllib.request.Request(f'{BASE_URL}/workspace/reset', headers={\n ... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def unique(lisst):
setlisst = set(lisst)
return len(setlisst)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def unique(lisst):
setlisst = set(lisst)
return len(setlisst)
print(unique({4, 5, 1, 1, 3}))
| flexible | {
"blob_id": "42d26ef51bb4dafc8a0201a828652e166a3905e4",
"index": 7339,
"step-1": "<mask token>\n",
"step-2": "def unique(lisst):\n setlisst = set(lisst)\n return len(setlisst)\n\n\n<mask token>\n",
"step-3": "def unique(lisst):\n setlisst = set(lisst)\n return len(setlisst)\n\n\nprint(unique({4, ... | [
0,
1,
2
] |
from django.db import models
from datetime import datetime
# Create your models here.
class Notifications(models.Model):
username= models.CharField(max_length=20)
phone_number= models.BigIntegerField(default= 0)
email= models.EmailField()
firstname= models.CharField(max_length=20)
app_name= models... | normal | {
"blob_id": "51ed99a68486bd52499bbc28e68ff2312e02ea1f",
"index": 6604,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Notifications(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 ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MulActionResource(restful.Resource):
def __init__(self):
self.db = get_connection()
def post(self, type):
args = parser.parse_args()
count = args.get('count')
sids = []
if type == 'extract':
pass
elif type == 'loc... | flexible | {
"blob_id": "44476a32b8ab68820d73955321e57b7d1b608beb",
"index": 6823,
"step-1": "<mask token>\n\n\nclass MulActionResource(restful.Resource):\n\n def __init__(self):\n self.db = get_connection()\n\n def post(self, type):\n args = parser.parse_args()\n count = args.get('count')\n ... | [
3,
4,
5,
6,
7
] |
import configparser
# CONFIG
config = configparser.ConfigParser()
config.read('dwh.cfg')
# DISTRIBUTION SCHEMA
schema = ("""CREATE SCHEMA IF NOT EXISTS public;
SET search_path TO public;""")
# DROP TABLES
staging_events_table_drop = ("DROP TABLE IF EXISTS staging_events;")
staging_songs_table_drop = ... | normal | {
"blob_id": "65b7a14c54cd988185bac54fd8a31330966f8ba9",
"index": 1916,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nconfig.read('dwh.cfg')\n<mask token>\n",
"step-3": "<mask token>\nconfig = configparser.ConfigParser()\nconfig.read('dwh.cfg')\nschema = \"\"\"CREATE SCHEMA IF NOT EXISTS public;\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def find_treasure(grid):
if not len(grid) or not len(grid[0]):
return -1
minimum_steps = math.inf
for i in range(len(grid)):
for j in range(len(grid[i])):
if grid[i][j] == 'S':
minimum_steps = min(minimum_steps, find_treasure_util(gr... | flexible | {
"blob_id": "e6851e86fa86ab2096f059218b2b8a2994642807",
"index": 3717,
"step-1": "<mask token>\n\n\ndef find_treasure(grid):\n if not len(grid) or not len(grid[0]):\n return -1\n minimum_steps = math.inf\n for i in range(len(grid)):\n for j in range(len(grid[i])):\n if grid[i][j... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
'''
Created on 2014/07/24
@author: seigo
'''
from google.appengine.api import users
from google.appengine.ext import webapp
from MyModel import HistoricalTable, PollRating, Government
from datetime import datetime
hts = [["2014/7/1","集団的自衛権行使容認の閣議決定","http://www.47news.jp/47topics/e/254919.ph... | normal | {
"blob_id": "b8957acb71d435a93b4397a24d3b5cf4b2a817f8",
"index": 2602,
"step-1": "<mask token>\n\n\nclass initDATA(webapp.RequestHandler):\n <mask token>\n\n def get(self):\n user = users.get_current_user()\n if user == None:\n self.redirect(users.create_login_url(self.request.uri)... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(
450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |
wx.CLOSE_BOX | wx.CLIP_CHILDREN, title='Assistant')
panel = wx.Pan... | flexible | {
"blob_id": "8f1e6ea93b2dd7add256cb31d2c621aa69721609",
"index": 8834,
"step-1": "<mask token>\n\n\nclass MyFrame(wx.Frame):\n\n def __init__(self):\n wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(\n 450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_stf_3_2_1_neg(fixture):
seed = fixture.common.get_seed()
fixture.stf.open_stf_exercise('3-2-1', seed)
fixture.stf.open_solution_url('test')
assert fixture.stf.get_solution() == Config.test_fail_text
... | flexible | {
"blob_id": "028b38a07c71232eb42bedecd734cf7188550239",
"index": 9602,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_stf_3_2_1_neg(fixture):\n seed = fixture.common.get_seed()\n fixture.stf.open_stf_exercise('3-2-1', seed)\n fixture.stf.open_solution_url('test')\n assert fixture... | [
0,
1,
2,
3,
4
] |
name = 'Ледяная скорбь'
description = 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобно тому, как он разрывает плоть, он разрывает души.'
price = 3000
fightable = True
def fight_use(user, reply, room):
return 200 | normal | {
"blob_id": "7254e74ff3f562613cc610e4816a2d92b6b1cd4c",
"index": 6074,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fight_use(user, reply, room):\n return 200\n",
"step-3": "name = 'Ледяная скорбь'\ndescription = (\n 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобн... | [
0,
1,
2,
3
] |
#encoding:UTF-8
from numpy import *
#----------------------------------------------------------------------
def differences(a, b):
""""""
c = a[a!=b]
d = b[a!=b]
nums = nonzero(a!=b)[0]
return concatenate((mat(nums), c, d)).T | normal | {
"blob_id": "67a76f1f1dad4b7e73359f04ca8f599c8d32dc92",
"index": 2900,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef differences(a, b):\n \"\"\"\"\"\"\n c = a[a != b]\n d = b[a != b]\n nums = nonzero(a != b)[0]\n return concatenate((mat(nums), c, d)).T\n",
"step-3": "from numpy ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
qc_ha.x(0)
qc_ha.x(1)
qc_ha.barrier()
qc_ha.cx(0, 2)
qc_ha.cx(1, 2)
qc_ha.ccx(0, 1, 3)
qc_ha.barrier()
qc_ha.measure(2, 0)
qc_ha.measure(3, 1)
<|reserved_special_token_0|>
plot_histogram(counts)
plt.show()
<|reserved_special_tok... | flexible | {
"blob_id": "02381f28ef20aa0c2c235ef6563e1810a5931e35",
"index": 5556,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nqc_ha.x(0)\nqc_ha.x(1)\nqc_ha.barrier()\nqc_ha.cx(0, 2)\nqc_ha.cx(1, 2)\nqc_ha.ccx(0, 1, 3)\nqc_ha.barrier()\nqc_ha.measure(2, 0)\nqc_ha.measure(3, 1)\n<mask token>\nplot_histogram(counts... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class BaseElementTest(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def test_parse_expressions(self):
xml_attrs = {(constants.XML_NAMESPACE_FLOW_CONTROL, 'if'):
'val == 7', (constants.XML_NAMESPACE_FLOW_CONTROL, 'for'):
'... | flexible | {
"blob_id": "c6b98cf309e2f1a0d279ec8dc728ffd3fe45dfdb",
"index": 4792,
"step-1": "<mask token>\n\n\nclass BaseElementTest(TestCase):\n <mask token>\n <mask token>\n\n def test_parse_expressions(self):\n xml_attrs = {(constants.XML_NAMESPACE_FLOW_CONTROL, 'if'):\n 'val == 7', (constants... | [
5,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def longestCommonPrefix(self, strs: List[str]) ->str:
pass
<|reserved_special_token_1|>
#
# @lc app=leetcode id=14 lang=python3
#
# [14] Longest C... | flexible | {
"blob_id": "401c6b09edf593e00aecf5bbb1b2201effc9e78c",
"index": 7384,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def longestCommonPrefix(self, strs: List[str]) ->str:\n pass\n",
"step-4": "#\n# @lc app=leetcode id=14 lang=python3\n... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "6f9f204cbd6817d5e40f57e71614ad03b64d9003",
"index": 3152,
"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 = [('website', '... | [
0,
1,
2,
3,
4
] |
import math
class Rank:
class Stats(object):
'''Holds info used to calculate amount of xp a player gets'''
post_likes = 0
post_dislikes = 0
comment_likes = 0
comment_dislikes = 0
usage = 0
class Interval(object):
'''A class representing an interval. It ... | normal | {
"blob_id": "cd0b55e163851344273ad020d434cc8662083d19",
"index": 6593,
"step-1": "<mask token>\n\n\nclass Rank:\n\n\n class Stats(object):\n \"\"\"Holds info used to calculate amount of xp a player gets\"\"\"\n post_likes = 0\n post_dislikes = 0\n comment_likes = 0\n comment... | [
5,
6,
7,
9,
11
] |
# coding:utf-8
class SpiderMiddlewares1(object):
def process_request(self, request):
print(u"SpiderMiddlewares1 process_request {}".format(request.url))
return request
def process_item(self, item):
print(u"SpiderMiddlewares1 process_item {}".format(item.data))
return item
cl... | normal | {
"blob_id": "8a2ab260f4758bcca7b1a68d1fb65b7eebab5533",
"index": 2518,
"step-1": "<mask token>\n\n\nclass SpiderMiddlewares2(object):\n\n def process_request(self, request):\n print(u'SpiderMiddlewares2 process_request {}'.format(request.url))\n return request\n\n def process_item(self, item)... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
def next_point(p1, p2):
diff_x = p1[0] - p2[0]
diff_y = p1[1] - p2[1]
angle = arctan(abs(diff_x) / abs(diff_y))
new_diff_x = int(sin(angle) * curr_length)
new_diff_y = int(cos(angle) * curr_length)
new_x = p1[0] + new_diff_x if diff_x < 0 else p1[0] - new_diff_x
... | flexible | {
"blob_id": "838279b4f8d9e656c2f90ff06eaff3bd9c12bbef",
"index": 3265,
"step-1": "<mask token>\n\n\ndef next_point(p1, p2):\n diff_x = p1[0] - p2[0]\n diff_y = p1[1] - p2[1]\n angle = arctan(abs(diff_x) / abs(diff_y))\n new_diff_x = int(sin(angle) * curr_length)\n new_diff_y = int(cos(angle) * cur... | [
1,
2,
3,
4,
5
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.