code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class QueueMaster(QueueSubscriberManager, QueuePublisherManager, QueueLifecycleManager): <|reserved_special_token_0|> pass <|reserved_special_token_1|> <|reserved_special_token_0|> class QueueMaster(QueueSubscri...
flexible
{ "blob_id": "b2b961c6ff1d975d80a84be361321ab44dc026a0", "index": 2134, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass QueueMaster(QueueSubscriberManager, QueuePublisherManager,\n QueueLifecycleManager):\n <mask token>\n pass\n", "step-3": "<mask token>\n\n\nclass QueueMaster(QueueSub...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FragmentMakoChain(Fragment): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, content=None, base=None, lookup_dirs=None): """ К...
flexible
{ "blob_id": "9d904225afd4f4d0cf338ae16f031f8ab41639ad", "index": 234, "step-1": "<mask token>\n\n\nclass FragmentMakoChain(Fragment):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, content=None, base=None, lookup_dirs=None):\n \"\"\"\n ...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class Resources(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "567076af26b8c93c68647103aeddf43aeb24db13", "index": 2054, "step-1": "<mask token>\n\n\nclass Resources(object):\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 @property\n def ...
[ 22, 28, 32, 36, 40 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from app import db, session, Node_Base, Column, relationship from datetime import datetime import models import os import json
flexible
{ "blob_id": "1711f74fae36ba761a7c0d84b95271b4e5043d27", "index": 6312, "step-1": "<mask token>\n", "step-2": "from app import db, session, Node_Base, Column, relationship\nfrom datetime import datetime\nimport models\nimport os\nimport json\n", "step-3": null, "step-4": null, "step-5": null, "step-ids"...
[ 0, 1 ]
<|reserved_special_token_0|> class BotonComando: <|reserved_special_token_0|> def __init__(self, *args, **kwargs): self.pilas = args[0] if len(args) and type(args[0] ) is pilasengine.Pilas else kwargs['pilas'] if kwargs.get('pilas', None) else None if self.pilas == Non...
flexible
{ "blob_id": "266b8958b761ee7266a8098aeaecb8b6c2a24a2a", "index": 1757, "step-1": "<mask token>\n\n\nclass BotonComando:\n <mask token>\n\n def __init__(self, *args, **kwargs):\n self.pilas = args[0] if len(args) and type(args[0]\n ) is pilasengine.Pilas else kwargs['pilas'] if kwargs.get(...
[ 10, 12, 13, 14, 19 ]
# The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: # 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... # By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word...
normal
{ "blob_id": "61019a5439a6f0c1aee51db9b048a26fb9b5bf5d", "index": 8257, "step-1": "<mask token>\n\n\ndef is_triangle_number(n):\n root = (-1 + math.sqrt(1 + 8.0 * n)) / 2\n if root.is_integer():\n return True\n return False\n\n\ndef calculation():\n count = 0\n for word in string_list:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ChoiceTargetNumbers(QWidget): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChoiceTargetNumbers(QWidget): <|reserved_special_token_0|> def __init__(self, parent=None) ->None: QW...
flexible
{ "blob_id": "291cd789ac3ab7b794be8feafe0f608ad0c081d7", "index": 9674, "step-1": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n\n def __init__(self, parent=None) ->None:\n ...
[ 1, 2, 3, 4, 5 ]
import fnmatch import tempfile from contextlib import contextmanager from os import ( makedirs, unlink, ) from os.path import ( abspath, basename, dirname, exists, join, sep, ) from re import ( compile, escape, ) from typing import ( Any, Dict, List, Type, ) from ...
normal
{ "blob_id": "1a5c189b9a2bed35fbbb7df40ec80a1d02402d7f", "index": 6860, "step-1": "<mask token>\n\n\nclass TransferAction(BaseAction):\n <mask token>\n action_type = 'transfer'\n staging = STAGING_ACTION_LOCAL\n\n\nclass CopyAction(BaseAction):\n \"\"\" This action indicates that the Pulsar client sho...
[ 84, 86, 97, 122, 127 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> config.read('dwh.cfg') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> config = configparser.ConfigParser() config.read('dwh.cfg') schema = """CREATE SCHEMA IF NOT EXISTS public; ...
flexible
{ "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 ]
from sklearn.svm import SVC from helper_functions import * from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.utils import shuffle from sklearn.preprocessing import StandardScaler import matplotlib.image as mpimg import matplotlib.pyplot as plt import glob impor...
normal
{ "blob_id": "89db4431a252d024381713eb7ad86346814fcbe4", "index": 7955, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_image(image):\n draw_image = np.copy(image)\n window_list_32 = slide_window(image, y_start_stop=y_start_stop_32,\n xy_window=(32, 32), xy_overlap=xy_overlap_3...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in vcf: if 'CHR' in line: continue cols = line.rstrip('\n').split() values = float(cols[4]) maf.append(values) <|reserved_special_token_0|> ax.hist(maf, bins=100, density=True) plt.tight_layout() f...
flexible
{ "blob_id": "dd79ffe3922494bcc345aec3cf76ed9efeb5185c", "index": 3916, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in vcf:\n if 'CHR' in line:\n continue\n cols = line.rstrip('\\n').split()\n values = float(cols[4])\n maf.append(values)\n<mask token>\nax.hist(maf, bins=100,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_network(cfg): arch = cfg.network heads = cfg.heads head_conv = cfg.head_conv num_layers = int(arch[arch.find('_') + 1:]) if '_' in arch else 0 arch = arch[:arch.find('_')] if '_' in arch else arch ...
flexible
{ "blob_id": "7df94c86ff837acf0f2a78fe1f99919c31bdcb9b", "index": 4881, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_network(cfg):\n arch = cfg.network\n heads = cfg.heads\n head_conv = cfg.head_conv\n num_layers = int(arch[arch.find('_') + 1:]) if '_' in arch else 0\n arch = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', PasswordList.as_view())] <|reserved_special_token_1|> from django.urls import path from .views import PasswordList urlpatterns = [path('', PasswordList.as_view())] <|reserved_special_token_1|> from dj...
flexible
{ "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 ]
import pyodbc print("Primera consulta SQL Server") servidor="LOCALHOST\SQLEXPRESS" bbdd="HOSPITAL" usuario="SA" password="azure" #CADENA CONEXION CON SEGURIDAD SQL SERVER (REMOTO) cadenaconexion=("DRIVER={ODBC Driver 17 for SQL Server};SERVER=" + servidor + "; DATABASE=" + bbdd + "; UID=" + usuario + "; PWD=" + passw...
normal
{ "blob_id": "0438f92aa9a36eaf1059244ec3be4397381f7a86", "index": 6703, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Primera consulta SQL Server')\n<mask token>\nprint('Intentando conectar...')\n<mask token>\nprint('Conectado!!!')\n<mask token>\ncursor.execute(sql)\n<mask token>\nprint(row)\n<mas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestPipRequirement: def is_packaging_subclass(self): r = PipRequirement('prefect') assert isinstance(r, packaging.requirements.Requirement) def test_can_be_used_in_pydantic_model(self): class MyModel(pydantic.BaseModel): req: PipRequir...
flexible
{ "blob_id": "64366e8532ffe05db7e7b7313e1d573c78a4e030", "index": 796, "step-1": "<mask token>\n\n\nclass TestPipRequirement:\n\n def is_packaging_subclass(self):\n r = PipRequirement('prefect')\n assert isinstance(r, packaging.requirements.Requirement)\n\n def test_can_be_used_in_pydantic_mod...
[ 6, 7, 8, 10, 11 ]
<|reserved_special_token_0|> class SkippableSeq(keras.utils.Sequence): def __init__(self, seq): super(SkippableSeq, self).__init__() self.start = 0 self.seq = seq def __iter__(self): return self def __next__(self): res = self.seq[self.start] self.start = ...
flexible
{ "blob_id": "2417dd4f3787742832fec53fec4592165d0fccfc", "index": 9513, "step-1": "<mask token>\n\n\nclass SkippableSeq(keras.utils.Sequence):\n\n def __init__(self, seq):\n super(SkippableSeq, self).__init__()\n self.start = 0\n self.seq = seq\n\n def __iter__(self):\n return se...
[ 9, 10, 11, 12, 13 ]
#!/usr/bin/python import argparse import contextlib import os.path import shutil import subprocess import sys import tempfile from Bio import SeqIO BOOTSTRAP_MODES = 'a', # Some utilities @contextlib.contextmanager def sequences_in_format(sequences, fmt='fasta', **kwargs): with tempfile.NamedTemporaryFile(**kwa...
normal
{ "blob_id": "28532fe798b6a764bec7ea511ba9e66a1d096b6f", "index": 9364, "step-1": "#!/usr/bin/python\n\nimport argparse\nimport contextlib\nimport os.path\nimport shutil\nimport subprocess\nimport sys\nimport tempfile\n\nfrom Bio import SeqIO\n\nBOOTSTRAP_MODES = 'a',\n\n# Some utilities\n@contextlib.contextmanag...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> host = 'datavis.cauuh8vzeelb.us-east-1.rds.amazonaws.com' database = 'top5' user = 'teamwonder' password = 'visproject' Gentrifying = [10002, 10003, 10009, 10026, 10027, 10029, 10030, 10031, 10032, 10033, 10034, 10035, 10037,...
flexible
{ "blob_id": "0ebf5646ee9693b7d0c1de61436e05b3725b2c9f", "index": 2560, "step-1": "<mask token>\n", "step-2": "<mask token>\nhost = 'datavis.cauuh8vzeelb.us-east-1.rds.amazonaws.com'\ndatabase = 'top5'\nuser = 'teamwonder'\npassword = 'visproject'\nGentrifying = [10002, 10003, 10009, 10026, 10027, 10029, 10030,...
[ 0, 1, 2, 3 ]
TRAIN_INPUT_PATH = "~/Projects/competitions/titanic/data/train.csv" TEST_INPUT_PATH = "~/Projects/competitions/titanic/data/test.csv" OUTPUT_PATH = "output/" TRAIN_VAL_SPLIT = 0.75 RANDOM_SEED = 42 MODEL = "LOGISTIC_REGRESSION" LOG_PATH = "logs/"
normal
{ "blob_id": "f1f708f00e05941c9a18a24b9a7556558583c3c7", "index": 738, "step-1": "<mask token>\n", "step-2": "TRAIN_INPUT_PATH = '~/Projects/competitions/titanic/data/train.csv'\nTEST_INPUT_PATH = '~/Projects/competitions/titanic/data/test.csv'\nOUTPUT_PATH = 'output/'\nTRAIN_VAL_SPLIT = 0.75\nRANDOM_SEED = 42\...
[ 0, 1, 2 ]
N, M, T = map(int, input().split()) AB = [list(map(int, input().split())) for i in range(M)] now_time = 0 battery = N ans = 'Yes' for a, b in AB: # カフェに付くまでにの消費 battery -= a-now_time if battery <= 0: ans = 'No' break # カフェでの充電 battery += b-a battery = min(battery, N) # 現...
normal
{ "blob_id": "15a7f6a63536ed24b6cf17395643476c689ec99b", "index": 8499, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor a, b in AB:\n battery -= a - now_time\n if battery <= 0:\n ans = 'No'\n break\n battery += b - a\n battery = min(battery, N)\n now_time = b\nbattery -= T ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def yuh(): corpus_path = '/tmp/data.txt' text = open(corpus_path, 'rb').read().decode(encoding='utf-8') text = preprocessText(text) corpus_words = corpusToList(text) map(str.strip, corpus_words) vocab = sorted(set(corpus_words)) print('Corpus length (in words):...
flexible
{ "blob_id": "5ff0c6bde8f3ffcb1f5988b0bbd1dfdd7fa2e818", "index": 8800, "step-1": "<mask token>\n\n\ndef yuh():\n corpus_path = '/tmp/data.txt'\n text = open(corpus_path, 'rb').read().decode(encoding='utf-8')\n text = preprocessText(text)\n corpus_words = corpusToList(text)\n map(str.strip, corpus_...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Board) <|reserved_special_token_1|> from django.contrib import admin from .models import Board admin.site.register(Board) <|reserved_special_token_1|> from django.contrib import admin # from .models impor...
flexible
{ "blob_id": "ea323a8398ceff8496e7f8d0f365d50f3115e954", "index": 5228, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Board)\n", "step-3": "from django.contrib import admin\nfrom .models import Board\nadmin.site.register(Board)\n", "step-4": "from django.contrib import admin\n# fr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while i >= 0: a = input('Name is: ') print(a) if a == 'Zeal': print('Name_Zeal.\n Age_16.\n Interested in Programming.') elif a == 'HanZaw': print('Name_Han Zaw.\n Age_18.\n Studying Cod...
flexible
{ "blob_id": "38184ed4117b1b7dcf9e135ce8612fa13c44a99c", "index": 5891, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i >= 0:\n a = input('Name is: ')\n print(a)\n if a == 'Zeal':\n print('Name_Zeal.\\n Age_16.\\n Interested in Programming.')\n elif a == 'HanZaw':\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def is_palindrome_v2(word): """(string)->boolean returns if word is palindrome (ignores white space)""" if len(word) < 2: return True if not word[0].isalpha() or not word[1].isalpha(): if word[0].isalpha(): return i...
flexible
{ "blob_id": "1fbe269c9c09fe58b0df1ebd4354cf9dc31a2f90", "index": 7739, "step-1": "<mask token>\n", "step-2": "def is_palindrome_v2(word):\n \"\"\"(string)->boolean\n returns if word is palindrome (ignores white space)\"\"\"\n if len(word) < 2:\n return True\n if not word[0].isalpha() or not ...
[ 0, 1, 2 ]
from pylab import * import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook import random import time from scipy.misc import imread from scipy.misc import imresize import matplotlib.image as mpimg import os from scipy.ndimage import filters import urllib import sys from PIL import Image fro...
normal
{ "blob_id": "ccb3ec8e367881710c437e7ae53082a1bb0137e5", "index": 9335, "step-1": "from pylab import *\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.cbook as cbook\nimport random\nimport time\nfrom scipy.misc import imread\nfrom scipy.misc import imresize\nimport matplotlib.image as mpim...
[ 0 ]
<|reserved_special_token_0|> class Columns(widget.Widget): def __init__(self, parent): super(Columns, self).__init__(parent) <|reserved_special_token_0|> def add_column(self): col = column.Column(self) self.children.append(col) <|reserved_special_token_0|> def on_reposit...
flexible
{ "blob_id": "e0874554c326bb11b53552e362bc8073bb57bc93", "index": 9720, "step-1": "<mask token>\n\n\nclass Columns(widget.Widget):\n\n def __init__(self, parent):\n super(Columns, self).__init__(parent)\n <mask token>\n\n def add_column(self):\n col = column.Column(self)\n self.child...
[ 4, 5, 6, 7, 8 ]
from abc import ABC, abstractmethod class Book: def __init__(self, title: str, content: str): self.title = title self.content = content class Formatter(ABC): @abstractmethod def format(self, book: Book): pass class TitleFormatter(Formatter): def format(self, book: Book) ...
normal
{ "blob_id": "d025b0719c6eecdfccb2e39a58af7842f4229c72", "index": 2678, "step-1": "<mask token>\n\n\nclass Formatter(ABC):\n <mask token>\n\n\nclass TitleFormatter(Formatter):\n\n def format(self, book: Book) ->str:\n return book.title\n\n\nclass ContentFormatter(Formatter):\n\n def format(self, b...
[ 7, 8, 10, 11 ]
# Generated by Django 2.2.1 on 2020-02-13 05:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app01', '0004_auto_20200213_1202'), ] operations = [ migrations.DeleteModel( name='Subject', ), migrations.Renam...
normal
{ "blob_id": "9b7601a5230bfd2370e73a71d141d6de68ade50f", "index": 8972, "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 = [('app01', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): N, M, K = map(int, input().split()) G = [[] for _ in range(N)] for _ in range(M): a, b, c = map(int, input().split()) a -= 1 b -= 1 G[a].append((c, b)) G[b].append((c, a)) ans = 0 used = [] marked = [False] * N ...
flexible
{ "blob_id": "13b2e05f12c6d0cd91e89f01e7eef610b1e99856", "index": 9158, "step-1": "<mask token>\n\n\ndef main():\n N, M, K = map(int, input().split())\n G = [[] for _ in range(N)]\n for _ in range(M):\n a, b, c = map(int, input().split())\n a -= 1\n b -= 1\n G[a].append((c, b)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_MainWindow(object): <|reserved_special_token_0|> def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate('MainWindow', 'MainWindo...
flexible
{ "blob_id": "f4094a81f90cafc9ae76b8cf902221cbdbc4871a", "index": 6711, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n\n def retranslateUi(self, MainWindow):\n _translate = QtCore.QCoreApplication.translate\n MainWindow.setWindowTitle(_...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "1f7d770106ea8e7d1c0bb90e1fc576b7ee2f0220", "index": 381, "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 = [('shop', '0003...
[ 0, 1, 2, 3, 4 ]
from django.urls import path, include from django.conf.urls import url, re_path #from rest_framework.urlpatterns import format_suffix_patterns from .views import (HomePageView, WordViewSet, WordNormalViewSet, TextViewSet, TextNormalViewSet, TextTagViewSet, TagSetViewSet, TagViewSet...
normal
{ "blob_id": "991b124d365443744c946b258504c97e9076dcea", "index": 7627, "step-1": "<mask token>\n\n\nclass OptionalSlashRouter(DefaultRouter):\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.trailing_slash = '/?'\n\n\n<mask token>\n", "step-2": "<mask token>\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class CommunicationController: <|reserved_special_token_0|> def sendCommand(self, right, back, left): self.count += 1 if self.count >= BUFFER_RESET_BOUND: board.reset_output_buffer() board.reset_input_buffer() self.count = 0 ...
flexible
{ "blob_id": "48291ab3deb1ca1ba672d3e642d55635a7270171", "index": 955, "step-1": "<mask token>\n\n\nclass CommunicationController:\n <mask token>\n\n def sendCommand(self, right, back, left):\n self.count += 1\n if self.count >= BUFFER_RESET_BOUND:\n board.reset_output_buffer()\n ...
[ 2, 3, 4, 5, 6 ]
#####coding=utf-8 import re import urllib.request import sys import redis from urllib.error import URLError, HTTPError import urllib.parse # /redis/cluster/23:1417694197540 def con(): pool = redis.ConnectionPool(host='ap2.jd.local', port=5360, password='/redis/cluster/1:1803528818953446384') r = redis.Stric...
normal
{ "blob_id": "4863581a1a557186ceee8d544d1a996082edcf2c", "index": 4644, "step-1": "<mask token>\n\n\ndef con():\n pool = redis.ConnectionPool(host='ap2.jd.local', port=5360, password=\n '/redis/cluster/1:1803528818953446384')\n r = redis.StrictRedis(connection_pool=pool)\n r.set('foo', 'bar')\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def create_context(appName): """ Creates Spark HiveContext """ logger.info('Creating Spark context - may take some while') conf = SparkConf() conf.set('spark.hadoop.validateOutputSpecs', 'false') sc = SparkContext(appName=appName, conf=conf) return sc def...
flexible
{ "blob_id": "d4b432735a112ccb293bf2f40929846b4ce34cd0", "index": 9348, "step-1": "<mask token>\n\n\ndef create_context(appName):\n \"\"\"\n Creates Spark HiveContext\n \"\"\"\n logger.info('Creating Spark context - may take some while')\n conf = SparkConf()\n conf.set('spark.hadoop.validateOutp...
[ 4, 5, 6, 7, 8 ]
import requests import os from jpmesh import parse_mesh_code from tqdm import tqdm url_login='https://platform.openquake.org/account/login/' client = requests.session() client.get(url_login) # Identification for openquake platform login_data = {'username':'###','password':'###'} r1=client.post(url_login,data=login_dat...
normal
{ "blob_id": "63a40282f16a7f27c118594f1a9468749682594f", "index": 420, "step-1": "import requests\nimport os\nfrom jpmesh import parse_mesh_code\nfrom tqdm import tqdm\n\nurl_login='https://platform.openquake.org/account/login/'\nclient = requests.session()\nclient.get(url_login)\n# Identification for openquake p...
[ 0 ]
<|reserved_special_token_0|> class Filter: <|reserved_special_token_0|> @classmethod def get_incorrect_vector_example(cls, file_list, example_number): """含まれる瞬時データの内指定した個数のデータがそれぞれ持つ誤ベクトル数""" incorrect_vector_list = [] try: file_list = file_list[0:example_number] ...
flexible
{ "blob_id": "5d4585dc96d4ebdbc15b7382038cfea959c9a6f3", "index": 2495, "step-1": "<mask token>\n\n\nclass Filter:\n <mask token>\n\n @classmethod\n def get_incorrect_vector_example(cls, file_list, example_number):\n \"\"\"含まれる瞬時データの内指定した個数のデータがそれぞれ持つ誤ベクトル数\"\"\"\n incorrect_vector_list = [...
[ 5, 9, 10, 11, 12 ]
<|reserved_special_token_0|> class Student(models.Model): name = models.CharField(max_length=70) cpf = models.CharField(max_length=14) birth_date = models.DateField() city = models.CharField(max_length=50) registration_date = models.DateTimeField(auto_now_add=True) email = models.EmailField(ma...
flexible
{ "blob_id": "0584ff5cb252fba0fe1fc350a5fb023ab5cbb02b", "index": 6750, "step-1": "<mask token>\n\n\nclass Student(models.Model):\n name = models.CharField(max_length=70)\n cpf = models.CharField(max_length=14)\n birth_date = models.DateField()\n city = models.CharField(max_length=50)\n registratio...
[ 3, 7, 8, 9, 11 ]
import os import sys sys.path.append("..") import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import Ridge from sklearn.model_selection import train_test_split, StratifiedKFold from sklearn.metrics import accuracy_score import config from mikasa.common import timer fro...
normal
{ "blob_id": "23f0ba622097eb4065337ea77ea8104a610d6857", "index": 6317, "step-1": "<mask token>\n\n\ndef run_train(model_name, base_trainer, X, y):\n cv = StratifiedKFold(n_splits=3, shuffle=True, random_state=config.SEED)\n trainer = RSACVTrainer(cv, base_trainer)\n trainer.fit(X=X, y=y, random_state=co...
[ 3, 4, 5, 6, 7 ]
import numpy from PIL import Image, ImageDraw def start(): # ---------------------------- # Set values # ---------------------------- image_file = 'sample.png' # Coordinates, where [0,0] is top left corner top_left_corner = [100, 100] # [x, y] bottom_right_corner = [200, 200] # [x, y] ...
normal
{ "blob_id": "84476e1793242bf3bae51263c2db28ff555c25d7", "index": 1104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef start():\n image_file = 'sample.png'\n top_left_corner = [100, 100]\n bottom_right_corner = [200, 200]\n img = Image.open(image_file)\n top_left_x = top_left_corner...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python #coding:gbk """ Author: pengtao --<pengtao@baidu.com> Purpose: 1. 管理和交互式调用hadoop Job的框架 History: 1. 2013/12/11 created """ import sys import inspect import cmd import readline #import argparse #from optparse import (OptionParser, BadOptionError, AmbiguousOptionError) from job i...
normal
{ "blob_id": "9178d39a44cfb69e74b4d6cd29cbe56aea20f582", "index": 3984, "step-1": "#!/usr/bin/env python\n#coding:gbk\n\n\"\"\"\n Author: pengtao --<pengtao@baidu.com>\n Purpose: \n 1. 管理和交互式调用hadoop Job的框架\n History:\n 1. 2013/12/11 created\n\"\"\"\n\n\n\nimport sys\nimport inspect\nimport cmd\nimport r...
[ 0 ]
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # FISL Live # ========= # Copyright (c) 2010, Triveos Tecnologia Ltda. # License: AGPLv3 from os.path import * from datetime import datetime from google.appengine.api import users from google.appengine.ext import db from google.appengine.ext import webapp from google....
normal
{ "blob_id": "64ed3c512894902f85d619020b78338e228dddb6", "index": 4380, "step-1": "<mask token>\n\n\nclass Page(webapp.RequestHandler):\n\n def get(self):\n if users.get_current_user():\n url = users.create_logout_url(self.request.uri)\n linktext = 'Logout'\n user = user...
[ 5, 6, 7, 9, 10 ]
# Generated by Django 2.2.3 on 2019-07-18 06:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('juchu', '0003_auto_20190718_1500'), ] operations = [ migrations.RemoveField( mode...
normal
{ "blob_id": "b0174b6f6c33434ff9b5cdb59531502899d8348a", "index": 4262, "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 = [('juchu', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .personal_questions import * from .survey_questions import *
flexible
{ "blob_id": "a8f2d527e9824d3986f4bb49c3cc75fd0d999bf7", "index": 3290, "step-1": "<mask token>\n", "step-2": "from .personal_questions import *\nfrom .survey_questions import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import re from blessings import Terminal from validate_email import validate_email import requests import sys _site_ = sys.argv[1] _saida_ = sys.argv[2] _file_ = open(_saida_, "w") t = Terminal() r = requests.get(_site_, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6....
normal
{ "blob_id": "b52269237d66ea50c453395b9536f25f1310bf2e", "index": 287, "step-1": "#!/usr/bin/env python2.7\n# -*- coding: utf-8 -*-\nimport re\nfrom blessings import Terminal\nfrom validate_email import validate_email\nimport requests\nimport sys\n_site_ = sys.argv[1]\n_saida_ = sys.argv[2]\n_file_ = open(_saida_...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(len(c)) <|reserved_special_token_1|> c = 'こ に ち わ ' print(len(c)) <|reserved_special_token_1|> c = "こ に ち わ " print (len(c))
flexible
{ "blob_id": "26f466a6a2fd09bb108ca89e4537192c070ff83b", "index": 1335, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(c))\n", "step-3": "c = 'こ に ち わ '\nprint(len(c))\n", "step-4": "c = \"こ に ち わ \"\nprint (len(c))\n", "step-5": null, "step-ids": [ 0, 1, 2, 3 ] }
[ 0, 1, 2, 3 ]
from sqlalchemy import Column, MetaData, Table, BigInteger, String, DateTime, Integer from migrate import * meta = MetaData() table = Table( 'accesses', meta, Column('id', BigInteger, primary_key=True, nullable=False), Column('uuid', String(255), nullable=False), Column('created_at', DateTime), ) def...
normal
{ "blob_id": "6154979cd2853dd2bd26d1ae5df7365efa0141c2", "index": 441, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef upgrade(migrate_engine):\n meta.bind = migrate_engine\n table.create()\n\n\ndef downgrade(migrate_engine):\n meta.bind = migrate_engine\n table.drop()\n", "step-3": "...
[ 0, 2, 3, 4, 5 ]
from setuptools import setup setup( name='nodepool_harness', version='0.1dev', description='Nodepool harness', packages=['nodepool_harness', 'statsd', 'apscheduler'], install_requires=["PyYAML", "python-novaclient", "paramiko", "sqlalchemy"], entry_points = { 'console_scripts': [ ...
normal
{ "blob_id": "61ff5fae02d18d51595e8050d97244574e7d8af1", "index": 6419, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='nodepool_harness', version='0.1dev', description=\n 'Nodepool harness', packages=['nodepool_harness', 'statsd',\n 'apscheduler'], install_requires=['PyYAML', 'python-nov...
[ 0, 1, 2, 3 ]
def dot_product(a, b): ans = 0 for i in range(len(a)): ans += a[i] * b[i] return ans n = int(input()) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) print(dot_product(a, b))
normal
{ "blob_id": "fc273a286a462cb673edaa2de2ecc6b9ca631004", "index": 9824, "step-1": "<mask token>\n", "step-2": "def dot_product(a, b):\n ans = 0\n for i in range(len(a)):\n ans += a[i] * b[i]\n return ans\n\n\n<mask token>\n", "step-3": "def dot_product(a, b):\n ans = 0\n for i in range(l...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(args=None): if args: slide_show(args[0]) <|reserved_special_token_1|> from .feature import slide_show def main(args=None): if args: slide_show(args[0])
flexible
{ "blob_id": "8680c033662a89ed6fc73e65ec544b93558c4208", "index": 688, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(args=None):\n if args:\n slide_show(args[0])\n", "step-3": "from .feature import slide_show\n\n\ndef main(args=None):\n if args:\n slide_show(args[0])\n"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.config.from_object(Config) <|reserved_special_token_0|> app.task_queue.empty() <|reserved_special_token_0|> app.eval_queue.empty() <|reserved_special_token_0|> app.register_blueprint(api_bp, url_prefix='/api') <|reserved_spe...
flexible
{ "blob_id": "14e336005da1f1f3f54ea5f2892c27b58f2babf0", "index": 4794, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object(Config)\n<mask token>\napp.task_queue.empty()\n<mask token>\napp.eval_queue.empty()\n<mask token>\napp.register_blueprint(api_bp, url_prefix='/api')\n", "step-3":...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_soft(soft): return [f.arg(0) for f in soft.children()] def free_vars(fs): seen = set([]) vars = set([]) def fv(seen, vars, f): if f in seen: return seen |= {f} if f.decl().kind() == Z3_OP_UNINTERPRETED: vars |= {f}...
flexible
{ "blob_id": "c0d8f2542f9cf9a5097011c61c90073c031d2708", "index": 9831, "step-1": "<mask token>\n\n\ndef get_soft(soft):\n return [f.arg(0) for f in soft.children()]\n\n\ndef free_vars(fs):\n seen = set([])\n vars = set([])\n\n def fv(seen, vars, f):\n if f in seen:\n return\n ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class Login(QMainWindow): def __init__(self): super(Login, self).__init__() loadUi('login_UI.ui', self) self.loginButton.clicked.connect(self.loginFunction) def loginFunction(self): lgUserLine = self.lgUserLine.text() lgPassLine = self.lgP...
flexible
{ "blob_id": "a9b1cc9b928b8999450b6c95656b863c476b273b", "index": 7355, "step-1": "<mask token>\n\n\nclass Login(QMainWindow):\n\n def __init__(self):\n super(Login, self).__init__()\n loadUi('login_UI.ui', self)\n self.loginButton.clicked.connect(self.loginFunction)\n\n def loginFuncti...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ ------------------------------------------------- # @Project :experiment9 # @File :text1 # @Date :2020/10/28 09:13 # @Author :施嘉伟 # @Email :1138128021@qq.com # @Software :PyCharm ------------------------------------------------- """ import urllib.request # 发出请求,得到响应 response=ur...
normal
{ "blob_id": "b186ae7a48afbb70edf3be0d9697deed4f31e542", "index": 2258, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.geturl())\n<mask token>\nwith open('bgdGW.html', 'w', encoding='utf-8') as fp:\n fp.write(html)\nprint(response.geturl())\n", "step-3": "<mask token>\nresponse = urlli...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def parse_args(): """ Usual pythonic way of parsing command line arguments :return: all command line arguments read """ args = argparse.ArgumentParser('GODIT') args.add_argument('-d', '--sketch_size', default=256, type=int, help= 'Sketch Vector Size') a...
flexible
{ "blob_id": "1490fecd6e983c0e3093a45d77d6fb8afdb54718", "index": 203, "step-1": "<mask token>\n\n\ndef parse_args():\n \"\"\"\n Usual pythonic way of parsing command line arguments\n :return: all command line arguments read\n \"\"\"\n args = argparse.ArgumentParser('GODIT')\n args.add_argument(...
[ 5, 6, 7, 8, 10 ]
n = input("Enter a number: ") def fact(num): factorial = 1 if int(num) >= 1: for i in range (1,int(n)+1): factorial = factorial * i return factorial print(fact(n))
normal
{ "blob_id": "93b00b5c1bec38d2a4ac109f1533d3c0d9e99044", "index": 5763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fact(num):\n factorial = 1\n if int(num) >= 1:\n for i in range(1, int(n) + 1):\n factorial = factorial * i\n return factorial\n\n\n<mask token>\n", "...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- #Title: Counting summations import math limit = 201 comboList = dict() alphabet = range(1, limit) searchAlphabet = set(alphabet) def concat(a, b): return "%i %i" % (a, b) def split(n, min=1, tab=6): if concat(n,min) in comboList.keys(): if tab == 6: print " %sn = %i, ...
normal
{ "blob_id": "618a8430d50aeca1c4b9c3fba975be342cc1893f", "index": 6348, "step-1": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#Title: Counting summations\n\nimport math\n\nlimit = 201\ncomboList = dict()\nalphabet = range(1, limit)\nsearchAlphabet = set(alphabet)\ndef concat(a, b):\n\treturn \"%i %i\" % (a, b)\n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> VERSION = 0, 2, 0 <|reserved_special_token_1|> # -*- coding: utf-8 -*- """microcms package, minimalistic flatpage enhancement. THIS SOFTWARE IS UNDER BSD LICENSE. Copyright (c) 2010-2012 Daniele Tricoli <eriol@mornie.org> Rea...
flexible
{ "blob_id": "3e1c2d0c5bb30d093a99f10020af14db5436bf02", "index": 5551, "step-1": "<mask token>\n", "step-2": "<mask token>\nVERSION = 0, 2, 0\n", "step-3": "# -*- coding: utf-8 -*-\n\"\"\"microcms package, minimalistic flatpage enhancement.\n\nTHIS SOFTWARE IS UNDER BSD LICENSE.\nCopyright (c) 2010-2012 Dani...
[ 0, 1, 2 ]
#!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 import sys def sumInput(text): f = open(text, 'r') sum = 0 count = 1 for line in f: count += 1 line = line.strip() if (line[0] == '+'): sum += int(line[1:]) else: sum -= int(line[1:...
normal
{ "blob_id": "c0d71d970b2632dbf182a5ee8bad27d3e41578f6", "index": 208, "step-1": "<mask token>\n\n\ndef sumInput(text):\n f = open(text, 'r')\n sum = 0\n count = 1\n for line in f:\n count += 1\n line = line.strip()\n if line[0] == '+':\n sum += int(line[1:])\n e...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TransferAction(BaseAction): <|reserved_special_token_0|> action_type = 'transfer' staging = STAGING_ACTION_LOCAL class CopyAction(BaseAction): """ This action indicates that the Pulsar client should execute a file system copy of the corresponding path to the Pu...
flexible
{ "blob_id": "1a5c189b9a2bed35fbbb7df40ec80a1d02402d7f", "index": 6860, "step-1": "<mask token>\n\n\nclass TransferAction(BaseAction):\n <mask token>\n action_type = 'transfer'\n staging = STAGING_ACTION_LOCAL\n\n\nclass CopyAction(BaseAction):\n \"\"\" This action indicates that the Pulsar client sho...
[ 84, 86, 97, 122, 127 ]
<|reserved_special_token_0|> def func(): x = 88 <|reserved_special_token_0|> def func_y(): global y y = 101 <|reserved_special_token_0|> def func_e(): count = 0 def foo(): nonlocal count count = 12 foo() print(count) <|reserved_special_token_0|> <|reserved_spec...
flexible
{ "blob_id": "e98767fbac44f50f58c149e16124fef95b38cf71", "index": 8190, "step-1": "<mask token>\n\n\ndef func():\n x = 88\n\n\n<mask token>\n\n\ndef func_y():\n global y\n y = 101\n\n\n<mask token>\n\n\ndef func_e():\n count = 0\n\n def foo():\n nonlocal count\n count = 12\n foo()\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, '../utils') <|reserved_special_token_0|> for json_file in json_files_path_list: current_collection = ('GeoJSON-quikscat-l2b12-' + path_functions. get_file_name(json_file)) print(current_collectio...
flexible
{ "blob_id": "cceda9a8a0188499ae0aa588701bb8104b5ed313", "index": 1041, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, '../utils')\n<mask token>\nfor json_file in json_files_path_list:\n current_collection = ('GeoJSON-quikscat-l2b12-' + path_functions.\n get_file_name(json_fil...
[ 0, 1, 2, 3, 4 ]
# Copyright 2021 Google LLC. 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 applicable law or a...
normal
{ "blob_id": "30df17d636c33d2824aad7d7ef6aae7db83615ec", "index": 8058, "step-1": "<mask token>\n\n\nclass LatestBlessedModelStrategy(resolver.ResolverStrategy):\n <mask token>\n\n def _resolve(self, input_dict: Dict[str, List[types.Artifact]],\n model_channel_key: str, model_blessing_channel_key: st...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class DeviceControllerApi(DeviceControllerApi): <|reserved_special_token_0|> <|reserved_special_token_0|> def claim_device_using_post(self, device_name, **kwargs): """claimDevice # noqa: E501 This method makes a synchronous HTTP request by default. To make a...
flexible
{ "blob_id": "9b30075183cf9611307afa74aa45979872e7e9d5", "index": 8132, "step-1": "<mask token>\n\n\nclass DeviceControllerApi(DeviceControllerApi):\n <mask token>\n <mask token>\n\n def claim_device_using_post(self, device_name, **kwargs):\n \"\"\"claimDevice # noqa: E501\n\n This method ...
[ 10, 11, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('YES', 'NO')[max(mat.count(str(i)) for i in xrange(1, 10)) > K * 2] <|reserved_special_token_1|> K = input() mat = ''.join(raw_input() for i in xrange(4)) print('YES', 'NO')[max(mat.count(str(i)) for i in xrange(1, 10)) >...
flexible
{ "blob_id": "879f7503f7f427f92109024b4646d1dc7f15d63d", "index": 2153, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('YES', 'NO')[max(mat.count(str(i)) for i in xrange(1, 10)) > K * 2]\n", "step-3": "K = input()\nmat = ''.join(raw_input() for i in xrange(4))\nprint('YES', 'NO')[max(mat.count(str...
[ 0, 1, 2, 3 ]
#Packages to be imported import requests import pandas as pd from geopy.distance import distance import json from datetime import date from datetime import datetime import time #POST request to get authentication token URL = "https://api.birdapp.com/user/login" email = {"email": "himanshu.agarwal20792@gmail.com"} head...
normal
{ "blob_id": "625a5d14aaf37493c3f75ec0cdce77d45ca08f78", "index": 9520, "step-1": "#Packages to be imported\nimport requests\nimport pandas as pd\nfrom geopy.distance import distance\nimport json\nfrom datetime import date\nfrom datetime import datetime\nimport time\n\n#POST request to get authentication token\nU...
[ 0 ]
import mysql.connector from getpass import getpass tables_schema = { "Country": "SELECT 'Id','Name','Code' " + "UNION ALL " + "SELECT Id, Name, Code ", "Indicator": "SELECT 'Id','Name','Code' " + "UNION ALL " + "SELECT Id, Name, Code ", "Year": "SELECT 'Id','FiveYearPe...
normal
{ "blob_id": "fd76a7dd90bac7c7ba9201b6db62e6cb3eedeced", "index": 4390, "step-1": "<mask token>\n\n\ndef backup_db(cursor):\n for table in tables_schema:\n backup_table(cursor, table)\n\n\ndef backup_table(cursor, table):\n cursor.execute(f'{tables_schema[table]}' +\n f\"INTO OUTFILE '/tmp/{ta...
[ 4, 5, 6, 7, 9 ]
<|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": "ad53b100a1774f5429278379302b85f3a675adea", "index": 8986, "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 = [('base_data_a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.style.use('default') <|reserved_special_token_0|> ax.bar(np.arange(5) + 0.1, [1 / 5, 1 / 5, 1 / 5, 1 / 5, 1 / 5], label= 'Kucharski profile', align='edge', color='C1', zorder=1, alpha=0.6) ax.bar(days, mass, label='Discret...
flexible
{ "blob_id": "fa5cbbd03641d2937e4502ce459d64d20b5ee227", "index": 8630, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.style.use('default')\n<mask token>\nax.bar(np.arange(5) + 0.1, [1 / 5, 1 / 5, 1 / 5, 1 / 5, 1 / 5], label=\n 'Kucharski profile', align='edge', color='C1', zorder=1, alpha=0.6)\nax...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f"""s = {s} m = {m} d = {d:.2f} di = {di} e = {e}""", end='') <|reserved_special_token_1|> n1 = 7 n2 = 3 s = n1 + n2 m = n1 * n2 d = n1 / n2 di = n1 // n2 e = n1 ** n2 print(f"""s = {s} m = {m} d = {d:.2f} di = {di...
flexible
{ "blob_id": "34b23e80b3c4aaf62f31c19fee0b47ace1561a8c", "index": 560, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f\"\"\"s = {s}\n m = {m}\n d = {d:.2f}\n di = {di}\n e = {e}\"\"\", end='')\n", "step-3": "n1 = 7\nn2 = 3\ns = n1 + n2\nm = n1 * n2\nd = n1 / n2\ndi = n1 // n2\ne = n1 ** n2\nprint...
[ 0, 1, 2, 3 ]
import os import pickle import PySimpleGUI as sg from typing import Dict sg.ChangeLookAndFeel('Black') import string from nltk.tokenize import word_tokenize from itertools import chain from glob import glob from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import PorterStemmer fro...
normal
{ "blob_id": "46bf5866d5353c58e130b20ffa4d95df8abf986b", "index": 6609, "step-1": "<mask token>\n", "step-2": "<mask token>\nsg.ChangeLookAndFeel('Black')\n<mask token>\nfor parole in words:\n parola = lmtzr.lemmatize(parole, 'v')\n appendFile = open('filteredtext.txt', 'a')\n appendFile.write(' ' + st...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> readFiles.extend([ '/store/mc/RunIIFall17MiniAODv2/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/MINIAODSIM/PU2017_12Apr2018_rp_94X_mc2017_realistic_v14-v1/240000/222ADB5A-A0FB-E911-A01F-002590E3A...
flexible
{ "blob_id": "15821bb33c2949f5a3e72e23cf7b5d8766dfce70", "index": 4568, "step-1": "<mask token>\n", "step-2": "<mask token>\nreadFiles.extend([\n '/store/mc/RunIIFall17MiniAODv2/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/MINIAODSIM/PU2017_12Apr2018_rp_94X_mc2017_realistic_v14...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "51af54c55834c4bdb8e1cbe4ac55b86bdc61bf4d", "index": 458, "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 = [('notesapp', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ProdutoManager(models.Manager): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ProdutoManager(models.Manager): def for_categoria(self, categoria): return ...
flexible
{ "blob_id": "d698fa1b43387ee0b73687df2764c30e04ee6fd0", "index": 2814, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProdutoManager(models.Manager):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ProdutoManager(models.Manager):\n\n def for_categoria(self, categoria):\n re...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def answer(): question = input('Ask me anything: ') print(random.choice(responses)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def answer(): question = input('Ask me anything: ') print(random.choice(responses)) answer() ...
flexible
{ "blob_id": "41eef711c79fb084c9780b6d2638d863266e569d", "index": 837, "step-1": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print(random.choice(responses))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def time_diff_procs(numprocs): """Time the convolution with different number of processors""" conv_times = dict() for proc in numprocs: start_time = datetime.datetime.now() convolve_spectra(spectrum_path, band, vsini, R, epsilon, fwhm_lim, plot, num...
flexible
{ "blob_id": "2105619102de0d4d976c7bdfc839ee08058b7ab5", "index": 2713, "step-1": "<mask token>\n\n\ndef time_diff_procs(numprocs):\n \"\"\"Time the convolution with different number of processors\"\"\"\n conv_times = dict()\n for proc in numprocs:\n start_time = datetime.datetime.now()\n c...
[ 1, 2, 3, 4, 5 ]
""" module rational number """ def _gcd(num_a, num_b): """ gratest common divisor """ if num_a == 0 or num_b == 0: raise ArithmeticError('gcd of zero') var_p = num_a var_q = num_b if var_p < var_q: var_p = num_b var_q = num_a var_r = var_p % var_q while var_r...
normal
{ "blob_id": "b1ab28a99fdcce66f0a1e4e25821073673f531cf", "index": 657, "step-1": "<mask token>\n\n\nclass Rational(object):\n <mask token>\n\n def __init__(self, num, den):\n \"\"\"\n simple constructor\n \"\"\"\n if den == 0:\n raise ZeroDivisionError('division by zer...
[ 17, 30, 33, 35, 41 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> _base_ = ['../models/cascade_rcnn_r50_fpn.py', '../datasets/dataset.py', '../runtime/valid_search_wandb_runtime.py', '../schedules/schedule_1x.py'] pretrained = ( 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_wi...
flexible
{ "blob_id": "2874e05d6d5e0f13924e5920db22ea3343707dfa", "index": 3898, "step-1": "<mask token>\n", "step-2": "_base_ = ['../models/cascade_rcnn_r50_fpn.py', '../datasets/dataset.py',\n '../runtime/valid_search_wandb_runtime.py', '../schedules/schedule_1x.py']\npretrained = (\n 'https://github.com/SwinTra...
[ 0, 1, 2 ]
from .sgd import StochasticGradientDescent from .momentum import Momentum
normal
{ "blob_id": "aa55f1dd4f363e07d5f9104346efaa24c0457d45", "index": 9126, "step-1": "<mask token>\n", "step-2": "from .sgd import StochasticGradientDescent\nfrom .momentum import Momentum\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class FileUtilsTest(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FileUtilsTest(TestCase): <|reserved_special_token_0|> def test_clear_attributes(self): clear_attributes(__...
flexible
{ "blob_id": "89059915df8891efcbe742174bd468a1390598e3", "index": 3001, "step-1": "<mask token>\n\n\nclass FileUtilsTest(TestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FileUtilsTest(TestCase):\n <mask token>\n\n def test_clear_attributes(self):\n clear_attribu...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def teacher_detail(request, pk): teacher = Teacher.objects.get(pk=pk) return render(request, 'teacher_detail.html', {'teacher': teacher}) def edit_teacher(request, pk): teacher = Teacher.objects.get(pk=pk) if request.method == 'POST': form = TeacherForm(request.P...
flexible
{ "blob_id": "cf97c87400649dd15e5d006707f9adfbd0c91b2c", "index": 4118, "step-1": "<mask token>\n\n\ndef teacher_detail(request, pk):\n teacher = Teacher.objects.get(pk=pk)\n return render(request, 'teacher_detail.html', {'teacher': teacher})\n\n\ndef edit_teacher(request, pk):\n teacher = Teacher.object...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def get_headers(): USER_AGENTS = [ 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' , 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; ...
flexible
{ "blob_id": "d49aa03cd6b8ba94d68a1bc1e064f77fded65000", "index": 8870, "step-1": "<mask token>\n\n\ndef get_headers():\n USER_AGENTS = [\n 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)'\n ,\n 'Mozilla/4.0 (compatible; MSIE 7.0...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def separa_sentencas(texto): """A funcao recebe um texto e devolve uma lista das sentencas dentro do texto""" sentencas = re.split('[.!?]+', texto) if sentencas[-1] == '': del sentencas[-1] return sentencas def separa_frases(sentenca): """A funcao recebe uma ...
flexible
{ "blob_id": "e207063eb3eb1929e0e24b62e6b77a8924a80489", "index": 1001, "step-1": "<mask token>\n\n\ndef separa_sentencas(texto):\n \"\"\"A funcao recebe um texto e devolve uma lista das sentencas dentro do texto\"\"\"\n sentencas = re.split('[.!?]+', texto)\n if sentencas[-1] == '':\n del sentenc...
[ 6, 17, 19, 22, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' Encontrar el valor mas alto el mas rapido, el mas lento para eso son los algoritmos de optimizacion Para eso debemos pensar en una funcion que queramos maximizar o minimizar Se aplican mas que todo para empresas como despegar, en donde se ...
flexible
{ "blob_id": "7163be250ae3a22931de037cb6896c2e6d5f00a8", "index": 584, "step-1": "<mask token>\n", "step-2": "'''\n Encontrar el valor mas alto el mas rapido, el mas lento\n para eso son los algoritmos de optimizacion\n Para eso debemos pensar en una funcion que queramos maximizar o minimizar\n Se a...
[ 0, 1 ]
<|reserved_special_token_0|> class HandleYaml: """ 处理并封装yaml文件 """ def __init__(self): with open(YAML_FILE_PATH, 'r') as fs: content = fs.read() self.ya = yaml.load(content, yaml.FullLoader) def get_value(self): return self.ya <|reserved_special_token_0|...
flexible
{ "blob_id": "08c309645a4ee59716bdd00556096be1c784331a", "index": 2469, "step-1": "<mask token>\n\n\nclass HandleYaml:\n \"\"\"\n 处理并封装yaml文件\n \"\"\"\n\n def __init__(self):\n with open(YAML_FILE_PATH, 'r') as fs:\n content = fs.read()\n self.ya = yaml.load(content, yaml....
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for value in range(2, 10000): high = value low = 1 divisors = [] while low < high: if value % low == 0: high = value // low divisors.append(low) if high != low: ...
flexible
{ "blob_id": "1f0349edd9220b663f7469b287f796e4a54df88d", "index": 6502, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor value in range(2, 10000):\n high = value\n low = 1\n divisors = []\n while low < high:\n if value % low == 0:\n high = value // low\n divisors...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PDModel(Model): <|reserved_special_token_0|> <|reserved_special_token_0|> def make_agents(self): for i in range(self.number_of_agents): x, y = self.coordinates.pop(0) pdagent = PDAgent((x, y), self, True) self.grid.place_agent...
flexible
{ "blob_id": "446c438b79f9957289fa85f21516c13d67e2cfaf", "index": 3270, "step-1": "<mask token>\n\n\nclass PDModel(Model):\n <mask token>\n <mask token>\n\n def make_agents(self):\n for i in range(self.number_of_agents):\n x, y = self.coordinates.pop(0)\n pdagent = PDAgent((x...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TestWepCmpt(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def testGetWepController(self): wepCntlr = self.wepCmpt.getWepController() self.assertTrue(isinsta...
flexible
{ "blob_id": "6e434ff213166768a6adadf99dc5d6d8611fa2ba", "index": 2762, "step-1": "<mask token>\n\n\nclass TestWepCmpt(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def testGetWepController(self):\n wepCntlr = self.wepCmpt.getWepController()\n sel...
[ 9, 14, 16, 22, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> District_Summary_df <|reserved_special_token_0|> school_summary_df <|reserved_special_token_0|> top_performing.head() <|reserved_special_token_0|> top_performing.head() <|reserved_special_token_0|> grade_math_score <|reserved_spec...
flexible
{ "blob_id": "8488fdd216c30c3cb4b0060305af6708d890bc86", "index": 8203, "step-1": "<mask token>\n", "step-2": "<mask token>\nDistrict_Summary_df\n<mask token>\nschool_summary_df\n<mask token>\ntop_performing.head()\n<mask token>\ntop_performing.head()\n<mask token>\ngrade_math_score\n<mask token>\ngrade_reading...
[ 0, 1, 2, 3, 4 ]
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0,1" import logging import itertools import torch from torch import nn, optim from torch.optim import lr_scheduler from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from setproctitle import setproctitle from ...
normal
{ "blob_id": "4d1900c1a0a8d7639e0ec16fb0128fd8efc2e8a1", "index": 9913, "step-1": "<mask token>\n\n\nclass MVAN(object):\n <mask token>\n <mask token>\n <mask token>\n\n def _setup_training(self):\n if self.hparams.save_dirpath == 'checkpoints/':\n self.save_dirpath = os.path.join(se...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .ffm import * from .fm import * from .utils import * from .base_model import * from .base_trainer import * from .logger import * from .metric import * from .input_fn import * <|reserved_special_token_1|> #!/usr/bin/env python # -*- coding: utf-8 -*- #...
flexible
{ "blob_id": "bbdb07a81d785bdf067707c4e56622a2ada76b7b", "index": 1692, "step-1": "<mask token>\n", "step-2": "from .ffm import *\nfrom .fm import *\nfrom .utils import *\nfrom .base_model import *\nfrom .base_trainer import *\nfrom .logger import *\nfrom .metric import *\nfrom .input_fn import *\n", "step-3"...
[ 0, 1, 2 ]
__author__ = 'aniket' import freenect import cv2 import numpy as np kernel = nfrp.ones((5,5),np.uint8) freenect.C def grayscale(): maske = np.zeros((480,640,3)) a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0] mask = a == 0 a[mask] = 8000 mask1 = a > 1000 b = freenect.sync_get_video()...
normal
{ "blob_id": "9540319cf192add1fb24375a35d70ea8e3031a72", "index": 7455, "step-1": "<mask token>\n\n\ndef grayscale():\n maske = np.zeros((480, 640, 3))\n a = freenect.sync_get_depth(format=freenect.DEPTH_MM)[0]\n mask = a == 0\n a[mask] = 8000\n mask1 = a > 1000\n b = freenect.sync_get_video()[0...
[ 1, 2, 3, 4, 5 ]
import tensorflow.keras from preprocessing_and_training.train import reshape_and_predict import glob """ Script for prediction - testing and importing the trained model from train.py """ def make_predictions(file_list, model, is_game=False): """ Predictions with model that is locally saved :param file_list:...
normal
{ "blob_id": "a17c448b068b28881f9d0c89be6037503eca3974", "index": 5700, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_single_prediction(wav_file, model, is_game):\n \"\"\" Predictions with model that is locally saved\n\n :param wav_file: wav-file we want to predict\n :param model: T...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # Script to time convolution using different number of processors. # Jason Neal # December 2016 from __future__ import division, print_function import datetime from eniric.nIRanalysis import convolve_spectra spectrum_name = "lte03900-4.50-0.0.PHOENIX-ACES-AGSS-COND-2011-HiRes_wave.dat" data_rep = ...
normal
{ "blob_id": "2105619102de0d4d976c7bdfc839ee08058b7ab5", "index": 2713, "step-1": "<mask token>\n\n\ndef time_diff_procs(numprocs):\n \"\"\"Time the convolution with different number of processors\"\"\"\n conv_times = dict()\n for proc in numprocs:\n start_time = datetime.datetime.now()\n c...
[ 1, 2, 3, 4, 5 ]
import os from distutils.core import setup from Cython.Distutils import Extension from Cython.Build import cythonize CUR_DIR = os.path.dirname(os.path.abspath(__file__)) SRC_DIR = os.path.join(CUR_DIR, 'src') TPM_DIR = os.path.join(SRC_DIR, 'tpm') include_dirs = [SRC_DIR] src_files = ["pytpm/_tpm.pyx"] # TPM library ...
normal
{ "blob_id": "3875d85bef37900f9066c108dc720b364cbafffa", "index": 8476, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='pytpm', packages=['pytpm'], package_dir={'pytpm': 'pytpm'},\n package_data={'pytpm': ['*.pxd', '*.pyx', '*.pxi']}, ext_modules=\n cythonize(ext_modules))\n", "step-3":...
[ 0, 1, 2, 3, 4 ]
from adb_local_installer.connection import ADBConnection with ADBConnection("a95x01", domain="dohmens.local") as conn: print(conn.conn)
normal
{ "blob_id": "6f583fde0eeab84984629b795e428300503a49c9", "index": 9852, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith ADBConnection('a95x01', domain='dohmens.local') as conn:\n print(conn.conn)\n", "step-3": "from adb_local_installer.connection import ADBConnection\nwith ADBConnection('a95x01',...
[ 0, 1, 2, 3 ]
import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage import tensorflow as tf from tensorflow.python.framework import ops from pathlib import Path from scipy.io import loadmat from skimage.transform import resize from sklearn....
normal
{ "blob_id": "5c315a49ead80e8d8ce057bd774f97bce098de59", "index": 5443, "step-1": "<mask token>\n\n\ndef model(input_shape):\n X_input = Input(input_shape)\n X = Conv2D(8, (4, 4), strides=(1, 1), name='conv0', kernel_regularizer=\n regularizers.l2(0.001), padding='same')(X_input)\n X = BatchNormal...
[ 1, 2, 3, 4, 5 ]
user_input = input() #abv>1>1>2>2asdasd exploded_str = user_input for n in range(len(user_input)): explosion_strength = 0 if user_input[n] == ">": explosion_strength += int(user_input[n+1]) if user_input[n+explosion_strength] != ">": exploded_str = user_input[:n] + user_input[n+ex...
normal
{ "blob_id": "7930bb813bd546747c7c65b661900939f5ba93f1", "index": 273, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(len(user_input)):\n explosion_strength = 0\n if user_input[n] == '>':\n explosion_strength += int(user_input[n + 1])\n if user_input[n + explosion_streng...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SpotlightVolumePluginTest(test_lib.PlistPluginTestCase): <|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 SpotlightVolumePluginTest(t...
flexible
{ "blob_id": "6d1b882af2a027f2eecaa3a881dbcab1e3a3b92b", "index": 9608, "step-1": "<mask token>\n\n\nclass SpotlightVolumePluginTest(test_lib.PlistPluginTestCase):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass SpotlightVolumePluginTest(test_lib.Pl...
[ 1, 4, 5, 6, 7 ]
""" Copyright (C) 2018-2020 Intel Corporation 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 i...
normal
{ "blob_id": "ce28462621a423c6661c672cf92d7e9c91875cfa", "index": 8247, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass InterpFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token>\n\n @classmethod\n def extract(cls, node):\n proto_layer = node.pb\n param = prot...
[ 0, 2, 3, 4, 5 ]