code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import xlrd
def get_rosters_from_excel(django_file):
workbook = xlrd.open_workbook(file_contents=django_file.read())
worksheet = workbook.sheet_by_name('Match_Rosters')
num_rows = worksheet.nrows - 1
cur_row = -1
rosters = []
while cur_row < num_rows:
cur_row += 1
if workshe... | normal | {
"blob_id": "a7a219e9ea5cdec004ef936958994ed1f5a96103",
"index": 3244,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_rosters_from_excel(django_file):\n workbook = xlrd.open_workbook(file_contents=django_file.read())\n worksheet = workbook.sheet_by_name('Match_Rosters')\n num_rows = ... | [
0,
1,
2,
3
] |
from django.urls import path
from .views import PasswordList
urlpatterns = [
path('', PasswordList.as_view()),
]
| normal | {
"blob_id": "0f3430cbfc928d26dc443fde518881923861f2e3",
"index": 3188,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', PasswordList.as_view())]\n",
"step-3": "from django.urls import path\nfrom .views import PasswordList\nurlpatterns = [path('', PasswordList.as_view())]\n",
"st... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Network(nn.Module):
def __init__(self):
super().__init__()
self.resnet50 = ResNet50(config.backbone_freeze_at, False)
self.FPN = FPN(self.resnet50, 2, 6)
self.RPN = RPN(config.rpn_channel)
self.RCNN = RCNN()
<|reserved_special_token_0... | flexible | {
"blob_id": "6ac13665c2348bf251482f250c0fcc1fc1a8af75",
"index": 4721,
"step-1": "<mask token>\n\n\nclass Network(nn.Module):\n\n def __init__(self):\n super().__init__()\n self.resnet50 = ResNet50(config.backbone_freeze_at, False)\n self.FPN = FPN(self.resnet50, 2, 6)\n self.RPN =... | [
5,
6,
7,
8,
11
] |
"""
Users model
"""
# Django
from django.conf import settings
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator
class User(AbstractUser):
"""User model"""
email = models.EmailField(
'email address',
... | normal | {
"blob_id": "360813a573f672e3ec380da4237a6e131dbcb7e6",
"index": 2345,
"step-1": "<mask token>\n\n\nclass User(AbstractUser):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Profile(models.Model):\n \"\"\"Profile model\"\... | [
5,
6,
8,
9,
10
] |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | normal | {
"blob_id": "bf51da12632013c62aa543ae7f02415057138c7a",
"index": 694,
"step-1": "<mask token>\n\n\ndef get_qa_set(directory, jsonl_file):\n \"\"\"Download the WMT en-fr training corpus to directory unless it's there.\"\"\"\n set_name = os.path.splitext(os.path.basename(jsonl_file))[0]\n set_path = os.pa... | [
2,
3,
7,
8,
10
] |
import pymysql
pymysql.install_as_MySQLdb()
# from keras.models import load_model
# from keras.models import Model
# from ai import settings
#
# print('load model ...')
# model = load_model(settings.MODEL_PATH)
# model = Model(inputs=model.input, outputs=model.get_layer('dnsthree').output)
# print('load done.')
| normal | {
"blob_id": "b7d3af29e024b0b2cf5d2c054290f799eae7fed1",
"index": 4476,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npymysql.install_as_MySQLdb()\n",
"step-3": "import pymysql\npymysql.install_as_MySQLdb()\n",
"step-4": "import pymysql\n\npymysql.install_as_MySQLdb()\n\n# from keras.models import lo... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import re
def phonenumbervalidate(phone):
pattern ='^[6-9][0-9]{9}$'
phone =str(phone)
if re.match(pattern,phone):
return True
return False
print(phonenumbervalidate(998855451))
print(phonenumbervalidate(9955441))
# In[10]:
import re
def pho... | normal | {
"blob_id": "6b2161379bdd27980d3a515cdf4719ab036845fe",
"index": 8217,
"step-1": "<mask token>\n\n\ndef phonenumbervalidate(phone):\n pattern = '^[0][6-9][0-9]{9}$'\n phone = str(phone)\n if re.match(pattern, phone):\n return True\n return False\n\n\n<mask token>\n",
"step-2": "<mask token>\... | [
1,
2,
3,
4,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for n in range(N):
counting_list[int(sys.stdin.readline())] += 1
for i, v in enumerate(counting_list):
if v:
sys.stdout.write((str(i) + '\n') * v)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
sys.st... | flexible | {
"blob_id": "efca954e1977a6f6ac9a966b3c84ba80f5b7a663",
"index": 690,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor n in range(N):\n counting_list[int(sys.stdin.readline())] += 1\nfor i, v in enumerate(counting_list):\n if v:\n sys.stdout.write((str(i) + '\\n') * v)\n",
"step-3": "<ma... | [
0,
1,
2,
3,
4
] |
from setuptools import setup
setup(
name="CoreMLModules",
version="0.1.0",
url="https://github.com/AfricasVoices/CoreMLModules",
packages=["core_ml_modules"],
setup_requires=["pytest-runner"],
install_requires=["numpy", "scikit-learn", "nltk"],
tests_require=["pytest<=3.6.4"]
)
| normal | {
"blob_id": "24cd3a1a05a1cfa638b8264fd89b36ee63b29f89",
"index": 1625,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='CoreMLModules', version='0.1.0', url=\n 'https://github.com/AfricasVoices/CoreMLModules', packages=[\n 'core_ml_modules'], setup_requires=['pytest-runner'], install_requ... | [
0,
1,
2,
3
] |
from datetime import timedelta
from django import template
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.utils import timezone
from api.analysis import *
from api.models import Service
register = template.Library()
# ... | normal | {
"blob_id": "43792a647243b9d667d6d98b62a086d742e8e910",
"index": 6093,
"step-1": "<mask token>\n\n\n@register.filter\ndef td_humanize(diff):\n if diff.total_seconds() < 0:\n return 'Meni jo!'\n days = diff.days\n if days >= 7:\n weeks, days = divmod(days, 7)\n result = str(weeks) + ... | [
2,
7,
8,
9,
12
] |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from rasa_core.actions.action import Action
from rasa_core.events import SlotSet
from rasa_core.dispatcher import Button, Element, Dispatcher
import json
import pickle
class ActionWeather(Action):
def na... | normal | {
"blob_id": "f87d08f3bb6faa237cce8379de3aaaa3270a4a34",
"index": 3854,
"step-1": "<mask token>\n\n\nclass ActionWeather(Action):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ActionWeather(Action):\n <mask token>\n\n def run(self, dispatcher, tracker, domain):\n loc = ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
ENV = 'development'
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'
SECRET_KEY = 'not-so-secret-in-tests'
DEBUG_TB_ENABLED = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
APP_ENV = 'testing'
JWT_SECRET_KEY = """-----BEGIN RSA ... | flexible | {
"blob_id": "909ea7b9335a858662f83abc71b4d58578bd0850",
"index": 8261,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nENV = 'development'\nTESTING = True\nSQLALCHEMY_DATABASE_URI = 'sqlite://'\nSECRET_KEY = 'not-so-secret-in-tests'\nDEBUG_TB_ENABLED = False\nSQLALCHEMY_TRACK_MODIFICATIONS = False\nAPP_EN... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def factorial(num):
assert num >= 0 and int(num) == num, 'Only positive integer accept'
if num in [0, 1]:
return 1
else:
return num * factorial(num - 1)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def factorial(n... | flexible | {
"blob_id": "2a799d81d963f73d8018a99cbd963af166681b35",
"index": 9416,
"step-1": "<mask token>\n",
"step-2": "def factorial(num):\n assert num >= 0 and int(num) == num, 'Only positive integer accept'\n if num in [0, 1]:\n return 1\n else:\n return num * factorial(num - 1)\n\n\n<mask toke... | [
0,
1,
2
] |
<|reserved_special_token_0|>
@instrumented_task(name=
'sentry.release_health.tasks.monitor_release_adoption', queue=
'releasemonitor', default_retry_delay=5, max_retries=5)
def monitor_release_adoption(**kwargs) ->None:
metrics.incr('sentry.tasks.monitor_release_adoption.start', sample_rate=1.0
)
... | flexible | {
"blob_id": "eb4271aa5abe3ddc05048858205e6ef807a4f8ac",
"index": 6863,
"step-1": "<mask token>\n\n\n@instrumented_task(name=\n 'sentry.release_health.tasks.monitor_release_adoption', queue=\n 'releasemonitor', default_retry_delay=5, max_retries=5)\ndef monitor_release_adoption(**kwargs) ->None:\n metric... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
# -*- coding: utf-8 -*-
"""Code handling the concurrency of data analysis."""
| flexible | {
"blob_id": "2e23225ec4cd693f5e9460a13d64206f184a86a0",
"index": 3043,
"step-1": "<mask token>\n",
"step-2": "# -*- coding: utf-8 -*-\n\"\"\"Code handling the concurrency of data analysis.\"\"\"\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
# -*- coding: utf-8 -*-
__author__ = 'Yun'
__project__ = 'DjangoBookTest2'
# from django.template import Template, Context
# from django.template.loader import get_template
# from django.http import HttpResponse
from django.shortcuts import render_to_response
import datetime
def current_datetime(request):
# now ... | normal | {
"blob_id": "ef6f55bf27982f53441215da6822cfcdc80706a5",
"index": 240,
"step-1": "<mask token>\n\n\ndef display_meta(request):\n context_dict = {'meta_dict': request.META}\n return render_to_response('display_meta.html', context_dict)\n",
"step-2": "<mask token>\n\n\ndef current_datetime(request):\n cu... | [
1,
2,
3,
4,
5
] |
my_func = lambda x, y: x ** y
| normal | {
"blob_id": "93baa6ba14d06661731dce3e34ea93d49c06001b",
"index": 9043,
"step-1": "<mask token>\n",
"step-2": "my_func = lambda x, y: x ** y\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
# -*- coding:UTF-8 -*-
from __future__ import print_function
import logging
import numpy as np
from optparse import OptionParser
import sys
from time import time
import matplotlib.pyplot as plt
import os
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from skl... | normal | {
"blob_id": "84a516e924252d897be7444e11acfecd66474090",
"index": 1177,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(forbidpath, 'rb') as f:\n for line in f:\n word = line.strip()\n forbidkword[word] = 0\n<mask token>\nwith open(inputpath, 'rb') as f:\n for line in f:\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def moveSDLIncludes():
flatCopyWithExt('./ext/SDL2/core/code/include/',
'./ext/SDL2/core/include/', '.h')
flatCopyWithExt('./ext/SDL2/SDL2-image/code/',
'./ext/SDL2/SDL2-image/include/', '.h')
flatCop... | flexible | {
"blob_id": "649c0c0f170b50fe51f5eaf11908e968f66625c9",
"index": 5925,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef moveSDLIncludes():\n flatCopyWithExt('./ext/SDL2/core/code/include/',\n './ext/SDL2/core/include/', '.h')\n flatCopyWithExt('./ext/SDL2/SDL2-image/code/',\n '.... | [
0,
1,
2,
3,
4
] |
import backtrader as bt
class RSIStrategy(bt.Strategy):
def __init__(self):
self.order = None
self.position.size = 0
self.sellAlert1 = False
self.sellAlert2 = False
self.buyAlert = False
self.failureNum = 0
self.successNum = 0
self.rsi_... | normal | {
"blob_id": "9119fc1c75de980bbcf74f1e06a36ba587fc490b",
"index": 102,
"step-1": "<mask token>\n\n\nclass RSIStrategy(bt.Strategy):\n\n def __init__(self):\n self.order = None\n self.position.size = 0\n self.sellAlert1 = False\n self.sellAlert2 = False\n self.buyAlert = False... | [
3,
4,
5,
6,
7
] |
#!/usr/bin/python
#
# Copyright 2017 Steven Watanabe
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
from MockProgram import *
command('strip', '-S', '-x', input_file('bin/darwin-4.2.1/release/target-os-darwin/t... | normal | {
"blob_id": "d2f77afd0d282b1fa4859c5368c9d2c745a5625e",
"index": 3293,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncommand('strip', '-S', '-x', input_file(\n 'bin/darwin-4.2.1/release/target-os-darwin/test'))\nmain()\n",
"step-3": "from MockProgram import *\ncommand('strip', '-S', '-x', input_fil... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
__all__ = ['FirestoreTradeCallback', 'GCPPubSubTradeCallback',
'CandleCallback', 'TradeCallback', 'ThreshCallback',
'SequentialIntegerTradeCallback', 'NonSequentialIntegerTradeCallback']
<|reserved_special_token_1|>
fro... | flexible | {
"blob_id": "b6dc29ae5661f84273ff91a124420bc10c7b6f6e",
"index": 3704,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__all__ = ['FirestoreTradeCallback', 'GCPPubSubTradeCallback',\n 'CandleCallback', 'TradeCallback', 'ThreshCallback',\n 'SequentialIntegerTradeCallback', 'NonSequentialIntegerTradeC... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(a, b, c)
<|reserved_special_token_0|>
print(a)
<|reserved_special_token_0|>
print(a, c, _)
<|reserved_special_token_0|>
print(a, c, _)
<|reserved_special_token_0|>
print(a, c, b)
<|reserved_special_token_0|>
print(a, b)
prin... | flexible | {
"blob_id": "c65755d7a58c1cda7d6eea83876e0522a7ca9c74",
"index": 2679,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(a, b, c)\n<mask token>\nprint(a)\n<mask token>\nprint(a, c, _)\n<mask token>\nprint(a, c, _)\n<mask token>\nprint(a, c, b)\n<mask token>\nprint(a, b)\nprint(*b)\n<mask token>\nprint... | [
0,
1,
2,
3
] |
import tkinter
from tkinter import ttk, filedialog, messagebox
import serial.tools.list_ports
from PIL import ImageTk, Image
from read_bytes import read
root = tkinter.Tk()
root.title('ChadBotX')
# Define constants for mode selection
MODE_RECORD = 1
MODE_PLAYBACK = 2
# Define gui state
portname = tkinter.StringVar(r... | normal | {
"blob_id": "6455741bbda42b9d84428545ddd50a5d1b54a7ba",
"index": 1376,
"step-1": "<mask token>\n\n\ndef get_ports():\n ports = serial.tools.list_ports.comports()\n ports_str = []\n for port in ports:\n ports_str.append(port.device)\n return ports_str\n\n\ndef start():\n opt_mode = mode.get(... | [
2,
4,
5,
6,
7
] |
from modeltranslation.translator import register, TranslationOptions
from .models import *
@register(PageTitleModel)
class TitleTranslationOptions(TranslationOptions):
fields = (
'name',
)
@register(NewsModel)
class ProjectTranslationOptions(TranslationOptions):
fields = (
'name',
... | normal | {
"blob_id": "9c29f04746de6847ad1bbdf08964d14e6c3766db",
"index": 8700,
"step-1": "<mask token>\n\n\n@register(NewsModel)\nclass ProjectTranslationOptions(TranslationOptions):\n fields = 'name', 'text'\n",
"step-2": "<mask token>\n\n\n@register(PageTitleModel)\nclass TitleTranslationOptions(TranslationOption... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if number % 2 == 0:
print(f'{number} is an even number.')
else:
print(f'{number} is an odd number.')
<|reserved_special_token_1|>
number = int(input("Enter a number, and I'll tell you if it's even or odd: "))
if number ... | flexible | {
"blob_id": "b147a22d6bd12a954c0d85c11e578a67f0a51332",
"index": 3025,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif number % 2 == 0:\n print(f'{number} is an even number.')\nelse:\n print(f'{number} is an odd number.')\n",
"step-3": "number = int(input(\"Enter a number, and I'll tell you if ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Prog(Emp):
def __init__(self):
super().__init__()
print('its child constructor')
def takeBreath(self):
super().takeBreath()
print('Iam a programmer and breathing++.')
a = 0
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<... | flexible | {
"blob_id": "cb2e2ef70935a22854c70fedf4f4a6715b089291",
"index": 1990,
"step-1": "<mask token>\n\n\nclass Prog(Emp):\n\n def __init__(self):\n super().__init__()\n print('its child constructor')\n\n def takeBreath(self):\n super().takeBreath()\n print('Iam a programmer and breat... | [
4,
6,
8,
11,
13
] |
<|reserved_special_token_0|>
class PolygonApplication:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class PolygonApplication:
<|reserved_special_token_0|>
def start(self):
self.window.show()
<|reserved_special_token... | flexible | {
"blob_id": "795bd22fb805069b342915638c52900ea52a4939",
"index": 9321,
"step-1": "<mask token>\n\n\nclass PolygonApplication:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass PolygonApplication:\n <mask token>\n\n def start(self):\n self.window.show()\n",
"step-3": "<ma... | [
1,
2,
3,
4
] |
# TrackwayDirectionStage.py
# (C)2014-2015
# Scott Ernst
from __future__ import print_function, absolute_import, unicode_literals, division
from collections import namedtuple
import math
from pyaid.number.NumericUtils import NumericUtils
from cadence.analysis.CurveOrderedAnalysisStage import CurveOrderedAnalysisSta... | normal | {
"blob_id": "a721adaaa69bf09c2ea259f12bea05515c818679",
"index": 5327,
"step-1": "<mask token>\n\n\nclass TrackwayDirectionStage(CurveOrderedAnalysisStage):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, key, owner, **kwargs):\n \"\"\"Creates a new instan... | [
7,
9,
11,
13,
17
] |
import pyttsx3
import pyglet
import time
import logging
import os
from gtts import gTTS
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
class GoogleTTS:
def utter_voice_message(self, message):
try:
# Google Text-to-Speech API - needs internet connectivity
#filename = ROOT_D... | normal | {
"blob_id": "9ed674513bebe65ece538e9ce2b3945bb0c532cc",
"index": 1357,
"step-1": "<mask token>\n\n\nclass GoogleTTS:\n <mask token>\n\n def check_google_connection(self):\n try:\n message = 'Hallo'\n filename = 'temp_voice.mp3'\n tts = gTTS(text=message, lang='de')\n... | [
5,
7,
8,
9,
10
] |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
import netaddr
from cargo.fields import MacAddress
from unit_tests.fields.Field import TestField
from unit_tests import configure
class TestMacAddress(configure.NetTestCase, TestField):
@property
def base(self):
return self.orm.mac
def test___call__... | normal | {
"blob_id": "b5dba7c1566721f8bb4ec99bc2f13cae4ade4f0a",
"index": 8713,
"step-1": "<mask token>\n\n\nclass TestMacAddress(configure.NetTestCase, TestField):\n <mask token>\n <mask token>\n\n def test_insert(self):\n self.base('08-00-2b-01-02-03')\n val = self.orm.new().insert(self.base)\n ... | [
8,
9,
11,
14,
15
] |
from django_evolution.mutations import ChangeField
MUTATIONS = [
ChangeField('ReviewRequest', 'depends_on', initial=None, null=False),
ChangeField('ReviewRequestDraft', 'depends_on', initial=None, null=False),
]
| normal | {
"blob_id": "286953e381d03c0817d57f9ee4e15f2a0ce808a9",
"index": 9776,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nMUTATIONS = [ChangeField('ReviewRequest', 'depends_on', initial=None, null=\n False), ChangeField('ReviewRequestDraft', 'depends_on', initial=None,\n null=False)]\n",
"step-3": "f... | [
0,
1,
2,
3
] |
# coding:utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from multiprocessing import Pool
"""
用户id,时间戳,浏览行为数据,浏览子行为编号
"""
names = ['userid','time','browser_behavior','browser_behavior_number']
browse_history_train = pd.read_csv("../../pcredit/train/browse_history_train.txt",header=None)
... | normal | {
"blob_id": "e6bd9391a5364e798dfb6d2e9b7b2b98c7b701ac",
"index": 6559,
"step-1": "# coding:utf-8\n\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom multiprocessing import Pool\n\n\"\"\"\n 用户id,时间戳,浏览行为数据,浏览子行为编号\n\"\"\"\nnames = ['userid','time','browser_behavior','browser_behavior... | [
0
] |
<|reserved_special_token_0|>
class OnMyWatch:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def run(self):
event_handler = Handler()
self.observer.schedule(event_handler, self.watchDirectory,
recursive=True)
self.observer.start()
try:
wh... | flexible | {
"blob_id": "6261d06ac7bdcb3ae25cd06338c4c41c3c5f5023",
"index": 7615,
"step-1": "<mask token>\n\n\nclass OnMyWatch:\n <mask token>\n <mask token>\n\n def run(self):\n event_handler = Handler()\n self.observer.schedule(event_handler, self.watchDirectory,\n recursive=True)\n ... | [
4,
7,
8,
10,
11
] |
<|reserved_special_token_0|>
class RSAGraphModel(SimpleLasagneModel):
<|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_sp... | flexible | {
"blob_id": "3496216de9f6b7d9d3db69eb4d8f8c0fdcd5123c",
"index": 1358,
"step-1": "<mask token>\n\n\nclass RSAGraphModel(SimpleLasagneModel):\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\n\nclass... | [
15,
21,
23,
36,
38
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
if __name__ == '__main__':
import sys
import os
sys.path.insert(0, os.path.abspath('config'))
import configure
configure_options = ['CC=icc', 'CXX=icpc', 'FC=ifort',
'--with-blas-lapack-dir=/soft/com/packages/intel/13/update5/mkl/'... | flexible | {
"blob_id": "43eb221758ebcf1f01851fc6cda67b72f32a73c7",
"index": 6992,
"step-1": "<mask token>\n",
"step-2": "if __name__ == '__main__':\n import sys\n import os\n sys.path.insert(0, os.path.abspath('config'))\n import configure\n configure_options = ['CC=icc', 'CXX=icpc', 'FC=ifort',\n '... | [
0,
1,
2
] |
from .scheduler import Scheduler
MyScheduler = Scheduler()
| normal | {
"blob_id": "d472a15d6fa826e50a550996369b00b6c599a1c7",
"index": 5401,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nMyScheduler = Scheduler()\n",
"step-3": "from .scheduler import Scheduler\nMyScheduler = Scheduler()\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
class KnowledgeBaseAnswer(_serialization.Model):
"""Represents knowledge base answer.
:ivar questions: List of questions associated with the answer.
:vartype questions: list[str]
:ivar answer: Answer text.
:vartype answer: str
:ivar confidence: Answer confidence s... | flexible | {
"blob_id": "fb258521fdfded0062cbe30651268bf5410d3384",
"index": 9864,
"step-1": "<mask token>\n\n\nclass KnowledgeBaseAnswer(_serialization.Model):\n \"\"\"Represents knowledge base answer.\n\n :ivar questions: List of questions associated with the answer.\n :vartype questions: list[str]\n :ivar ans... | [
36,
37,
51,
56,
72
] |
<|reserved_special_token_0|>
def lazy(func):
class Lazy:
def __init__(self, original) ->None:
self._value_computed = False
self._value = None
self._original = [original]
def get_value(self, *args, **kwargs):
if self._value_computed:
... | flexible | {
"blob_id": "1b529d8bafc81ef4dd9ff355de6abbd6f4ebddf1",
"index": 706,
"step-1": "<mask token>\n\n\ndef lazy(func):\n\n\n class Lazy:\n\n def __init__(self, original) ->None:\n self._value_computed = False\n self._value = None\n self._original = [original]\n\n def... | [
1,
2,
3,
4,
5
] |
import argparse
from ags_save_parser import saved_game
def report_mismatch(compare_result_list):
report = []
for i in range(len(compare_result_list)):
value = compare_result_list[i]
if value != '_':
report.append((i, value))
return report
def report_mismatch_for_module(
... | normal | {
"blob_id": "329451a3d3fa95f5572dc1701d1adbf4aaa72628",
"index": 8521,
"step-1": "<mask token>\n\n\ndef report_mismatch_for_module(modules_1, modules_2, index):\n module_1 = modules_1[index]\n module_2 = modules_2[index]\n if len(module_1) != 2 or len(module_2) != 2:\n raise AssertionError('Modul... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def eval_loop():
while True:
s = input('Please input: ')
if s != 'done':
print(eval(s))
else:
break
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def eval_loop():
while True:
s =... | flexible | {
"blob_id": "80969de6924ae5fe6bb8e7f1211e7aca28c63989",
"index": 2615,
"step-1": "<mask token>\n",
"step-2": "def eval_loop():\n while True:\n s = input('Please input: ')\n if s != 'done':\n print(eval(s))\n else:\n break\n\n\n<mask token>\n",
"step-3": "def eval... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def resolve_build_and_write(year, day_part, file_part, nb_blocks_footer=0,
nb_words_footer=0, headers=None, skip_nb_page=0, parser=None,
indentation_threshold=15):
resolver = FilePathResolver(year, day_part, file_par... | flexible | {
"blob_id": "ab3d443c60ca8ee82f594ae04e9b485a53d53f36",
"index": 5665,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef resolve_build_and_write(year, day_part, file_part, nb_blocks_footer=0,\n nb_words_footer=0, headers=None, skip_nb_page=0, parser=None,\n indentation_threshold=15):\n reso... | [
0,
1,
2,
3,
4
] |
import telebot
import os
from misc.answers import answer_incorrect, answer_correct, answer_start
from helper import get_challenge_text, get_solved_challenge_text, is_correct_answer
bot = telebot.TeleBot(os.environ.get('API_KEY_TELEGRAM'))
default_parse_mode = "Markdown"
@bot.message_handler(commands=['start'])
def w... | normal | {
"blob_id": "f9f66452756cb67689d33aeb2e77535086355a7d",
"index": 5115,
"step-1": "<mask token>\n\n\n@bot.message_handler(commands=['new_game'])\ndef new_game(message):\n print(f'try new game with message: {message.text}')\n answer = ''\n try:\n answer = get_challenge_text(message.text)\n p... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Terminal based number guessing game')
while True:
try:
numberOfGames = int(input(
'Please choose how many games you want to play ---> '))
except:
print('Only numbes accepted')
con... | flexible | {
"blob_id": "20c081dc47f541a988bccef89b8e51f446c80f58",
"index": 5471,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Terminal based number guessing game')\nwhile True:\n try:\n numberOfGames = int(input(\n 'Please choose how many games you want to play ---> '))\n except:\n... | [
0,
1,
2,
3,
4
] |
import json
import datetime
import requests
import pymysql
import pymongo
def insert_category(conn):
"""将商品的种类插入数据库 """
# 商品种类的 id 和对应的名称
categories_dict = {
66: "手机",
327: "腕表配饰",
65: "电脑办公",
67: "相机单反",
217: "平板数码",
179: "运动户外",
255: "家电家居",
... | normal | {
"blob_id": "b69e3f5e57adc8e89b6ff22fb4a10d2539e13ca3",
"index": 7200,
"step-1": "<mask token>\n\n\ndef insert_category(conn):\n \"\"\"将商品的种类插入数据库 \"\"\"\n categories_dict = {(66): '手机', (327): '腕表配饰', (65): '电脑办公', (67):\n '相机单反', (217): '平板数码', (179): '运动户外', (255): '家电家居', (1000): '其他'}\n with... | [
2,
4,
5,
6,
7
] |
import random
import math
import time
import pygame
pygame.init()
scr = pygame.display.set_mode((700,700))
enemies = []
#music = pygame.mixer.music.load('ENERGETIC CHIPTUNE Thermal - Evan King.mp3')
#pygame.mixer.music.play(-1)
hit = []
class Player:
def __init__(self):
self.x = 275
sel... | normal | {
"blob_id": "54e04d740ef46fca04cf4169d2e7c05083414bd8",
"index": 11,
"step-1": "<mask token>\n\n\nclass Player:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Bullet:\n\n def __init__(self, color):\n self.x = 0\n self.y = 0\n self.angle = 0\n self.color = color\n\... | [
14,
17,
19,
20,
21
] |
<|reserved_special_token_0|>
class RiskAnalysis(gtk.VPaned):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def create_risk_analysis_page(self, notebook):
"""
Method to create the development environment risk analysis page and add
it to the risk analysis gtk.Notebook().... | flexible | {
"blob_id": "327371d373819273a2f77f63e0cedee6950dbc46",
"index": 976,
"step-1": "<mask token>\n\n\nclass RiskAnalysis(gtk.VPaned):\n <mask token>\n <mask token>\n\n def create_risk_analysis_page(self, notebook):\n \"\"\"\n Method to create the development environment risk analysis page and... | [
4,
5,
7,
9,
10
] |
class StartStateImpl:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def exit_state(self, message, user):
user.send_message(StartStateImpl.thank_you)
<|reserved_special_token_0|>
class StartState(StartStateImpl):
... | flexible | {
"blob_id": "3741e44178375f351278cb17c2bf8f11c69e1262",
"index": 4009,
"step-1": "class StartStateImpl:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def exit_state(self, message, user):\n user.send_message(StartStateImpl.thank_you)\n <mask token>\n\n\nclass StartState(... | [
5,
6,
7,
8,
10
] |
# -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... | normal | {
"blob_id": "eb1737ac671129ed3459ce4feacb81d414eef371",
"index": 5667,
"step-1": "<mask token>\n\n\n@pytest.fixture(scope='module')\ndef module_scope_prefix(request, session_scope_prefix):\n \"\"\"\n Generate a name prefix to be shared by objects created during this pytest module\n Relies on pytest's bu... | [
17,
20,
21,
23,
45
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def days_count(year, month, hour):
point = datetime.datetime(year, month, hour, 0, 0, 0, 0)
now = datetime.datetime.now()
interval_day = point - now
return interval_day.days
<|reserved_special_token_0|>
<|res... | flexible | {
"blob_id": "82ce6304977d468945526824ade1500e10d25d09",
"index": 2872,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef days_count(year, month, hour):\n point = datetime.datetime(year, month, hour, 0, 0, 0, 0)\n now = datetime.datetime.now()\n interval_day = point - now\n return interva... | [
0,
1,
2,
3,
4
] |
import TryItYourSelf_9_8 as userObj
print('\n\n\n\n')
admin1 = userObj.Admin('john', 'deer', 30)
admin1.describe_user()
print('\n')
admin1.set_user_name('Reven10')
print('\n')
admin1.describe_user()
admin1.privileges.show_privileges()
| normal | {
"blob_id": "169ad888e7629faff9509399ac7ead7a149a9602",
"index": 543,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('\\n\\n\\n\\n')\n<mask token>\nadmin1.describe_user()\nprint('\\n')\nadmin1.set_user_name('Reven10')\nprint('\\n')\nadmin1.describe_user()\nadmin1.privileges.show_privileges()\n",
... | [
0,
1,
2,
3
] |
print("Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos")
count=1
lista=[]
while count<11:
numero=int(input('Introduzca su %d numero:' %(count)))
lista.append(numero)
count=count+1
listanueva=[]
s= ','
f... | normal | {
"blob_id": "9dd5db441044c808274493f16a912d1b65a6c28b",
"index": 5911,
"step-1": "<mask token>\n",
"step-2": "print(\n 'Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos'\n )\n<mask token>\nwhile count < 11:\n numero = int(... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Predict:
def __init__(self, text):
"""
taking the user input string
loading trained feature numpy array
loading the output for the numpy array
loading the vectorizer saved during training
:param text:
"""
self.tex... | flexible | {
"blob_id": "26df6ddf3533a8648b59f0fa2b03f89c93af7491",
"index": 8154,
"step-1": "<mask token>\n\n\nclass Predict:\n\n def __init__(self, text):\n \"\"\"\n taking the user input string\n loading trained feature numpy array\n loading the output for the numpy array\n loading t... | [
3,
4,
5,
6
] |
from rest_framework import serializers
from notes import models
class CategorySerializer(serializers.ModelSerializer):
id = serializers.StringRelatedField()
class Meta:
model = models.Category
fields = (
'id',
'name',
'color',
)
# nested category in... | normal | {
"blob_id": "704047cb7eb05db9fa5f7ae61763ddbc8942ff60",
"index": 9614,
"step-1": "<mask token>\n\n\nclass InsightSerializer(serializers.ModelSerializer):\n id = serializers.StringRelatedField()\n category = CategorySerializer()\n\n\n class Meta:\n model = models.Insight\n fields = 'id', 'c... | [
2,
3,
4,
5,
6
] |
<|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": "a4f2ca3155f2bb4c17be5bb56dd889abb5d20293",
"index": 3791,
"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
] |
import datetime as dt
import json
import pandas as pd
import numpy as np
from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, func
from iotfunctions.base import BaseTransformer
from iotfunctions.metadata import EntityType
from iotfunctions.db import Database
from iotfunctions import ui
with open('c... | normal | {
"blob_id": "f15a0956c4aa27da861f9bccbeff7a6b6a909b73",
"index": 1113,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('credentials_as.json', encoding='utf-8') as F:\n credentials = json.loads(F.read())\n<mask token>\nprint(df)\n",
"step-3": "<mask token>\nwith open('credentials_as.json', e... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
admin.site.register(Coupon)
admin.site.register(Games)
<|reserved_special_token_1|>
from django.contrib import admin
from coupon.models import Coupon, Games
admin.site.register(Coupon)
admin.site.register(Games)
| flexible | {
"blob_id": "6c10213c2e866ec84f229aa426c7122aa817d167",
"index": 4239,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Coupon)\nadmin.site.register(Games)\n",
"step-3": "from django.contrib import admin\nfrom coupon.models import Coupon, Games\nadmin.site.register(Coupon)\nadmin.site... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class PolicyFullyConnected:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class PolicyFullyConnected:
def __init__(self, observation_space, action_space, batch_size, reuse):... | flexible | {
"blob_id": "ecf09f2c503452fefc427e8dbe151e7bc7ef677e",
"index": 6139,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass PolicyFullyConnected:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass PolicyFullyConnected:\n\n def __init__(self, observation_space, action_space, batch_size, reu... | [
0,
1,
2,
3,
4
] |
import logging
from pathlib import Path
import numpy as np
import torch
import re
import json
from helpers import init_helper, data_helper, vsumm_helper, bbox_helper
from modules.model_zoo import get_model
logger = logging.getLogger()
def evaluate(model, val_loader, nms_thresh, device):
model.eval()
stats ... | normal | {
"blob_id": "dd3419f42a3b1aafd1d4f5d88189fb3c6bd0c67e",
"index": 4233,
"step-1": "<mask token>\n\n\ndef evaluate(model, val_loader, nms_thresh, device):\n model.eval()\n stats = data_helper.AverageMeter('fscore', 'diversity')\n json_file = []\n with torch.no_grad():\n for test_key, seq, gt, cp... | [
4,
5,
7,
8,
10
] |
## @file
# Contains several utilitities shared by migration tools.
#
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full... | normal | {
"blob_id": "2dbb1051b35898288db629fd0c5b3887c429e9b8",
"index": 1313,
"step-1": "<mask token>\n\n\ndef SetCommon(Common, XmlCommon):\n XmlTag = 'Usage'\n Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()\n XmlTag = 'FeatureFlag'\n Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)\n XmlTag... | [
11,
18,
20,
21,
23
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with shelve.open(FILENAME) as clubs:
clubs_by_country = list(filter(lambda s: s.country.lower() == country.
lower(), clubs.values()))
if len(clubs_by_country) == 0:
print('No clubs with such country')
... | flexible | {
"blob_id": "1346bf78241b4be00f2da3c22731d2846f9d1ada",
"index": 4629,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith shelve.open(FILENAME) as clubs:\n clubs_by_country = list(filter(lambda s: s.country.lower() == country.\n lower(), clubs.values()))\n if len(clubs_by_country) == 0:\n ... | [
0,
1,
2,
3,
4
] |
import pandas as pd
import numpy as np
from scipy import misc
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import time
import math
import cv2
import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
from keras.models import Sequential
from keras.layers im... | normal | {
"blob_id": "b109568c4dba05b16cbed1759a2b9e0a99babc67",
"index": 2982,
"step-1": "<mask token>\n\n\ndef load_data(data):\n temp = []\n for i in range(len(data)):\n im = cv2.imread(data[i])\n im = misc.imresize(im, size=DOWNSAMPLE_RATIO)\n im = crop(im)\n temp.append(im)\n ret... | [
8,
10,
12,
16,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(test[['RoofStyle', 'RoofStyle_enc']].drop_duplicates())
<|reserved_special_token_1|>
train['RoofStyle_enc'], test['RoofStyle_enc'] = mean_target_encoding(train=
train, test=test, target='SalePrice', categorical='RoofS... | flexible | {
"blob_id": "5433e75bdc46d5a975969e7ece799174dc9b8713",
"index": 2918,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(test[['RoofStyle', 'RoofStyle_enc']].drop_duplicates())\n",
"step-3": "train['RoofStyle_enc'], test['RoofStyle_enc'] = mean_target_encoding(train=\n train, test=test, target='S... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(z)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
x = int(raw_input('Please supply a number: '))
y = int(raw_input('Please supply a second number: '))
z = random.randint(x, y)
print(z)
<|reserved_special_toke... | flexible | {
"blob_id": "104c49941a79948749b27217a0c728f19435f77a",
"index": 643,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(z)\n",
"step-3": "<mask token>\nx = int(raw_input('Please supply a number: '))\ny = int(raw_input('Please supply a second number: '))\nz = random.randint(x, y)\nprint(z)\n",
"ste... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
tables
<|reserved_special_token_0|>
df.head()
<|reserved_special_token_0|>
df.head()
df.set_index('State', inplace=True)
df.head()
df.loc['Alabama']
<|reserved_special_token_0|>
html_table
html_table.replace('\n', '')
df.to_html('... | flexible | {
"blob_id": "f4fca5ce20db0e27da11d76a7a2fd402c33d2e92",
"index": 4731,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntables\n<mask token>\ndf.head()\n<mask token>\ndf.head()\ndf.set_index('State', inplace=True)\ndf.head()\ndf.loc['Alabama']\n<mask token>\nhtml_table\nhtml_table.replace('\\n', '')\ndf.to... | [
0,
1,
2,
3,
4
] |
from flask_minify.utils import get_optimized_hashing
class MemoryCache:
def __init__(self, store_key_getter=None, limit=0):
self.store_key_getter = store_key_getter
self.limit = limit
self._cache = {}
self.hashing = get_optimized_hashing()
@property
def store(self):
... | normal | {
"blob_id": "ef5c51a5c706387b62ef3f40c7cadf7dbef6d082",
"index": 8671,
"step-1": "<mask token>\n\n\nclass MemoryCache:\n\n def __init__(self, store_key_getter=None, limit=0):\n self.store_key_getter = store_key_getter\n self.limit = limit\n self._cache = {}\n self.hashing = get_opt... | [
6,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(f'Metade de {moeda.moeda(p)} é {moeda.metade(p, show=True)}')
print(f'O dobro de {moeda.moeda(p)} é {moeda.dobro(p, show=True)}')
print(f'Aumentando 10%, temos {moeda.aumentar(p, 10, show=True)}')
print(f'Reduzindo 13%, temo... | flexible | {
"blob_id": "5a50ca64810c391231a00c6bfe5ae925ffe5ca7d",
"index": 6332,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(f'Metade de {moeda.moeda(p)} é {moeda.metade(p, show=True)}')\nprint(f'O dobro de {moeda.moeda(p)} é {moeda.dobro(p, show=True)}')\nprint(f'Aumentando 10%, temos {moeda.aumentar(p, ... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-26 20:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Cbrowser', '0002_links_l_title'),
]
operations = [
migrations.AddField(
... | normal | {
"blob_id": "ffd11d49f8499b4bfec8f17d07b66d899dd23d2e",
"index": 6924,
"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 = [('Cbrowser', ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Tweet(models.Model):
<|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 Tweet(models.Model):
<|reserved_special_token_0|>
<|r... | flexible | {
"blob_id": "28978bc75cb8c5585fd0d145fe0d0c0c5456ad2e",
"index": 6955,
"step-1": "<mask token>\n\n\nclass Tweet(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Tweet(models.Model):\n <mask token>\n <mask token>\n <mask token... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def main():
updater = Updater('', use_context=True)
dp = updater.dispatcher
jobs = updater.job_queue
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
loggi... | flexible | {
"blob_id": "0a90f29a4e18c2aed23cb31b4239d44d23526327",
"index": 9133,
"step-1": "<mask token>\n\n\ndef main():\n updater = Updater('', use_context=True)\n dp = updater.dispatcher\n jobs = updater.job_queue\n dp.add_error_handler(error)\n updater.start_polling()\n updater.idle()\n\n\n<mask toke... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class User(db.Model, UserMixin):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __repr__(self):
return '<User {}>'.format... | flexible | {
"blob_id": "866ec11f6fe13fb2283709128376080afc7493bf",
"index": 5040,
"step-1": "<mask token>\n\n\nclass User(db.Model, UserMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<User {}>'.format(self.email... | [
8,
10,
11,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def localize(colors, measurements, motions, sensor_right, p_move):
p = []
m = len(colors)
n = len(colors[0])
size = m * n
for i in range(m):
temp = []
for j in range(n):
temp.appen... | flexible | {
"blob_id": "10937ee1e48d23b12b76a2abc44ee8bd0647aef5",
"index": 9248,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef localize(colors, measurements, motions, sensor_right, p_move):\n p = []\n m = len(colors)\n n = len(colors[0])\n size = m * n\n for i in range(m):\n temp = [... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# -*-coding:utf-8 -*-
from common import http_requests_get,is_domain
import re
class Crt(object):
def __init__(self, domain):
self.domain=domain
self.site='http://crt.sh/?q=%25.'
self.result=[]
def run(self):
url = self.site + self.domain
print u... | normal | {
"blob_id": "3ac13cc74a7eabef686ceb9d9e46f2ef109a225e",
"index": 1354,
"step-1": "#!/usr/bin/env python\n# -*-coding:utf-8 -*-\n\n\nfrom common import http_requests_get,is_domain\nimport re\n\nclass Crt(object):\n def __init__(self, domain):\n self.domain=domain\n self.site='http://crt.sh/?q=%25... | [
0
] |
import tensorflow.contrib.slim as slim
import tensorflow as tf
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import init_ops
import numpy as np
WEIGHT_DECAY = 0.0005
class ScaledVarianceUniform(init_ops.Initializer):
"""Initializer that genera... | normal | {
"blob_id": "9da6bfa614d64956a302abbfeeea30c0339e9db3",
"index": 5583,
"step-1": "<mask token>\n\n\nclass ConvLayer(object):\n <mask token>\n\n def apply(self, h):\n if self.activation_fn == False:\n if self.normalizer_fn == False:\n if self.dropout == False:\n ... | [
19,
21,
23,
33,
35
] |
class Area :
def circle(self):
rad = int(input("Enter the radius:"))
area = (22/7)*(rad**2)
print("Area is :" , area , "cm square")
def square(self):
side = int(input("Enter the length of a side:"))
area = side**2
print("Area is :" , area , "cm s... | normal | {
"blob_id": "4f36c7e98c54d38aaef9f2ebdafd0c34a157fcd7",
"index": 8268,
"step-1": "class Area:\n <mask token>\n\n def square(self):\n side = int(input('Enter the length of a side:'))\n area = side ** 2\n print('Area is :', area, 'cm square')\n\n def rect(self):\n print('Enter ... | [
4,
5,
6,
8,
10
] |
<|reserved_special_token_0|>
def preprocess_image(image):
image = tf.image.decode_jpeg(image, channels=3)
image = tf.image.resize(image, [280, 280])
image /= 255.0
return image
<|reserved_special_token_0|>
def make_generator_model():
model = tf.keras.Sequential()
model.add(layers.Dense(7 *... | flexible | {
"blob_id": "e007e2d32fa799e7658813f36911616f7bf58b48",
"index": 3972,
"step-1": "<mask token>\n\n\ndef preprocess_image(image):\n image = tf.image.decode_jpeg(image, channels=3)\n image = tf.image.resize(image, [280, 280])\n image /= 255.0\n return image\n\n\n<mask token>\n\n\ndef make_generator_mod... | [
8,
10,
12,
13,
14
] |
<|reserved_special_token_0|>
class Base(unittest.TestCase):
<|reserved_special_token_0|>
def setUp(self):
self.schemas = {}
self.session = requests.Session()
self.session.headers.update({'x-apikey': SETTINGS['APIKEY']})
self.addCleanup(self.close_session)
def close_sessio... | flexible | {
"blob_id": "c455de70a79f70f5f0e21391511f5035f1b4feb9",
"index": 646,
"step-1": "<mask token>\n\n\nclass Base(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n self.schemas = {}\n self.session = requests.Session()\n self.session.headers.update({'x-apikey': SETTINGS['APIKEY']})\... | [
8,
12,
13,
14,
16
] |
<|reserved_special_token_0|>
def isHammerHangman(high, low, open, close):
body = abs(open - close)
leg = min(open, close) - low
return leg / body >= 2.0 and high / max(open, close) <= 1.08
def isEngulfing(df, bottom=True):
open_0 = df['open'][-1]
close_0 = df['close'][-1]
open_1 = df['open']... | flexible | {
"blob_id": "6e739c30b3e7c15bd90b74cfd5a1d6827e863a44",
"index": 4413,
"step-1": "<mask token>\n\n\ndef isHammerHangman(high, low, open, close):\n body = abs(open - close)\n leg = min(open, close) - low\n return leg / body >= 2.0 and high / max(open, close) <= 1.08\n\n\ndef isEngulfing(df, bottom=True):... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def setup(app: Application):
app.register_run_task(multiply)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def multiply():
print('multiply', 2 * 2)
def setup(app: Application):
app.register_run_tas... | flexible | {
"blob_id": "760a62a94347171eb9e40015c0c43d72df8f4fc8",
"index": 1463,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef setup(app: Application):\n app.register_run_task(multiply)\n",
"step-3": "<mask token>\n\n\ndef multiply():\n print('multiply', 2 * 2)\n\n\ndef setup(app: Application):\n ... | [
0,
1,
2,
3
] |
from scipy.cluster.hierarchy import dendrogram, linkage
from get_train import get, pre
import matplotlib.pyplot as plt
#%%
index = [
'BAC',
'JPM',
'GS',
'C',
'AAPL',
'IBM',
'MSFT',
'ORCL'
]
years = [
2010,
2013,
... | normal | {
"blob_id": "8279f8a80d96a7231e35100d2c39fa5e1f34f5f5",
"index": 9777,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfig.tight_layout()\nfig.subplots_adjust(wspace=0.05)\n<mask token>\nfor year in years:\n train = get(year, features, index)\n train = pre(train)\n for method in methods:\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class PLTT(Editable):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def define(self, clr):
self.clr = clr
self.string('magic', length=4, default='PLTT')
self.uint32('size_')
self.uint32('format')
... | flexible | {
"blob_id": "2fadc5c90d1bae14c57fc3bf02582e12aa8abdf6",
"index": 790,
"step-1": "<mask token>\n\n\nclass PLTT(Editable):\n <mask token>\n <mask token>\n <mask token>\n\n def define(self, clr):\n self.clr = clr\n self.string('magic', length=4, default='PLTT')\n self.uint32('size_'... | [
13,
14,
15,
16,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def city_country(city, country):
"""Name a city and the country it resides in seperated by a comma."""
print(f'"{city.title()}, {country.title()}"\n')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def city_country(city, country):
... | flexible | {
"blob_id": "2866ecf69969b445fb15740a507ddecb1dd1762d",
"index": 3395,
"step-1": "<mask token>\n",
"step-2": "def city_country(city, country):\n \"\"\"Name a city and the country it resides in seperated by a comma.\"\"\"\n print(f'\"{city.title()}, {country.title()}\"\\n')\n\n\n<mask token>\n",
"step-3... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class SupportSetManager(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, datasets, config, sample_per_class):
self.config = config
TEXT, LABEL, train, dev, test = datasets[0]
self.TEXT = TEXT
self.sample_per... | flexible | {
"blob_id": "13a2814e8744c6c09906d790185ed44fc2b3f23e",
"index": 3642,
"step-1": "<mask token>\n\n\nclass SupportSetManager(object):\n <mask token>\n <mask token>\n\n def __init__(self, datasets, config, sample_per_class):\n self.config = config\n TEXT, LABEL, train, dev, test = datasets[0... | [
6,
8,
9,
10,
12
] |
"""game"""
def get_word_score(word_1, n_1):
"""string"""
# import string
# key = list(string.ascii_lowercase)
# value = []
# x=1
sum_1 = 0
# for i in range(0, 26):
# value.append(x)
# x+=1
# dictionary_ = dict(zip(key, value))
# print(dictionary_)
dictionary_ = {'... | normal | {
"blob_id": "325708d5e8b71bad4806b59f3f86a737c1baef8d",
"index": 3976,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_word_score(word_1, n_1):\n \"\"\"string\"\"\"\n sum_1 = 0\n dictionary_ = {'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2,\n 'h': 4, 'i': 1, 'j': 8, 'k... | [
0,
1,
2,
3,
4
] |
from flask import Flask
from apis import api
app = Flask(__name__)
app.config.from_object('config')
api.init_app(app)
if __name__ == "__main__":
app.run() | normal | {
"blob_id": "f4ea36c3154f65c85647da19cfcd8a058c507fe1",
"index": 4992,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp.config.from_object('config')\napi.init_app(app)\nif __name__ == '__main__':\n app.run()\n",
"step-3": "<mask token>\napp = Flask(__name__)\napp.config.from_object('config')\napi.... | [
0,
1,
2,
3,
4
] |
from .interface import AudioInterface
from .config import AudioConfig
from .buffer import CustomBuffer
| normal | {
"blob_id": "cc33d0cf1b922a6b48fb83be07acb35a62372f2e",
"index": 8260,
"step-1": "<mask token>\n",
"step-2": "from .interface import AudioInterface\nfrom .config import AudioConfig\nfrom .buffer import CustomBuffer\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import base64
code=b'CmltcG9ydCBweW1vbmdvCmltcG9ydCByYW5kb20KaW1wb3J0IHJlCmltcG9ydCBzdHJpbmcKaW1wb3J0IHN5cwppbXBvcnQgZ2V0b3B0CmltcG9ydCBwcHJpbnQKCiMgQ29weXJpZ2h0IDIwMTUKIyBNb25nb0RCLCBJbmMuCiMgQXV0aG9yOiBBbmRyZXcgRXJsaWNoc29uICAgYWplQDEwZ2VuLmNvbQojCiMgSWYgeW91IGFyZSBhIHN0dWRlbnQgYW5kIHJlYWRpbmcgdGhpcyBjb2RlLCB0dXJuIGJ... | normal | {
"blob_id": "c7f26978333c7e6cccf7451ea5d10511a66b62c2",
"index": 1908,
"step-1": "<mask token>\n",
"step-2": "<mask token>\neval(compile(base64.b64decode(code), '<string>', 'exec'))\n",
"step-3": "<mask token>\ncode = (\n b'CmltcG9ydCBweW1vbmdvCmltcG9ydCByYW5kb20KaW1wb3J0IHJlCmltcG9ydCBzdHJpbmcKaW1wb3J0IH... | [
0,
1,
2,
3,
4
] |
import serial
import time
import struct
# Assign Arduino's serial port address
# Windows example
# usbport = 'COM3'
# Linux example
# usbport = '/dev/ttyUSB0'
# MacOSX example
# usbport = '/dev/tty.usbserial-FTALLOK2'
# basically just see what ports are open - >>> ls /dev/tty*
# Set up s... | normal | {
"blob_id": "6c98be473bf4cd458ea8a801f8b1197c9d8a07b3",
"index": 3514,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntime.sleep(2)\n\n\ndef write(i):\n ser.write(struct.pack('>BBB', 255, 0, i))\n\n\nwrite(0)\ntime.sleep(1)\n",
"step-3": "<mask token>\nusbport = '/dev/ttyS3'\nser = serial.Serial(usb... | [
0,
2,
3,
4,
5
] |
"""
Написать программу, которая принимает строку
и выводит строку без пробелов и ее длину.
Для удаления пробелов реализовать доп функцию.
""" | normal | {
"blob_id": "1eab2ddda6fdd71db372e978caa6e7d24c7fe78e",
"index": 7724,
"step-1": "<mask token>\n",
"step-2": "\"\"\"\n Написать программу, которая принимает строку\n и выводит строку без пробелов и ее длину.\n Для удаления пробелов реализовать доп функцию.\n\"\"\"",
"step-3": null,
"step-4": null,... | [
0,
1
] |
# Generated by Django 3.1.2 on 2021-02-13 14:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('post', '0014_profilepic_user'),
]
operations = [
migrations.CreateModel(
name='profile_pic',
fields=[
... | normal | {
"blob_id": "bf05a096956ca4f256832e2fc6659d42c5611796",
"index": 6712,
"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 = [('post', '001... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(frase)
for vocal in vocales:
conteo_vocales = frase.count(vocal)
mensaje = f'En la frase hay {conteo_vocales} veces, la vocal{vocal}'
resultado.append(mensaje)
for elemento in resultado:
print(elemento)
<|r... | flexible | {
"blob_id": "f0a03f9a6dc78d01455913f7db3ab1948b19ea63",
"index": 6250,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(frase)\nfor vocal in vocales:\n conteo_vocales = frase.count(vocal)\n mensaje = f'En la frase hay {conteo_vocales} veces, la vocal{vocal}'\n resultado.append(mensaje)\nfor ... | [
0,
1,
2,
3
] |
from django.db import models
class Link(models.Model):
text = models.CharField(max_length=100)
link = models.URLField()
def __str__(self):
return self.text
| normal | {
"blob_id": "61a58b934c6663e87824e4f9f9ffd92c3236947c",
"index": 7930,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Link(models.Model):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Link(models.Model):\n <mask token>\n <mask token>\n\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Batch:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class MyIterator(data.Iterator):
def create_batches(self):
if self.train:
def pool(d, random_shuffler):
for p in data.batch(d, self.b... | flexible | {
"blob_id": "57bc34c6a23c98fd031ea6634441d4d135c06590",
"index": 8694,
"step-1": "<mask token>\n\n\nclass Batch:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MyIterator(data.Iterator):\n\n def create_batches(self):\n if self.train:\n\n def pool(d, random_shuffler):\n ... | [
7,
14,
17,
18,
21
] |
#time:2020-11-28
import xlrd #读取库
def get_teacherData():
excelDir = r'../data/松勤-教管系统接口测试用例-v1.4.xls'
workBook = xlrd.open_workbook(excelDir, formatting_info=True) # 保存原样---样式
# 2-操作对应的用例表
workSheet = workBook.sheet_by_name('3-老师模块') # 通过表名获取
dataList = []
for cnt in range(1, 2): # 到第四行
... | normal | {
"blob_id": "d7dee3311e202ae50172077940fc625f1cc6836d",
"index": 1429,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_teacherData():\n excelDir = '../data/松勤-教管系统接口测试用例-v1.4.xls'\n workBook = xlrd.open_workbook(excelDir, formatting_info=True)\n workSheet = workBook.sheet_by_name('3-老... | [
0,
1,
2,
3,
4
] |
from flask import Flask, jsonify
import dataExtraction as dataEx
from flask_cors import CORS,cross_origin
from analyseSentiment import twitterDataExtaraction
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/scrapingDB"
mongo = PyMongo(app)
db = mongo.db
cors ... | normal | {
"blob_id": "17505f5c14190df3311c04c19f687937481b920b",
"index": 1168,
"step-1": "<mask token>\n\n\n@app.route('/visualisation/confirmed/<string:country>')\n@cross_origin()\ndef confirmedCases(country):\n array = dataEx.getData('Confirmed', country).tolist()\n return jsonify({'confirmed': array})\n\n\n@app... | [
17,
18,
19,
21,
22
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(data[0]['url'])
<|reserved_special_token_1|>
<|reserved_special_token_0|>
client = pymongo.MongoClient(host='127.0.0.1', port=27017)
db = client.NBA_china_spider
collection = db.data
data = [title for title in collection.... | flexible | {
"blob_id": "52ebe80e2d520bf07b21dc668223348002eb6d42",
"index": 2790,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(data[0]['url'])\n",
"step-3": "<mask token>\nclient = pymongo.MongoClient(host='127.0.0.1', port=27017)\ndb = client.NBA_china_spider\ncollection = db.data\ndata = [title for titl... | [
0,
1,
2,
3,
4
] |
from ContactBook import ContactBook
import csv
def run():
contact_book = ContactBook()
with open("22_agenda/contactos.csv",'r') as f:
reader = csv.reader(f)
for idx,row in enumerate(reader):
if idx == 0:
continue
else:
contact_bo... | normal | {
"blob_id": "f5831b84c1177d8b869db05d332bd364b3f72fff",
"index": 4282,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run():\n contact_book = ContactBook()\n with open('22_agenda/contactos.csv', 'r') as f:\n reader = csv.reader(f)\n for idx, row in enumerate(reader):\n ... | [
0,
1,
2,
3,
4
] |
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import weather_forecast
from weather_forecast import forecast
from googlesearch import search
from youtube_search import YoutubeSearch... | normal | {
"blob_id": "60354f25f55136d4e873d118cfe048cf08c06e39",
"index": 1587,
"step-1": "<mask token>\n\n\ndef game():\n for i in range(1000):\n request = input('Auto-Bot at your service. Please state your request. '\n )\n if request == 'google':\n query = input('Search: ')\n ... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python
from application import app
import pprint
import sys
URL_PREFIX = '/pub/livemap'
class LoggingMiddleware(object):
def __init__(self, app):
self._app = app
def __call__(self, environ, resp):
errorlog = environ['wsgi.errors']
pprint.pprint(('REQUEST', environ), st... | normal | {
"blob_id": "a2aa615ac660f13727a97cdd2feaca8f6e457da4",
"index": 4830,
"step-1": "<mask token>\n\n\nclass LoggingMiddleware(object):\n <mask token>\n <mask token>\n\n\nclass ScriptNameEdit(object):\n\n def __init__(self, app):\n self.app = app\n\n def __call__(self, environ, start_response):\n... | [
4,
5,
6,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestMember(TestCase):
def test_here(self):
member = Member('John', 'Doe')
self.assertFalse(member.attended)
member.here()
self.assertTrue(member.attended)
<|reserved_special_token_1|>... | flexible | {
"blob_id": "a6713a4edece14a88bd9c8ddd483ff8e16acdbcc",
"index": 9695,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestMember(TestCase):\n\n def test_here(self):\n member = Member('John', 'Doe')\n self.assertFalse(member.attended)\n member.here()\n self.assertT... | [
0,
2,
3,
4,
5
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.