code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import MySQLdb
from MySQLdb import escape_string as thwart
"""
"""
class DatabaseConnection:
def __init__(self, address, user, password, database):
self.address = address
self.user = user
self.password = password
self.database = database
"""
"""
def connect(self):
... | normal | {
"blob_id": "c6502d6b589fa75dfbd5946a1097e77fc0b472c4",
"index": 1126,
"step-1": "<mask token>\n\n\nclass DatabaseConnection:\n <mask token>\n <mask token>\n\n def connect(self):\n self.conn = MySQLdb.connect(host=self.address, port=3306, user=self\n .user, passwd=self.password, db=sel... | [
5,
6,
7,
8,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for line in infile:
line = line.strip()
my_list = line.split(',')
if my_list[0] != 'ball':
continue
batsman = my_list[4]
bowler = my_list[6]
if my_list[9] == 'run out' or my_list[9] == '""' or my_li... | flexible | {
"blob_id": "cfa7dc295c635bbdf707f1e899c4fbf8ea91df9a",
"index": 1209,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in infile:\n line = line.strip()\n my_list = line.split(',')\n if my_list[0] != 'ball':\n continue\n batsman = my_list[4]\n bowler = my_list[6]\n if my_l... | [
0,
1,
2,
3,
4
] |
def is_balanced(tree_root):
# Determine if the tree is superbalanced
if tree_root is None:
return True
nodeQ = [(tree_root, 0)]
depths = []
while len(nodeQ):
last_node, depth = nodeQ.pop()
if( not last_node.left ) and (not last_node.right ):
... | normal | {
"blob_id": "833c8234d829dfa1937392f0ad4952aeffa4e26d",
"index": 1150,
"step-1": "<mask token>\n",
"step-2": "def is_balanced(tree_root):\n if tree_root is None:\n return True\n nodeQ = [(tree_root, 0)]\n depths = []\n while len(nodeQ):\n last_node, depth = nodeQ.pop()\n if not... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def eval_ground_scores(gt_relations, pred_relations, tiou_threshold):
"""
:param gt_relations:
:param pred_relations:
:param tiou_threshold:
:return:
"""
relation_num = len(gt_relations)
predict, predict_sub, predict_obj = 0, 0, 0
for relation, pred_tr... | flexible | {
"blob_id": "f26e6164fc4c07fd3339171e316b3a1f7a4be669",
"index": 2447,
"step-1": "<mask token>\n\n\ndef eval_ground_scores(gt_relations, pred_relations, tiou_threshold):\n \"\"\"\n\n :param gt_relations:\n :param pred_relations:\n :param tiou_threshold:\n :return:\n \"\"\"\n relation_num = l... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class SVs(object):
def __init__(self, size, ntuple, buff):
self.__size = size
self.__value = ntuple._make(unpack(self.__size, buff))
def _get(self):
l = []
for i in self.__value._fields:
l.append(getattr(self.__value, i))
retur... | flexible | {
"blob_id": "2e6f04c3ff3e47a2c3e9f6a7d93e7ce2955a2756",
"index": 8354,
"step-1": "<mask token>\n\n\nclass SVs(object):\n\n def __init__(self, size, ntuple, buff):\n self.__size = size\n self.__value = ntuple._make(unpack(self.__size, buff))\n\n def _get(self):\n l = []\n for i i... | [
35,
62,
63,
65,
71
] |
class Figura:
def __init__(self):
print("Tworze obiekt klasy Figura...")
def pobierz_polozenie(self):
print("Metoda pobierz_polozenie klasy Figura.")
def nadaj_polozenie(self):
print("Metoda nadaj_polozenie klasy Figura.")
def wyswietl(self):
print("Metoda wyswietl klasy ... | normal | {
"blob_id": "774bf2b49f6e546f16294edc17e9ac34fa8a9ba8",
"index": 2711,
"step-1": "<mask token>\n\n\nclass Punkt(Figura):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Linia(Figura):\n\n def __init__(self):\n print('Tworze obiekt klasy Linia...')\n\n def wyswietl(... | [
27,
30,
31,
34,
41
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
fp_growth.minTree(myFPtree, myHeaderTab, 100000, set([]), myFreqList)
print(len(myFreqList))
<|reserved_special_token_1|>
<|reserved_special_token_0|>
parsedDat = [line.split() for line in open('kosarak.dat').readlines()]
initS... | flexible | {
"blob_id": "e8b0e6e5e68933703e2ac8c9b2b62d68c0c2f53d",
"index": 8295,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfp_growth.minTree(myFPtree, myHeaderTab, 100000, set([]), myFreqList)\nprint(len(myFreqList))\n",
"step-3": "<mask token>\nparsedDat = [line.split() for line in open('kosarak.dat').read... | [
0,
1,
2,
3,
4
] |
# Demo - train the decoders & use them to stylize image
from __future__ import print_function
from train import train
from infer import stylize
from utils import list_images
IS_TRAINING = True
# for training
TRAINING_IMGS_PATH = 'MS_COCO'
ENCODER_WEIGHTS_PATH = 'vgg19_normalised.npz'
MODEL_SAVE_PATH = 'models/auto... | normal | {
"blob_id": "31ed798118f20005b5a26bc1fc0053b7d0a95657",
"index": 5366,
"step-1": "<mask token>\n\n\ndef main():\n if IS_TRAINING:\n training_imgs_paths = list_images(TRAINING_IMGS_PATH)\n train(training_imgs_paths, ENCODER_WEIGHTS_PATH, MODEL_SAVE_PATH,\n autoencoder_levels=AUTUENCODE... | [
1,
2,
3,
4,
5
] |
# from __future__ import annotations
from typing import List,Union,Tuple,Dict,Set
import sys
input = sys.stdin.readline
# from collections import defaultdict,deque
# from itertools import permutations,combinations
# from bisect import bisect_left,bisect_right
import heapq
# sys.setrecursionlimit(10**5)
# class UnionFi... | normal | {
"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|>
def wordCount(db):
words = {}
for sent, labels in iterReviews(db):
for word in sent:
if word not in words:
words[word] = 1
else:
words[word] += 1
return words
def filterWords(words, min_count=0):
return set(... | flexible | {
"blob_id": "04867e8911f7cb30af6cefb7ba7ff34d02a07891",
"index": 7970,
"step-1": "<mask token>\n\n\ndef wordCount(db):\n words = {}\n for sent, labels in iterReviews(db):\n for word in sent:\n if word not in words:\n words[word] = 1\n else:\n words... | [
3,
5,
6,
7,
8
] |
"""
Copyright (C) Adrian Herrera, 2017
You will need to install r2pipe and pydot:
```
pip install r2pipe pydot
```
"""
from __future__ import print_function
import glob
import json
import os
import pydot
import r2pipe
import s2e_web.S2E_settings as S2E_settings
def function_addrs(r2):
"""
Yield a list of... | normal | {
"blob_id": "2aee4af2e5a5c3f59dde4d9dd46f8d124a32fb27",
"index": 2590,
"step-1": "<mask token>\n\n\ndef function_addrs(r2):\n \"\"\"\n Yield a list of all the function's start addresses.\n \"\"\"\n for addr in r2.cmdj('aflqj'):\n yield int(addr, 16)\n\n\n<mask token>\n\n\ndef basic_block_cover... | [
3,
4,
5,
6,
7
] |
# coding: utf-8
"""
Knetik Platform API Documentation latest
This is the spec for the Knetik API. Use this in conjunction with the documentation found at https://knetikcloud.com.
OpenAPI spec version: latest
Contact: support@knetik.com
Generated by: https://github.com/swagger-api/swagger-codeg... | normal | {
"blob_id": "05aec07b94f3363e07d8740b102262d817e08e71",
"index": 1253,
"step-1": "# coding: utf-8\n\n\"\"\"\n Knetik Platform API Documentation latest \n\n This is the spec for the Knetik API. Use this in conjunction with the documentation found at https://knetikcloud.com.\n\n OpenAPI spec version: lat... | [
0
] |
<|reserved_special_token_0|>
class TorchData(Dataset):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def create_gt_mask(vocal_spec, bg_spec):
"""
Take in log spect... | flexible | {
"blob_id": "1133d3cf900e31278dc491565c99969a116e6c83",
"index": 1998,
"step-1": "<mask token>\n\n\nclass TorchData(Dataset):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_gt_mask(vocal_spec, bg_spec):\n \"\"\"\n Take in log spectrogra... | [
1,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
num_seq = input('Введите последовательность чисел через пробел: ').split()
num_lst = [float(s) for s in num_seq if is_numb_val(s)]
print(sorted(num_lst))
<|reserved_special_token_0|>
<|reserved_specia... | flexible | {
"blob_id": "4c8a873c816678532b029af409be13258757eae1",
"index": 7577,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n num_seq = input('Введите последовательность чисел через пробел: ').split()\n num_lst = [float(s) for s in num_seq if is_numb_val(s)]\n print(sorted(num_lst))\n\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Config(OrderedDict):
<|reserved_special_token_0|>
def __init__(self):
ec = Console(stderr=True, style='bold red')
Config.ensure_path(ec)
config_file = get_config_path()
if not os.path.exists(config_file) or os.path.getsize(config_file
... | flexible | {
"blob_id": "5a9e0b220d2c94aea7e3d67338771cf48c3aec8f",
"index": 6439,
"step-1": "<mask token>\n\n\nclass Config(OrderedDict):\n <mask token>\n\n def __init__(self):\n ec = Console(stderr=True, style='bold red')\n Config.ensure_path(ec)\n config_file = get_config_path()\n if not... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns += static(settings_common.MEDIA_URL, document_root=settings_dev
.MEDIA_ROOT)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('admin/', admin.site.urls), path('', include(
'login... | flexible | {
"blob_id": "ce626afa7c0fd2e190afd92b57a0ebebf19f9e9b",
"index": 6842,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns += static(settings_common.MEDIA_URL, document_root=settings_dev\n .MEDIA_ROOT)\n",
"step-3": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', inclu... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def neural_network_model(data):
l1 = tf.add(tf.matmul(data, hidden_1_layer['weight']), hidden_1_layer[
'bias'])
l1 = tf.nn.relu(l1)
l2 = tf.add(tf.matmul(l1, hidden_2_layer['weight']), hidden_2_layer['bias']
)
l2 = tf.nn.relu(l2)
l3 = tf.add(tf.matmul(l... | flexible | {
"blob_id": "1446268583bf9fa3375319eae3c21cf47f47faca",
"index": 7279,
"step-1": "<mask token>\n\n\ndef neural_network_model(data):\n l1 = tf.add(tf.matmul(data, hidden_1_layer['weight']), hidden_1_layer[\n 'bias'])\n l1 = tf.nn.relu(l1)\n l2 = tf.add(tf.matmul(l1, hidden_2_layer['weight']), hidd... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_get_latest_backup(raw_binlog_status):
instance = BinlogStatus(raw_binlog_status)
assert instance.get_latest_backup() == BinlogCopy(host='master1', name=
'mysqlbin005.bin', created_at=100504)
<|reserved... | flexible | {
"blob_id": "0dc556336cee9e5f41c036c6fcf6da950216693c",
"index": 5910,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_get_latest_backup(raw_binlog_status):\n instance = BinlogStatus(raw_binlog_status)\n assert instance.get_latest_backup() == BinlogCopy(host='master1', name=\n 'm... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Appointment(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __str__(self):
... | flexible | {
"blob_id": "3343844bf49cb3f4d655613475e44a140ac3106d",
"index": 4505,
"step-1": "<mask token>\n\n\nclass Appointment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.first_n... | [
2,
3,
4,
5,
6
] |
import os
import json
from threading import Thread
import time
from time import sleep
from flask import Flask, json, render_template, request
import redis
from collections import OrderedDict
import requests
from Queue import Queue
REGISTRAR_URL = 'http://cuteparty-registrar1.cfapps.io/update'
app = Flask(__name__)
p... | normal | {
"blob_id": "b976dab3c621bb929eb488fa7f4394666efec2ed",
"index": 4410,
"step-1": "import os\nimport json\nfrom threading import Thread\nimport time\nfrom time import sleep\nfrom flask import Flask, json, render_template, request\nimport redis\nfrom collections import OrderedDict\nimport requests\n\nfrom Queue im... | [
0
] |
import os
import sys
import winreg
import zipfile
class RwpInstaller:
railworks_path = None
def extract(self, target):
with zipfile.ZipFile(target) as z:
if z.testzip():
return self.output('Corrupt file {}\n'.format(target))
self.output('{} file valid\n\n'.form... | normal | {
"blob_id": "9c751dece67ef33ba8e5cb8281f024d2143e0808",
"index": 8811,
"step-1": "<mask token>\n\n\nclass RwpInstaller:\n <mask token>\n\n def extract(self, target):\n with zipfile.ZipFile(target) as z:\n if z.testzip():\n return self.output('Corrupt file {}\\n'.format(targ... | [
4,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def undistort_img(img):
"""
Return an undistorted image given previous calibrated parameters
References from OpenCV docs
"""
ret = load_camera_ret()
K = load_K()
dist = load_camera_dist()
h, w = img.sh... | flexible | {
"blob_id": "844c630d3fe2dda833064556228b524608cfece9",
"index": 4671,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef undistort_img(img):\n \"\"\"\n Return an undistorted image given previous calibrated parameters \n References from OpenCV docs\n \"\"\"\n ret = load_camera_ret()\n K =... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class FintelInsiderAcquisition:
def __init__(self, trading_date=None):
self.task_name = 'FintelInsiderAcquisition'
self.trading_date = trading_date
self.symbols = Financial_Symbols.get_all()
self.finance_db = None
self._reset_counters()
<|r... | flexible | {
"blob_id": "08b13069020696d59028003a11b0ff06014a4c68",
"index": 3779,
"step-1": "<mask token>\n\n\nclass FintelInsiderAcquisition:\n\n def __init__(self, trading_date=None):\n self.task_name = 'FintelInsiderAcquisition'\n self.trading_date = trading_date\n self.symbols = Financial_Symbol... | [
5,
7,
9,
10,
11
] |
import pygame
import time as time_
import random
import os
from pygame.locals import *
from math import sin, cos, pi
from sys import exit
# ---------------------------
from unzip import *
unzip()
# ---------------------------
from others import *
from gaster_blaster import *
from board import *
from bone import *
from ... | normal | {
"blob_id": "46fd4b976526a1bc70cf902bdb191feea8b84ad9",
"index": 2633,
"step-1": "<mask token>\n\n\ndef set_turn_time(time):\n\n def next_turn(screen):\n global stop\n stop = False\n tasks.append(Task(next_turn, time))\n\n\ndef add_attack(func):\n attacks.append(func)\n return func\n\n\... | [
16,
26,
28,
32,
47
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
c.newpin('joint1', hal.HAL_FLOAT, hal.HAL_IN)
c.newpin('joint2', hal.HAL_FLOAT, hal.HAL_IN)
c.newpin('joint3', hal.HAL_FLOAT, hal.HAL_IN)
c.newpin('joint4', hal.HAL_FLOAT, hal.HAL_IN)
c.newpin('joint5', hal.HAL_FLOAT, hal.HAL_IN)
... | flexible | {
"blob_id": "ae83a0e1ebf1190ab55459563bc7b86d240de89a",
"index": 4146,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nc.newpin('joint1', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint2', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint3', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint4', hal.HAL_FLOAT, hal.HAL_IN)\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def get_session(db, usr, pwd):
"""Функция устанавливает соединение с ТД и возвращает сессию"""
if platform.system() == 'Windows':
driver = 'Teradata'
else:
driver = 'Teradata Database ODBC Driver 16.20'
udaExec = teradata.UdaExec(appName='DataLoad', version... | flexible | {
"blob_id": "a05c94ae0ee41cfef5687f741e07a54ae793e40d",
"index": 2183,
"step-1": "<mask token>\n\n\ndef get_session(db, usr, pwd):\n \"\"\"Функция устанавливает соединение с ТД и возвращает сессию\"\"\"\n if platform.system() == 'Windows':\n driver = 'Teradata'\n else:\n driver = 'Teradata... | [
4,
5,
6,
7,
8
] |
# -*- coding: utf-8 -*-
import urllib2, json, traceback
from django.conf import settings
from django.db import models
from TkManager.order.models import User
from TkManager.juxinli.models import *
from TkManager.juxinli.error_no import *
from TkManager.common.tk_log import TkLog
from datetime import datetime
from djan... | normal | {
"blob_id": "fa825846c54ed32c2ede94128ac08f9d5e172c0f",
"index": 5581,
"step-1": "# -*- coding: utf-8 -*-\nimport urllib2, json, traceback\n\nfrom django.conf import settings\nfrom django.db import models\nfrom TkManager.order.models import User\nfrom TkManager.juxinli.models import *\nfrom TkManager.juxinli.err... | [
0
] |
<|reserved_special_token_0|>
class Growable(object):
def __init__(self, capacity=1024, dtype=numpy.uint32, grow=2):
self.grow = grow
self.capacity = capacity
self.dtype = dtype
self.arr = numpy.empty((self.capacity,), dtype=self.dtype)
self.size = 0
<|reserved_special_... | flexible | {
"blob_id": "8a2fe83ab1adae7de94eb168290ce4843ab39fe1",
"index": 9476,
"step-1": "<mask token>\n\n\nclass Growable(object):\n\n def __init__(self, capacity=1024, dtype=numpy.uint32, grow=2):\n self.grow = grow\n self.capacity = capacity\n self.dtype = dtype\n self.arr = numpy.empty... | [
5,
6,
7,
9,
10
] |
def erato(n):
m = int(n ** 0.5)
sieve = [True for _ in range(n+1)]
sieve[1] = False
for i in range(2, m+1):
if sieve[i]:
for j in range(i+i, n+1, i):
sieve[j] = False
return sieve
input()
l = list(map(int, input().split()))
max_n = max(l)
prime_l = erato(max_n)
... | normal | {
"blob_id": "28eb1d7a698480028fb64827746b3deec0f66a9a",
"index": 6224,
"step-1": "<mask token>\n",
"step-2": "def erato(n):\n m = int(n ** 0.5)\n sieve = [(True) for _ in range(n + 1)]\n sieve[1] = False\n for i in range(2, m + 1):\n if sieve[i]:\n for j in range(i + i, n + 1, i):... | [
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": "12c3fe8a3ca1e660eeb90b16eca17eddd47e5de7",
"index": 7124,
"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 = [('KYusers', '... | [
0,
1,
2,
3,
4
] |
from django.db import models
class Book(models.Model):
title = models.TextField(max_length=32, blank=False, null=False)
# from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
#
#
# class UserAccountManager(BaseUserManager):
# def create_user(self, email, firstname,lastna... | normal | {
"blob_id": "8286407987301ace7af97d6acdcf6299ce3d8525",
"index": 5440,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Book(models.Model):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Book(models.Model):\n title = models.TextField(max_length=32, blank=False, null=False)\n",
"s... | [
0,
1,
2,
3,
4
] |
import numpy as np
import pandas as pd
import geopandas as gp
from sklearn.cluster import KMeans
import shapely
from descartes import PolygonPatch
# -- load the data
data = pd.read_csv('/scratch/share/gdobler/parqa/output/Tables/'
'ParkQualityScores/QualityArea_ZipCode_FiscalYears.csv')
zips = gp.... | normal | {
"blob_id": "2c181a33c84ce262404c192abdc515924a1916a9",
"index": 6165,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nvals -= vals[:, np.newaxis].mean(-1)\nvals /= vals[:, np.newaxis].std(-1)\n<mask token>\nkm.fit(vals)\n<mask token>\nfor ii in range(len(zips)):\n tzip = int(zips.ZIPCODE[ii])\n if ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestAssert(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def test_consumption_below(self):
sample = create_random_sample(10, 1)
asserts.consumption_below(sample, 11)
with self.assertRaises(Exception):
a... | flexible | {
"blob_id": "eda1c1db5371f5171f0e1929e98d09e10fdcef24",
"index": 1677,
"step-1": "<mask token>\n\n\nclass TestAssert(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_consumption_below(self):\n sample = create_random_sample(10, 1)\n asserts.consumption_below(sample, 11)\n ... | [
4,
5,
6,
7,
8
] |
import pandas as pd
from datetime import datetime
from iFinDPy import *
thsLogin = THS_iFinDLogin("iFind账号","iFind账号密码")
index_list = ['000001.SH','399001.SZ','399006.SZ']
result = pd.DataFrame()
today =datetime.today().strftime('%Y-%m-%d')
for index in index_list:
data_js = THS_DateSerial(index,'ths_pre_clo... | normal | {
"blob_id": "7f62af951b49c3d1796c2811527ceb30ca931632",
"index": 8607,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor index in index_list:\n data_js = THS_DateSerial(index,\n 'ths_pre_close_index;ths_open_price_index;ths_close_price_index;ths_high_price_index'\n , ';;;', 'Days:Traded... | [
0,
1,
2,
3,
4
] |
# 1.Create a list of 10 elements of four different data types like int, string, complex and float.
i=[1,2,3,4,5,6,7,8,9,10]
f=[10.5,12.2,13.7,14.9,14.9,18.8,19.7,23.6,90.9,25.7]
s=['Arpi','world','Hello','Python','Consultadd','job','c++','Concepts','interesting']
c=[1+2j,2+3j,4+5j,5+6j,56+7j,8+9j,7+8j,3+6j,7+9j]
print... | normal | {
"blob_id": "87d1c28819d187944a3cf99b35b1d41eab11b139",
"index": 6652,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(c)\n",
"step-3": "i = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nf = [10.5, 12.2, 13.7, 14.9, 14.9, 18.8, 19.7, 23.6, 90.9, 25.7]\ns = ['Arpi', 'world', 'Hello', 'Python', 'Consultadd', 'jo... | [
0,
1,
2,
3
] |
# presentation console
# - a python interpreter for "pseudo-interative" demos
#
# usage: $ python prescons.py <filename>
#
# <filename> should be a file that contains python code as would be entered
# directly in a terminal - see example.py
#
# while running, press 'space' to move through the code
#
# github.com/ingles... | normal | {
"blob_id": "fa531e8b07de6ee3c22146904ee8724cefab9033",
"index": 2732,
"step-1": "# presentation console\n# - a python interpreter for \"pseudo-interative\" demos\n#\n# usage: $ python prescons.py <filename>\n#\n# <filename> should be a file that contains python code as would be entered\n# directly in a terminal... | [
0
] |
<|reserved_special_token_0|>
def parseTex(lines: list):
new_lines = []
for i, line in enumerate(lines):
if line == '\n':
continue
inline = False
if line[0] == '$' and line[1] != '$':
inline = True
line = line.replace('$', '')
line = line.replace(... | flexible | {
"blob_id": "dbd04f7b88fa43ae920a6744e3979dbf917d3fc6",
"index": 7649,
"step-1": "<mask token>\n\n\ndef parseTex(lines: list):\n new_lines = []\n for i, line in enumerate(lines):\n if line == '\\n':\n continue\n inline = False\n if line[0] == '$' and line[1] != '$':\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Custom_Loss_for_Autoencoder(nn.Module):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Custom_Loss_for_Autoencoder(nn.Module):
<|reserved_special_token_0|>
def forward(self, reconstructe... | flexible | {
"blob_id": "ce3e2aa2534bb404b45202bcb76e9d07080560cb",
"index": 2739,
"step-1": "<mask token>\n\n\nclass Custom_Loss_for_Autoencoder(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Custom_Loss_for_Autoencoder(nn.Module):\n <mask token>\n\n def forward(self, reconst... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_Count_By_distance(centers, pixel_use, d):
d_min = 1
d_b = d
count_use = 0
for i in range(len(centers)):
d = attenuation(centers[i], pixel_use)
if d < d_min:
d_min = d
... | flexible | {
"blob_id": "918db455fc50b49ca2b40dd78cecdec4ba08dcb8",
"index": 6013,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_Count_By_distance(centers, pixel_use, d):\n d_min = 1\n d_b = d\n count_use = 0\n for i in range(len(centers)):\n d = attenuation(centers[i], pixel_use)\n ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# coding=utf-8
from django.core.management.base import BaseCommand
from BanBanTong.utils import task_scheduler
class Command(BaseCommand):
'''
启动BanBanTong.tasks定时任务
'''
def handle(self, *args, **options):
task_scheduler.start()
| normal | {
"blob_id": "e9c81be79d9107433e00182c27488e64f1ca779f",
"index": 1458,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n\n def handle(self, *args, **options):\n task_scheduler.start()\n",
"step-3": "<mask token>\n\n\nclass Command(BaseCommand):... | [
0,
2,
3,
4,
5
] |
# coding: utf-8
import re
import numpy as np
from sklearn.manifold import TSNE
import word2vec
from matplotlib import pyplot as plt
from adjustText import adjust_text
import nltk
'''
word2vec.word2phrase('all.txt', 'phrases.txt', verbose=True)
word2vec.word2vec('phrases.txt', 'text.bin', size=100, verbose=True)
word2ve... | normal | {
"blob_id": "31996699bec6507d941eb8a7aaacffbd6248d79c",
"index": 7112,
"step-1": "<mask token>\n\n\ndef plot_scatter(x, y, texts, adjust=False):\n fig, ax = plt.subplots()\n ax.plot(x, y, 'bo')\n texts = [plt.text(x[i], y[i], texts[i]) for i in range(len(x))]\n if adjust:\n plt.title(str(adjus... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('-' * 60)
print(
'Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...'
)
print()
<|reserved_special_token_0|>
if age >= 21:
print('Cool, come on in.')
else:
print(
... | flexible | {
"blob_id": "19ffac718008c7c9279fb8cbc7608597d2d3e708",
"index": 3937,
"step-1": "<mask token>\n",
"step-2": "print('-' * 60)\nprint(\n 'Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...'\n )\nprint()\n<mask token>\nif age >= 21:\n pri... | [
0,
1,
2
] |
from numpy import array, zeros, arange, concatenate, searchsorted, where, unique
from pyNastran.bdf.fieldWriter import print_card_8
from pyNastran.bdf.bdfInterface.assign_type import (integer, integer_or_blank,
double_or_blank, integer_double_or_blank, blank)
class PBAR(object):
type = 'PBAR'
def __init_... | normal | {
"blob_id": "8f960ad465d0a7bf48752db35c73169be6da27d8",
"index": 9092,
"step-1": "<mask token>\n\n\nclass PBAR(object):\n <mask token>\n\n def __init__(self, model):\n \"\"\"\n Defines the PCOMP object.\n\n :param self: the PCOMP object\n :param model: the BDF object\n :p... | [
3,
6,
7,
8,
9
] |
#!/usr/bin/python3
"""HAWK GUI interface Selenium test: tests hawk GUI with Selenium using firefox or chrome"""
import argparse, re, hawk_test_driver, hawk_test_ssh, hawk_test_results
### MAIN
# Command line argument parsing
parser = argparse.ArgumentParser(description='HAWK GUI interface Selenium test')
parser.add_... | normal | {
"blob_id": "874668d5f3ea61b6aabde7b784078b431961a9c9",
"index": 9096,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-b', '--browser', type=str, required=True, help=\n 'Browser to use in the test. Can be: firefox, chrome, chromium')\nparser.add_argument('-H', '--host', type=str, ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class ProductModelTests(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class SellerViewTests(TestCase):
@classmethod
def setUpTestData(cls):
Seller.objects.create(name='Bruna', email='bruna@example.com')
def test_get(self):
cli... | flexible | {
"blob_id": "71ab4ada4062ecde1463f2a766b5951860d0f2fb",
"index": 7250,
"step-1": "<mask token>\n\n\nclass ProductModelTests(TestCase):\n <mask token>\n <mask token>\n\n\nclass SellerViewTests(TestCase):\n\n @classmethod\n def setUpTestData(cls):\n Seller.objects.create(name='Bruna', email='bru... | [
9,
10,
13,
16,
17
] |
from django.shortcuts import render, redirect
from .game import run
from .models import Match
from team.models import Team, Player
from django.urls import reverse
# Create your views here.
def startgame(request):
match = Match(team1_pk = 1, team2_pk = 2)
team1 = Team.objects.get(pk = match.team1_pk)
team... | normal | {
"blob_id": "e1829904cea51909b3a1729b9a18d40872e7c13c",
"index": 6163,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef results(request):\n team1damage = 0\n team2damage = 0\n winner = run(1, 2)\n team1 = Team.objects.get(pk=1)\n team2 = Team.objects.get(pk=2)\n player1 = Player.o... | [
0,
1,
2,
3,
4
] |
from AStar import astar
def main():
grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0,... | normal | {
"blob_id": "ba483c7eaf2f2ced7f70a14b53c781f190585024",
"index": 1257,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0],\n [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0,\n 0, 0, 0,... | [
0,
1,
2,
3,
4
] |
# Original code from http://www.pythonforbeginners.com/code-snippets-source-code/port-scanner-in-python
#!/usr/bin/env python
# modules
import threading
import socket
import subprocess
import sys
import time
import scapy
from threading import Thread, Lock
from queue import Queue
from datetime import datetime
from log... | normal | {
"blob_id": "7e0eefb1d913787f675adc2ba0dccb16007464e4",
"index": 1764,
"step-1": "<mask token>\n\n\ndef checkhost(ip):\n conf.verb = 0\n try:\n ping = sr1(IP(dst=ip) / ICMP())\n print('\\n[*] Target is up, beginning scan...')\n except Exception:\n print(\"\\n[!] Couldn't resolve tar... | [
2,
3,
4,
5,
6
] |
# Stubs for docutils.parsers.rst.directives.tables (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
import csv
from docutils.statemachine import StringList
from docutils.nodes import Node, system_message, table, title
from docutils.parsers.rst import Directive
from typing impo... | normal | {
"blob_id": "9abf2b9b90d18332ede94cf1af778e0dda54330b",
"index": 949,
"step-1": "<mask token>\n\n\nclass RSTTable(Table):\n\n def run(self) ->List[Node]:\n ...\n\n\nclass CSVTable(Table):\n option_spec: Dict[str, Callable[[str], Any]] = ...\n\n\n class DocutilsDialect(csv.Dialect):\n delim... | [
11,
19,
20,
22,
24
] |
<|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": "65ea27851d9db0f0a06d42bd37eff633d22a1548",
"index": 9528,
"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 = [('books', '00... | [
0,
1,
2,
3,
4
] |
###############################################################
## File Name: 11_exercise.py
## File Type: Python File
## Author: surge55
## Course: Python 4 Everybody
## Chapter: Chapter 11 - Regular Expressions
## Excercise: n/a
## Description: Code walkthrough from book
## Other References: associated files... | normal | {
"blob_id": "860908126d473e6c4ed070992a1b518683fd4c27",
"index": 3275,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in hand:\n line = line.rstrip()\n x = re.findall('([0-9]+)', line)\n if len(x) > 0:\n for i in x:\n total += float(i)\nprint('sum is', int(total))\n",
... | [
0,
1,
2,
3,
4
] |
import re
f = open('q4text.txt')
text = f.read()
f.close()
pattern = r'''[0-9]+[,][0-9]+|[0-9]+[.][0-9]+|[0-9]+|\b[A-Z][a-z]+[.]|\b[A-Za-z]+['][a-z]+|[A-Z.]+[A-Z]|\b[A-Za-z-]+|[.]+|[.,'"!?:;]'''
word_token = re.findall(pattern, text)
token_dictionary = {}
for element in word_token:
if element in token_dictionary... | normal | {
"blob_id": "2e27302abbe239c1a6067a9eb52f5a857fff7dd2",
"index": 1736,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nf.close()\n<mask token>\nfor element in word_token:\n if element in token_dictionary:\n token_dictionary[element] += 1\n else:\n token_dictionary[element] = 1\nfor key... | [
0,
1,
2,
3,
4
] |
from django import template
import random
register = template.Library()
@register.simple_tag
def random_quote():
"""Returns a random quote to be displayed on the community sandwich page"""
quotes = [
"Growth is never by mere chance; it is the result of forces working together.\n-James Cash Penney",
... | normal | {
"blob_id": "6e73625adc10064cdb1b5f0546a4fc7320e9f5dc",
"index": 8366,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@register.simple_tag\ndef random_quote():\n \"\"\"Returns a random quote to be displayed on the community sandwich page\"\"\"\n quotes = [\n \"\"\"Growth is never by mere... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def animation_callback(step, cylinder, cylinder_frame, prev_cylinder2world,
Stheta_dot, inertia_inv):
if step == 0:
prev_cylinder2world[:, :] = np.eye(4)
Stheta_dot[:] = 0.0
wrench_in_cylinder = np.array([0.1, 0.001, 0.001, 0.01, 1.0, 1.0])
dt = 0.0005
... | flexible | {
"blob_id": "2019a2a5588e57164ff4226ef3bcbbc506f2b315",
"index": 7432,
"step-1": "<mask token>\n\n\ndef animation_callback(step, cylinder, cylinder_frame, prev_cylinder2world,\n Stheta_dot, inertia_inv):\n if step == 0:\n prev_cylinder2world[:, :] = np.eye(4)\n Stheta_dot[:] = 0.0\n wrench... | [
1,
3,
4,
5,
6
] |
# 代码3-14 pandas累积统计特征函数、移动窗口统计函数示例
import pandas as pd
D = pd.Series(range(0, 20)) # 构造Series,内容为0~19共20个整数
print(D.cumsum()) # 给出前n项和
print(D.rolling(2).sum()) # 依次对相邻两项求和
| normal | {
"blob_id": "7639b80c9e6e1b2e1e55a47a862c433b64168cf6",
"index": 7475,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(D.cumsum())\nprint(D.rolling(2).sum())\n",
"step-3": "<mask token>\nD = pd.Series(range(0, 20))\nprint(D.cumsum())\nprint(D.rolling(2).sum())\n",
"step-4": "import pandas as pd\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class ReadingTipRepository:
<|reserved_special_token_0|>
def get_tips(self, user, tag='all'):
if tag == 'all':
return ReadingTip.query.filter_by(user=user).all()
else:
return ReadingTip.query.filter_by(user=user).filter(ReadingTip.
... | flexible | {
"blob_id": "d82b68d5c83ae538d7a8b5ae5547b43ac4e8a3d4",
"index": 6910,
"step-1": "<mask token>\n\n\nclass ReadingTipRepository:\n <mask token>\n\n def get_tips(self, user, tag='all'):\n if tag == 'all':\n return ReadingTip.query.filter_by(user=user).all()\n else:\n retur... | [
4,
7,
9,
11,
12
] |
<|reserved_special_token_0|>
class result(Enum):
CRIT = 16
HIT = 8
EVADE = 4
FOCUS = 2
BLANK = 1
<|reserved_special_token_0|>
class die:
def __init__(self):
self.rerolled = False
def __str__(self):
return result_str(self.result)
@staticmethod
def __roll_die__... | flexible | {
"blob_id": "5261346f96e7520b6ef75a292b3d44a6f00d868c",
"index": 5566,
"step-1": "<mask token>\n\n\nclass result(Enum):\n CRIT = 16\n HIT = 8\n EVADE = 4\n FOCUS = 2\n BLANK = 1\n\n\n<mask token>\n\n\nclass die:\n\n def __init__(self):\n self.rerolled = False\n\n def __str__(self):\n ... | [
24,
26,
29,
33,
38
] |
<|reserved_special_token_0|>
def _map(arg):
key, names = arg
size = len(names)
urls = set()
for index, name in enumerate(names):
html = gzip.decompress(open('htmls/' + name, 'rb').read()).decode()
soup = bs4.BeautifulSoup(html, 'lxml')
for a in soup.findAll('a', href=True):
... | flexible | {
"blob_id": "3acd592594ae4f12b9b694aed1aa0d48ebf485f5",
"index": 5787,
"step-1": "<mask token>\n\n\ndef _map(arg):\n key, names = arg\n size = len(names)\n urls = set()\n for index, name in enumerate(names):\n html = gzip.decompress(open('htmls/' + name, 'rb').read()).decode()\n soup = ... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 4 12:14:16 2020
@author: mdevasish
"""
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression,Lasso,Ridge
from sklearn.metrics import mean_squared_error,mean_absolute_error
from sklearn.model_selection import train_test_split
import job... | normal | {
"blob_id": "f07b95a3b18aecf6cadaa8398c9158a7cd10aeeb",
"index": 7101,
"step-1": "<mask token>\n\n\nclass model_construction:\n <mask token>\n\n def implement_model(self, filename):\n \"\"\"\n Method inside the model_construction class, used for implementing the model\n and return feat... | [
2,
3,
4,
5,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
__all__ = ['MimicExplainer']
<|reserved_special_token_1|>
<|reserved_special_token_0|>
from .mimic_explainer import MimicExplainer
__all__ = ['MimicExplainer']
<|reserved_special_token_1|>
# ---------------------------------... | flexible | {
"blob_id": "0b8cb522c531ac84d363b569a3ea4bfe47f61993",
"index": 5390,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__all__ = ['MimicExplainer']\n",
"step-3": "<mask token>\nfrom .mimic_explainer import MimicExplainer\n__all__ = ['MimicExplainer']\n",
"step-4": "# ----------------------------------... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
"""
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
22=4, 23=8, 24=16, 25=32
32=9, 33=27, 34=81, 35=243
42=16, 43=64, 44=256, 45=1024
52=25, 53=125, 54=625, 55=3125
If they are then placed in numerical order, with any repeats removed, we get the following seq... | normal | {
"blob_id": "c93bd042340a6e1d0124d8f6176bdf17ab56e405",
"index": 2229,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef euler_29(max_a, max_b):\n gen = (a ** b for a, b in itertools.product(range(2, max_a + 1), range(\n 2, max_b + 1)))\n return len(set(gen))\n\n\n<mask token>\n",
"st... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(5):
arr.append(int(input()))
print(min(arr[0], arr[1], arr[2]) + min(arr[3], arr[4]) - 50)
<|reserved_special_token_1|>
arr = []
for i in range(5):
arr.append(int(input()))
print(min(arr[0], arr[1], arr[2... | flexible | {
"blob_id": "8745855d86dcdabe55f8d1622b66b3613dbfe3e1",
"index": 4015,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(5):\n arr.append(int(input()))\nprint(min(arr[0], arr[1], arr[2]) + min(arr[3], arr[4]) - 50)\n",
"step-3": "arr = []\nfor i in range(5):\n arr.append(int(input()))... | [
0,
1,
2
] |
#!/usr/bin/env python2
import socket
import struct
RHOST = "10.10.10.2"
RPORT = 110
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((RHOST, RPORT))
# OFFSETS
# EIP 4654
# ESP 342
# EBP 4650
# jmp_esp in slmfc.dll at 5f4a358f
jmp_esp = 0x5f4a358f
nop_sled = "\x90" * 32
buf_totlen = 5000
offset_srp =... | normal | {
"blob_id": "280a4e1fb35937bb5a5c604f69337d30a4b956a9",
"index": 6302,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ns.connect((RHOST, RPORT))\n<mask token>\nshellcode_calc += b'\\xba\\xd5\\x90\\xd2}\\xdb\\xd5\\xd9t$'\nshellcode_calc += b'\\xf4X1\\xc9\\xb161P\\x13\\x83'\nshellcode_calc += b\"\\xe8\\xfc\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
l_store_id = random.randint(1, 4)
now = datetime.datetime.now()
l_bill_id = now.strftime('%Y%m%d%H%M%S')
start_date = datetime.date(2000, 1, 1)
end_date = datetime.date(2020, 1, 1)
time_between_... | flexible | {
"blob_id": "fad2ad89e4d0f04fad61e27048397a5702870ca9",
"index": 6177,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n l_store_id = random.randint(1, 4)\n now = datetime.datetime.now()\n l_bill_id = now.strftime('%Y%m%d%H%M%S')\n start_date = datetime.date(2000, 1, 1)\n end_da... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Area(Resource):
<|reserved_special_token_0|>
pareser.add_argument('name', type=str, required=True, help=
'Area name is required')
@jwt_required()
def get(self, name):
area = AreaModel.search_area_byname(name)
if area:
return area.... | flexible | {
"blob_id": "4dcc0261abdb783c60471736567faf7db8b56190",
"index": 9548,
"step-1": "<mask token>\n\n\nclass Area(Resource):\n <mask token>\n pareser.add_argument('name', type=str, required=True, help=\n 'Area name is required')\n\n @jwt_required()\n def get(self, name):\n area = AreaModel... | [
5,
6,
7,
8,
9
] |
import os
import shutil
import numpy as np
import unittest
from lsst.ts.wep.Utility import FilterType, runProgram
from lsst.ts.wep.WepController import WepController
from lsst.ts.wep.ctrlIntf.RawExpData import RawExpData
from lsst.ts.aoclcSim.Utility import getModulePath
from lsst.ts.aoclcSim.WepCmpt import WepCmpt
... | normal | {
"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|>
def check_bit4(input):
mas = 8
desired = input & mas
if desired > 0:
return 'om'
else:
return 'off'
<|reserved_special_token_1|>
def check_bit4(input):
mas=0b1000
desired=input & mas
if desired>0:
return "om"
else :
... | flexible | {
"blob_id": "29dc940292a6805aabfa5bed22bb75d31140c83f",
"index": 3257,
"step-1": "<mask token>\n",
"step-2": "def check_bit4(input):\n mas = 8\n desired = input & mas\n if desired > 0:\n return 'om'\n else:\n return 'off'\n",
"step-3": "def check_bit4(input):\n\tmas=0b1000\n\tdesire... | [
0,
1,
2
] |
from django import forms
class RemoveProdutoDoCarrinhoForm(forms.Form):
class Meta:
fields = ('produto_id')
produto_id = forms.CharField(widget=forms.HiddenInput())
class QuantidadeForm(forms.Form):
class Meta:
fields = ('quantidade', 'produto_id')
# <input type="hidden" name="produt... | normal | {
"blob_id": "fd5fca0e9abbb669ddff4d676147acc4344cdd1c",
"index": 509,
"step-1": "<mask token>\n\n\nclass QuantidadeForm(forms.Form):\n\n\n class Meta:\n fields = 'quantidade', 'produto_id'\n produto_id = forms.CharField(widget=forms.HiddenInput())\n quantidade = forms.IntegerField(min_value=1, ma... | [
2,
3,
4,
5,
6
] |
from os.path import dirname
import binwalk
from nose.tools import eq_, ok_
def test_firmware_squashfs():
'''
Test: Open hello-world.srec, scan for signatures
verify that only one signature is returned
verify that the only signature returned is Motorola S-rec data-signature
'''
expected_result... | normal | {
"blob_id": "d55043c2a18b935478d9be442aaf7305231edc7d",
"index": 5828,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_firmware_squashfs():\n \"\"\"\n Test: Open hello-world.srec, scan for signatures\n verify that only one signature is returned\n verify that the only signature ret... | [
0,
1,
2,
3
] |
# Created by Yuexiong Ding
# Date: 2018/9/4
# Description:
| normal | {
"blob_id": "ddb139fa3fbfa1218459e3865150465a44a03bea",
"index": 6306,
"step-1": "# Created by Yuexiong Ding\n# Date: 2018/9/4\n# Description: \n\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
1
]
} | [
1
] |
<|reserved_special_token_0|>
def get_ratings(file_path):
ratings = pd.read_table(file_path, header=0, sep=';', encoding='ISO-8859-1'
)
print('前5条数据:\n{}\n'.format(ratings.head(5)))
print('总的数据条数:\n{}\n'.format(ratings.count()))
print('用户对图书的评分范围:<{},{}>\n'.format(min(ratings['Book-Rating']),
... | flexible | {
"blob_id": "be5178f013e639d5179ed1af380dd7a63044bff2",
"index": 5636,
"step-1": "<mask token>\n\n\ndef get_ratings(file_path):\n ratings = pd.read_table(file_path, header=0, sep=';', encoding='ISO-8859-1'\n )\n print('前5条数据:\\n{}\\n'.format(ratings.head(5)))\n print('总的数据条数:\\n{}\\n'.format(rati... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main() ->None:
try:
command = sys.argv[0]
args = sys.argv[1:]
cli.main(command, args)
except KeyboardInterrupt:
pass
<|reserved_special_token_1|>
import sys
from . import cli
def ... | flexible | {
"blob_id": "9969dcf820a5ff34b483593cd43e4dfba9588ed2",
"index": 4348,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main() ->None:\n try:\n command = sys.argv[0]\n args = sys.argv[1:]\n cli.main(command, args)\n except KeyboardInterrupt:\n pass\n",
"step-3": ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def gz_decode(obj):
return pickle.loads(zlib.decompress(bytes(obj)))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def gz_encode(obj):
return sqlite3.Binary(zlib.compress(pickle.dumps(obj, pickle.
HIGHEST_PROTOCOL)))
def gz... | flexible | {
"blob_id": "295d6a66335491b406f47212064da9fd5fca6eb6",
"index": 6812,
"step-1": "<mask token>\n\n\ndef gz_decode(obj):\n return pickle.loads(zlib.decompress(bytes(obj)))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef gz_encode(obj):\n return sqlite3.Binary(zlib.compress(pickle.dumps(obj, pickle.... | [
1,
2,
3,
4,
5
] |
alien_0 = {} # 声明一个空字典
alien_0['color'] = 'green' # 向空字典中添加值
alien_0['points'] = 5
print(alien_0)
x = alien_0['color']
print(f"\nThe alien is {alien_0['color']}") # 引号的用法
alien_0['color'] = 'yellow' # 对字典中的元素重新赋值
print(f"The alien is now {alien_0['color']}")
| normal | {
"blob_id": "f4dd9500835cb22a859da8bd57487052522bb593",
"index": 7697,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(alien_0)\n<mask token>\nprint(f\"\"\"\nThe alien is {alien_0['color']}\"\"\")\n<mask token>\nprint(f\"The alien is now {alien_0['color']}\")\n",
"step-3": "alien_0 = {}\nalien_0['... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class MethodMessageParserTestCase(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MethodMessageParserTestCase(unittest.TestCase):
<|reserved_special_token_0|>
def test_parse... | flexible | {
"blob_id": "e103e7a215614e1a7923838b775f49bba2792036",
"index": 8508,
"step-1": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n\n def test_... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(float(my_int))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
greeting = 'My name is '
your_name = ''
best_string = 'I am '
your_age = 6
my_int = 5
print(float(my_int))
pi = 3.1415
<|reserved_special_token_1|... | flexible | {
"blob_id": "fcbbffe0682da9f2131fdddbef606dcae3303ce9",
"index": 1979,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(float(my_int))\n<mask token>\n",
"step-3": "greeting = 'My name is '\nyour_name = ''\nbest_string = 'I am '\nyour_age = 6\nmy_int = 5\nprint(float(my_int))\npi = 3.1415\n",
"ste... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
@app.callback(Output('ganttpersoon', 'figure'), [Input(
'dropdownganttpersoon', 'value'), Input('dropdownganttpersoonstatus',
'value')])
def update_ganttpersoon(v1, v2):
ganttdata = []
for i, j in data['kaarten'].items():
if j[config.get('Custom Field for Person')]... | flexible | {
"blob_id": "c5f41b69ac215bd661ee39bdc8c3119db9606ca8",
"index": 6020,
"step-1": "<mask token>\n\n\n@app.callback(Output('ganttpersoon', 'figure'), [Input(\n 'dropdownganttpersoon', 'value'), Input('dropdownganttpersoonstatus',\n 'value')])\ndef update_ganttpersoon(v1, v2):\n ganttdata = []\n for i, ... | [
2,
8,
10,
11,
12
] |
class TestContext:
def test_should_get_variable_from_env(self, monkeypatch, fake_context):
expected = "test"
monkeypatch.setenv("SOURCE_PATH", expected)
actual = fake_context.get("SOURCE_PATH")
assert actual == expected
def test_should_get_variable_from_local_state(self, fake_co... | normal | {
"blob_id": "e83a9a4675e5beed938860037658d33c4d347b29",
"index": 8528,
"step-1": "class TestContext:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "class TestContext:\n <mask token>\n\n def test_should_get_variable_from_local_state(self, fake_context):\n expected = 'test'\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
@micro_service.route('/')
def home():
return jsonify({'message': 'Hello, world!'})
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@micro_service.route('/')
def home():
return jsonify({'message': 'Hello, world!'})
if __name__ == '__m... | flexible | {
"blob_id": "4b14dee3625d5d0c703176ed2f0a28b2583fd84d",
"index": 6519,
"step-1": "<mask token>\n\n\n@micro_service.route('/')\ndef home():\n return jsonify({'message': 'Hello, world!'})\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\n@micro_service.route('/')\ndef home():\n return jsonify({'message': ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('', home_vacancies_view, name='vacancy-home'), path(
'list/', vacancies_view, name='vacancy')]
<|reserved_special_token_1|>
from django.urls import path
from jobscrapper.views import *
urlpatterns = [pat... | flexible | {
"blob_id": "3ee20391d56d8c429ab1bd2f6b0e5b261721e401",
"index": 7965,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', home_vacancies_view, name='vacancy-home'), path(\n 'list/', vacancies_view, name='vacancy')]\n",
"step-3": "from django.urls import path\nfrom jobscrapper.vie... | [
0,
1,
2,
3
] |
#!/opt/Python/2.7.3/bin/python
import sys
from collections import defaultdict
import numpy as np
import re
import os
import argparse
from Bio import SeqIO
def usage():
test="name"
message='''
python CircosConf.py --input circos.config --output pipe.conf
'''
print message
def fasta_id(fastafile):
... | normal | {
"blob_id": "fe0d6cc03512d54d2d8722551e3f2a7c1bf43997",
"index": 3581,
"step-1": "#!/opt/Python/2.7.3/bin/python\nimport sys\nfrom collections import defaultdict\nimport numpy as np\nimport re\nimport os\nimport argparse\nfrom Bio import SeqIO\n\ndef usage():\n test=\"name\"\n message='''\npython CircosCon... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
def isNumber(self, A):
while len(A) > 0 and A[0] == ' ... | flexible | {
"blob_id": "50be2cbdaec6ed76e5d9367c6a83222f9153db82",
"index": 7426,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Solution:\n\n def isNumber(self, A):\n while len(A) > 0 and A[0] == ' ':\n ... | [
0,
1,
2,
3,
4
] |
# Import other modules
from zelda_utilities.constants import *
# Helps establish the current frame for sprite animation/image changing
class Animation:
def __init__(self):
# Animation clock
self.next_frame = pygame.time.get_ticks()
# Starting frame
self.frame = 0
# ~12 fr... | normal | {
"blob_id": "0b36bf9ac7887101be5503a0edce19e1111e5ca0",
"index": 6607,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Animation:\n\n def __init__(self):\n self.next_frame = pygame.time.get_ticks()\n self.frame = 0\n self.frame_time = 1000 // ANIMATION_RATE\n <mask tok... | [
0,
2,
3,
4,
5
] |
api_id = "2168275"
api_hash = "e011a9cb95b7e7e153aa5840985fc883"
| normal | {
"blob_id": "c6d6fcc242e1b63104a3f3eb788880635257ff4c",
"index": 7503,
"step-1": "<mask token>\n",
"step-2": "api_id = '2168275'\napi_hash = 'e011a9cb95b7e7e153aa5840985fc883'\n",
"step-3": "api_id = \"2168275\"\napi_hash = \"e011a9cb95b7e7e153aa5840985fc883\"\n",
"step-4": null,
"step-5": null,
"step-... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class UIHBarrier(UIHandler):
<|reserved_special_token_0|>
class UIWBDetector(UIHandler):
def get(self, *args, **kwargs):
template_args = self.get_template_args()
template_args['demo_title'] = 'Détecteur noir/blanc'
self.render(os.path.join(self.applicati... | flexible | {
"blob_id": "b13d4b0ccb693fb97befb4ee47974d8ee076b52b",
"index": 5177,
"step-1": "<mask token>\n\n\nclass UIHBarrier(UIHandler):\n <mask token>\n\n\nclass UIWBDetector(UIHandler):\n\n def get(self, *args, **kwargs):\n template_args = self.get_template_args()\n template_args['demo_title'] = 'D... | [
7,
11,
14,
15,
16
] |
from nmigen import *
class Top(Elaboratable):
def __init__(self):
self.counter = Signal(3)
self.led = Signal()
def elaborate(self, platform):
m = Module()
m.d.comb += self.led.eq(self.counter[2])
m.d.sync += self.counter.eq(self.counter + 1)
return m
| normal | {
"blob_id": "22b6ea64cdb109e1c6b2536b50935d09d37a7e1a",
"index": 3057,
"step-1": "<mask token>\n\n\nclass Top(Elaboratable):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Top(Elaboratable):\n <mask token>\n\n def elaborate(self, platform):\n m = Module()\n m.d.c... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(round(km / cg, 3), 'km/l')
<|reserved_special_token_1|>
km = float(input())
cg = float(input())
print(round(km / cg, 3), 'km/l')
<|reserved_special_token_1|>
km=float(input())
cg=float(input())
print(round(km/cg,3),"km... | flexible | {
"blob_id": "db33f7386d1eacbfbfd29aa367df310c557ae864",
"index": 8520,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(round(km / cg, 3), 'km/l')\n",
"step-3": "km = float(input())\ncg = float(input())\nprint(round(km / cg, 3), 'km/l')\n",
"step-4": "km=float(input())\ncg=float(input())\nprint(r... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def setupLed1():
for port in led1:
GPIO.setup(port[1], GPIO.OUT)
def setupLed2():
for port in led2:
GPIO.setup(port[1], GPIO.OUT)
def statusLed(port, status):
GPIO.output(port, status)
def turnOnAllLeds():
for led in led1:
statusLed(led[1], Tr... | flexible | {
"blob_id": "0d022291f9ace02ef1ee5c462657ea6376a0e6a4",
"index": 9436,
"step-1": "<mask token>\n\n\ndef setupLed1():\n for port in led1:\n GPIO.setup(port[1], GPIO.OUT)\n\n\ndef setupLed2():\n for port in led2:\n GPIO.setup(port[1], GPIO.OUT)\n\n\ndef statusLed(port, status):\n GPIO.output... | [
10,
11,
12,
13,
15
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "6b7ff00eb9a5d0837def5b245ba2d4a0acec972e",
"index": 3466,
"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 = [('challenges'... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(str(bool(re.search(regex, raw_input()))).lower())
<|reserved_special_token_1|>
<|reserved_special_token_0|>
regex = '^\\d{2}(-?)\\d{2}\\1\\d{2}\\1\\d{2}$'
<|reserved_special_token_0|>
print(str(bool(re.search(regex, raw_i... | flexible | {
"blob_id": "e884ce5878de75afe93085e2310b4b8d5953963a",
"index": 337,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(str(bool(re.search(regex, raw_input()))).lower())\n",
"step-3": "<mask token>\nregex = '^\\\\d{2}(-?)\\\\d{2}\\\\1\\\\d{2}\\\\1\\\\d{2}$'\n<mask token>\nprint(str(bool(re.search(re... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class LoggerTestCase(TestCase):
def test_flag_value(self):
self.assertEqual(SUCCESS, '\x1b[34mSUCCESS\x1b[0m')
self.assertEqual(FAILURE, '\x1b[31mFAILURE\x1b[0m')
<|reserved_special_token_0|>
<|reserve... | flexible | {
"blob_id": "ac8c8dc4bcccef7942dd48d54902e13e811f950c",
"index": 5059,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LoggerTestCase(TestCase):\n\n def test_flag_value(self):\n self.assertEqual(SUCCESS, '\\x1b[34mSUCCESS\\x1b[0m')\n self.assertEqual(FAILURE, '\\x1b[31mFAILURE\\... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def extremes(nums):
return max(nums), min(nums)
<|reserved_special_token_1|>
# *Using Min & Max Exercise
def extremes(nums):
return (max(nums), min(nums))
| flexible | {
"blob_id": "0577c274672bac333500535f21f568ade62100c7",
"index": 3580,
"step-1": "<mask token>\n",
"step-2": "def extremes(nums):\n return max(nums), min(nums)\n",
"step-3": "\n# *Using Min & Max Exercise\ndef extremes(nums):\n return (max(nums), min(nums))\n",
"step-4": null,
"step-5": null,
"st... | [
0,
1,
2
] |
import pandas as pd
import notification
def modify(nyt_url, jh_url):
# read data from both sources into a dataframe
# remove unwanted data, formats, and filters
# join dataframes on index
try:
nyt_df = pd.read_csv(nyt_url,
header=0,
nam... | normal | {
"blob_id": "c60971b3b0649fce8c435813de4a738f4eacda27",
"index": 4377,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef modify(nyt_url, jh_url):\n try:\n nyt_df = pd.read_csv(nyt_url, header=0, names=['Date', 'Cases',\n 'Deaths'], dtype={'Cases': 'Int64', 'Deaths': 'Int64'})\n ... | [
0,
1,
2,
3
] |
import os
import math
import time
from tqdm import tqdm
import torch
from torch import nn
import torch.optim as optim
from torch.nn import functional as F
from torch.nn.utils import clip_grad_norm_
from torch.utils.data import DataLoader
from nag.modules import Transformer, TransformerTorch
from nag.logger... | normal | {
"blob_id": "bc6c3383684cbba775d17f81ead3346fe1a01f90",
"index": 5102,
"step-1": "<mask token>\n\n\ndef train(epoch, model, dataloader, criterion, optimizer, scheduler):\n global global_train_step\n model.train()\n total_loss = 0.0\n bleu_score = 0.0\n distinct_1_score, distinct_2_score = 0.0, 0.0... | [
3,
4,
5,
6,
8
] |
<|reserved_special_token_0|>
class Cluster:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __len__(self):
return len(self.embeddings_dict)
def set_label(self, label):
self.label = label
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_sp... | flexible | {
"blob_id": "265c594b12ea45a2dda12e1157e5ea040f4d6ce4",
"index": 9021,
"step-1": "<mask token>\n\n\nclass Cluster:\n <mask token>\n <mask token>\n\n def __len__(self):\n return len(self.embeddings_dict)\n\n def set_label(self, label):\n self.label = label\n <mask token>\n <mask to... | [
7,
17,
20,
21,
22
] |
<|reserved_special_token_0|>
def SetCommon(Common, XmlCommon):
XmlTag = 'Usage'
Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
XmlTag = 'FeatureFlag'
Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
XmlTag = 'SupArchList'
Common.SupArchList = XmlAttribute(XmlCommon, XmlTag).split()... | flexible | {
"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
] |
""" Python Package Support """
# Not applicable
""" Django Package Support """
# Not applicable
""" Internal Package Support """
from Data_Base.models import School, Person, Child
"""
Data_Base/Data/Imports/child_import.py
Author: Matthew J Swann;
Yong Kin;
Bradon Atkins; and
... | normal | {
"blob_id": "d0287b057530883a50ad9c1e5e74dce10cd825b6",
"index": 7961,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ChildImport(object):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass ChildImport(object):\n\n def __init__(self, scriptName=None):\n x = Child.objects.creat... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MultinomialAdversarialNetwork(TopicModel):
<|reserved_special_token_0|>
def prepare_data(self, d):
"""
Assume d is a dictionary of dataset where d[domain] = another dataset class
Assume labeled domain = train set, unlabeled = test
"""
... | flexible | {
"blob_id": "8f01934472805b5ad6dca328483a7ac79ae7748a",
"index": 6474,
"step-1": "<mask token>\n\n\nclass MultinomialAdversarialNetwork(TopicModel):\n <mask token>\n\n def prepare_data(self, d):\n \"\"\"\n Assume d is a dictionary of dataset where d[domain] = another dataset class\n As... | [
4,
5,
6,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def buildExpectations(queryPath, searchPatternPath):
"""
Based on SpeechCommand_v0.02 directory structure.
"""
expectations = []
currentDirectory = ''
queryFilename = queryPath.split('/')[-1]
queryDir... | flexible | {
"blob_id": "03fb1cf0aac0c37858dd8163562a7139ed4e1179",
"index": 776,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef buildExpectations(queryPath, searchPatternPath):\n \"\"\"\n Based on SpeechCommand_v0.02 directory structure.\n \"\"\"\n expectations = []\n currentDirectory = ''\n ... | [
0,
2,
3,
4,
5
] |
import abc
class Connector:
"""@abc.abstractmethod
def connect(self):
pass
"""
@abc.abstractmethod
def save(self, item):
pass
@abc.abstractmethod
def load_all(self):
pass
@abc.abstractmethod
def load_by_id(self, i... | normal | {
"blob_id": "ac46aa6f8f4f01b6f3c48532533b9dd41a8a1c1c",
"index": 7007,
"step-1": "<mask token>\n\n\nclass Connector:\n <mask token>\n\n @abc.abstractmethod\n def save(self, item):\n pass\n\n @abc.abstractmethod\n def load_all(self):\n pass\n\n @abc.abstractmethod\n def load_by_... | [
4,
5,
7,
8,
10
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.