code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from .views import home, profile from member.views import member from publication.views import publication, pub_detail from notice.views import list, notice_detail from...
normal
{ "blob_id": "a35e86e474883d892a6ce8eb191a3a5f8a9558c8", "index": 1105, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.STATIC_URL, document_root=settings.\n STATIC_ROOT)\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDI...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def do_main_program(): print('start the main program...') while True: time.sleep(1) print('another second passed') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def do_main_program(): print('start the main program...
flexible
{ "blob_id": "3cb96607aaf58a7de3fa0a9cd61b7f4e3c6b061a", "index": 4802, "step-1": "<mask token>\n\n\ndef do_main_program():\n print('start the main program...')\n while True:\n time.sleep(1)\n print('another second passed')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef do_main_progr...
[ 1, 2, 3, 4, 5 ]
#coding: utf-8 from django.conf.urls import patterns, url import views urlpatterns = patterns('', url(r'^douban/books$', views.BookList.as_view()), )
normal
{ "blob_id": "93418e554893db4eb888396e8d6f60a8364d9ee3", "index": 8560, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^douban/books$', views.BookList.as_view()))\n", "step-3": "from django.conf.urls import patterns, url\nimport views\nurlpatterns = patterns('', url('^dou...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def validIPAddress(self, IP): """ :type IP: str :rtype: str """ def validateIPv4(IP): digits = IP.split(...
flexible
{ "blob_id": "6216a5e45fee8ade5ec9072c42c1b08f3b0f4c65", "index": 2433, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def validIPAddress(self, IP):\n \"\"\"\n :type IP: str\n :rtype: str\n \"\"\"\n\n def valida...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MyManager(BaseManager): pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MyManager(BaseManager): pass MyManager.register('LinphoneBase', LinphoneBase) <|reserved_special_token_0|> manager.start() <|reserved_special_to...
flexible
{ "blob_id": "3bb25cedc29f9063046329db1c00e7d9e10ce1cc", "index": 5089, "step-1": "<mask token>\n\n\nclass MyManager(BaseManager):\n pass\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MyManager(BaseManager):\n pass\n\n\nMyManager.register('LinphoneBase', LinphoneBase)\n<mask token>\nmanager.sta...
[ 1, 2, 3, 4, 5 ]
import datetime # to add timestamps on every block in blockchain import hashlib # library that is ued to hash the block import json # to communicate in json data # Flask to implement webservices jsonify to see the jsop message/response # request help us to connect all the nodes of the blockchain together froming the...
normal
{ "blob_id": "e85d3660968410b83b14ba610150c0c8cc880119", "index": 9191, "step-1": "<mask token>\n\n\nclass Blockchain:\n\n def __init__(self):\n self.chain = []\n self.transactions = []\n self.create_block(proof=0, previous_hash='0')\n self.nodes = set()\n\n def create_block(self...
[ 6, 15, 17, 19, 20 ]
# -*- coding: utf-8 -*- ############################################################################# # # Copyright (C) 2019-Antti Kärki. # Author: Antti Kärki. # # You can modify it under the terms of the GNU AFFERO # GENERAL PUBLIC LICENSE (AGPL v3), Version 3. # # This program is distributed ...
normal
{ "blob_id": "96131e3d6c67c0ee4ff7f69d4ffedcbf96470f14", "index": 7069, "step-1": "<mask token>\n\n\nclass rocker_connection:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass rocker_connection:\n\n @api.multi\n def create_connection(self):\n _database_record = self\n _datasource = _d...
[ 1, 2, 3, 4, 5 ]
import os import math def get_datas(): filename = None while True: filename = input('Please enter filename:') if not filename.strip(): print('Filename is empty!') continue if not os.path.exists(filename): print('File is not exists!') conti...
normal
{ "blob_id": "6829f7bcbc1b12500795eec19829ff077502e270", "index": 3260, "step-1": "<mask token>\n\n\ndef get_datas():\n filename = None\n while True:\n filename = input('Please enter filename:')\n if not filename.strip():\n print('Filename is empty!')\n continue\n ...
[ 6, 7, 8, 10, 12 ]
<|reserved_special_token_0|> class BulletSpawnerTemplate(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def setRounds(self, rounds): self._rounds = rounds <|reserved_special_token_0|> def setInBetweenTimer(self, delay): self._inBetweenTimer = delay <|reser...
flexible
{ "blob_id": "519746450826d02230a492a99e0b518602d53fcb", "index": 9932, "step-1": "<mask token>\n\n\nclass BulletSpawnerTemplate(object):\n <mask token>\n <mask token>\n\n def setRounds(self, rounds):\n self._rounds = rounds\n <mask token>\n\n def setInBetweenTimer(self, delay):\n sel...
[ 16, 19, 22, 25, 26 ]
import requests import json import pandas as pd from sqlalchemy import create_engine from sqlalchemy.types import VARCHAR,INT,FLOAT,BIGINT import time from tqdm import tqdm #数据库联接设置 connect_info = 'mysql+pymysql://root:rootroot@localhost:3306/db1?charset=UTF8MB4' engine = create_engine(connect_info) sql = ''' s...
normal
{ "blob_id": "a95e64877a1fc9f8109f1293b4ae9176f4f64647", "index": 3090, "step-1": "<mask token>\n\n\ndef sentiment(text):\n global url\n global headers\n body = {'text': text}\n try:\n r = requests.post(url, headers=headers, data=json.dumps(body))\n dic = r.json()\n except Exception a...
[ 1, 2, 3, 4, 5 ]
import sqlite3 # cur.execute('CREATE TABLE admin(username TEXT,password TEXT)') # conn.commit() # cur.execute("INSERT INTO admin VALUES('nilesh','nilesh')") # conn.commit() def verif_admin(username, password): try: conn = sqlite3.connect('SuperMarket.db') cur = conn.cursor() print(usernam...
normal
{ "blob_id": "88d0ced41a8f176a8a12bba6406b4162ea6dfc52", "index": 9308, "step-1": "<mask token>\n\n\ndef update_delete_product(rowid, id_, name, quantity, cost, qry):\n if id_ == '' and name == '' and quantity == '' and cost == '':\n return False, ' You Cannot Leave It Empty '\n try:\n conn =...
[ 3, 6, 7, 9, 10 ]
import bisect import sys input = sys.stdin.readline N = int(input()) A = [int(input()) for _ in range(N)] dp = [float('inf')] * (N + 1) for a in A[::-1]: idx = bisect.bisect_right(dp, a) dp[idx] = a ans = 0 for n in dp: if n != float('inf'): ans += 1 print(ans)
normal
{ "blob_id": "dfe79d2f4bf4abc1d04035cf4556237a53c01122", "index": 6913, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor a in A[::-1]:\n idx = bisect.bisect_right(dp, a)\n dp[idx] = a\n<mask token>\nfor n in dp:\n if n != float('inf'):\n ans += 1\nprint(ans)\n", "step-3": "<mask token>...
[ 0, 1, 2, 3 ]
# ------------------------------------------- # MODULES # ------------------------------------------- import sys import platform if(platform.system()== "Windows"): dir_sep = "\\" else: dir_sep = "/" import time import os import numpy as np import subprocess import math from mathutils import Vector try: from CifFi...
normal
{ "blob_id": "e14319e705a3c1cdf85e0a2fe77c211e2afa9baa", "index": 9880, "step-1": "<mask token>\n\n\nclass Crysdata:\n\n def __init__(self, F, cb):\n self.start = time.time()\n print('Draw timer started')\n self.name = F\n self.cell = Cell(cb)\n self.atoms = readEl(cb)\n ...
[ 20, 32, 41, 42, 51 ]
""" 1. Если в строке больше символов в нижнем регистре - вывести все в нижнем, если больше в верхнем - вывести все в верхнем, если поровну - вывести в противоположных регистрах. 2. Если в строке каждое слово начинается с заглавной буквы, тогда добавить в начало строки 'done. '. И...
normal
{ "blob_id": "c7c405535b2ca656d4d5f18013e3e2fdef70efea", "index": 8088, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor char in string:\n if char.isupper():\n upp_regist += 1\n elif char.islower():\n low_regist += 1\nprint('Some string:', string)\nif upp_regist > low_regist:\n pr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('valor de D: %.4f' % D) print('valor de Rey: %.4f' % Rey) print('valor de k: %.4f' % k) <|reserved_special_token_1|> <|reserved_special_token_0|> f = float(input('Digite o valor de f: ')) L = float(input('Digite o valor d...
flexible
{ "blob_id": "b6183daa943cc63fd2959e3e54fc1e6af5d761de", "index": 202, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('valor de D: %.4f' % D)\nprint('valor de Rey: %.4f' % Rey)\nprint('valor de k: %.4f' % k)\n", "step-3": "<mask token>\nf = float(input('Digite o valor de f: '))\nL = float(input('D...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sftp_connection(): while True: cnopts = pysftp.CnOpts() cnopts.hostkeys = None try: with pysftp.Connection('sb-emea.avl.com', username= 'abhishek.hingwasia@avl.com', pa...
flexible
{ "blob_id": "676ccbac9385a4b63d599c3f85f16e28d839e9b8", "index": 3731, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sftp_connection():\n while True:\n cnopts = pysftp.CnOpts()\n cnopts.hostkeys = None\n try:\n with pysftp.Connection('sb-emea.avl.com', username...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def preprocessing_terms(termlist, lang_in, timeEx, patternBasedClean, pluralClean, numbersClean, accentClean): date = '2020-06-03' print('terms:', termlist) print('lang:', lang_in) processedTerms = clean_terms(termlist, lang_in) print('This is processedTerms ') ...
flexible
{ "blob_id": "afb0359f4cdf5ed32bb785d969e9bf8919bb6add", "index": 3408, "step-1": "<mask token>\n\n\ndef preprocessing_terms(termlist, lang_in, timeEx, patternBasedClean,\n pluralClean, numbersClean, accentClean):\n date = '2020-06-03'\n print('terms:', termlist)\n print('lang:', lang_in)\n process...
[ 8, 9, 10, 13, 14 ]
import pandas as pd import random import math # takes 2 row series and calculates the distances between them def euclidean_dist(a: pd.Series, b: pd.Series): diff = a.sub(other=b) squares = diff ** 2 dist = 0 for feature_distance in squares: if not math.isnan(feature_distance): dis...
normal
{ "blob_id": "46b51f46f6ed73e3b9dc2f759535ba71facd2aae", "index": 5712, "step-1": "<mask token>\n\n\ndef euclidean_dist(a: pd.Series, b: pd.Series):\n diff = a.sub(other=b)\n squares = diff ** 2\n dist = 0\n for feature_distance in squares:\n if not math.isnan(feature_distance):\n di...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class _NodesTree(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __hasCycle(self, node, new_deps): if node in new_deps: return True deps = set(new_deps) node2deps = self.node2deps ...
flexible
{ "blob_id": "cbfccffce2884e1cbebe21daf7792eebc1f88571", "index": 6864, "step-1": "<mask token>\n\n\nclass _NodesTree(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __hasCycle(self, node, new_deps):\n if node in new_deps:\n return True\n deps = set(new_deps)\n ...
[ 68, 84, 88, 95, 105 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mainLoop(): wilfredCommunication = command.Command() wilfredCommunication.waitForClient() wilfredCommand = command.Command() while True: if not wilfredCommunication.checkConnection(): wilf...
flexible
{ "blob_id": "a77fb90cdc6e7f9b70f9feeefc2b7f8e93a2d8c5", "index": 9875, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mainLoop():\n wilfredCommunication = command.Command()\n wilfredCommunication.waitForClient()\n wilfredCommand = command.Command()\n while True:\n if not wilfre...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def run_explanations(network, explanation_module, data_iterator): network.eval() best_accuracy = 0 worst_accuracy = 0 best_correct = 0 worst_correct = 0 covered = 0 total = 0 pbar = tqdm() pbar.reset(total=len(data_iterator)) for _, data in enumerat...
flexible
{ "blob_id": "00dbcae2d3941c9ef4c8b6753b8f6f7a46417400", "index": 5110, "step-1": "<mask token>\n\n\ndef run_explanations(network, explanation_module, data_iterator):\n network.eval()\n best_accuracy = 0\n worst_accuracy = 0\n best_correct = 0\n worst_correct = 0\n covered = 0\n total = 0\n ...
[ 3, 5, 6, 7, 9 ]
#사각형의 면적을 구하는 프로그램을 작성하시오, #사각형의 면적 = 높이*밑변 height=int(input('높이 입력: ')) base=int(input('밑변 입력: ')) area=height*base print('높이는',height,' 밑변은',base,'사각형의 면적은',area,'입니다.')
normal
{ "blob_id": "f9b48c1b6489d8981e192838cf1c734e2296ab15", "index": 9833, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('높이는', height, ' 밑변은', base, '사각형의 면적은', area, '입니다.')\n", "step-3": "height = int(input('높이 입력: '))\nbase = int(input('밑변 입력: '))\narea = height * base\nprint('높이는', height, ' 밑변...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def predict(theta, X): probability = sigmoid(X * theta.T) return [(1 if x >= 0.5 else 0) for x in probability] def implement_for_LR(X_train, X_test, y_train, y_test, lamda=1): n = X_train.shape[1] X_train = np.array(X_train.values) y_train = np.array(y_train.values) ...
flexible
{ "blob_id": "991c361043eb1539a80b5e8e1db44bc365e7e639", "index": 6345, "step-1": "<mask token>\n\n\ndef predict(theta, X):\n probability = sigmoid(X * theta.T)\n return [(1 if x >= 0.5 else 0) for x in probability]\n\n\ndef implement_for_LR(X_train, X_test, y_train, y_test, lamda=1):\n n = X_train.shape...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('begin') imgui.create_context() <|reserved_special_token_0|> imgui.get_io().fonts.get_tex_data_as_rgba32() imgui.new_frame() imgui.begin('Window', True) imgui.text('HelloWorld') imgui.end() imgui.render() imgui.end_frame() p...
flexible
{ "blob_id": "146cae8f60b908f04bc09b10c4e30693daec89b4", "index": 6560, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('begin')\nimgui.create_context()\n<mask token>\nimgui.get_io().fonts.get_tex_data_as_rgba32()\nimgui.new_frame()\nimgui.begin('Window', True)\nimgui.text('HelloWorld')\nimgui.end()\...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # coding: utf-8 # In[2]: print(" sum of n numbers with help of for loop. ") n = 10 sum = 0 for num in range(0, n+1, 1): sum = sum+num print("Output: SUM of first ", n, "numbers is: ", sum ) # In[3]: print(" sum of n numbers with help of while loop. ") num = int(input("Enter the value of...
normal
{ "blob_id": "d3c36ad36c50cd97f2101bc8df99d1961b0ad7ea", "index": 4078, "step-1": "<mask token>\n", "step-2": "print(' sum of n numbers with help of for loop. ')\n<mask token>\nfor num in range(0, n + 1, 1):\n sum = sum + num\nprint('Output: SUM of first ', n, 'numbers is: ', sum)\nprint(' sum of n numbers w...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestGeneral(unittest.TestCase): def _check_instantiations(self, template, supports_symbolic=True): default_cls = template[None] self.assertTrue(template[float] is default_cls) self.assertTrue(template[AutoDiffXd] is not default_cls) if supports_s...
flexible
{ "blob_id": "f17ae8a44f8b032feac7c18fe39663054fea40c0", "index": 5282, "step-1": "<mask token>\n\n\nclass TestGeneral(unittest.TestCase):\n\n def _check_instantiations(self, template, supports_symbolic=True):\n default_cls = template[None]\n self.assertTrue(template[float] is default_cls)\n ...
[ 25, 26, 28, 30, 35 ]
#!usr/bin/python #--*--coding:utf-8--*-- import sys import re if __name__ == '__main__': category = re.compile('\[\[Category\:.*\]\]')#.は改行以外の任意の文字列にマッチ for line in open(sys.argv[1]): if category.search(line) is not None:#比較にはisを用いなければならない print line.strip()
normal
{ "blob_id": "14b6dc403be76abef5fde2cca5d773c88faa4b40", "index": 6083, "step-1": "#!usr/bin/python\n#--*--coding:utf-8--*--\n\nimport sys\nimport re\n\nif __name__ == '__main__':\n category = re.compile('\\[\\[Category\\:.*\\]\\]')#.は改行以外の任意の文字列にマッチ\n for line in open(sys.argv[1]):\n if category.search(li...
[ 0 ]
<|reserved_special_token_0|> def getRegionClass(image_path, data_id, imgName): region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect', 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard'] label_class = ['nosmoke_bg', 'nosmoke_face', 'nosmoke_susp', 'nosmoke_cover', 'sm...
flexible
{ "blob_id": "75833617996549167fa157ff78cc1a11f870784f", "index": 8639, "step-1": "<mask token>\n\n\ndef getRegionClass(image_path, data_id, imgName):\n region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect',\n 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard']\n label_clas...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def convert(decimal_num): roman = {(1000): 'M', (900): 'CM', (500): 'D', (400): 'CD', (100): 'C', (90): 'XC', (50): 'L', (40): 'XL', (10): 'X', (9): 'IX', (5): 'V', (4): 'IV', (1): 'I'} num_to_roman = '' for i in roman.keys(): num_to_roman += roman[i] *...
flexible
{ "blob_id": "7025cc896035c59e0bbb7943493b6ca24fd9e6ca", "index": 9429, "step-1": "<mask token>\n\n\ndef convert(decimal_num):\n roman = {(1000): 'M', (900): 'CM', (500): 'D', (400): 'CD', (100): 'C',\n (90): 'XC', (50): 'L', (40): 'XL', (10): 'X', (9): 'IX', (5): 'V',\n (4): 'IV', (1): 'I'}\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Launcher: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class ShotTracker: """ Graphical depiction of a projectile flight using a Circle """ def __init__...
flexible
{ "blob_id": "09aedd6cab0b8c6a05bbee5b336fcd38aea1f7b9", "index": 3202, "step-1": "<mask token>\n\n\nclass Launcher:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ShotTracker:\n \"\"\" Graphical depiction of a projectile flight using a Circle \"\"\"\n\n ...
[ 12, 14, 15, 17, 20 ]
import numpy as np import cv2 import datetime import random # from random import randint import time import logging def GetDateTimeString(): dt = str(datetime.datetime.now()).split(".")[0] clean = dt.replace(" ","_").replace(":","_") return clean def GetBackground(bgNumber): # bgImage = './backgrounds...
normal
{ "blob_id": "a14c23398bbf42832a285d29c1b80aefc5fdaf6c", "index": 9031, "step-1": "<mask token>\n\n\ndef GetDateTimeString():\n dt = str(datetime.datetime.now()).split('.')[0]\n clean = dt.replace(' ', '_').replace(':', '_')\n return clean\n\n\ndef GetBackground(bgNumber):\n bgImage = '/home/pi/piboot...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python import ROOT ROOT.gROOT.SetBatch() ROOT.gROOT.ProcessLine('gErrorIgnoreLevel = kError;') import os import time import varial.tools import varial.generators as gen import itertools from varial.sample import Sample import varial.analysis as analysis # import varial.toolinterface dirname = 'VLQToHi...
normal
{ "blob_id": "05ced056bf2f59f85bef82e53803e7df7ff8c8df", "index": 1156, "step-1": "<mask token>\n\n\ndef select_histograms(wrp):\n use_this = True\n if use_cuts and all('NoGenSel-' + c not in wrp.in_file_path for c in\n current_cuts):\n use_this = False\n if wrp.name.startswith('cf_'):\n ...
[ 10, 13, 14, 18, 20 ]
#!/usr/bin/python # ~~~~~============== HOW TO RUN ==============~~~~~ # 1) Configure things in CONFIGURATION section # 2) Change permissions: chmod +x bot.py # 3) Run in loop: while true; do ./bot.py; sleep 1; done from __future__ import print_function import sys import socket import json import time # ~~~~~==...
normal
{ "blob_id": "56c5c515de8490f2e3516563e037c375aba03667", "index": 3221, "step-1": "<mask token>\n\n\ndef connect():\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.connect((exchange_hostname, port))\n return s.makefile('rw', 1)\n\n\ndef write_to_exchange(exchange, obj):\n json.dump(obj, ex...
[ 5, 8, 9, 10, 16 ]
<|reserved_special_token_0|> class If_Statement(Instruction): def __init__(self, row, column, expBool, elseif_list, else_, stmts) ->None: super().__init__(row, column) self.expBool = expBool self.elseif_list = elseif_list self.else_ = else_ self.stmts = stmts <|reserve...
flexible
{ "blob_id": "bbbdb30ceef920e600c9f46fb968732b077be2d8", "index": 4231, "step-1": "<mask token>\n\n\nclass If_Statement(Instruction):\n\n def __init__(self, row, column, expBool, elseif_list, else_, stmts) ->None:\n super().__init__(row, column)\n self.expBool = expBool\n self.elseif_list ...
[ 7, 9, 10, 11, 12 ]
<|reserved_special_token_0|> def get_position_from_angle(razon, data, start, end): dni_df, altitude_angles, azimuth_angles = data cos_correct_df = razon.get_cos_factors(altitude_angles, azimuth_angles) dni_df = razon.cos_correct(dni_df, cos_correct_df) angles = pd.DataFrame() angles['Theta'] = dni...
flexible
{ "blob_id": "13a4fb5ce9ab0a3ef9ce503698615eae4157a637", "index": 7962, "step-1": "<mask token>\n\n\ndef get_position_from_angle(razon, data, start, end):\n dni_df, altitude_angles, azimuth_angles = data\n cos_correct_df = razon.get_cos_factors(altitude_angles, azimuth_angles)\n dni_df = razon.cos_correc...
[ 1, 2, 3, 4, 5 ]
import numpy as np from .basic import scRefData, featureSelection from .utils import find_variable_genes, dropout_linear_model from .process import find_de_tt, find_de_anova """ after normalization befor cluster or nn_indexing """ class highlyVarSelecter(featureSelection): """ select highly varable genes; ...
normal
{ "blob_id": "c972f732553f27261d2a4a03e6e353f2e1b5f5d3", "index": 8256, "step-1": "<mask token>\n\n\nclass manualSelecter(featureSelection):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass markerSelecter_tt(featureSelection):\n \"\"\"\n for labeled data only\n select cluster marker as fe...
[ 9, 11, 21, 23, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('翻译结果:%s' % target['translateResult'][0][0]['tgt']) <|reserved_special_token_1|> <|reserved_special_token_0|> content = input('请输入需要翻译的内容:') url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' data...
flexible
{ "blob_id": "e01b1f57a572571619d6c0981370030dc6105fd2", "index": 8636, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('翻译结果:%s' % target['translateResult'][0][0]['tgt'])\n", "step-3": "<mask token>\ncontent = input('请输入需要翻译的内容:')\nurl = 'http://fanyi.youdao.com/translate?smartresult=dict&smartres...
[ 0, 1, 2, 3, 4 ]
questions = ('Какой язык мы учим?', 'Какой тип данных имеет целая переменная?', 'Какой тип данных имеет вещественная переменная?', 'Какой тип данных имеет логическая переменная?', 'Какой тип данных имеет символьная переменная?') answers = ('Python', 'Integer', 'Float', 'Bool', 'String') i = 0 count_answers = 0 while i ...
normal
{ "blob_id": "dd936839d71b97b3a21115498092d8984de0e3f1", "index": 7445, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i < len(questions):\n user_answers = input('{}...'.format(questions[i]))\n if user_answers.capitalize() == answers[i]:\n count_answers = count_answers + 1\n i += 1\n...
[ 0, 1, 2, 3 ]
import tensorflow as tf from tensorflow.contrib import layers from tensorflow.contrib.framework.python.ops import arg_scope from tensorflow.contrib.layers.python.layers import initializers from tensorflow.contrib.layers.python.layers import layers as layers_lib from tensorflow.contrib.layers.python.layers import regula...
normal
{ "blob_id": "ca93f49fbdc1d64e0616bca035a6043b3cc80ddc", "index": 1485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef inception_2d_fields(img, fields, num_classes=30, is_training=True,\n dropout_keep_prob=0.6, prediction_fn=layers_lib.softmax,\n spatial_squeeze=True, reuse=None, scope='Ince...
[ 0, 1, 2, 3 ]
_base_ = "../model.py" model = dict( type="ImageClassifier", task="classification", pretrained=None, backbone=dict(), head=dict(in_channels=-1, loss=dict(type="CrossEntropyLoss", loss_weight=1.0), topk=(1, 5)), ) checkpoint_config = dict(type="CheckpointHookWithValResults")
normal
{ "blob_id": "8bd5eff12e68f7145676f5e089b51376a82ab489", "index": 3231, "step-1": "<mask token>\n", "step-2": "_base_ = '../model.py'\nmodel = dict(type='ImageClassifier', task='classification', pretrained=None,\n backbone=dict(), head=dict(in_channels=-1, loss=dict(type=\n 'CrossEntropyLoss', loss_weight...
[ 0, 1, 2 ]
l = int(input("Enter lower range: ")) u = int(input("Enter upper range: ")) if(l<=0): print "invalid" if (u<=0): print "invalid" for num in range(l,u+1): n = len(str(num)) sum = 0 temp = num while temp > 0: digit = temp % 10 sum += digit ** n ...
normal
{ "blob_id": "42fa0aa98e2d3336bdb56cba97596d8532d46cb4", "index": 2896, "step-1": "l = int(input(\"Enter lower range: \"))\nu = int(input(\"Enter upper range: \"))\nif(l<=0):\n print \"invalid\"\nif (u<=0):\n print \"invalid\"\n for num in range(l,u+1):\n n = len(str(num))\n sum = 0\n ...
[ 0 ]
import pandemic as pd from typing import Sequence def save_gml(path: str, peers: Sequence[pd.Peer]) -> bool: try: with open(path, "w") as file: file.write(graph(peers)) except Exception: return True return False def print_gml(peers: Sequence[pd.Peer]) -> None: print(grap...
normal
{ "blob_id": "cb0b963c0e5aadcb67b5ee5f055fb9b6f21892fc", "index": 5292, "step-1": "<mask token>\n\n\ndef node(peer: pd.Peer):\n if peer.data_infection is None:\n return ''\n return '\\t' + 'node [' + '\\n' + '\\t' + '\\t' + 'id {}'.format(peer.id\n ) + '\\n' + '\\t' + '\\t' + 'label \"{}\"'.fo...
[ 2, 5, 6, 7, 8 ]
#!/usr/bin/env python import sys,re print('\n'.join(re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',sys.stdin.read())))
normal
{ "blob_id": "4cefaa964251e77a05066af1f61f9fd2a4350d38", "index": 7622, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('\\n'.join(re.findall(\n 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\\\(\\\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'\n , sys.stdin.read())))\n", "step-3": "import sys, re\nprint(...
[ 0, 1, 2, 3 ]
from more_itertools import ilen from my.body import weight, shower, food, water def test_body() ->None: for func in (weight, shower, food, water): assert ilen(func()) >= 1
normal
{ "blob_id": "e06b740f27e41b9f120c962fd76a38a29d54af3c", "index": 973, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_body() ->None:\n for func in (weight, shower, food, water):\n assert ilen(func()) >= 1\n", "step-3": "from more_itertools import ilen\nfrom my.body import weight, ...
[ 0, 1, 2 ]
from setuptools import setup, find_packages from setuptools.extension import Extension from sys import platform cython = True try: from Cython.Build import cythonize cython = True except ImportError: cython = False # Define the C++ extension if platform == "darwin": extra_compile_args = ['-O3', '-pthread',...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.executemany('INSERT INTO persone VALUES (null,?,?)', dipendenti) conn.commit() conn.close() <|reserved_special_token_1|> <|reserved_special_token_0|> conn = sqlite3.connect('19-BD/prove.db') cursor = conn.cursor() dipend...
flexible
{ "blob_id": "3e1ca6ed4668e75a62baa65ef44346dd86a16491", "index": 3093, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.executemany('INSERT INTO persone VALUES (null,?,?)', dipendenti)\nconn.commit()\nconn.close()\n", "step-3": "<mask token>\nconn = sqlite3.connect('19-BD/prove.db')\ncursor = conn...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # 导入包 import matplotlib.pyplot as plt import numpy as np # 显示中文和显示负号 plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False # X轴和Y轴数据,票房单位亿 a = ["战狼2","速度与激情8","功夫瑜伽","西游伏妖篇","变形金刚5:最后的骑士","摔跤吧!爸爸","加勒比海盗5:死无对证","金刚:骷髅岛","极限特工:终极回归","生化危机6:终章","乘风破浪","神偷奶爸3","...
normal
{ "blob_id": "16d86c48c45ab0441046e968ea364d27f6dcfd12", "index": 3066, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure(figsize=(20, 8), dpi=128)\nplt.barh(a, b, height=0.5, color='red')\nplt.title('2018年电影票房纪录', fontsize=24)\nplt.xlabel('票房(亿元)', fontsize=14)\n<mask token>\nplt.xticks(my_x_tick...
[ 0, 1, 2, 3, 4 ]
import os import sys import string from array import * from datetime import datetime #f = open('input_test.txt', 'r') f = open('input_task.txt', 'r') width = 60 height = 5000 sleepingMinutes = [[0 for x in range(width)] for y in range(height)] infos = [] # Change lines to tuples and store to array for sorting for l...
normal
{ "blob_id": "293533d07b530be9e8f97f1720619bf6c3113cca", "index": 9447, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f:\n line = line.rstrip('\\n')\n line = line.replace('[', '')\n splitted = line.split(']')\n stringTime = splitted[0]\n stringTask = splitted[1]\n datetimeTi...
[ 0, 1, 2, 3, 4 ]
def fib(limit): a, b = 0, 1 yield a yield b while b < limit: a, b = b, a + b yield b print sum(x for x in fib(4000000) if not x % 2) # 4613732
normal
{ "blob_id": "1c7635917e398c30e4a232f76b2c02a51e165a63", "index": 4147, "step-1": "def fib(limit):\n a, b = 0, 1\n yield a\n yield b\n while b < limit:\n a, b = b, a + b\n yield b\n\n\nprint sum(x for x in fib(4000000) if not x % 2) # 4613732\n", "step-2": null, "step-3": null, "s...
[ 0 ]
<|reserved_special_token_0|> def get_cruiseitemArr(): conn = db_connect.connect() query = conn.execute('select * from CruiseItem') InventoryArr = query.cursor.fetchall() print(InventoryArr) return jsonify(InventoryArr) def get_cruiseitemArr_byLoc(Location): conn = db_connect.connect() qu...
flexible
{ "blob_id": "65bfb59a255b42854eec8b55b28711737cfc46c2", "index": 9325, "step-1": "<mask token>\n\n\ndef get_cruiseitemArr():\n conn = db_connect.connect()\n query = conn.execute('select * from CruiseItem')\n InventoryArr = query.cursor.fetchall()\n print(InventoryArr)\n return jsonify(InventoryArr...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> def load_module(shortname): if shortname.startswith('__'): pass elif shortname.endswith('_'): import ub.events import sys import importlib from pathlib import Path path = Path(f'ub/modules/{shortname}.py') name = 'ub.modules....
flexible
{ "blob_id": "4b672ad420bb67b8e2726102939ed6d369683150", "index": 7267, "step-1": "<mask token>\n\n\ndef load_module(shortname):\n if shortname.startswith('__'):\n pass\n elif shortname.endswith('_'):\n import ub.events\n import sys\n import importlib\n from pathlib import...
[ 4, 7, 9, 13, 15 ]
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import minimize from scipy.stats import chisquare, chi2, binom, poisson def f_1(x, a): return (1 / (x + 5)) * np.sin(a * x) def f_2(x, a): return np.sin(a * x) + 1 def f_3(x, a): return np.sin(a * (x ** 2)) def f_4(x, a): ret...
normal
{ "blob_id": "27edc753ebb9d60715a2ffa25d77e69ef363d010", "index": 3568, "step-1": "<mask token>\n\n\ndef f_1(x, a):\n return 1 / (x + 5) * np.sin(a * x)\n\n\ndef f_2(x, a):\n return np.sin(a * x) + 1\n\n\ndef f_3(x, a):\n return np.sin(a * x ** 2)\n\n\n<mask token>\n\n\ndef f_5(x):\n return x * np.tan...
[ 6, 9, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': scale = 768 bitmap = Image.new('RGB', (scale, scale), 'white') pix = bitmap.load() c = complex(-0.585, 0.85) move = 0.0 maxIter = 255 for x in range(scale): for y in r...
flexible
{ "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 ]
""" You can perform the following operations on the string, : Capitalize zero or more of 's lowercase letters. Delete all of the remaining lowercase letters in . Given two strings, and , determine if it's possible to make equal to as described. If so, print YES on a new line. Otherwise, print NO. For example, give...
normal
{ "blob_id": "5fb998fa761b989c6dd423634824197bade4f8a5", "index": 23, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef abbreviation(a, b):\n m, n = len(a), len(b)\n dp = [([False] * (m + 1)) for _ in range(n + 1)]\n dp[0][0] = True\n for i in range(n + 1):\n for j in range(1, m + ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello world! im in github') <|reserved_special_token_1|> print("Hello world! im in github")
flexible
{ "blob_id": "2db6f88b733c23063803c374d7a5b651e8443bd5", "index": 6135, "step-1": "<mask token>\n", "step-2": "print('Hello world! im in github')\n", "step-3": "print(\"Hello world! im in github\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def file_list(dir): subdir_list = [] for item in os.listdir(dir): fullpath = os.path.join(dir, item) if os.path.isdir(fullpath): subdir_list.append(fullpath) else: print(fu...
flexible
{ "blob_id": "051544f41cc3c7d78210076cb9720866924ea2a1", "index": 2942, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef file_list(dir):\n subdir_list = []\n for item in os.listdir(dir):\n fullpath = os.path.join(dir, item)\n if os.path.isdir(fullpath):\n subdir_list.a...
[ 0, 1, 2, 3, 4 ]
adict = {'name': 'bob', 'age': 23} print('bob' in adict) print('name' in adict) for key in adict: print('%s:%s' % (key, adict[key])) print('%(name)s:%(age)s' % adict)
normal
{ "blob_id": "aa4d872c6a529d8acf18f1c3b477bc1816ac2887", "index": 575, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('bob' in adict)\nprint('name' in adict)\nfor key in adict:\n print('%s:%s' % (key, adict[key]))\nprint('%(name)s:%(age)s' % adict)\n", "step-3": "adict = {'name': 'bob', 'age': ...
[ 0, 1, 2 ]
team = input("Wymien wszystkich czlonkow swojego zespolu: ").split(",") for member in team: print("Hello, " + member)
normal
{ "blob_id": "5d3f7d74cf1cc2612d599c65393abed11181c981", "index": 2300, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor member in team:\n print('Hello, ' + member)\n", "step-3": "team = input('Wymien wszystkich czlonkow swojego zespolu: ').split(',')\nfor member in team:\n print('Hello, ' + mem...
[ 0, 1, 2, 3 ]
from django.db import transaction from django.contrib.auth.models import Group from drf_yasg import openapi from drf_yasg.utils import swagger_auto_schema from rest_framework import status, mixins from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.viewsets imp...
normal
{ "blob_id": "43b5936ca9368dcae8d41b44fd9dc927fe18c9bc", "index": 8794, "step-1": "<mask token>\n\n\nclass CustomUsuarioViewSet(AccessViewSetMixin, mixins.CreateModelMixin,\n mixins.RetrieveModelMixin, mixins.ListModelMixin, GenericViewSet):\n <mask token>\n <mask token>\n <mask token>\n <mask toke...
[ 13, 14, 19, 21, 23 ]
import base64 import json class BaseTestCloudAuth: """ Required setup: initialize test case teardown: del items for test decode: check decoded token and assigned info """ ACCESS_TOKEN = "" SCOPE_ACCESS_TOKEN = "" ID_TOKEN = "" TESTCLIENT = None def assert_get_res...
normal
{ "blob_id": "9a2b5b9b2b2f9532b5d0749147aca644c2ac26e3", "index": 2878, "step-1": "<mask token>\n\n\nclass BaseTestCloudAuth:\n \"\"\"\n Required\n setup: initialize test case\n teardown: del items for test\n decode: check decoded token and assigned info\n \"\"\"\n ACCESS_TOKEN = ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for file_dir in file_dirs: fdir = 'custom_dataset/' + file_dir for directory in os.listdir(fdir): new_location = ('/content/gdrive/My Drive/project/custom_dataset/' + file_dir + directory) xml_f...
flexible
{ "blob_id": "3a053c2c8a2b9123974183e65914dc0f73d2e078", "index": 6368, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file_dir in file_dirs:\n fdir = 'custom_dataset/' + file_dir\n for directory in os.listdir(fdir):\n new_location = ('/content/gdrive/My Drive/project/custom_dataset/' +\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def DiceLoss(pred, target, smooth=2): index = (2 * torch.sum(pred * target) + smooth) / (torch.sum(pred) + torch.sum(target) + smooth) return 1 - index <|reserved_special_token_1|> import torch def DiceLoss(...
flexible
{ "blob_id": "0aa0fcbb0ec1272bea93574a9287de9f526539c8", "index": 3119, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef DiceLoss(pred, target, smooth=2):\n index = (2 * torch.sum(pred * target) + smooth) / (torch.sum(pred) +\n torch.sum(target) + smooth)\n return 1 - index\n", "step-...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def git_short_hash(): try: git_str = '+' + os.popen('git log -1 --format="%h"').read().strip() except: git_str = '' else: if git_str == '+': git_str = '' return git_str <|reserved_special_token_0|> def write_version_py(filename='ipyh...
flexible
{ "blob_id": "2e2de50a7d366ca1a98d29b33ed157a1e8445ada", "index": 3523, "step-1": "<mask token>\n\n\ndef git_short_hash():\n try:\n git_str = '+' + os.popen('git log -1 --format=\"%h\"').read().strip()\n except:\n git_str = ''\n else:\n if git_str == '+':\n git_str = ''\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class UserInterface(ABC): <|reserved_special_token_0|> <|reserved_special_token_0|> @abstractmethod def show_message(self, msg: str): """Show a message""" <|reserved_special_token_0|> @abstractmethod def close(self): """Close the updtater UI""...
flexible
{ "blob_id": "efeb069a7e2aab7262a557236c693752d2973523", "index": 4169, "step-1": "<mask token>\n\n\nclass UserInterface(ABC):\n <mask token>\n <mask token>\n\n @abstractmethod\n def show_message(self, msg: str):\n \"\"\"Show a message\"\"\"\n <mask token>\n\n @abstractmethod\n def clo...
[ 14, 15, 16, 17, 19 ]
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Taobao .Inc # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://code.taobao.org/license.html. # # This software consists of voluntary ...
normal
{ "blob_id": "bacd0c729193f064b21ab8e01e98dfc276094458", "index": 7853, "step-1": "<mask token>\n\n\ndef need_owner(view_func):\n\n def _wrapped_view(request, *args, **kwargs):\n rc = request.rc\n rc.project = q_get(Project, name=kwargs['name'], status=consts.\n PROJECT_ENABLE)\n ...
[ 7, 14, 16, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> curses.noecho() curses.cbreak() stdscr.keypad(True) curses.curs_set(0) <|reserved_special_token_0|> window.keypad(1) window.timeout(100) <|reserved_special_token_0|> window.addch(int(food[0]), int(food[1]), curses.ACS_PI) <|reserv...
flexible
{ "blob_id": "153d37b58a10847aae1fa7dbec4c7576c3d97fb2", "index": 3407, "step-1": "<mask token>\n", "step-2": "<mask token>\ncurses.noecho()\ncurses.cbreak()\nstdscr.keypad(True)\ncurses.curs_set(0)\n<mask token>\nwindow.keypad(1)\nwindow.timeout(100)\n<mask token>\nwindow.addch(int(food[0]), int(food[1]), curs...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class test_A1(unittest.TestCase): def setUp(self): self.security1 = security.Security('XXX-1234-ABCD-1234', None) self.security2 = security.Security(None, 'kkklas8882kk23nllfjj88290') self.security3 = security.Security('XXX-1234-ABCD-1234', 'kkklas...
flexible
{ "blob_id": "2ba5cb1265090b42b9a4838b792a3e81b209ba1a", "index": 3822, "step-1": "<mask token>\n\n\nclass test_A1(unittest.TestCase):\n\n def setUp(self):\n self.security1 = security.Security('XXX-1234-ABCD-1234', None)\n self.security2 = security.Security(None, 'kkklas8882kk23nllfjj88290')\n ...
[ 6, 7, 8, 9, 11 ]
# -*- coding: utf-8 -*- import scrapy from selenium import webdriver import datetime class GoldpriceSpider(scrapy.Spider): name = 'goldprice' allowed_domains = ['g-banker.com'] start_urls = ['https://g-banker.com/'] def __init__(self): self.browser = webdriver.PhantomJS() self.price =...
normal
{ "blob_id": "e59404149c739a40316ca16ab767cbc48aa9b685", "index": 3526, "step-1": "<mask token>\n\n\nclass GoldpriceSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self):\n self.browser = webdriver.PhantomJS()\n self.price = None\n\n def parse(self...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- #!/bin/python3 import websocket import json import time from loraCrypto import LoRaCrypto from binascii import hexlify ''' 没有加密的数据 { cmd: 'tx'; EUI: string; port: number; data: string } 加密的数据 { cmd: 'tx'; EUI: string; port: number; encdata: string; seqno: number; } ''' GATEWAY_ID = "...
normal
{ "blob_id": "3683b1f799fa315d736e4b62c9c093360afa893f", "index": 2052, "step-1": "# -*- coding: utf-8 -*-\n#!/bin/python3\nimport websocket\nimport json\nimport time\nfrom loraCrypto import LoRaCrypto\nfrom binascii import hexlify\n\n'''\n没有加密的数据\n{\n\tcmd: 'tx';\n\tEUI: string;\n\tport: number;\n\tdata: string\...
[ 0 ]
<|reserved_special_token_0|> class Student: <|reserved_special_token_0|> def displayDetails(self): print('{} \t {} \t {}'.format(self.name, self.rollNo, self.marks)) try: if self.marks < 40: raise Fail('Student {} has Scored {} marks and has Failed ' ...
flexible
{ "blob_id": "ddf074e400551d2c147d898fe876a31d13a72699", "index": 5324, "step-1": "<mask token>\n\n\nclass Student:\n <mask token>\n\n def displayDetails(self):\n print('{} \\t {} \\t {}'.format(self.name, self.rollNo, self.marks))\n try:\n if self.marks < 40:\n raise...
[ 2, 5, 6, 7 ]
import numpy as np import matplotlib.pyplot as plt import networkx as nx import time import sys class ConsensusSimulation: """Class to model a general consensus problem see DOI: 10.1109/JPROC.2006.887293""" def __init__(self, topology, dynamics, dynami...
normal
{ "blob_id": "3164eab8dc221149c9f865645edf9991d810d2ac", "index": 8698, "step-1": "<mask token>\n\n\nclass ConsensusSimulation:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def run_sim(self, record_all=False, update_every=1.0):\n \"\"\"run the core simulation\"\"\"\n ...
[ 3, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Bob(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Bob(object): <|reserved_special_token_0|> def hey(self, question): if not question or question.strip() == '': ...
flexible
{ "blob_id": "7ff7da216bdda5c30bf7c973c82886035b31247c", "index": 4093, "step-1": "<mask token>\n", "step-2": "class Bob(object):\n <mask token>\n <mask token>\n", "step-3": "class Bob(object):\n <mask token>\n\n def hey(self, question):\n if not question or question.strip() == '':\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def dpd1_process(lst): """已废弃的方法""" if not lst: return for key, l in lst.items(): rule = getattr(BeforeInBomber, key).value query = AutoIVRActions.select(fn.DISTINCT(AutoIVRActions.loanid) ).where(AutoIVRActions.loanid.in_(l), AutoIVRActions...
flexible
{ "blob_id": "1fbe9078748b00efad0211b29ad572df97cda921", "index": 1958, "step-1": "<mask token>\n\n\ndef dpd1_process(lst):\n \"\"\"已废弃的方法\"\"\"\n if not lst:\n return\n for key, l in lst.items():\n rule = getattr(BeforeInBomber, key).value\n query = AutoIVRActions.select(fn.DISTINCT...
[ 60, 69, 74, 80, 146 ]
import random def get_ticket(): ticket = '' s = 'abcdefghijkrmnopqrstuvwxyz1234567890' for i in range(28): r_num = random.choice(s) ticket += r_num return ticket
normal
{ "blob_id": "d2a9a2fd3a1118c0855b8f77ce4c25cc6b4e8f87", "index": 4328, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_ticket():\n ticket = ''\n s = 'abcdefghijkrmnopqrstuvwxyz1234567890'\n for i in range(28):\n r_num = random.choice(s)\n ticket += r_num\n return tick...
[ 0, 1, 2 ]
import math def hipotenusa(a,b): return math.sqrt((a*a)+(b*b)) def main(): cateto1=input('dime un cateto') cateto2=input('dime el otro cateto') print ('la hipotenusa es: '),hipotenusa(cateto1,cateto2) main()
normal
{ "blob_id": "50ae2b4c6d51451031fc31ebbc43c820da54d827", "index": 7898, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n cateto1 = input('dime un cateto')\n cateto2 = input('dime el otro cateto')\n print('la hipotenusa es: '), hipotenusa(cateto1, cateto2)\n\n\n<mask token>\n", "...
[ 0, 1, 2, 3, 5 ]
import time import DHT22 import pigpio import Sensor class MagicBoxDHT22(object): def DHT22(self): self.s.trigger() time.sleep(0.2) self.tempF=round(self.s.temperature()*1.8+32,2) -3.7 #+adjustment self.humidity=round(self.s.humidity()) def __init__(self): self.pi=pigp...
normal
{ "blob_id": "179b07870d656fb24b73d8b0a1f76ffed08aa5c2", "index": 9665, "step-1": "<mask token>\n\n\nclass MagicBoxDHT22(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MagicBoxDHT22(object):\n <mask token>\n\n def __init__(self):\n self.pi = pigpio.pi()\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for k, v in EXTRAS_REQUIRES.iteritems(): if k == 'test' or k == 'dev': continue EXTRAS_REQUIRES['test'] += v <|reserved_special_token_0|> with open(path) as fp: long_description = fp.read() setup(name='linkins'...
flexible
{ "blob_id": "f531af47431055866db72f6a7181580da461853d", "index": 6780, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k, v in EXTRAS_REQUIRES.iteritems():\n if k == 'test' or k == 'dev':\n continue\n EXTRAS_REQUIRES['test'] += v\n<mask token>\nwith open(path) as fp:\n long_description...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import print_function import os import sys from dkfileutils.path import Path def line_endings(fname): """Return all line endings in the file. """ _endings = {line[-2:] for line in open(fname, 'rb').readlines()} res = set() for e in _endings: if e.en...
normal
{ "blob_id": "be279fe44b0d52c9d473e08d8b9c28d5b6386b45", "index": 5184, "step-1": "<mask token>\n\n\ndef line_endings(fname):\n \"\"\"Return all line endings in the file.\n \"\"\"\n _endings = {line[-2:] for line in open(fname, 'rb').readlines()}\n res = set()\n for e in _endings:\n if e.end...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Tue Apr 27 10:34:15 2021 @author: Ivan 課程教材:行銷人轉職爬蟲王實戰|5大社群平台+2大電商 版權屬於「楊超霆」所有,若有疑問,可聯絡ivanyang0606@gmail.com 第一章 爬蟲基本訓練 Html爬蟲Post教學-台灣股市資訊網 """ import requests from bs4 import BeautifulSoup # 要抓取的網址 url = 'https://goodinfo.tw/StockInfo/StockDividendPolicy.asp?S...
normal
{ "blob_id": "a5918679b6e3a9bde54808264d9526c6a191578f", "index": 7737, "step-1": "<mask token>\n", "step-2": "<mask token>\nsoup.find('td', {'style': 'color:red'}).text\n", "step-3": "<mask token>\nurl = 'https://goodinfo.tw/StockInfo/StockDividendPolicy.asp?STOCK_ID=2002'\nheaders = {'User-Agent':\n 'Moz...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def send_email(mconn, mailto, mailfrom, mailsub, msgbody): msg = MIMEText(msgbody) msg['Subject'] = mailsub msg['To'] = mailto msg['From'] = mailfrom mconn.sendmail(mailfrom, mailto, msg.as_string()) mcon...
flexible
{ "blob_id": "ec604aea28dfb2909ac9e4b0f15e6b5bbe1c3446", "index": 2934, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef send_email(mconn, mailto, mailfrom, mailsub, msgbody):\n msg = MIMEText(msgbody)\n msg['Subject'] = mailsub\n msg['To'] = mailto\n msg['From'] = mailfrom\n mconn.se...
[ 0, 1, 2, 3 ]
class User: account = [] def __init__(self,balance,int_rate): self.balance = balance self.int_rate = int_rate User.account.append(self) def dep(self,amount): self.balance += amount return self def make_withdrawal(self,amount): if(self.balance-amount) >= 0...
normal
{ "blob_id": "ff3f6d50498f58f3a340e2d690165efcc1a5fb1d", "index": 6000, "step-1": "class User:\n <mask token>\n\n def __init__(self, balance, int_rate):\n self.balance = balance\n self.int_rate = int_rate\n User.account.append(self)\n\n def dep(self, amount):\n self.balance +=...
[ 8, 10, 11, 12, 13 ]
class Person: def __init__(self,mood): self.mood=mood; def laugh(self): self.mood.laugh() def cry(self): self.mood.cry() def setMood(self, mood): self.mood=mood class Mood: def laugh(self): pass def cry(self): pass class HappyMood(Mood): def laugh(self): print 'Ha ha ha!' class SadMood(Mood)...
normal
{ "blob_id": "4deb691545887104b3fb70dd2be52138088ba1e8", "index": 1751, "step-1": "class Person:\n\tdef __init__(self,mood):\n\t\tself.mood=mood;\n\n\tdef laugh(self):\n\t\tself.mood.laugh()\n\n\tdef cry(self):\n\t\tself.mood.cry()\n\t\n\tdef setMood(self, mood):\n\t\tself.mood=mood\n\nclass Mood:\n\tdef laugh(se...
[ 0 ]
"""Module to convert a lanelet UTM representation to OSM.""" __author__ = "Benjamin Orthen" __copyright__ = "TUM Cyber-Physical Systems Group" __credits__ = ["Priority Program SPP 1835 Cooperative Interacting Automobiles"] __version__ = "1.1.2" __maintainer__ = "Benjamin Orthen" __email__ = "commonroad-i06@in.tum.de" ...
normal
{ "blob_id": "472c8b0649e29c31b144607080938793e5f1293e", "index": 6834, "step-1": "<mask token>\n\n\nclass L2OSMConverter:\n <mask token>\n\n def __init__(self, proj_string):\n if proj_string:\n self.proj = Proj(proj_string)\n else:\n self.proj = Proj(DEFAULT_PROJ_STRING)...
[ 7, 8, 10, 16, 17 ]
# Game Tebak Angka from random import randint nyawa = 3 angka_rahasia = randint(0,10) limit = 0 print(f"Selamat datang di Game Tebak angka") while nyawa > limit: print(f"Percobaan anda tersisa {nyawa}") jawaban = int(input("Masukkan angka 0-10 = ")) if jawaban == angka_rahasia: ...
normal
{ "blob_id": "d4b01b015723950a4d8c3453d736cd64f306d27b", "index": 2940, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'Selamat datang di Game Tebak angka')\nwhile nyawa > limit:\n print(f'Percobaan anda tersisa {nyawa}')\n jawaban = int(input('Masukkan angka 0-10 = '))\n if jawaban == ang...
[ 0, 1, 2, 3, 4 ]
from collections import deque ''' Big O เวลาเรียก queue จะมี2operation 1deque 2enqueue เวลาเอาไปใช้ อยู่ที่การimplementation โปรแกรมที่ดี 1.ทำงานถูกต้อง 2.ทันใจ 3.ทรัพยากรที่ใช้รันได้ทุกเครื่อง(specคอมกาก) 4.ทำงานได้ตามต้องการ5.ความเสถียรของระบบ 6.Bugs แพง คือ memory expansive ใช้หน่วยความจำเยอะ runtime exp...
normal
{ "blob_id": "c96a64573fc6cc207ee09be4f4b183d065736ff6", "index": 5442, "step-1": "<mask token>\n\n\nclass Queue:\n\n def __init__(self):\n self.items = deque()\n\n def enQueue(self, i):\n self.items.append(i)\n\n def deQueue(self):\n return self.items.popleft()\n\n def isEmpty(se...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "98bc6e0552991d7de1cc29a02242b25e7919ef82", "index": 3764, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NetworkLookup: def __init__(self): self.loaded = 0 self.subnets = {} self.vpcs = {} def load(self): if self.loaded: return client = boto3.client('ec2') subnets_r = client.describe_subnets() subnets_list = ...
flexible
{ "blob_id": "767c0e6d956701fcedddb153b6c47f404dec535a", "index": 65, "step-1": "<mask token>\n\n\nclass NetworkLookup:\n\n def __init__(self):\n self.loaded = 0\n self.subnets = {}\n self.vpcs = {}\n\n def load(self):\n if self.loaded:\n return\n client = boto3...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(' Guess a number between 0 and 100') <|reserved_special_token_0|> while condition != 1: counter += 1 if condition == 0: last = middle elif condition == 2: start = middle middle = int((start + ...
flexible
{ "blob_id": "42d03aabef7d75c813f30bb6d8a835d76fd1fc83", "index": 603, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Guess a number between 0 and 100')\n<mask token>\nwhile condition != 1:\n counter += 1\n if condition == 0:\n last = middle\n elif condition == 2:\n start = ...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = "Sponge_sy" # Date: 2021/9/11 import numpy from tqdm import tqdm from bert4keras.tokenizers import Tokenizer from bert4keras.models import build_transformer_model from bert4keras.snippets import sequence_padding, DataGenerator from utils import * class d...
normal
{ "blob_id": "5cb390b06026bc0899c0b10dc93f3ec1f2ffefa6", "index": 9727, "step-1": "<mask token>\n\n\nclass data_generator(DataGenerator):\n <mask token>\n\n def __init__(self, pattern='', is_pre=True, *args, **kwargs):\n super(data_generator, self).__init__(*args, **kwargs)\n self.pattern = pa...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class MainViewNode(NodeBase): <|reserved_special_token_0|> def Label(self): return 'Main View' <|reserved_special_token_0|> class DockSectionNode(NodeBase): def __init__(self, label, icon, contents, settings): NodeBase.__init__(self, icon) self....
flexible
{ "blob_id": "f80de2b069cf1dee2e665556262c6e84ce04b208", "index": 1244, "step-1": "<mask token>\n\n\nclass MainViewNode(NodeBase):\n <mask token>\n\n def Label(self):\n return 'Main View'\n <mask token>\n\n\nclass DockSectionNode(NodeBase):\n\n def __init__(self, label, icon, contents, settings...
[ 15, 37, 38, 44, 48 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def findPaths(self, m, n, N, i, j): """ :type m: int :type n: int :type N: int :type i: int :...
flexible
{ "blob_id": "ebbc79d6582f7d6139e0dcec6333b679bb86c63c", "index": 1383, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def findPaths(self, m, n, N, i, j):\n \"\"\"\n :type m: int\n :type n: int\n :type ...
[ 0, 1, 2, 3 ]
#Create a 3x3 identity matrix import numpy as np vector = np.zeros((8,8)) vector[1::2,::2]=1 vector[::2,1::2]=1 print(vector) ''' Output [[0. 1. 0. 1. 0. 1. 0. 1.] [1. 0. 1. 0. 1. 0. 1. 0.] [0. 1. 0. 1. 0. 1. 0. 1.] [1. 0. 1. 0. 1. 0. 1. 0.] [0. 1. 0. 1. 0. 1. 0. 1.] [1. 0. 1. 0. 1. 0. 1. 0.] [0. 1. 0. 1. 0....
normal
{ "blob_id": "10d3ee459a296c26429659a202833a9570cf9454", "index": 9639, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(vector)\n<mask token>\n", "step-3": "<mask token>\nvector = np.zeros((8, 8))\nvector[1::2, ::2] = 1\nvector[::2, 1::2] = 1\nprint(vector)\n<mask token>\n", "step-4": "import num...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def extract(input_data: str) ->tuple: """take input data and return the appropriate data structure""" sheet = set() folds = list() s_instr, f_instr = input_data.split('\n\n') for line in s_instr.split('\n'): sheet.add(tuple(map(int, line.split(',')))) for l...
flexible
{ "blob_id": "bda28e5a0cb8a3dddea58c9c59a165b31274ac03", "index": 5225, "step-1": "<mask token>\n\n\ndef extract(input_data: str) ->tuple:\n \"\"\"take input data and return the appropriate data structure\"\"\"\n sheet = set()\n folds = list()\n s_instr, f_instr = input_data.split('\\n\\n')\n for l...
[ 5, 8, 10, 11, 12 ]
# Generated by Django 3.2.3 on 2021-06-19 11:27 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='BillDetail', ...
normal
{ "blob_id": "b7a8e4105f1c1c532eaae27afae14e9a4f2ddfba", "index": 2915, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NodeTests(unittest.TestCase): <|reserved_special_token_0|> def tearDown(self): pass <|reserved_special_token_0|> <|reserved_special_token_0|> def test_Add(self): x1 = core.Input(name='x1', shape=(2, 2)) x2 = core.Input(name='x2', shape=(...
flexible
{ "blob_id": "8e74bd0c051b672bf22c2c8dfb03760805b105c5", "index": 8799, "step-1": "<mask token>\n\n\nclass NodeTests(unittest.TestCase):\n <mask token>\n\n def tearDown(self):\n pass\n <mask token>\n <mask token>\n\n def test_Add(self):\n x1 = core.Input(name='x1', shape=(2, 2))\n ...
[ 19, 20, 23, 25, 34 ]
rate=69 dollar=int(input("enter an dollars to convert:")) inr=dollar*rate print('INR :Rs.',inr,'/-')
normal
{ "blob_id": "62018b32bf0c66fa7ec3cc0fcbdc16e28b4ef2d6", "index": 2396, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('INR :Rs.', inr, '/-')\n", "step-3": "rate = 69\ndollar = int(input('enter an dollars to convert:'))\ninr = dollar * rate\nprint('INR :Rs.', inr, '/-')\n", "step-4": "rate=69\nd...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class OptionsManager(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> logging.basicConfig(format=format, level=logging.INFO, datefmt='%H:%M:%S') logging.getLogger().setLevel(logging.DEBUG) ...
flexible
{ "blob_id": "92529c4d4c33a7473773f081f730e64bae4d7f54", "index": 5742, "step-1": "<mask token>\n\n\nclass OptionsManager(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n logging.basicConfig(format=format, level=logging.INFO, datefmt='%H:%M:%S')\n logging.getLogger().setLev...
[ 4, 6, 7, 9, 11 ]
import pygame import random from pygame.locals import * import pygame from pygame.locals import * class GameObject(pygame.sprite.Sprite): SIZE = 8 def __init__(self, x, y, surface): super(GameObject, self).__init__() self.x = x self.y = y self.surface = surface ...
normal
{ "blob_id": "c589ce4ba2ae60d14787a8939146f6140fff1f01", "index": 7914, "step-1": "<mask token>\n\n\nclass GameObject(pygame.sprite.Sprite):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass Food(gameobject.GameObject):\n\n def __init__(self, x, y, surface, ti...
[ 5, 7, 8, 10, 11 ]
# from mini_imagenet_dataloader import MiniImageNetDataLoader import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" import matplotlib.pyplot as plt import torch import torch.nn as nn from tqdm import tqdm import torch.nn.functional as F from torchmeta.utils.gradient_based import gradient_update_parameters from libs.model...
normal
{ "blob_id": "e2a50fbd277ab868fbe71f9ff113a68a30b9f893", "index": 2523, "step-1": "<mask token>\n\n\ndef ModelConvMiniImagenet(out_features, hidden_size=84):\n return MetaConvModel(3, out_features, hidden_size=hidden_size,\n feature_size=5 * 5 * hidden_size)\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 1, 2, 4, 5, 6 ]
# coding=utf-8 """ author: wlc function: 百科检索数据层 """ # 引入外部库 import json import re from bs4 import BeautifulSoup # 引入内部库 from src.util.reptile import * class EncyclopediaDao: @staticmethod def get_key_content (key: str) -> list: """ 获取指定关键字的百科内容检索内容 :param key: :return: """ # 1.参数设置 url = 'https://...
normal
{ "blob_id": "a7f348b258e1d6b02a79c60e4fe54b6d53801f70", "index": 3877, "step-1": "<mask token>\n\n\nclass EncyclopediaDao:\n <mask token>\n <mask token>\n\n @staticmethod\n def get_faq_content(query: str, page: str) ->list:\n \"\"\"\n\t\t获取指定query的faq检索内容\n\t\t:param query:\n\t\t:param page:\n...
[ 2, 3, 4, 5, 6 ]