code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
a = (5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7) b = [] for index, elements in enumerate (a): if elements == 5: b.append(index) print(b)
normal
{ "blob_id": "d7876a078af8572e44b4eb16f3ec0898db73724d", "index": 2118, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor index, elements in enumerate(a):\n if elements == 5:\n b.append(index)\nprint(b)\n", "step-3": "a = 5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7\nb = []\nfor index, elements i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def _split_journal_attrs(attrs): if attrs: return [t.text.replace(':', '').strip().split('\n') for t in [k for k in attrs if isinstance(k, bs4.element.Tag)]] return [] def _get_title_history(history_attrs): all_td = [] if history_attrs: for h ...
flexible
{ "blob_id": "002f65fd77ce5043d1a0495ed13c15e3b4d2fb76", "index": 7244, "step-1": "<mask token>\n\n\ndef _split_journal_attrs(attrs):\n if attrs:\n return [t.text.replace(':', '').strip().split('\\n') for t in [k for\n k in attrs if isinstance(k, bs4.element.Tag)]]\n return []\n\n\ndef _ge...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> wd.get('https://www.baidu.com/') wd.find_element_by_id('kw').send_keys(u'哈哈') wd.quit() <|reserved_special_token_1|> <|reserved_special_token_0|> wd = webdriver.Firefox() wd.get('https://www.baidu.com/') wd.find_element_by_id('...
flexible
{ "blob_id": "8de36400f21bfb4e24703d5a65471a961e1afddc", "index": 9796, "step-1": "<mask token>\n", "step-2": "<mask token>\nwd.get('https://www.baidu.com/')\nwd.find_element_by_id('kw').send_keys(u'哈哈')\nwd.quit()\n", "step-3": "<mask token>\nwd = webdriver.Firefox()\nwd.get('https://www.baidu.com/')\nwd.fin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_status_name(status): return '[%d]%s' % (status, statuses[status]['name']) <|reserved_special_token_1|> __author__ = 'virtual' statuses = {None: {'name': 'None'}, (-1): {'name': 'unknown'}, (0): {'name': ''}, (...
flexible
{ "blob_id": "a847fc32af2602db3b5545c15186c0209eb8ae8d", "index": 4008, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_status_name(status):\n return '[%d]%s' % (status, statuses[status]['name'])\n", "step-3": "__author__ = 'virtual'\nstatuses = {None: {'name': 'None'}, (-1): {'name': 'unk...
[ 0, 1, 2, 3 ]
#program_skeleton.py #import load_json_files as bm import write import merge as m import load_df as ldf import load_vars as lv import log as log import clean_df as clean import download as dl import gc import confirm_drcts as cfs import fix_files as ff import readwrite as rw import df_filter as df_f import realtor_scr...
normal
{ "blob_id": "6a8007e44d2c4b56426cd49772cbc23df2eca49c", "index": 6917, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef program_skeleton(dictionary: dict):\n if dictionary['tasks']['environmental_vars']['run'] == True:\n dictionary['tasks']['environmental_vars']['log'][\n 'envi...
[ 0, 1, 2, 3 ]
import os import csv from django.core.management.base import BaseCommand, CommandError from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from aec.apps.vocabulary.serializers import DictionarySerializer from aec.apps.vocabulary.models import Word from aec.apps.library.serializers i...
normal
{ "blob_id": "7d4d5ca14c3e1479059f77c6a7f8dcfad599443b", "index": 4729, "step-1": "import os\nimport csv\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\nfrom django.core.exceptions import ObjectDoesNotExist\n\nfrom aec.apps.vocabulary.serializers import Dict...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "d5c7b8966e73c607d1d1c5da9814ef507dc53b59", "index": 6852, "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 = [('proposal', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class InvoicePositionViewSet(ModelViewSet): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class CountryListView(ListAPIView): queryset = Country.objects.all() serializer_class = CountrySerializer filter_backends = [filters...
flexible
{ "blob_id": "43bad38d209b5c326cb9f17ba1ae135d06320e97", "index": 145, "step-1": "<mask token>\n\n\nclass InvoicePositionViewSet(ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass CountryListView(ListAPIView):\n queryset = Country.objects.all()\n serializer_class = CountrySerial...
[ 5, 6, 9, 11, 12 ]
from torchsummary import summary import torch import torch.nn as nn import torch.nn.functional as F from eva4modeltrainer import ModelTrainer class Net(nn.Module): """ Base network that defines helper functions, summary and mapping to device """ def conv2d(self, in_channels, out_channels, ker...
normal
{ "blob_id": "f925b3b2f55c3f8daf57438d8d20b60446ae39af", "index": 6111, "step-1": "<mask token>\n\n\nclass Net(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def create_depthwise_conv2d(self, in_channels, out_channels,\n kernel_size=(3, 3), dila...
[ 6, 7, 11, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(*args, **kwargs): text = ' '.join(map(str, args)) espeak.synth(text) <|reserved_special_token_1|> try: from espeak import espeak except ImportError: class espeak: @classmethod def sy...
flexible
{ "blob_id": "cd5929496b13dd0d5f5ca97500c5bb3572907cc5", "index": 2769, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(*args, **kwargs):\n text = ' '.join(map(str, args))\n espeak.synth(text)\n", "step-3": "try:\n from espeak import espeak\nexcept ImportError:\n\n\n class espeak:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestMixin(TestCase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestMixin(TestCase): @classmethod def setUpClass(cls): cls.base_dir = os.path.dirn...
flexible
{ "blob_id": "268a8252f74a2bdafdadae488f98997c91f5607c", "index": 2686, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestMixin(TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestMixin(TestCase):\n\n @classmethod\n def setUpClass(cls):\n cls.base_dir = os.pat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @override_settings(USE_TZ=False) class TestEmailUserManager(TestCase): def setUp(self): self.email = 'user@example.com' self.password = 'default' def test_private_create_user_without_email(self): """ Test that EmailUser.objects._create_user withou...
flexible
{ "blob_id": "71f9d9d7973809654db3ea613073f2d431f2d65f", "index": 1510, "step-1": "<mask token>\n\n\n@override_settings(USE_TZ=False)\nclass TestEmailUserManager(TestCase):\n\n def setUp(self):\n self.email = 'user@example.com'\n self.password = 'default'\n\n def test_private_create_user_witho...
[ 7, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def get_features_da(config, sent_dict): features = [] if len(config[0]) > 0: top = config[0][-1] top_stk_token_feature = 'TOP_STK_TOKEN_' + str(sent_dict['FORM'][ top].lower()) features.append(top_stk_token_feature)...
flexible
{ "blob_id": "e0ce8a8ad9c842b013bbb1ea1c585b6c4c2a68f5", "index": 2868, "step-1": "<mask token>\n", "step-2": "def get_features_da(config, sent_dict):\n features = []\n if len(config[0]) > 0:\n top = config[0][-1]\n top_stk_token_feature = 'TOP_STK_TOKEN_' + str(sent_dict['FORM'][\n ...
[ 0, 1, 2 ]
#!/usr/bin/env python ''' export_claims -- export claims in CSV format https://sfreeclaims.anvicare.com/docs/forms/Reference-CSV%20Specifications.txt ''' import csv from itertools import groupby from operator import itemgetter import wsgiref.handlers import MySQLdb import ocap from hhtcb import Xataface, WSGI def...
normal
{ "blob_id": "41f70cdfc9cbe5ec4560c1f3271a4636cca06d16", "index": 3012, "step-1": "#!/usr/bin/env python\n''' export_claims -- export claims in CSV format\n\nhttps://sfreeclaims.anvicare.com/docs/forms/Reference-CSV%20Specifications.txt\n'''\n\nimport csv\nfrom itertools import groupby\nfrom operator import itemg...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.open('ECS165') print(db) <|reserved_special_token_0|> print('Merge Start') q.table.merge(0) print('Merge End') db.close() <|reserved_special_token_1|> <|reserved_special_token_0|> db = Database() db.open('ECS165') print(db) ...
flexible
{ "blob_id": "8f5b7711d913c7375d6816dd94731f1ce5ca1a62", "index": 8289, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.open('ECS165')\nprint(db)\n<mask token>\nprint('Merge Start')\nq.table.merge(0)\nprint('Merge End')\ndb.close()\n", "step-3": "<mask token>\ndb = Database()\ndb.open('ECS165')\nprint...
[ 0, 1, 2, 3, 4 ]
from __future__ import print_function import re import sys from pyspark import SparkContext # define a regular expression for delimiters NON_WORDS_DELIMITER = re.compile(r'[^\w\d]+') def main(): if len(sys.argv) < 2: print('''Usage: pyspark q2.py <file> e.g. pyspark q2.py file:///home/cloudera/test...
normal
{ "blob_id": "deff4eb3ae933a99036f39213ceaf2144b682904", "index": 5025, "step-1": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 2:\n print(\n 'Usage: pyspark q2.py <file>\\n e.g. pyspark q2.py file:///home/cloudera/test_file'\n )\n exit(-1)\n sc = SparkContext(ap...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( """ Instructions press Enter to begin. Afterwards press Enter to "click" the stopwatch. Press Ctrl-C to quit""" ) input() print('Started') <|reserved_special_token_0|> try: while True: input() ...
flexible
{ "blob_id": "cc87682d4ebb283e2d0ef7c09ad28ba708c904bd", "index": 4407, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n \"\"\" \n\nInstructions\n\npress Enter to begin.\n\nAfterwards press Enter to \"click\" the stopwatch.\n\nPress Ctrl-C to quit\"\"\"\n )\ninput()\nprint('Started')\n<mask t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def pw_validator(pw): pw = list(pw) if len(pw) < 6 or len(pw) > 16: return 'Please enter a valid password.' num_count = 0 lower_count = 0 upper_count = 0 spec_count = 0 for i in pw: if...
flexible
{ "blob_id": "d72f9d521613accfd93e6de25a71d188626a0952", "index": 4807, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef pw_validator(pw):\n pw = list(pw)\n if len(pw) < 6 or len(pw) > 16:\n return 'Please enter a valid password.'\n num_count = 0\n lower_count = 0\n upper_count...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def base_url(): default_request = {'base_url': url, 'headers': {'Content-Type': 'application/json;charset=UTF-8'}} return default_request['base_url'] def random_Num(length, string=[]): for i in range(length): y = str(random.randint(0, 9)) string.appen...
flexible
{ "blob_id": "c55b6fed92a5f4f2961c6f8d5b150b22a5f622e8", "index": 4520, "step-1": "<mask token>\n\n\ndef base_url():\n default_request = {'base_url': url, 'headers': {'Content-Type':\n 'application/json;charset=UTF-8'}}\n return default_request['base_url']\n\n\ndef random_Num(length, string=[]):\n ...
[ 10, 13, 15, 17, 18 ]
from nodes.Value import Value class Number(Value): def __init__(self, number: int): if abs(number) > 2 ** 31: raise SyntaxError(str(number) + ' number is out of range') self.number = number def __str__(self): return str(self.number)
normal
{ "blob_id": "7da274803de80f2864471d00c9d15aff1103372f", "index": 3648, "step-1": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n\n def __str__(self):\n return str(self.number)\n", "step-3": "<mask ...
[ 1, 2, 3, 4 ]
# myapp/serializers.py from rest_framework import serializers from rest_framework.authtoken.models import Token from .models import * # Serializers define the API representation. class GeneralSerializer(serializers.ModelSerializer): class Meta: model = None fields = '__all__' class V2OfUsersSeri...
normal
{ "blob_id": "44cbe1face91d3ac7edcd93d0b470bce90c8b674", "index": 2916, "step-1": "<mask token>\n\n\nclass MeasurementsSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Measurements\n fields = '__all__'\n <mask token>\n\n\nclass CountSerializer(serializers.Serializer):\n ...
[ 9, 10, 11, 12, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_file_ontology(file_path): """ Method that, given a file, returns its URI. This method is in a separate file in case we want to extract additional metadata if required Parameters ---------- @param f...
flexible
{ "blob_id": "c327f8f7aece1a9c25079613809df52e9a8e7a52", "index": 8763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_file_ontology(file_path):\n \"\"\"\n Method that, given a file, returns its URI.\n This method is in a separate file in case we want to extract additional metadata if ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(3): numList[i] = int(sys.stdin.readline()) <|reserved_special_token_0|> for i in intList: print(resultList.count(str(i))) <|reserved_special_token_1|> <|reserved_special_token_0|> numList = list(range(3))...
flexible
{ "blob_id": "c3de6cd76ca7180a1a4d236bb2a6a18f7594f38b", "index": 1304, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(3):\n numList[i] = int(sys.stdin.readline())\n<mask token>\nfor i in intList:\n print(resultList.count(str(i)))\n", "step-3": "<mask token>\nnumList = list(range(3)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': """所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行""" app = QApplication(sys.argv) """Qwidget组件是PyQt5中所有用户界面类的基础类。我们给QWidget提供了默认的构造方法。默认构造方法没有父类。没有父类的widget组件将被...
flexible
{ "blob_id": "6ff300bbd7866466d1992445e46c5ee54f73d0d7", "index": 9167, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n \"\"\"所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行\"\"\"\n app = QApplication(sys.argv)\n \"\"\"Qwidget组件是PyQt5中所有用户...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BeanAttributes(Base): """ Defines the data model for the table `bean_attributes`. """ __tablename__ = 'bean_attributes' id = Column(Integer, primary_key=True) species = Column(String(100), unique=False, nullable=True) owner = Column(String(100), unique=False, nul...
flexible
{ "blob_id": "76f2312a01bf8475220a9fcc16209faddfccd2ae", "index": 9754, "step-1": "<mask token>\n\n\nclass BeanAttributes(Base):\n \"\"\" Defines the data model for the table `bean_attributes`. \"\"\"\n __tablename__ = 'bean_attributes'\n id = Column(Integer, primary_key=True)\n species = Column(Strin...
[ 5, 6, 7, 8, 9 ]
""" Chess state handling model. """ from concurrent.futures import ThreadPoolExecutor from itertools import count from json import dumps from .base_board import BaseBoard, NoBoard from .table_board import TableBoard from .table_game import TableGame __all__ = ['Board', 'NoBoard'] class Board(BaseBoard): """ ...
normal
{ "blob_id": "796fada5dcd45ace8240760ac7e9bad41953ab56", "index": 9347, "step-1": "<mask token>\n\n\nclass Board(BaseBoard):\n <mask token>\n EMOJI = ['⌛', '‼', '♝', '♗', '♚', '♔', '♞', '♘', '♟', '♙', '♛', '♕',\n '♜', '♖', '▪', '▫']\n\n def __init__(self, board=None, _id=None, active_player=True):...
[ 8, 9, 10, 11, 12 ]
from ccapi.interfaces.bitfinex import Bitfinex from ccapi.interfaces.bittrex import Bittrex from ccapi.interfaces.poloniex import Poloniex from ccapi.interfaces.bithumb import Bithumb from ccapi.interfaces.coinone import Coinone from ccapi.interfaces.korbit import Korbit # from ccapis.interfaces.coinbase import Coinbas...
normal
{ "blob_id": "098c91f4aa367cb389e542c0199b633e7ecd4003", "index": 4369, "step-1": "<mask token>\n", "step-2": "from ccapi.interfaces.bitfinex import Bitfinex\nfrom ccapi.interfaces.bittrex import Bittrex\nfrom ccapi.interfaces.poloniex import Poloniex\nfrom ccapi.interfaces.bithumb import Bithumb\nfrom ccapi.in...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(negativo, positivo) <|reserved_special_token_0|> print(b_neg, b_pos) <|reserved_special_token_1|> positivo = float(1.0000001) negativo = float(-1.000001) print(negativo, positivo) b_pos = bin(positivo) b_neg = bin(negativ...
flexible
{ "blob_id": "5c908697000247056bb63a443f837eef88b4c957", "index": 9196, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(negativo, positivo)\n<mask token>\nprint(b_neg, b_pos)\n", "step-3": "positivo = float(1.0000001)\nnegativo = float(-1.000001)\nprint(negativo, positivo)\nb_pos = bin(positivo)\nb...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .. import _utilities import typing from .authority import * from .ca_pool import * from .ca_pool_iam_binding import * from .ca_pool_iam_member import * from .ca_pool_iam_policy import * from .certificate import * from .certificate_template import * from ...
flexible
{ "blob_id": "4ca4d4bd684802b056417be4ee3d7d10e8f5dc85", "index": 8842, "step-1": "<mask token>\n", "step-2": "from .. import _utilities\nimport typing\nfrom .authority import *\nfrom .ca_pool import *\nfrom .ca_pool_iam_binding import *\nfrom .ca_pool_iam_member import *\nfrom .ca_pool_iam_policy import *\nfro...
[ 0, 1, 2 ]
import IDS # In[7]: # testfile = 'data/good_fromE2.txt' # testfile = 'data/goodqueries.txt' good_testfile = "data/good_fromE2.txt" bad_testfile = "data/badqueries.txt" # a = IDS.LG() a = IDS.SVM() # preicdtlist = ['www.foo.com/id=1<script>alert(1)</script>','www.foo.com/name=admin\' or 1=1','abc.com/admin.php','"><s...
normal
{ "blob_id": "e627bcc6c9a49d46190cc793a77103aa0a760989", "index": 1709, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(good_testfile, 'r') as f:\n print('预测数据集: ' + good_testfile)\n preicdtlist = [i.strip('\\n') for i in f.readlines()[:]]\n result = a.predict(preicdtlist)\n print('恶意...
[ 0, 1, 2, 3, 4 ]
import cv2 import os """ 视频场景拼接 """ stich_path="stichImage\\" def read_video(filename): ''' 将视频每秒的内容提取出来 :param filename: 视频文件路径 :return: 视频文件名,用来拼接 ''' cap=cv2.VideoCapture(filename) rate = cap.get(cv2.CAP_PROP_FPS) count=0 success, frame = cap.read() imageCount=0 while suc...
normal
{ "blob_id": "a8506420b1bc558fa953f0cec3f8c16beaf44909", "index": 9886, "step-1": "<mask token>\n\n\ndef read_video(filename):\n \"\"\"\n 将视频每秒的内容提取出来\n :param filename: 视频文件路径\n :return: 视频文件名,用来拼接\n \"\"\"\n cap = cv2.VideoCapture(filename)\n rate = cap.get(cv2.CAP_PROP_FPS)\n count = 0\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def loadData(filename): _data = json.loads(open(filename).read()) return _data def buildUserDict(userDict, _data, boardName): for article in _data: _user = article['b_作者'].split(' ')[0] if not _user in userDict: userDict[_user] = dict() if...
flexible
{ "blob_id": "306240db8a1652fe7cd79808c40e4354c3158d3e", "index": 3434, "step-1": "<mask token>\n\n\ndef loadData(filename):\n _data = json.loads(open(filename).read())\n return _data\n\n\ndef buildUserDict(userDict, _data, boardName):\n for article in _data:\n _user = article['b_作者'].split(' ')[0...
[ 3, 4, 5, 6, 7 ]
# 赛场统分 # 【问题】在编程竞赛中,有10个评委为参赛的选手打分,分数为0 ~ 100分。 # 选手最后得分为:去掉一个最高分和一个最低分后其余8个分数的平均值。请编写一个程序实现。 sc_lst = [] i = 1 while len(sc_lst) < 10: try: sc = int(input('请第%d位评委打分:' % i)) if sc > 0 and sc < 101: sc_lst.append(sc) i += 1 else: print('超出范围,输入无效') ex...
normal
{ "blob_id": "a17abd3947a946daf2c453c120f2e79d2ba60778", "index": 901, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile len(sc_lst) < 10:\n try:\n sc = int(input('请第%d位评委打分:' % i))\n if sc > 0 and sc < 101:\n sc_lst.append(sc)\n i += 1\n else:\n ...
[ 0, 1, 2, 3 ]
import os class Config(object): """Base Config Object""" DEBUG = False SECRET_KEY = os.environ.get('SECRET_KEY') or 'Som3$ec5etK*y' UPLOAD_FOLDER = './uploads' dbconfig = {'host': os.environ.get('MYSQL_HOST') or 'localhost', 'user': os .environ.get('MYSQL_USER') or 'root', 'password': os.environ...
normal
{ "blob_id": "833923c1928862e13c24904f5614927a683b168f", "index": 611, "step-1": "<mask token>\n\n\nclass DevelopmentConfig(Config):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ProductionConfig(Config):\n \"\"\"Production Config that extends the Base Config Object\"\"\"\n DEBUG = False\...
[ 4, 6, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Mood(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_1|> class Moo...
flexible
{ "blob_id": "511016b9cd54f6824360d609ede233b9cc3e4447", "index": 7564, "step-1": "<mask token>\n", "step-2": "class Mood(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "class Mood(object):\n <mask token>\n <mask token>\...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import statistics import csv df = pd.read_csv("height-weight.csv") heightlist = df["Height(Inches)"].to_list() weightlist = df["Weight(Pounds)"].to_list() heightmean = statistics.mean(heightlist) heightmedian = statistics.median(heightlist) heightmode = statistics.mode(heightlist) heigh...
normal
{ "blob_id": "3f4b05a1d0c4c2a2b085a0265bafbf89b5635e31", "index": 8021, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(heightmean)\nprint(heightmedian)\nprint(heightmode)\nprint(heightstdev)\n<mask token>\nprint(firstpercentage)\nprint(secondpercentage)\nprint(thirdpercentage)\n", "step-3": "<mask...
[ 0, 1, 2, 3, 4 ]
from PIL import Image from src import urbandictionary_api from src.card.cardDrawer import CardDrawer from src.card.cardModel import CardModel from src.repository import Repository from src.urbandictionary_api import get_random_word def save_card(word, image_path, filepath='data/cards/', filename=None): '''Функци...
normal
{ "blob_id": "6bf1d410a33e3b2535e39e4f8c5c7f8278b3de67", "index": 330, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save_card(word, image_path, filepath='data/cards/', filename=None):\n \"\"\"Функция для генерации и сохранения изображения\n Возвращает filepath+filename\n \n Параметры...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Bases(metaclass=ABCMeta): def __init__(self): pass @abstractmethod def set_style(self): """set workshet's style, indent,border,font,and so on""" @abstractmethod def query(self): """query from mysql, sqlserver""" @abstractmethod ...
flexible
{ "blob_id": "092c6d637fe85136b4184d05f0ac7db17a8efb3b", "index": 6087, "step-1": "<mask token>\n\n\nclass Bases(metaclass=ABCMeta):\n\n def __init__(self):\n pass\n\n @abstractmethod\n def set_style(self):\n \"\"\"set workshet's style, indent,border,font,and so on\"\"\"\n\n @abstractmet...
[ 13, 14, 15, 16, 17 ]
#!/usr/bin/env python """add_columns.py: This script reads an SCEC ETAS forecast directory name and extracts key fields that are then added as attributes in the SCEC Deriva schema. This script is an example of how the ERD used by Deriva is extended as additional information or metadata is added to the asset descri...
normal
{ "blob_id": "a745f72081e06ff3399f9d7f65a30d7eef594689", "index": 2292, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n hostname = 'forecast.derivacloud.org'\n catalog_id = '5'\n model = Model.from_catalog(DerivaServer('https', hostname, credentials=\n get_crede...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """Very basic codec tests. :copyright: the translitcodec authors and developers, see AUTHORS. :license: MIT, see LICENSE for more details. """ import codecs import translitcodec data = u'£ ☹ wøóf méåw' def test_default(): assert codecs.encode(data, 'transliterate') == u'GBP :-( woof mea...
normal
{ "blob_id": "426002bf900e23fd9b1d32c484350ac854228459", "index": 2565, "step-1": "<mask token>\n\n\ndef test_translit_long():\n assert codecs.encode(data, 'translit/long') == u'GBP :-( woof meaaw'\n\n\ndef test_translit_short():\n assert codecs.encode(data, 'translit/short') == u'GBP :-( woof meaw'\n\n\n<m...
[ 6, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class HoursForm(FlaskForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: csrf = False <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "b1a808e76008edec02d37ec596461e3a00a1d349", "index": 4553, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass HoursForm(FlaskForm):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n csrf = False\n", "step-3": "<mask token>\n\n\nclass HoursForm(FlaskFo...
[ 0, 1, 2, 3, 4 ]
import os from redis import Redis try: if os.environ.get('DEBUG'): import settings_local as settings else: import settings_prod as settings except ImportError: import settings redis_env = os.environ.get('REDISTOGO_URL') if redis_env: redis = Redis.from_url(redis_env) elif getattr(setting...
normal
{ "blob_id": "4c3a27bf1f7e617f4b85dc2b59efa184751b69ac", "index": 3868, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n if os.environ.get('DEBUG'):\n import settings_local as settings\n else:\n import settings_prod as settings\nexcept ImportError:\n import settings\n<mask toke...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Utilizator(AbstractUser): """ Tabel info utilizator nume - extras automat din email ([nume]@gmail.com) email - se va loga cu emailul parola - *** descriere - informatiile despre utilizator scrise de acesta pen...
flexible
{ "blob_id": "85b8ffe1bca879acd86251e4662b33648b713588", "index": 7243, "step-1": "<mask token>\n\n\nclass Utilizator(AbstractUser):\n \"\"\" Tabel info utilizator \n nume - extras automat din email ([nume]@gmail.com)\n email - se va loga cu emailul\n parola -...
[ 4, 5, 6, 7, 9 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/4/11 16:07 # @Author : LiuZhi # @Site : # @File : Function.py # @Software: PyCharm #求绝对值的函数 print(abs(100)) print(abs(-20)) print(abs(12.34)) #print(abs(1,2)) #print(abs('q')) print(max(1,2)) print(max(1,2,3,-5)) print(int('123')) print(int(12....
normal
{ "blob_id": "8a6eb2eb746e3b9de92998b70ddff2a39cb1f269", "index": 6374, "step-1": "<mask token>\n\n\ndef move(x, y, step, angle=0):\n nx = x + step * math.cos(angle)\n ny = y - step * math.sin(angle)\n return nx, ny\n\n\n<mask token>\n\n\ndef enroll(name, gender, age=6, city='Beijing'):\n print('name:...
[ 9, 14, 15, 19, 20 ]
<|reserved_special_token_0|> class Team(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Team(models.Model): teamName = models.TextField() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_sp...
flexible
{ "blob_id": "331b5f0a34db4d12d713439db3d2818e8c922310", "index": 4236, "step-1": "<mask token>\n\n\nclass Team(models.Model):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Team(models.Model):\n teamName = models.TextField()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ncl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class GetRootData(Function): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GetRootData(Function): def __init__(self, data_display): self.data_display = data_display <|reserved_special...
flexible
{ "blob_id": "e8ea307352805bf0b5129e2ad7f7b68c44e78fc9", "index": 9118, "step-1": "<mask token>\n\n\nclass GetRootData(Function):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass GetRootData(Function):\n\n def __init__(self, data_display):\n self.data_display = data_display\n...
[ 1, 2, 3, 4, 5 ]
from django import forms class CriteriaForm(forms.Form): query = forms.CharField(widget=forms.Textarea)
normal
{ "blob_id": "b6529dc77d89cdf2d49c689dc583b78c94e31c4d", "index": 4716, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n query = forms.CharField(widget=forms.Textarea)\n", "step-4"...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from Cython.Build import cythonize cython = True except ImportError: cython = False if platform == 'darwin': extra_compile_args = ['-O3', '-pthread', '-funroll-loops', '-std=c++0x', '-stdlib=libc++', '...
flexible
{ "blob_id": "312cc666c88fcd22882c49598db8c5e18bd3dae1", "index": 26, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from Cython.Build import cythonize\n cython = True\nexcept ImportError:\n cython = False\nif platform == 'darwin':\n extra_compile_args = ['-O3', '-pthread', '-funroll-lo...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _ut...
normal
{ "blob_id": "8535020e7157699310b3412fe6c5a28ee8e61f49", "index": 6911, "step-1": "<mask token>\n\n\n@pulumi.output_type\nclass ApplicationCredential(dict):\n <mask token>\n\n def __getitem__(self, key: str) ->Any:\n ApplicationCredential.__key_warning(key)\n return super().__getitem__(key)\n ...
[ 10, 11, 12, 13, 16 ]
#H############################################################## # FILENAME : rec.py # # DESCRIPTION : # Classifies text using defined regular expressions # # PUBLIC FUNCTIONS : # int processToken( string ) # # NOTES : # This function uses specific critera to classify # Criteria desc...
normal
{ "blob_id": "6d543e9e24debaff7640006a3836c59ec0096255", "index": 5205, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef processToken(token):\n idPattern1 = re.compile('^([$]|[|]|[a-z])[A-Z0-9]*$')\n idPattern2 = re.compile('^([|][A-Z0-9]*[|])$')\n intPattern = re.compile('^(%)([0-9]|[A-Fa-...
[ 0, 1, 3, 4, 5 ]
# -*- coding: utf-8 -*- from django.db import models from backend.models.account import Account from string import Template out = Template("$account: $parts") class Group(models.Model): name = models.CharField(max_length=100) class GroupParticipation(models.Model): account = models.ForeignKey(Account, r...
normal
{ "blob_id": "11337f6f9cf22ba6fbed68dfcb7a07fb6368e94e", "index": 6350, "step-1": "<mask token>\n\n\nclass GroupParticipation(models.Model):\n account = models.ForeignKey(Account, related_name='groups')\n parts = models.FloatField(default=1.0)\n group = models.ForeignKey(Group, related_name='participants...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cPickle.dump(v, open(PROJECT + 'db/dictvectorizer.pickle', 'wb')) <|reserved_special_token_1|> <|reserved_special_token_0|> videos, users, reviews = load_data() orig_X = np.array([(x['date'], x['text'], x['user']) for x in revi...
flexible
{ "blob_id": "e26fa69ea1f0bee82b4108ac5a541a6175645728", "index": 5955, "step-1": "<mask token>\n", "step-2": "<mask token>\ncPickle.dump(v, open(PROJECT + 'db/dictvectorizer.pickle', 'wb'))\n", "step-3": "<mask token>\nvideos, users, reviews = load_data()\norig_X = np.array([(x['date'], x['text'], x['user'])...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def submissions_to_user_submission_activities_dfs(submissions_df: DataFrame ) ->Dict[str, DataFrame]: """ Convert a Submission API DataFrame to a Dict of UserActivity UDM DataFrames grouped by source system secti...
flexible
{ "blob_id": "d6a760774b45454c959c2932d7b28deee7f81872", "index": 318, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef submissions_to_user_submission_activities_dfs(submissions_df: DataFrame\n ) ->Dict[str, DataFrame]:\n \"\"\"\n Convert a Submission API DataFrame to a Dict of UserActivity...
[ 0, 1, 2, 3, 4 ]
# The following code causes an infinite loop. Can you figure out what’s missing and how to fix it? # def print_range(start, end): # # Loop through the numbers from start to end # n = start # while n <= end: # print(n) # print_range(1, 5) # Should print 1 2 3 4 5 (each number on its own line) # Solution # Vari...
normal
{ "blob_id": "05454cc6c9961aa5e0de6979bb546342f5bd7b79", "index": 3321, "step-1": "# The following code causes an infinite loop. Can you figure out what’s missing and how to fix it?\n\n# def print_range(start, end):\n# \t# Loop through the numbers from start to end\n# \tn = start\n# \twhile n <= end:\n# \t\tprint...
[ 0 ]
from typing import List, Optional from backend.domain.well import FacilityState, Well from backend.repository.persistence.well import WellPersistenceSchema class WellRepository: schema = WellPersistenceSchema() def __init__(self, db): self._db = db def list(self) -> List[Well]: return [...
normal
{ "blob_id": "5a181b0c22faa47c6c887daac675dd7374037f30", "index": 3056, "step-1": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n\n d...
[ 1, 5, 7, 8, 9 ]
#!/usr/bin/python import gzip import os infiles = [] ids=[] ages=[] with open('all_C_metadata.txt') as f: f.readline() f.readline() for line in f: infiles.append(line.split('\t')[0]) ids.append(line.split('\t')[1]) ages.append(line.split('\t')[2]) with open('all_C_samples/diversi...
normal
{ "blob_id": "c02f46e8d89dd4b141c86df461ecbb8ed608b61b", "index": 7826, "step-1": " #!/usr/bin/python\n\nimport gzip\nimport os\n\ninfiles = []\nids=[]\nages=[]\nwith open('all_C_metadata.txt') as f:\n f.readline()\n f.readline()\n for line in f:\n infiles.append(line.split('\\t')[0])\n ids...
[ 0 ]
from . import find_resault from . import sql
normal
{ "blob_id": "6f05d1915cd2e123dd72233b59d4de43fd724035", "index": 7743, "step-1": "<mask token>\n", "step-2": "from . import find_resault\nfrom . import sql\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from keyboards import * from DB import cur, conn from bot_token import bot from limit_text import limit_text def send_answer(question_id, answer_owner, receiver_tel_id, short): answer = cur.execute('''SELECT answer FROM Answers WHERE question_id = (%s) AND tel_id = (%s)''', (question_id, answer_owner)).fetchone()...
normal
{ "blob_id": "464fc2c193769eee86a639f73b933d5413be2b87", "index": 3396, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef send_answer(question_id, answer_owner, receiver_tel_id, short):\n answer = cur.execute(\n 'SELECT answer FROM Answers WHERE question_id = (%s) AND tel_id = (%s)'\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # Always prefer setuptools over distutils from setuptools import setup, find_packages setup( name="isc-dhcpd-parser", version="0.1", description="Parser for isc-dhcp config files (dhcpd.conf)", author="Pavel Podkorytov", author_email="pod.pavel@gmail.com", classifiers=[ ...
normal
{ "blob_id": "79141679bb2839de9d4a25b6c6c285905dddbb0d", "index": 6460, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='isc-dhcpd-parser', version='0.1', description=\n 'Parser for isc-dhcp config files (dhcpd.conf)', author=\n 'Pavel Podkorytov', author_email='pod.pavel@gmail.com', class...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ExecuteCommandTest(TestBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ExecuteCommandTest(...
flexible
{ "blob_id": "c312bf096c7f4aaf9269a8885ff254fd4852cfe0", "index": 9996, "step-1": "<mask token>\n\n\nclass ExecuteCommandTest(TestBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ExecuteCommandTest(TestBase):\n\n def setUp...
[ 1, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def SO3_to_R3(x_skew): x = np.zeros((3, 1)) x[0, 0] = -1 * x_skew[1, 2] x[1, 0] = x_skew[0, 2] x[2, 0] = -1 * x_skew[0, 1] return x <|reserved_special_token_1|> import numpy as np def SO3_to_R3(x_skew): ...
flexible
{ "blob_id": "97bff6eb0cd16c915180cb634e6bf30e17adfdef", "index": 2080, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef SO3_to_R3(x_skew):\n x = np.zeros((3, 1))\n x[0, 0] = -1 * x_skew[1, 2]\n x[1, 0] = x_skew[0, 2]\n x[2, 0] = -1 * x_skew[0, 1]\n return x\n", "step-3": "import nu...
[ 0, 1, 2 ]
stevila = [5, 2, 8, 3] #Izpis vseh števil print(stevila) #Izpis števila na mestu 1 print(stevila[1])
normal
{ "blob_id": "6e845f2543b548fb936cc3719eb150e530281945", "index": 9505, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(stevila)\nprint(stevila[1])\n", "step-3": "stevila = [5, 2, 8, 3]\nprint(stevila)\nprint(stevila[1])\n", "step-4": "stevila = [5, 2, 8, 3]\n\n#Izpis vseh števil\nprint(stevila)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def fetch(entries): input_list = [] for entry in entries: field = entry[0] text = entry[1].get() input_list.append(text) telnetConnection(input_list[0], input_list[1], input_list[2], input_list[3], input_list[4]) def makeform(root, fields): ...
flexible
{ "blob_id": "3328c2ae0816c146398ecde92a056d1e77683696", "index": 7357, "step-1": "<mask token>\n\n\ndef fetch(entries):\n input_list = []\n for entry in entries:\n field = entry[0]\n text = entry[1].get()\n input_list.append(text)\n telnetConnection(input_list[0], input_list[1], inp...
[ 2, 3, 4, 5, 6 ]
<|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 updateMatrix(self, matrix): """ :type matrix...
flexible
{ "blob_id": "1145050d82e614d5c248fc7e6a71720e6ff72414", "index": 6055, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def updateMatrix(self, matrix):\n \"\"\"\n :type matrix: Li...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- import time from abc import ABCMeta, abstractmethod from xlreportform.worksheet import WorkSheet __author__ = "Andy Yang" class Bases(metaclass=ABCMeta): def __init__(self): pass @abstractmethod def set_style(self): """set workshet's style, indent,bor...
normal
{ "blob_id": "092c6d637fe85136b4184d05f0ac7db17a8efb3b", "index": 6087, "step-1": "<mask token>\n\n\nclass Bases(metaclass=ABCMeta):\n\n def __init__(self):\n pass\n\n @abstractmethod\n def set_style(self):\n \"\"\"set workshet's style, indent,border,font,and so on\"\"\"\n\n @abstractmet...
[ 13, 14, 15, 16, 17 ]
# encoding: utf-8 # module Revit.GeometryConversion calls itself GeometryConversion # from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes class CurveUtils(object): # no doc @staticmethod def CurvesAreSimilar(a,b): ...
normal
{ "blob_id": "f5ca2fb2ce8bcb7a67abe3123d4c50949e9c2f2f", "index": 2029, "step-1": "# encoding: utf-8\r\n# module Revit.GeometryConversion calls itself GeometryConversion\r\n# from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null\r\n# by generator 1.145\r\n# no doc\r\n# no imports\r\n\r\n# no func...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "645f8f1ebd3bfa0ba32d5be8058b07e2a30ba9b5", "index": 1314, "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 = [('barriers', ...
[ 0, 1, 2, 3, 4 ]
from catalyst_rl.contrib.registry import ( Criterion, CRITERIONS, GRAD_CLIPPERS, Model, MODELS, Module, MODULES, Optimizer, OPTIMIZERS, Sampler, SAMPLERS, Scheduler, SCHEDULERS, Transform, TRANSFORMS ) from catalyst_rl.core.registry import Callback, CALLBACKS from catalyst_rl.utils.tools.registry import Reg...
normal
{ "blob_id": "09d13fe6b090850782feb601412cf135d497136f", "index": 6206, "step-1": "<mask token>\n\n\ndef _callbacks_loader(r: Registry):\n from catalyst_rl.dl import callbacks as m\n r.add_from_module(m)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef _callbacks_loader(r: Registry):\n from catal...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 #coding=utf8 from __future__ import (division,absolute_import,print_function,unicode_literals) import argparse, csv, sys,subprocess,time NR_THREAD=20 def shell(cmd): subprocess.call(cmd,shell=True) print("Done! {0}.".format(cmd)) start=time.time() cmd = 'mkdir FTRL/tmp -p' shell(cmd) ...
normal
{ "blob_id": "2a0172641c48c47f048bf5e9f1889b29abbb0b7c", "index": 767, "step-1": "<mask token>\n\n\ndef shell(cmd):\n subprocess.call(cmd, shell=True)\n print('Done! {0}.'.format(cmd))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef shell(cmd):\n subprocess.call(cmd, shell=True)\n print('Done...
[ 1, 2, 3, 4, 5 ]
import pandas as pd import random import string import names def generatetest(n=100, filename="test_data"): ids = [] names_list = [] for _ in range(n): ids.append(''.join(random.choices( string.ascii_letters + string.digits, k=9))) names_list.append(names.get_full_name()) ...
normal
{ "blob_id": "aa913fd40a710cfd7288fd59c4039c4b6a5745cc", "index": 4569, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generatetest(n=100, filename='test_data'):\n ids = []\n names_list = []\n for _ in range(n):\n ids.append(''.join(random.choices(string.ascii_letters + string.\n ...
[ 0, 1, 2, 3, 4 ]
import scrapy import time import os.path from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from tempfile import mkstem...
normal
{ "blob_id": "237a93ff73cb98fd9d4006f14d3cadbdc09259a4", "index": 9885, "step-1": "<mask token>\n\n\nclass ProductSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self):\n options = webdriver.ChromeOptions()\n options.add_argument('--start-maximized')\...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if response.info().get('Content-Type') == 'application/x-gzip': buf = StringIO(response.read()) f = gzip.GzipFile(fileobj=buf) data = f.read() else: data = response.read() <|reserved_special_token_0|> f.write(data)...
flexible
{ "blob_id": "4b622c7f9b5caa7f88367dd1fdb0bb9e4a81477b", "index": 2338, "step-1": "<mask token>\n", "step-2": "<mask token>\nif response.info().get('Content-Type') == 'application/x-gzip':\n buf = StringIO(response.read())\n f = gzip.GzipFile(fileobj=buf)\n data = f.read()\nelse:\n data = response.r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ContentCategory(BaseModel): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: db_table = 'tb_content_category' verbose_name = '广告内容类别' verbose_name_plural = verbose_name <|reserved_special...
flexible
{ "blob_id": "fd96bf5595ce6ec1f95d0f7a9d1c4ff582826ac0", "index": 1439, "step-1": "<mask token>\n\n\nclass ContentCategory(BaseModel):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'tb_content_category'\n verbose_name = '广告内容类别'\n verbose_name_plural ...
[ 5, 6, 7, 8, 10 ]
import os import RPi.GPIO as GPIO from google.cloud import firestore import time ############Explicit Credential environment path="/home/pi/Desktop/Parking.json" os.environ['GOOGLE_APPLICATION_CREDENTIALS'] =path #GPIO starts s1=2 s2=21 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(s1,GPIO.IN) GPIO....
normal
{ "blob_id": "e1cc4e17bffcbbae3e7785e4c55acde167a8a50a", "index": 6482, "step-1": "<mask token>\n", "step-2": "<mask token>\nGPIO.setmode(GPIO.BCM)\nGPIO.setwarnings(False)\nGPIO.setup(s1, GPIO.IN)\nGPIO.setup(s2, GPIO.IN)\n<mask token>\nwhile 1:\n if GPIO.input(s1) == False:\n data1 = 1\n coun...
[ 0, 1, 2, 3, 4 ]
import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from WeatherDL.data_maker import dataset_maker from WeatherDL.model_maker import model_3 # Extract data from data_maker X, y = dataset_maker(window=5, forecast_day=1) (X_train, X_test, y_train, y_test) = train_test_split(X, y, test_s...
normal
{ "blob_id": "011dd579bb076ec094e9e3085aa321883c484f1c", "index": 5296, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(model.summary())\n<mask token>\nplt.plot(history.history['loss'])\nplt.plot(history.history['val_loss'])\nplt.title('MSE')\nplt.legend(['Train', 'Test'], loc='upper right')\nplt.sho...
[ 0, 1, 2, 3, 4 ]
""" mupub module. """ __all__ = ( '__title__', '__summary__', '__version__', '__author__', '__license__', '__copyright__', ) __title__ = 'mupub' __summary__ = 'Musical score publishing utility for the Mutopia Project' """Versioning: This utility follows a MAJOR . MINOR . EDIT format. Upon a major release, t...
normal
{ "blob_id": "eabf06481509962652812af67ad59da5cfe30fae", "index": 1, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ('__title__', '__summary__', '__version__', '__author__',\n '__license__', '__copyright__')\n__title__ = 'mupub'\n__summary__ = 'Musical score publishing utility for the Mutopia...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Boolean Exercise') print(False or False) print(False and False) print(not True or not False)
flexible
{ "blob_id": "2385882f040ef4bd0a3611bebfbb2ae5b3cd1dc6", "index": 4204, "step-1": "<mask token>\n", "step-2": "print('Boolean Exercise')\nprint(False or False)\nprint(False and False)\nprint(not True or not False)\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def globalVariableCheck(debug=False): for liquor in liquorLookup: if liquor in noGrapeLookup: print( 'WARNING:liquorLookup regexs will never execute - they are in noGrapeLookup:' , liquor) if liquor in ignoreGrapeLookup: ...
flexible
{ "blob_id": "d786e89b9d478dcff3c541c89731247075d078c3", "index": 678, "step-1": "<mask token>\n\n\ndef globalVariableCheck(debug=False):\n for liquor in liquorLookup:\n if liquor in noGrapeLookup:\n print(\n 'WARNING:liquorLookup regexs will never execute - they are in noGrape...
[ 7, 13, 15, 18, 19 ]
# -*- coding:utf-8 -*- # pylint: disable=line-too-long _BASE_REPRESENTATIONS = [ "Primitive(field='f1', op='eq', value='value')", "Primitive(field='f1', op='eq', value=42)", "Primitive(field='f1', op='eq', value=3.14)", "Primitive(field='f1', op='eq', value=True)", "Condition(op=Operator.OR, values...
normal
{ "blob_id": "137842d50355563b2df6c2fc48864c01a22afa80", "index": 5567, "step-1": "<mask token>\n", "step-2": "_BASE_REPRESENTATIONS = [\"Primitive(field='f1', op='eq', value='value')\",\n \"Primitive(field='f1', op='eq', value=42)\",\n \"Primitive(field='f1', op='eq', value=3.14)\",\n \"Primitive(fiel...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class YieldPeriodicCallback(object): <|reserved_special_token_0|> def __init__(self, callback, callback_time, io_loop=None, faststart=False): """Init method it can be used like tornado periodic callback, but it has extra paramtetr :param faststart: if tru...
flexible
{ "blob_id": "7726f8cc9adf15823cccdaa4ba316800bb134460", "index": 1920, "step-1": "<mask token>\n\n\nclass YieldPeriodicCallback(object):\n <mask token>\n\n def __init__(self, callback, callback_time, io_loop=None, faststart=False):\n \"\"\"Init method it can be used like tornado periodic callback, b...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(HuyenQuan) <|reserved_special_token_1|> from django.contrib import admin from .models import HuyenQuan admin.site.register(HuyenQuan) <|reserved_special_token_1|> from django.contrib import admin # Regis...
flexible
{ "blob_id": "16e5a44cb4fbe71eaa9c1f5b00505578de0d2cea", "index": 6403, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(HuyenQuan)\n", "step-3": "from django.contrib import admin\nfrom .models import HuyenQuan\nadmin.site.register(HuyenQuan)\n", "step-4": "from django.contrib import...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BRFCustomerBuilder(BRFBaseBuilder): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BRFCustomerBuilder(BRFBaseBuilder): def define_translator(self) ->None: self._translator = BRFCusto...
flexible
{ "blob_id": "8020bac94de3e68193c9891a628a48c537c5afa0", "index": 9069, "step-1": "<mask token>\n\n\nclass BRFCustomerBuilder(BRFBaseBuilder):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BRFCustomerBuilder(BRFBaseBuilder):\n\n def define_translator(self) ->None:\n self._...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Test_PlaceModel(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_var_initialization(self): self.assertTrue(hasattr(self.model, 'city_id')) self.assertTrue(hasattr(self.model, 'user_id')) self.assertTrue(hasat...
flexible
{ "blob_id": "c7881c0d06600a43bdc01f5e464127c596db6713", "index": 7993, "step-1": "<mask token>\n\n\nclass Test_PlaceModel(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_var_initialization(self):\n self.assertTrue(hasattr(self.model, 'city_id'))\n self.assertTrue(hasattr(sel...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> im1.show() im.show() <|reserved_special_token_1|> <|reserved_special_token_0|> im = Image.open('data/frame1.jpg') left = 155 top = 65 right = 360 bottom = 270 im1 = im.crop((left, top, right, bottom)) im1.show() im.show() <|r...
flexible
{ "blob_id": "9fd73e0a1dacc46c177f11ce4cf2351b3d622c0d", "index": 7594, "step-1": "<mask token>\n", "step-2": "<mask token>\nim1.show()\nim.show()\n", "step-3": "<mask token>\nim = Image.open('data/frame1.jpg')\nleft = 155\ntop = 65\nright = 360\nbottom = 270\nim1 = im.crop((left, top, right, bottom))\nim1.sh...
[ 0, 1, 2, 3, 4 ]
import plotly.express as px import pandas as pd def fiig(plan): df = pd.DataFrame(plan) fig = px.timeline(df, x_start="Начало", x_end="Завершение", y="РЦ", color='РЦ', facet_row_spacing=0.6, facet_col_spacing=0.6, opacity=0.9, hover_data=['Проект', 'МК', 'Наменование', 'Номер', 'Минут'],...
normal
{ "blob_id": "09850f0d3d295170545a6342337e97a0f190989a", "index": 6578, "step-1": "<mask token>\n\n\ndef fig_porc_projects(plan):\n df = pd.DataFrame(plan)\n fig = px.timeline(df, x_start='Начало', x_end='Завершение', y='Проект',\n color='РЦ', facet_row_spacing=0.2, facet_col_spacing=0.1, opacity=\n ...
[ 2, 3, 4, 5, 6 ]
from django.db import models from NavigantAnalyzer.common import convert_datetime_string import json # A custom view-based model for flat outputs - RÖ - 2018-10-24 # Don't add, change or delete fields without editing the view in the Db class Results_flat(models.Model): race_id = models.IntegerField() race_name...
normal
{ "blob_id": "802eb0502c5eddcabd41b2d438bf53a5d6fb2c82", "index": 8368, "step-1": "<mask token>\n\n\nclass Results_flat(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 1, 2, 3, 4, 5 ]
# A program to display and find the sum of a list of numbers using for loop list=[10,20,30,40,50] sum=0; for i in list: print(i) sum=sum+i print('sum =',sum)
normal
{ "blob_id": "88e34ee5cd5af7d3b04321c4aa4fc815f926add1", "index": 7110, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =', sum)\n", "step-3": "list = [10, 20, 30, 40, 50]\nsum = 0\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =',...
[ 0, 1, 2, 3 ]
import testTemplate def getTests(): tests = [] suite=testTemplate.testSuite("Sample Test Cases") testcase = testTemplate.testInstance("3\n1 1 1\n1 1 1\n1 1 1" , "6" , "Sample #1") suite.add(testcase) testcase = testTemplate.testInstance("11\n1 0 0 1 0 0 0 0 0 1 1 \n1 1 1 1 1 0 1 0 1 0 0 \n1 0 0 1 0 0 1 1 0 1 0 ...
normal
{ "blob_id": "de4c31ad474b7ce75631214aceafbe4d7334f14b", "index": 6956, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getTests():\n tests = []\n suite = testTemplate.testSuite('Sample Test Cases')\n testcase = testTemplate.testInstance('3\\n1 1 1\\n1 1 1\\n1 1 1', '6',\n 'Sample #...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MaterialSiteEditor(QObject): <|reserved_special_token_0|> def __init__(self, site, parent=None): super().__init__(parent) loader = UiLoader() self.ui = loader.load_file('material_site_editor.ui', parent) self._site = site self.charge_...
flexible
{ "blob_id": "ec2be72f81d260c491cdc31b68b34401fb49b91e", "index": 2660, "step-1": "<mask token>\n\n\nclass MaterialSiteEditor(QObject):\n <mask token>\n\n def __init__(self, site, parent=None):\n super().__init__(parent)\n loader = UiLoader()\n self.ui = loader.load_file('material_site_...
[ 39, 40, 47, 54, 57 ]
import pandas as pd import numpy as np import difflib as dl import sys def get_close(x): if len(x) == 0: return "" return x[0] list_file = sys.argv[1] rating_file = sys.argv[2] output_file = sys.argv[3] movie_list = open(list_file).read().splitlines() movie_data = pd.DataFrame({'movie': movie_list}) rating_data ...
normal
{ "blob_id": "7a9515b1f8cc196eb7551137a1418d5a387e7fd3", "index": 959, "step-1": "<mask token>\n\n\ndef get_close(x):\n if len(x) == 0:\n return ''\n return x[0]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_close(x):\n if len(x) == 0:\n return ''\n return x[0]\n\n\n<mask ...
[ 1, 2, 3, 4, 5 ]
import json from aioredis import Redis from aiologger.loggers.json import ExtendedLogRecord from aiologger.handlers.base import Handler from app.core import config class RedisHandler(Handler): def __init__( self, redis_client, key=f"{config.APP_NAME}-log", *args, **kwargs...
normal
{ "blob_id": "fe581ca8176fed01309f0d852f72564863aa0895", "index": 8413, "step-1": "<mask token>\n\n\nclass RedisHandler(Handler):\n <mask token>\n <mask token>\n\n async def emit(self, record: ExtendedLogRecord) ->None:\n await self.redis_client.rpush(self.key, self.format(record))\n\n async de...
[ 2, 3, 4, 5, 6 ]
# #River Sheppard # # from PIL import Image if __name__ == "__main__": scale = 768 # creating the new image in RGB mode bitmap = Image.new("RGB", (scale, scale), "white") # Allocating the storage for the image and # loading the pixel data. pix = bitmap.load() ...
normal
{ "blob_id": "507251113d80eaa3684081f7814470053b04dda9", "index": 1436, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n scale = 768\n bitmap = Image.new('RGB', (scale, scale), 'white')\n pix = bitmap.load()\n c = complex(-0.585, 0.85)\n move = 0.0\n maxIter = ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on 11/03/2020 @author: stevenp@valvesoftware.com """ import sys from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QRadioButton, QVBoxLayout, QCheckBox, QProgressBar, QGroupBox, QComboBox, QLineEdit, QPushButton, QMessageBox, QInputDialog, QDialog, QDialogButton...
normal
{ "blob_id": "33464f19c42d1a192792a73297f4d926df78ab71", "index": 2906, "step-1": "<mask token>\n\n\nclass MainWindow(QWidget):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def initUI(self):\n self.setGeometry(300, 300, 500, 600)\n self.setWindowTi...
[ 4, 6, 9, 10, 11 ]
from checkov.common.models.enums import CheckCategories, CheckResult from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck class FunctionAppDisallowCORS(BaseResourceNegativeValueCheck): def __init__(self): name = "Ensure function apps are not acces...
normal
{ "blob_id": "30c2d46d6587df3cbc3e83ecb7af787fcd86eb1f", "index": 7067, "step-1": "<mask token>\n\n\nclass FunctionAppDisallowCORS(BaseResourceNegativeValueCheck):\n\n def __init__(self):\n name = 'Ensure function apps are not accessible from all regions'\n id = 'CKV_AZURE_62'\n supported_...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def findWords(self, board: List[List[str]], words: List[str]) ->List[str]: m = len(board) n = len(board[0]) ans = [] root = ...
flexible
{ "blob_id": "f996dffcb9650663278ec1e31d9f88d50142f4ea", "index": 4491, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def findWords(self, board: List[List[str]], words: List[str]) ->List[str]:\n m = len(board)\n n = len(board...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class YandexSearch(BaseEngine): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def next_url(self, soup): if (regex := re.findall('"(/search/\\?[^>]+p=[^"]+)', str(soup))): return self.base_url + regex[-1] de...
flexible
{ "blob_id": "0ec3ca0f952dbc09c7a7a3e746c0aeab28ee9834", "index": 6498, "step-1": "<mask token>\n\n\nclass YandexSearch(BaseEngine):\n <mask token>\n <mask token>\n <mask token>\n\n def next_url(self, soup):\n if (regex := re.findall('\"(/search/\\\\?[^>]+p=[^\"]+)', str(soup))):\n r...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class deeplens_classifier(BaseKerasClassifier): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class deeplens_classifier(BaseKerasClassifier): def _model_definition(self, net...
flexible
{ "blob_id": "6bd47fb71a32b8383a75e72111d802008bc6bc68", "index": 3350, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass deeplens_classifier(BaseKerasClassifier):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass deeplens_classifier(BaseKerasClassifier):\n\n def _model_definition(self,...
[ 0, 1, 2, 3, 4 ]
# Copyright 2017-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev> # License MIT (https://opensource.org/licenses/MIT). from datetime import datetime, timedelta from odoo import fields from odoo.tests.common import TransactionCase class TestCase(TransactionCase): def setUp(self): super(Test...
normal
{ "blob_id": "29ec576d1fe04108eeb03a5d1b167671d3004570", "index": 4403, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestCase(TransactionCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestCase(TransactionCase):\n\n def setUp(self):\n super(TestCase, self).setUp()\n...
[ 0, 1, 2, 3, 4 ]
import csv #ratings.csv must be in the same directory skipped_header = False with open("ratings.csv") as in_file: csvreader = csv.reader(in_file) #read each row of ratings.csv (userId,movieId,rating,timestamp) with open("ratings_train.csv", 'w') as train_out: with open("ratings_test.csv", 'w...
normal
{ "blob_id": "e48a6a84268a0fe64e90714bd32712665934fc39", "index": 2223, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('ratings.csv') as in_file:\n csvreader = csv.reader(in_file)\n with open('ratings_train.csv', 'w') as train_out:\n with open('ratings_test.csv', 'w') as test_out:\n...
[ 0, 1, 2, 3, 4 ]
def checkRaiz(): a = int(input("Informe o primeiro coeficiente: ")) b = int(input("Informe o segundo coeficiente: ")) c = int(input("Informe o terceiro coeficiente: ")) delta = (b*b) - (4*a*c) if (delta < 0): print("Não tem raiz real") elif (delta == 0): print("Existe uma raiz...
normal
{ "blob_id": "603a73a7cc0487fcabb527ebc21d44cb95817ecb", "index": 5909, "step-1": "<mask token>\n", "step-2": "def checkRaiz():\n a = int(input('Informe o primeiro coeficiente: '))\n b = int(input('Informe o segundo coeficiente: '))\n c = int(input('Informe o terceiro coeficiente: '))\n delta = b * ...
[ 0, 1, 2, 3 ]