code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from django.urls import path, re_path from .views import * app_name = 'articles' urlpatterns = [ path('',articles_list,name='list'), path('create', create_article, name='create'), path('<slug:slug>', article_detail,name='detail'), ]
normal
{ "blob_id": "1c222f42c5c0178f97391f1bdc60bba110f3d118", "index": 9866, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'articles'\nurlpatterns = [path('', articles_list, name='list'), path('create',\n create_article, name='create'), path('<slug:slug>', article_detail,\n name='detail')]\n"...
[ 0, 1, 2, 3 ]
import numpy as np from datetime import date, timedelta, datetime from pytz import timezone import store import psycopg2 import requests import os import filters FIRST = 4 def prepareDate(): pc_tz = timezone('US/Pacific') n = datetime.now(pc_tz) nd = n.date() store.updateStore(today=nd) def getData(): toda...
normal
{ "blob_id": "5b4651f37cdcbb13f8ddd03327ef65af0f9cf61d", "index": 1944, "step-1": "<mask token>\n\n\ndef getDates():\n dates = store.mapStore('dates')\n data = store.mapStore('data')\n exceptions = store.mapStore('exceptions')\n if len(exceptions) > 0:\n return False\n try:\n d0 = dat...
[ 3, 4, 6, 7, 8 ]
x, y = [float(x) for x in raw_input().split(" ")] print(x*y)
normal
{ "blob_id": "1ed7fb0dd5f0fa5e60c855eceaaf3259092918ef", "index": 1240, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x * y)\n", "step-3": "x, y = [float(x) for x in raw_input().split(' ')]\nprint(x * y)\n", "step-4": "x, y = [float(x) for x in raw_input().split(\" \")]\nprint(x*y)", "step-5"...
[ 0, 1, 2, 3 ]
from db_upgrader.Repositories.store import Store, StoreException from db_upgrader.Models.product import * class ProductStore(Store): table = 'product' def add_product(self, product): try: c = self.conn.cursor() c.execute( 'INSERT INTO product (`name`,customerId...
normal
{ "blob_id": "963499e071873083dc942486b9a5b094393cd99e", "index": 4458, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProductStore(Store):\n <mask token>\n\n def add_product(self, product):\n try:\n c = self.conn.cursor()\n c.execute(\n 'INSERT ...
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solve(): a = int(input()) b = int(input()) return math.sqrt(a * a + b * b) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solve(): a = int(input()) b = i...
flexible
{ "blob_id": "a22d38f7e8122d6339d1beab3bf08fa41c36d61d", "index": 9648, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solve():\n a = int(input())\n b = int(input())\n return math.sqrt(a * a + b * b)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef solve():\n a = int(input())\n...
[ 0, 1, 2, 3 ]
''' This module is used for handling the button. ''' import RPi.GPIO as GPIO from aiy.voicehat import * class Button: status = bool() #status indicates whether it is supposed to be on or off. LED_pin = 25 #Pin for the LED in the button in the Google AIY kit. button_pin = 23#...
normal
{ "blob_id": "878937e19d6a48a0d44309efbac1d41c208ce849", "index": 6195, "step-1": "<mask token>\n\n\nclass Button:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def read_button(self):\n self.status = GPIO.input(self.button_pin)\n\n def light(self, stat):\n if stat...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sns.catplot(x='romantic', y='absences', data=student_data, kind='point', hue='school', ci=None, estimator=median) plt.show() <|reserved_special_token_1|> import numpy as np from numpy import median sns.catplot(x='romantic',...
flexible
{ "blob_id": "11072601e31ceba13f8adf6c070f84ca5add35e9", "index": 3300, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.catplot(x='romantic', y='absences', data=student_data, kind='point',\n hue='school', ci=None, estimator=median)\nplt.show()\n", "step-3": "import numpy as np\nfrom numpy import m...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Bank: <|reserved_special_token_0|> def __init__(self): self.Bank_name = 'State Bank of India' self.ifsc = 'SBI0N00012' def __repr__(self): return f'Bank Name: {self.Bank_name}, IFSC_Code : {self.ifsc} ' class CustomerDetails(Bank): check_a...
flexible
{ "blob_id": "66ae7f4ee01ca5516d8e3dc447eeb4709e2b6aec", "index": 4615, "step-1": "<mask token>\n\n\nclass Bank:\n <mask token>\n\n def __init__(self):\n self.Bank_name = 'State Bank of India'\n self.ifsc = 'SBI0N00012'\n\n def __repr__(self):\n return f'Bank Name: {self.Bank_name}, ...
[ 9, 10, 13, 14, 15 ]
import json import math import rospy import sys import RPi.GPIO as GPIO from std_msgs.msg import Float32 from geometry_msgs.msg import Point32 from time import sleep #pulse width of difference rotations d_45 = 1.0 d_90 = 1.5 d_180 = 2.5 frequency = 50.0 t_per_cycle = (1.0 / frequency) * 1000.0 #convert to duty cycle...
normal
{ "blob_id": "95845aeb47e0d2c579739767ece35f4134564d98", "index": 7717, "step-1": "<mask token>\n\n\nclass Servo_node:\n\n def __init__(self):\n rospy.init_node('servo_node', anonymous=False)\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BCM)\n motor_x = 13\n motor_y = 12\n ...
[ 7, 8, 10, 11, 12 ]
# Given an array of integers, return indices of the two numbers such that they add up to a specific target. # You may assume that each input would have exactly one solution, and you may not use the same element twice. # Example: # Given nums = [2, 7, 11, 15], target = 9, # Because nums[0] + nums[1] = 2 + 7 = 9, # retu...
normal
{ "blob_id": "16cc85324b555f0cfec8d577b776b86872578822", "index": 6016, "step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution:\n\n def twoSum(self, nums, target):\n d = dict([(nums[i], i) for i in range(len(nums))])\n for n in range(len(nums)):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class BinarySearchTreeNode: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class BinarySearchTreeNode: def __init__(self, node_data): self.data = node_data self.left = None self.rig...
flexible
{ "blob_id": "3bdf3a48451b83347a6c9a9851b5b85b608f0b63", "index": 2826, "step-1": "<mask token>\n", "step-2": "class BinarySearchTreeNode:\n <mask token>\n\n\n<mask token>\n", "step-3": "class BinarySearchTreeNode:\n\n def __init__(self, node_data):\n self.data = node_data\n self.left = No...
[ 0, 1, 2, 3, 4 ]
# 選択肢が書き換えられないようにlistではなくtupleを使う chose_from_two = ('A', 'B', 'C') answer = [] answer.append('A') answer.append('C') print(chose_from_two) # ('A', 'B', 'C') print(answer) # ['A', 'C']
normal
{ "blob_id": "70b26052d9516fd067ff71074a6dc4c58ace7d80", "index": 5513, "step-1": "<mask token>\n", "step-2": "<mask token>\nanswer.append('A')\nanswer.append('C')\nprint(chose_from_two)\nprint(answer)\n", "step-3": "chose_from_two = 'A', 'B', 'C'\nanswer = []\nanswer.append('A')\nanswer.append('C')\nprint(ch...
[ 0, 1, 2, 3 ]
input = open('in.txt') output = open('out.py', 'w+') def opstr(op): if op == 'RSHIFT': return '>>' if op == 'LSHIFT': return '<<' if op == 'OR': return '|' if op == 'AND': return '&' if op == 'NOT': return '~' raise RuntimeError('Unknown {0}'.format(op)) def funstr(fun): return '{0}_fn'.f...
normal
{ "blob_id": "e68588dff0e54fa03dbb1c629c39d8312a0df26d", "index": 7230, "step-1": "<mask token>\n\n\ndef opstr(op):\n if op == 'RSHIFT':\n return '>>'\n if op == 'LSHIFT':\n return '<<'\n if op == 'OR':\n return '|'\n if op == 'AND':\n return '&'\n if op == 'NOT':\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TestTiming(TestCase): def test_decompose_ns(self): duration: int = 234 decomposition: List[Tuple[int, str]] = decompose(duration) expected_decomposition: List[Tuple[int, str]] = [(234, 'ns')] self.assertListEqual(expected_decomposition, decomposi...
flexible
{ "blob_id": "afecbb46a98fbf6b5c26f5b6c8026aec035fadf1", "index": 6696, "step-1": "<mask token>\n\n\nclass TestTiming(TestCase):\n\n def test_decompose_ns(self):\n duration: int = 234\n decomposition: List[Tuple[int, str]] = decompose(duration)\n expected_decomposition: List[Tuple[int, str...
[ 7, 11, 12, 16, 17 ]
<|reserved_special_token_0|> class ShanghaiTechPartA(Dataset): def __init__(self, root, shuffle=False, transform=None, downsample=1): self.root = root self.shuffle = shuffle self.transform = transform self.downsample = downsample self.image_names = [filename for filename i...
flexible
{ "blob_id": "8a0a98ab072e46463d80d8638c830e6db0032a77", "index": 8101, "step-1": "<mask token>\n\n\nclass ShanghaiTechPartA(Dataset):\n\n def __init__(self, root, shuffle=False, transform=None, downsample=1):\n self.root = root\n self.shuffle = shuffle\n self.transform = transform\n ...
[ 3, 4, 5, 6, 7 ]
""" Script: coverage.py Identifies domains that only occur in multi-domain proteins. The main script is master. -------------------- Felix A Kruger momo.sander@ebi.ac.uk """ #### #### import modules. #### import queryDevice import operator import yaml import time #### #### Load parameters. ####...
normal
{ "blob_id": "2467825d2cb01c86d3ba27562decc12551877af1", "index": 457, "step-1": "\"\"\"\n Script: coverage.py\n Identifies domains that only occur in multi-domain proteins. The main\n script is master.\n --------------------\n Felix A Kruger\n momo.sander@ebi.ac.uk\n\"\"\"\n####\n#### import m...
[ 0 ]
<|reserved_special_token_0|> def getIkbResult(search_str): ans_list = get_search_res('ikb', 'kb', search_str) for i in ans_list: i['kb_id'] = i.pop('id') return ans_list def get_search_res(index, doc_type, query): ans = {} search_dsl = '{"query":{"regexp":{"text":".*%s.*"}}}' % query ...
flexible
{ "blob_id": "70c78021a2544ea372545b037ed55298c26391d1", "index": 1182, "step-1": "<mask token>\n\n\ndef getIkbResult(search_str):\n ans_list = get_search_res('ikb', 'kb', search_str)\n for i in ans_list:\n i['kb_id'] = i.pop('id')\n return ans_list\n\n\ndef get_search_res(index, doc_type, query):...
[ 4, 5, 7, 8, 10 ]
import heapq from util import edit_distance def autocomplete(suggest_tree, bktree, prefix, count=5): """Suggest top completions for a prefix given a SuggestTree and BKTree. Completions for a given prefix are weighted primarily by their weight in the suggest tree, and secondarily by their Levenshtein...
normal
{ "blob_id": "24891cdefcd061f04e7b7768b1bde4e32b78adcc", "index": 8690, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef completion_proximity_score(prefix, completion):\n \"\"\"Calculate a score based on suffix length where a shorter length always\n yields a higher score.\"\"\"\n if prefix ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sb.set(style='ticks') <|reserved_special_token_0|> os.chdir( 'C://Users/pearseb/Dropbox/PhD/My articles/nitrogen-carbon cycles/data_for_publication' ) <|reserved_special_token_0|> lon_bnds[:, 0] += 360.0 <|reserved_special...
flexible
{ "blob_id": "635b02e03578d44f13530bd57ab1a99987d4909d", "index": 5987, "step-1": "<mask token>\n", "step-2": "<mask token>\nsb.set(style='ticks')\n<mask token>\nos.chdir(\n 'C://Users/pearseb/Dropbox/PhD/My articles/nitrogen-carbon cycles/data_for_publication'\n )\n<mask token>\nlon_bnds[:, 0] += 360.0\n...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- import json from datetime import datetime from math import ceil, floor from os.path import abspath, join, pardir from struct import pack from .global_settings import ( DEBUG, DEBUG_POLY_STOP, INPUT_JSON_FILE_NAME, INVALID_ZONE_ID, NR_BYTES_H, NR_BYTES_I, NR_SHORTCUTS_PER_LAT, NR_SHORTCUT...
normal
{ "blob_id": "52e43f795c864340734de2640e3c1a70b05e8ea0", "index": 7248, "step-1": "<mask token>\n\n\ndef x_shortcut(lng):\n return floor((lng + 180) * NR_SHORTCUTS_PER_LNG)\n\n\ndef y_shortcut(lat):\n return floor((90 - lat) * NR_SHORTCUTS_PER_LAT)\n\n\ndef big_zone(xmax, xmin, ymax, ymin):\n return (xma...
[ 11, 13, 15, 17, 22 ]
<|reserved_special_token_0|> def findIris(eyeMask, im, thresh): r = im[:, :, 2] _, binaryIm = cv2.threshold(r, thresh, 255, cv2.THRESH_BINARY_INV) kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (4, 4)) morph = cv2.dilate(binaryIm, kernel, 1) morph = cv2.merge((morph, morph, morph)) morp...
flexible
{ "blob_id": "65ff3b5137c94890c3293a2ae3f57dee1f60a54c", "index": 9097, "step-1": "<mask token>\n\n\ndef findIris(eyeMask, im, thresh):\n r = im[:, :, 2]\n _, binaryIm = cv2.threshold(r, thresh, 255, cv2.THRESH_BINARY_INV)\n kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (4, 4))\n morph = cv2.d...
[ 3, 6, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_attack(attack_config: Dict): if attack_config['attack_model'] == 'drift': return DriftAttack(attack_config=attack_config) elif attack_config['attack_model'] == 'additive_gaussian': return Additive...
flexible
{ "blob_id": "11320922d24b27c5cfa714f88eb0a757deef987f", "index": 8546, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_attack(attack_config: Dict):\n if attack_config['attack_model'] == 'drift':\n return DriftAttack(attack_config=attack_config)\n elif attack_config['attack_model']...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def which_lov(series: pd.Series, patterns: Sequence[Sequence[Any]], method: Optional[Union[Callable, str]]=None, **kwargs) ->np.ndarray: """Which list-of-values does every element of series match first? Warnings: ...
flexible
{ "blob_id": "7b9bf791d52fdc801e24d0c8541d77d91a488e12", "index": 3361, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef which_lov(series: pd.Series, patterns: Sequence[Sequence[Any]], method:\n Optional[Union[Callable, str]]=None, **kwargs) ->np.ndarray:\n \"\"\"Which list-of-values does ever...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_dev_key(): ads_dev_key_filename = os.path.abspath(os.path.expanduser('~/.ads/dev_key') ) if os.path.exists(ads_dev_key_filename): with open(ads_dev_key_filename, 'r') as fp: dev_key = fp.readline().rstrip() return dev_key dev_key = o...
flexible
{ "blob_id": "9e314cdf4ef09ecf4a4b43358ae32f76c40aaea8", "index": 8037, "step-1": "<mask token>\n\n\ndef get_dev_key():\n ads_dev_key_filename = os.path.abspath(os.path.expanduser('~/.ads/dev_key')\n )\n if os.path.exists(ads_dev_key_filename):\n with open(ads_dev_key_filename, 'r') as fp:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ProcessDisplay(commands.Cog): <|reserved_special_token_0|> <|reserved_special_token_0|> @commands.Cog.listener() async def on_ready(self): """ Ran when bot is starting up and ready Deletes messages from the bot in the TEXTCHANNEL star...
flexible
{ "blob_id": "8dfef0a4525328be8dfb4723f0a168dc22eb5eb2", "index": 520, "step-1": "<mask token>\n\n\nclass ProcessDisplay(commands.Cog):\n <mask token>\n <mask token>\n\n @commands.Cog.listener()\n async def on_ready(self):\n \"\"\"\n Ran when bot is starting up and ready\n Deletes...
[ 2, 4, 6, 9, 11 ]
<|reserved_special_token_0|> class CouponForm(forms.ModelForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def clean(self): cleaned_type = self.cleane...
flexible
{ "blob_id": "a0f83f0a2c6ddaa2fc641bd4fa48a6f50fd1d978", "index": 1755, "step-1": "<mask token>\n\n\nclass CouponForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def clean(self):\n cleaned_type = self.cleaned_data.get(...
[ 2, 3, 4, 5, 6 ]
# class User: # def __init__(self, name_parameter, email_parameter): # self.nameofPerson = name_parameter # self.emailofPerson = email_parameter # self.account_balance = 0 # def depositMoney(self, amount); # self.account_balance += amount # return self # def transfe...
normal
{ "blob_id": "c69dcffc06146af610a7976e522b6e35cabde1aa", "index": 3050, "step-1": "# class User:\n# def __init__(self, name_parameter, email_parameter):\n# self.nameofPerson = name_parameter\n# self.emailofPerson = email_parameter\n# self.account_balance = 0\n\n# def depositMoney(s...
[ 1 ]
<|reserved_special_token_0|> class RatesAdmin(admin.ModelAdmin): list_filter = ['c_code_id', 'upd_id'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CurrencyAdmin(admin.ModelAdmin): pass class UpdAdmin(admin.ModelAdmin): pass class RatesAdmin(admin...
flexible
{ "blob_id": "20ccdd319bfbbb4f17e8518eb60d125112c05d8e", "index": 6828, "step-1": "<mask token>\n\n\nclass RatesAdmin(admin.ModelAdmin):\n list_filter = ['c_code_id', 'upd_id']\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass CurrencyAdmin(admin.ModelAdmin):\n pass\n\n\nclass UpdAdmin(admin.ModelA...
[ 2, 4, 5, 6 ]
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QComboBox class ChoiceTargetNumbers(QWidget): """Виджет с выбором номеров целей""" def __init__(self, parent=None) -> None: QWidget.__init__(self, parent) # Нужные компоненты label = QLabel(text="Выберите номера целей:") ...
normal
{ "blob_id": "291cd789ac3ab7b794be8feafe0f608ad0c081d7", "index": 9674, "step-1": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n\n def __init__(self, parent=None) ->None:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_data(): class_list = [] with open('counts.tsv') as fd: for line in fd.read().splitlines(): class_data = line.split('\t') class_list.append(class_data) return class_list def get_fall_2016(): directory = get_data() fall_2016_...
flexible
{ "blob_id": "af8a3fbce35685cd89dee72449a8be2a133b4a3f", "index": 4684, "step-1": "<mask token>\n\n\ndef get_data():\n class_list = []\n with open('counts.tsv') as fd:\n for line in fd.read().splitlines():\n class_data = line.split('\\t')\n class_list.append(class_data)\n ...
[ 17, 19, 24, 26, 27 ]
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from sqlalchemy import create_engine, MetaData, Table class DoubanPipeline(object): conn = None film_table = None ...
normal
{ "blob_id": "5ef6b2ff89ee1667ddb01b1936557f1f11a49910", "index": 4673, "step-1": "# -*- coding: utf-8 -*-\n\n# Define your item pipelines here\n#\n# Don't forget to add your pipeline to the ITEM_PIPELINES setting\n# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html\nfrom sqlalchemy import create_eng...
[ 0 ]
<|reserved_special_token_0|> def __run_query(self, query): URL = 'https://api.github.com/graphql' request = requests.post(URL, json=query, auth=HTTPBasicAuth('gleisonbt', 'Aleister93')) if request.status_code == 200: return request.json() else: raise Exception('Query failed to ...
flexible
{ "blob_id": "fa511411e59880fd80fba0ccc49c95d42cb4b78d", "index": 6962, "step-1": "<mask token>\n\n\ndef __run_query(self, query):\n URL = 'https://api.github.com/graphql'\n request = requests.post(URL, json=query, auth=HTTPBasicAuth('gleisonbt',\n 'Aleister93'))\n if request.status_code == 200:\n...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python host, port = "localhost", 9999 import os import sys import signal import socket import time import select from SocketServer import TCPServer from SocketServer import StreamRequestHandler class TimeoutException(Exception): pass def read_command(rfile,wfile,prompt): def timeout_handler(signum...
normal
{ "blob_id": "e00b81f73f4f639e008fde1a6b2d4f7937df4207", "index": 8518, "step-1": "<mask token>\n\n\nclass TimeoutException(Exception):\n pass\n\n\n<mask token>\n\n\nclass Control(StreamRequestHandler):\n allow_reuse_address = True\n\n def handle(self):\n command = 'go'\n prompt = True\n ...
[ 6, 9, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> player_resource = PlayerResource() game_resource = GameResource() urlpatterns = [url('^$', views.index, name='index'), url('^api/', include( player_resource.urls)), url('^api/', include(game_resource.urls))] <|reserved_speci...
flexible
{ "blob_id": "ff959a388438a6d9c6d418e28c676ec3fd196ea0", "index": 6076, "step-1": "<mask token>\n", "step-2": "<mask token>\nplayer_resource = PlayerResource()\ngame_resource = GameResource()\nurlpatterns = [url('^$', views.index, name='index'), url('^api/', include(\n player_resource.urls)), url('^api/', in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def getAllMembersFromDB(**kwargs): """Finds and returns all the registered members""" isResponseParsed = kwargs.get('isParsed', False) logging.info('Trying to find all the users') try: rawMembersData = Member.objects() parsedMembers = [MemberInDBSchema(**me...
flexible
{ "blob_id": "95f9e9a8f681679f56c3755199fba7d654af85e8", "index": 1937, "step-1": "<mask token>\n\n\ndef getAllMembersFromDB(**kwargs):\n \"\"\"Finds and returns all the registered members\"\"\"\n isResponseParsed = kwargs.get('isParsed', False)\n logging.info('Trying to find all the users')\n try:\n ...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 2.2.16 on 2020-11-04 12:48 import ckeditor_uploader.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('course', '0002_auto_20201103_1648'), ] operations = [ migrations.AddField( model_name='course',...
normal
{ "blob_id": "afacc2c54584c070963c4cb3cabbae64bb0e3159", "index": 1858, "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 = [('course', '0...
[ 0, 1, 2, 3, 4 ]
import os from sqlalchemy import Column, ForeignKey, Integer, String, Float, Boolean, DateTime from sqlalchemy import and_, or_ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine, func from sqlalchemy.orm import sessionmaker, scoped_sess...
normal
{ "blob_id": "6db0adf25a7cc38c8965c07cc80bde0d82c75d56", "index": 3955, "step-1": "<mask token>\n\n\nclass UsageData(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def dt...
[ 9, 11, 12, 16, 21 ]
<|reserved_special_token_0|> def genAcc(): num = 1 y = [3, 0] while num <= 8: x = random.randint(0, 9) y.append(x) num = num + 1 accountNo = ''.join([str(i) for i in y]) return accountNo def transfer(tName, tNo, amount, tBankName): user[-1] = int(user[-1]) + amoun...
flexible
{ "blob_id": "a8106c8f14e15706b12e6d157b889288b85bc277", "index": 6789, "step-1": "<mask token>\n\n\ndef genAcc():\n num = 1\n y = [3, 0]\n while num <= 8:\n x = random.randint(0, 9)\n y.append(x)\n num = num + 1\n accountNo = ''.join([str(i) for i in y])\n return accountNo...
[ 7, 8, 9, 13, 15 ]
<|reserved_special_token_0|> class nearest(svm): <|reserved_special_token_0|> def __init__(self): svm.__init__(self) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class nearest(svm): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "7d1ca15129b1bf6b713e1d5eda4436d4a8539ad1", "index": 5939, "step-1": "<mask token>\n\n\nclass nearest(svm):\n <mask token>\n\n def __init__(self):\n svm.__init__(self)\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass nearest(svm):\n <mask token>\n\n def ...
[ 2, 3, 5, 6, 7 ]
# Generated by Django 2.2.1 on 2019-05-05 18:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.AlterField( model_name='divida', name='id_cliente', ...
normal
{ "blob_id": "1ce7b292f89fdf3f978c75d4cdf65b6991f71d6f", "index": 7499, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def init_setup(): cfg = get_cfg() cfg.merge_from_file(model_zoo.get_config_file( 'COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml')) cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url( 'COCO-InstanceSegmentatio...
flexible
{ "blob_id": "a18e98db417fe234e3d8d5d1321203fbac18751c", "index": 8174, "step-1": "<mask token>\n\n\ndef init_setup():\n cfg = get_cfg()\n cfg.merge_from_file(model_zoo.get_config_file(\n 'COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml'))\n cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5\n cf...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- """Module providing views for asset storage folder""" from Products.Five.browser import BrowserView from plone import api from plone.app.contenttypes.interfaces import IImage class AssetRepositoryView(BrowserView): """ Folderish content page default view """ def contained_items(self, u...
normal
{ "blob_id": "70c20b38edb01552a8c7531b3e87a9302ffaf6c5", "index": 5062, "step-1": "<mask token>\n\n\nclass AssetRepositoryView(BrowserView):\n <mask token>\n\n def contained_items(self, uid):\n stack = api.content.get(UID=uid)\n return stack.restrictedTraverse('@@folderListing')()\n\n def i...
[ 3, 4, 5, 6, 7 ]
import unittest from textwrap import dedent from simplesat import InstallRequirement, Repository from simplesat.test_utils import packages_from_definition from ..compute_dependencies import (compute_dependencies, compute_leaf_packages, compute_re...
normal
{ "blob_id": "fcf19c49bb161305eaa5ba8bc26e276a8e8db8ea", "index": 3925, "step-1": "<mask token>\n\n\nclass TestComputeReverseDependencies(unittest.TestCase):\n\n def setUp(self):\n repo_0 = Repository(packages_from_definition(PACKAGE_DEF_0))\n repo_1 = Repository(packages_from_definition(PACKAGE_...
[ 5, 12, 13, 14, 18 ]
<|reserved_special_token_0|> def follow(request): action = request.POST.get('action') followed_user_id = request.POST.get('followedUserId') followed_user = User.objects.get(id=followed_user_id) if followed_user == request.user: return JsonResponse({}) if request.user.is_authenticated(): ...
flexible
{ "blob_id": "0b4f070d30642449536118accffa371a89dd3075", "index": 8857, "step-1": "<mask token>\n\n\ndef follow(request):\n action = request.POST.get('action')\n followed_user_id = request.POST.get('followedUserId')\n followed_user = User.objects.get(id=followed_user_id)\n if followed_user == request....
[ 6, 9, 11, 12, 16 ]
import numpy as np import yaml import pickle import os from flask import Flask, request, jsonify, render_template, redirect, url_for, flash from flask_mail import Mail, Message from flask_wtf import FlaskForm from flask_sqlalchemy import SQLAlchemy from flask_bootstrap import Bootstrap from wtforms import StringField,...
normal
{ "blob_id": "f6a3693fe81e629d987067265bf4e410bf260bcf", "index": 1663, "step-1": "<mask token>\n\n\nclass User(UserMixin, db.Model):\n id = db.Column(db.Integer, primary_key=True)\n username = db.Column(db.String(15), unique=True)\n email = db.Column(db.String(50), unique=True)\n password = db.Column...
[ 25, 26, 28, 36, 39 ]
<|reserved_special_token_0|> def upload(client, fnames): for im in fnames: im = Path(im) client.file(ORIGINAL_DATA_DIR + str(im.name)).put(im.read_bytes()) <|reserved_special_token_0|> def style_transfer(fnames, out_folder, filter_name): client = Algorithmia.client(API_KEY) client.dir(...
flexible
{ "blob_id": "2536b22c2d154e87bdecb72cc967d8c56ddb73fb", "index": 609, "step-1": "<mask token>\n\n\ndef upload(client, fnames):\n for im in fnames:\n im = Path(im)\n client.file(ORIGINAL_DATA_DIR + str(im.name)).put(im.read_bytes())\n\n\n<mask token>\n\n\ndef style_transfer(fnames, out_folder, fi...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python from __future__ import print_function from __future__ import division from __future__ import absolute_import # Workaround for segmentation fault for some versions when ndimage is imported after tensorflow. import scipy.ndimage as nd import argparse import numpy as np from pybh import tensorpack...
normal
{ "blob_id": "a283fd1e4098ea8bb3cc3580438c90e5932ba22f", "index": 5852, "step-1": "<mask token>\n\n\ndef dict_from_dataflow_generator(df):\n for sample in df.get_data():\n yield sample[0]\n\n\ndef split_lmdb_dataset(lmdb_input_path, lmdb_output_path1,\n lmdb_output_path2, split_ratio1, batch_size, sh...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): imgpath1 = 'C:\\Shreyas\\OpenCv\\DIP_OpenCV\\lena.png' imgpath2 = 'C:\\Shreyas\\OpenCv\\DIP_OpenCV\\lena.png' img1 = cv2.imread(imgpath1, 1) img2 = cv2.imread(imgpath2, 1) titles = ['Pepper Gray',...
flexible
{ "blob_id": "2867a7b24b4911b2936cb34653fa57431c14d6a3", "index": 7319, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n imgpath1 = 'C:\\\\Shreyas\\\\OpenCv\\\\DIP_OpenCV\\\\lena.png'\n imgpath2 = 'C:\\\\Shreyas\\\\OpenCv\\\\DIP_OpenCV\\\\lena.png'\n img1 = cv2.imread(imgpath1, 1)...
[ 0, 1, 2, 3, 4 ]
from django.core.mail import send_mail from django.template.loader import render_to_string from django.utils.html import strip_tags from datetime import datetime, timedelta def sendmail(subject, template, to, context): template_str = 'app/' + template + '.html' html_msg = render_to_string(template_str, {'data...
normal
{ "blob_id": "0349a8a4841b024afd77d20ae18810645fad41cd", "index": 4883, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sendmail(subject, template, to, context):\n template_str = 'app/' + template + '.html'\n html_msg = render_to_string(template_str, {'data': context})\n plain_msg = strip_...
[ 0, 1, 2 ]
from django.db.models import Sum, Count from django.db.models.functions import Coalesce from django.utils.timezone import localtime from .models import Quote, Vote import pygal from pygal.style import Style style = Style( background='transparent', plot_background='transparent', foreground='#3d3d3d', foreground_s...
normal
{ "blob_id": "6f6f57ff317d7e3c6e6ae4d450c6fdf0e22eb4eb", "index": 7256, "step-1": "<mask token>\n\n\nclass QuotesByMonth:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass QuotesByRating:\n\n def __init__(self):\n self.chart = pygal.Histogram(title='Quotes by Rating', margin=20,\n ...
[ 9, 16, 20, 21, 23 ]
# Generated by Django 3.1.7 on 2021-04-16 14:03 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='AuditLog', fields=[ ('id', models.AutoField...
normal
{ "blob_id": "d65d85b4573728ed32ccf987459d5a228e2a8897", "index": 5196, "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|> def convert_mass_to_concentration(fluidStream, component): total_mass = fluidStream.TotalMass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def convert_mass_to_concentration(fluidStream, component): total_mass = fluidStream.TotalMass...
flexible
{ "blob_id": "3471f02f507104202c1e49440172f120ba17730f", "index": 9263, "step-1": "<mask token>\n\n\ndef convert_mass_to_concentration(fluidStream, component):\n total_mass = fluidStream.TotalMass\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef convert_mass_to_concentration(fluidStream, component):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class UserForm(forms.ModelForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = User fields = 'first_name', 'last_name', 'email' <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "5215b5e4efe2e126f18b3c4457dc3e3902923d49", "index": 6360, "step-1": "<mask token>\n\n\nclass UserForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'first_name', 'last_name', 'email'\n <mask token>\n <mask t...
[ 10, 11, 15, 16, 17 ]
import pymysql class DB: def __init__(self, host='localhost', port=3306, db_='test', user='wj', passwd='', charset='utf8'): self.db = db_ self.conn = pymysql.connect(host=host, port=port, db=db_, user=user, passwd=passwd, charset=charset) self.cur = self.conn.curso...
normal
{ "blob_id": "80ad4459436e2e1cc44509e7dae18d1539bf2bc0", "index": 8139, "step-1": "<mask token>\n\n\nclass DB:\n <mask token>\n\n def __enter__(self):\n return self\n <mask token>\n\n def write(self, data):\n sql = \"INSERT INTO {}({}) VALUES ('%s')\".format('data', 'a') % data\n ...
[ 4, 6, 7, 8, 9 ]
# Generated by Django 2.2.15 on 2020-09-16 03:20 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.db.models.fields class Migration(migrations.Migration): dependencies = [ ('api', '0005_cashiershift_couriershift_couriershiftexpenses_...
normal
{ "blob_id": "1c979d505b58025aae74865d6556c726ed3f0769", "index": 2651, "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 = [('api',\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3.7 import Adafruit_GPIO import Adafruit_GPIO.I2C as I2C import time import sys import argparse import os argparser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Select I2C channel multiplexed by TCA9548A") argparser.add_argument...
normal
{ "blob_id": "46aa795bb72db0fcd588b1747e3559b8828be17c", "index": 6927, "step-1": "<mask token>\n", "step-2": "<mask token>\nargparser.add_argument('ch', nargs='?', help='channel', type=int)\n<mask token>\nif args.ch is None:\n for channel in range(0, 8):\n print(f'== CHANNEL {channel} ==')\n T...
[ 0, 1, 2, 3, 4 ]
from pointsEau.models import PointEau from django.contrib.auth.models import User from rest_framework import serializers class PointEauSerializer(serializers.ModelSerializer): class Meta: model = PointEau fields = [ 'pk', 'nom', 'lat', 'long', ...
normal
{ "blob_id": "51f171b3847b3dbf5657625fdf3b7fe771e0e004", "index": 4743, "step-1": "<mask token>\n\n\nclass UserSerializer(serializers.ModelSerializer):\n pointseau = serializers.PrimaryKeyRelatedField(many=True, queryset=\n PointEau.objects.all())\n\n\n class Meta:\n model = User\n fiel...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> @app.route('/') def index(): list = [] creds = config.get_ec2_conf() for region in config.region_list(): conn = connect_to_region(region, aws_access_key_id=creds[ 'AWS_ACCESS_KEY_ID'], aws_secret_access_key=creds[ 'AWS_SECRET_ACCESS_KEY']) ...
flexible
{ "blob_id": "22c2425f1dc14b6b0005ebf2231af8abf43aa2e1", "index": 5273, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n list = []\n creds = config.get_ec2_conf()\n for region in config.region_list():\n conn = connect_to_region(region, aws_access_key_id=creds[\n 'AWS_ACCESS_...
[ 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: SECRET_KEY except NameError: SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt') try: SECRET_KEY = open(SECRET_FILE).read().strip() except IOError: try: from random import choice ...
flexible
{ "blob_id": "32ca107fde4c98b61d85f6648f30c7601b31c7f3", "index": 3182, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n SECRET_KEY\nexcept NameError:\n SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')\n try:\n SECRET_KEY = open(SECRET_FILE).read().strip()\n except IOError:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(number) <|reserved_special_token_0|> print(c) <|reserved_special_token_0|> print(word1, ' ' + word2, ' ' + word3) <|reserved_special_token_0|> print(word[:4]) <|reserved_special_token_1|> number = (30 * 39 + 300) ** 10 pr...
flexible
{ "blob_id": "c2f82cf73d095979d1da346b7dd7779bcc675805", "index": 4045, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(number)\n<mask token>\nprint(c)\n<mask token>\nprint(word1, ' ' + word2, ' ' + word3)\n<mask token>\nprint(word[:4])\n", "step-3": "number = (30 * 39 + 300) ** 10\nprint(number)\n...
[ 0, 1, 2, 3 ]
import dataset import json import gc import os jsonDir = "/home/jr/share/python/music-visualizer/merged" db = dataset.connect('sqlite:///test.db') table = db['Songs'] for root, subFolders, files in os.walk(jsonDir): for f in files: print("file:{}".format(f)) gc.collect() tmpJson = json.lo...
normal
{ "blob_id": "3461e9dceb2c0bfc49002809154f8be4cd8c66e2", "index": 1483, "step-1": "import dataset\nimport json\nimport gc\nimport os\n\njsonDir = \"/home/jr/share/python/music-visualizer/merged\"\n\ndb = dataset.connect('sqlite:///test.db')\ntable = db['Songs']\n\nfor root, subFolders, files in os.walk(jsonDir):\...
[ 0 ]
from .score_funcs import * from cryptonita.fuzzy_set import FuzzySet from cryptonita.helpers import are_bytes_or_fail def scoring(msg, space, score_func, min_score=0.5, **score_func_params): ''' Run the score function over the given message and over a parametric value x. Return all the values x as a Fuzz...
normal
{ "blob_id": "99048ddb3f42382c8b8b435d832a45011a031cf1", "index": 8537, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef scoring(msg, space, score_func, min_score=0.5, **score_func_params):\n \"\"\" Run the score function over the given message and over a parametric\n value x. Return all t...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Wed Dec 19 09:41:08 2018 hexatrigesimal to decimal calculator, base 36 encoding; use of letters with digits. @author: susan """ ## create a dictionary as reference for BASE 36 calculations WORD = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" # digits of BASE 36 BASE = {} for i,...
normal
{ "blob_id": "5a265ecb9f1d6d0e4a5c66d241fbfe4a6df97825", "index": 8191, "step-1": "<mask token>\n\n\ndef enter_num():\n \"\"\" get user input and do error checking for illegal digits.\n returns\n -------\n num\n \"\"\"\n num = input('please enter a BASE 36 number, e.g. A36Z :> ')\n num = num....
[ 2, 4, 5, 6, 7 ]
from django.urls import path,include from.import views from user.views import DetailsChangeView, HomeView, PasswordChangeView,SignUpView,LoginView,SettingsView,LogoutView,CreatePostView,CommentPostView,PasswordChangeView urlpatterns = [ path('', HomeView.as_view(), name = 'HomeView'), path('LoginView/', LoginV...
normal
{ "blob_id": "5bd8cee2595215fda6ab523a646cf918e3d84a50", "index": 937, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', HomeView.as_view(), name='HomeView'), path(\n 'LoginView/', LoginView.as_view(), name='LoginView'), path(\n 'SignUpView/', SignUpView.as_view(), name='SignUpV...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(id(x)) print(id(y)) print() <|reserved_special_token_0|> print(id(x)) print(id(y)) print() <|reserved_special_token_0|> print(z) print(w) print(id(z)) print(id(w)) print() <|reserved_special_token_0|> print(z) print(w) print...
flexible
{ "blob_id": "956adc5961188458393b56564649ad0a3a787669", "index": 7327, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(id(x))\nprint(id(y))\nprint()\n<mask token>\nprint(id(x))\nprint(id(y))\nprint()\n<mask token>\nprint(z)\nprint(w)\nprint(id(z))\nprint(id(w))\nprint()\n<mask token>\nprint(z)\nprin...
[ 0, 1, 2, 3 ]
import sys import smtplib from email.mime.text import MIMEText from email.utils import formatdate from ... import config def create_message(from_addr, to_addr, subject, message, encoding): body = MIMEText(message, 'plain', encoding) body['Subject'] = subject body['From'] = from_addr body['To'] = to_add...
normal
{ "blob_id": "237724db5130926123a3a31be7070947ec7b01f3", "index": 3492, "step-1": "<mask token>\n\n\ndef create_message(from_addr, to_addr, subject, message, encoding):\n body = MIMEText(message, 'plain', encoding)\n body['Subject'] = subject\n body['From'] = from_addr\n body['To'] = to_addr\n body...
[ 2, 3, 4, 5, 6 ]
# KeyLogger.py # show a character key when pressed without using Enter key # hide the Tkinter GUI window, only console shows import Tkinter as tk def key(event): if event.keysym == 'Escape': root.destroy() print event.char, event.keysym root = tk.Tk() print "Press a key (Escape key to exit):" root.bi...
normal
{ "blob_id": "368151a134f987ed78c8048521137672530b5cce", "index": 1022, "step-1": "# KeyLogger.py\n# show a character key when pressed without using Enter key\n# hide the Tkinter GUI window, only console shows\n\nimport Tkinter as tk\n\ndef key(event):\n if event.keysym == 'Escape':\n root.destroy()\n ...
[ 0 ]
<|reserved_special_token_0|> class DevConfig(Config): <|reserved_special_token_0|> ENV = 'dev' DEBUG = True class TestConfig(Config): """Test configuration.""" TESTING = True DEBUG = True <|reserved_special_token_1|> <|reserved_special_token_0|> class ProdConfig(Config): """Producti...
flexible
{ "blob_id": "4cc1c8668a84cc6faadf60053568d155b8852c5f", "index": 5643, "step-1": "<mask token>\n\n\nclass DevConfig(Config):\n <mask token>\n ENV = 'dev'\n DEBUG = True\n\n\nclass TestConfig(Config):\n \"\"\"Test configuration.\"\"\"\n TESTING = True\n DEBUG = True\n", "step-2": "<mask token>...
[ 5, 9, 11, 13, 14 ]
# Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
normal
{ "blob_id": "21cfe1ca606d18763fbfb8ff6862c382b3321adc", "index": 8511, "step-1": "<mask token>\n\n\ndef firmware_pack_create(handle, org_name, name, rack_bundle_version,\n blade_bundle_version, descr='', mode='staged', org_parent='org-root'):\n \"\"\"\n This method creates Host Firmware pack.\n\n Arg...
[ 2, 3, 4, 5, 6 ]
import pandas def ludwig_get_model_definition(df: 'Dataframe', target: str, features: list): input_features, output_features = [], [] for p in features: if (pandas.api.types.is_numeric_dtype(df[p])): input_features.append({'name': p, 'type': 'numerical', 'preprocessing'...
normal
{ "blob_id": "b7521a604fb49591df814d469f53d35574126fdb", "index": 7609, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ludwig_get_model_definition(df: 'Dataframe', target: str, features: list):\n input_features, output_features = [], []\n for p in features:\n if pandas.api.types.is_nu...
[ 0, 1, 2, 3 ]
a, b, c = map(int, input().split()) frag = 'NO' for i in range(b - 1): if (i + 1) * a % b == c: frag = 'YES' break print(frag)
normal
{ "blob_id": "6ad36f2b115c822a50a38e88a8d7d524fc5b045b", "index": 195, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(b - 1):\n if (i + 1) * a % b == c:\n frag = 'YES'\n break\nprint(frag)\n", "step-3": "a, b, c = map(int, input().split())\nfrag = 'NO'\nfor i in range(b -...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class RuyConan(ConanFile): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|...
flexible
{ "blob_id": "fe1c499efe492dbd4f5c9b99bd6339c503c7902b", "index": 5766, "step-1": "<mask token>\n\n\nclass RuyConan(ConanFile):\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>\n <...
[ 4, 12, 14, 15, 17 ]
<|reserved_special_token_0|> def heapify(array, size, ind): largest = ind left = 2 * ind + 1 right = 2 * ind + 2 if left < size and array[left] > array[largest]: largest = left if right < size and array[right] > array[largest]: largest = right if largest != ind: array[i...
flexible
{ "blob_id": "fbcbad9f64c0f9b68e29afde01f3a4fdba012e10", "index": 4868, "step-1": "<mask token>\n\n\ndef heapify(array, size, ind):\n largest = ind\n left = 2 * ind + 1\n right = 2 * ind + 2\n if left < size and array[left] > array[largest]:\n largest = left\n if right < size and array[right...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .facebook import *
flexible
{ "blob_id": "7901a2bd4ae1070c8263d3cd97351b01ffbf7bb1", "index": 7246, "step-1": "<mask token>\n", "step-2": "from .facebook import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def is_list_equal(a, b): if a == b: print('CORRECT answer! :) ') time.sleep(2) print('See you next time !') time.sleep(3) return True else: print('This is a WRONG answer !') time.sleep(2) print('See you next time ! :)...
flexible
{ "blob_id": "bff9fb50f1901094c9ab3d61566509835c774f21", "index": 6776, "step-1": "<mask token>\n\n\ndef is_list_equal(a, b):\n if a == b:\n print('CORRECT answer! :) ')\n time.sleep(2)\n print('See you next time !')\n time.sleep(3)\n return True\n else:\n print('Th...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getData(request): index = request.GET.get('index') msg = '未查找到数据' if ExtExecute.objects.filter(query_code=index): ext = ExtExecute.objects.filter(query_code=index).first() result = getpicture(ext....
flexible
{ "blob_id": "e32c73abdcd384ee7c369182527cca6495f067b3", "index": 1977, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getData(request):\n index = request.GET.get('index')\n msg = '未查找到数据'\n if ExtExecute.objects.filter(query_code=index):\n ext = ExtExecute.objects.filter(query_cod...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python2 import unittest import luna_utils as luna import time API_URL = "com.webos.service.videooutput/" VERBOSE_LOG = True SUPPORT_REGISTER = False SINK_MAIN = "MAIN" SINK_SUB = "SUB0" #TODO(ekwang): If you connect SUB, HAL error occurs. Just test MAIN in the current state #SINK_LIST = [SINK_MAIN, SINK_...
normal
{ "blob_id": "27e66b2a03bc626d5babd804e736a4652ba030d5", "index": 8624, "step-1": "<mask token>\n\n\nclass TestVideoMethods(luna.TestBase):\n\n def vlog(self, message):\n if VERBOSE_LOG:\n print(message)\n\n def setUp(self):\n self.vlog('setUp')\n if SUPPORT_REGISTER:\n ...
[ 11, 14, 15, 17, 18 ]
#!/usr/bin/env python import unittest from pyspark import SparkConf, SparkContext from mmtfPyspark.io.mmtfReader import download_mmtf_files from mmtfPyspark.datasets import secondaryStructureExtractor from mmtfPyspark.filters import ContainsLProteinChain from mmtfPyspark.mappers import StructureToPolymerChains class...
normal
{ "blob_id": "480e6ae9eee70b2da58ca5624a43d8f5dcae1d33", "index": 1207, "step-1": "<mask token>\n\n\nclass SecondaryStructureExtractorTest(unittest.TestCase):\n <mask token>\n\n def test1(self):\n pdb = self.pdb.filter(ContainsLProteinChain()).flatMap(\n StructureToPolymerChains()).filter(...
[ 3, 4, 5, 6, 7 ]
from floppy.node import Node, Input, Output, Tag, abstractNode @abstractNode class StringNode(Node): Tag('StringOperations') class StringAppend(StringNode): """ Creates a new node which combines two strings. These can be seperated by a delimiter. :param nodeClass: subclass object of 'Node'. :ret...
normal
{ "blob_id": "1bb151171bbbb899456324056be3634e87b5c8fb", "index": 3494, "step-1": "<mask token>\n\n\nclass StringAppend(StringNode):\n <mask token>\n Input('First', str)\n Input('Second', str)\n Input('Delimiter', str, optional=True, default='')\n Output('Joined', str)\n <mask token>\n\n\nclass ...
[ 4, 5, 6, 8 ]
import urllib, json from PyQt4.QtCore import QRectF, Qt from PyQt4.Qt import QPrinter, QPainter, QFont, QBrush, QColor, QPen, QImage from PyQt4.QtGui import QApplication # bkgimg = QImage() # bkgimg.load("KosyMost.jpg", format = "jpg") # # print bkgimg # exit() def background(painter, bkgimg): maxx = painter.d...
normal
{ "blob_id": "47587cce572807922344523d8c5fefb09552fe34", "index": 8638, "step-1": "import urllib, json\nfrom PyQt4.QtCore import QRectF, Qt\nfrom PyQt4.Qt import QPrinter, QPainter, QFont, QBrush, QColor, QPen, QImage\nfrom PyQt4.QtGui import QApplication\n\n\n# bkgimg = QImage()\n# bkgimg.load(\"KosyMost.jpg\", ...
[ 0 ]
<|reserved_special_token_0|> class TestExtractTrialData(unittest.TestCase): def setUp(self): self.main_path = Path(__file__).parent self.training_lt5 = {'path': self.main_path / 'data' / 'session_training_lt5'} self.biased_lt5 = {'path': self.main_path / 'data' / '...
flexible
{ "blob_id": "f17d33f1d035da42dc9a2b4c0c60beefc6a48dea", "index": 64, "step-1": "<mask token>\n\n\nclass TestExtractTrialData(unittest.TestCase):\n\n def setUp(self):\n self.main_path = Path(__file__).parent\n self.training_lt5 = {'path': self.main_path / 'data' /\n 'session_training_l...
[ 27, 34, 37, 45, 49 ]
# question 1d # points: 6 import sys import numpy as np from astropy.stats import kuiper import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import handin2 as nur def main(): seed = 8912312 np.random.seed(8912312) u = 0 sigma = 1 cdf = nur.gaussian_cdf num_samples = np.lo...
normal
{ "blob_id": "0158141832423b567f252e38640e384cdf340f8b", "index": 7105, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n seed = 8912312\n np.random.seed(8912312)\n u = 0\n sigma = 1\n cdf = nur.gaussian_cdf\n num_samples = np.logspace(1, 5, num=50)\n sample_size = int(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestNestedDict(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_dfood(self): self.assertEqual(self.dfood.keys(), [u'0001', u'0002', u'0003']) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_s...
flexible
{ "blob_id": "f9a255a464b5f48a1a8be2e2887db721a92e7f4e", "index": 1474, "step-1": "<mask token>\n\n\nclass TestNestedDict(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_dfood(self):\n self.assertEqual(self.dfood.keys(), [u'0001', u'0002', u'0003'])\n <mask token>\n <mask toke...
[ 3, 6, 8, 10, 12 ]
<|reserved_special_token_0|> class GpTestCase(unittest.TestCase): def __init__(self, methodName='runTest'): super(GpTestCase, self).__init__(methodName) self.patches = [] self.mock_objs = [] def apply_patches(self, patches): if self.patches: raise Exception('Test ...
flexible
{ "blob_id": "e9c88e18472281438783d29648c673aa08366abb", "index": 1686, "step-1": "<mask token>\n\n\nclass GpTestCase(unittest.TestCase):\n\n def __init__(self, methodName='runTest'):\n super(GpTestCase, self).__init__(methodName)\n self.patches = []\n self.mock_objs = []\n\n def apply_...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_register_new_accont(self): cos = self.cos cos.get('https://wizzair.com/pl-pl#/') cos.find_elements_by_class_name( 'navigation__button navigation__button--simple').click() cos.find_elements_by_cla...
flexible
{ "blob_id": "6efd22feb4f96de74633276b1ec8550f8d853075", "index": 2657, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_register_new_accont(self):\n cos = self.cos\n cos.get('https://wizzair.com/pl-pl#/')\n cos.find_elements_by_class_name(\n 'navigation__button navigation__butt...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def click(x, y): win32api.SetCursorPos((x, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) time.sleep(0.01) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0) <|reserved_special_token_0|> <...
flexible
{ "blob_id": "9f831b8c90dd428879319b63712bd03fcc01b631", "index": 8212, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef click(x, y):\n win32api.SetCursorPos((x, y))\n win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)\n time.sleep(0.01)\n win32api.mouse_event(win32con.MOUSEEVENTF...
[ 0, 1, 2, 3, 4 ]
from bbdd import * def usuario(): global usser usser=input("Introduce un usuario : ") if len(usser)<5 or len(usser)>15: print("El usuario debe tener entre 5 y 15 caracteres") usuario() elif usser.isalnum()==False: print("Los valores del usurio deben ser únicamente letras o números") usuario() ...
normal
{ "blob_id": "ce75c23c6b0862dde797225f53c900b4ebc56428", "index": 514, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef usuario():\n global usser\n usser = input('Introduce un usuario : ')\n if len(usser) < 5 or len(usser) > 15:\n print('El usuario debe tener entre 5 y 15 caracteres'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run_test(file_name, capture_stdout=True, allure_dir=None): cmd = [file_name, '-vvv'] if capture_stdout: cmd.append('-s') test_name = os.path.splitext(os.path.basename(file_name))[0] alluredir = os.pat...
flexible
{ "blob_id": "7e7a50cb8e66a71c1df2d61241f8a55c042b7d59", "index": 2664, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_test(file_name, capture_stdout=True, allure_dir=None):\n cmd = [file_name, '-vvv']\n if capture_stdout:\n cmd.append('-s')\n test_name = os.path.splitext(os.pa...
[ 0, 1, 2, 3 ]
#2) write a program to make banking system develop business logic #in one module and call functionality in another .py file class Customer: #user defined class def __init__(self,name,phoneno,address,pin,accno,balance) : #constructor with multiple arguments self._name=name self._pno=phoneno ...
normal
{ "blob_id": "cf5a9b8dad5a02610fa5ce2a849b6f9fc50a0aa8", "index": 1872, "step-1": "class Customer:\n\n def __init__(self, name, phoneno, address, pin, accno, balance):\n self._name = name\n self._pno = phoneno\n self._add = address\n self._pin = pin\n self._acc = accno\n ...
[ 5, 6, 7, 8, 9 ]
my_dict = {'one': '1', 'two': '2'} for key in my_dict: print('{} - {}'.format(key, my_dict[key]))
normal
{ "blob_id": "1d524312cbd3b735850046131f31c03fdfa90bbc", "index": 483, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))\n", "step-3": "my_dict = {'one': '1', 'two': '2'}\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))...
[ 0, 1, 2 ]
#!/usr/bin/env python # KMeans # 参考 https://qiita.com/g-k/items/0d5d22a12a4507ecbf11 # # データを適当なクラスタに分けた後、クラスタの平均を用いてうまい具合にデータがわかれるように調整させていくアルゴリズム # 任意の指定のk個のクラスタを作成するアルゴリズムであることから、k-means法(k点平均法と呼ばれている) # k-meansの初期値選択の弱点を解消したのが、k-means++ # k-means++では、中心点が互いに遠いところに配置されるような確率が高くなるように操作する。 # 教師なし学習のアルゴ...
normal
{ "blob_id": "10bf7959f178d3b5c0ce6e97253e665d32363af7", "index": 6015, "step-1": "<mask token>\n\n\ndef kmeansplus(X, K, n_iter):\n n = X.shape[0]\n idx = np.zeros(X.shape[0])\n distance = np.zeros(n * K).reshape(n, K)\n centers = np.zeros(X.shape[1] * K).reshape(K, -1)\n pr = np.repeat(1 / n, n)\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> hiddenimports = ['sklearn.utils.sparsetools._graph_validation', 'sklearn.utils.sparsetools._graph_tools', 'sklearn.utils.lgamma', 'sklearn.utils.weight_vector'] datas = collect_data_files('sklearn') <|reserved_special_to...
flexible
{ "blob_id": "12396130dc52866cc54d6dc701cf0f9a41a168b6", "index": 8351, "step-1": "<mask token>\n", "step-2": "<mask token>\nhiddenimports = ['sklearn.utils.sparsetools._graph_validation',\n 'sklearn.utils.sparsetools._graph_tools', 'sklearn.utils.lgamma',\n 'sklearn.utils.weight_vector']\ndatas = collect...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if x == 'Y' or x == 'N' or x == 'Q': while x == 'Y' or x == 'N' or x == 'Q': if x == 'Q': print('Exiting the Program') import sys sys.exit() elif x == 'N': print(...
flexible
{ "blob_id": "7dff15a16ecc3ce3952f4b47290393ea3183807f", "index": 4414, "step-1": "<mask token>\n", "step-2": "<mask token>\nif x == 'Y' or x == 'N' or x == 'Q':\n while x == 'Y' or x == 'N' or x == 'Q':\n if x == 'Q':\n print('Exiting the Program')\n import sys\n sys....
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from flask import Blueprint, render_template, redirect, url_for, flash import subprocess def check_output(*args): return subprocess.Popen(*args, stdout=subprocess.PIPE).communicate()[0] mod = Blueprint('system', __name__) @mod.route('/') def index(): uptime = check_output(["uptime"]) ...
normal
{ "blob_id": "e056a1600b620519e729c597dcec57793284019a", "index": 1470, "step-1": "<mask token>\n\n\n@mod.route('/shutdown')\ndef shutdown():\n flash(\n 'Shutting down.<br>When the LEDs on the board stop flashing, it should be safe to unplug your Raspberry Pi.'\n )\n subprocess.call(['sudo...
[ 1, 4, 5, 6, 7 ]
#!/usr/bin/env python import sys import json import time import random import pathlib import argparse import subprocess proc = None def get_wallpaper(FOLDER): files = [path for path in pathlib.Path(FOLDER).iterdir() if path.is_file()] return random.choice(files) def get_outputs(): cmd = ...
normal
{ "blob_id": "46b1991bba83968466390d306a4415b362b6a868", "index": 3140, "step-1": "<mask token>\n\n\ndef get_outputs():\n cmd = ['swaymsg', '-t', 'get_outputs']\n proc_result = subprocess.run(cmd, capture_output=True).stdout.decode()\n proc_json = json.loads(proc_result)\n return [output['name'] for o...
[ 1, 2, 3, 5, 6 ]
# Developed by Lorenzo Mambretti, Justin Wang # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://github.com/jtwwang/hanabi/blob/master/LICENSE # # Unless required by applic...
normal
{ "blob_id": "bbd5eb1f80843efdd2709aa19a65bf325a88f473", "index": 8856, "step-1": "<mask token>\n\n\ndef model_crossover(weights1, weights2):\n new_weights = []\n assert len(weights1) == len(weights2)\n if random.uniform(0, 1) > 0.3:\n print('crossover')\n for layer in range(len(weights1)):...
[ 3, 4, 5, 6, 7 ]
import numpy as np # Read in training data and labels # Some useful parsing functions # male/female -> 0/1 def parseSexLabel(string): if (string.startswith('male')): return 0 if (string.startswith('female')): return 1 print("ERROR parsing sex from " + string) # child/teen/adult/senior ->...
normal
{ "blob_id": "6822a0a194e8b401fecfed2b617ddd5489302389", "index": 4718, "step-1": "<mask token>\n\n\ndef parseSexLabel(string):\n if string.startswith('male'):\n return 0\n if string.startswith('female'):\n return 1\n print('ERROR parsing sex from ' + string)\n\n\n<mask token>\n\n\ndef pars...
[ 2, 3, 4, 5, 7 ]
#coding: utf-8 """ 1) Encontre em um texto os nomes próprios e os retorne em uma lista. Utilize o Regex (‘import re’) e a função findall(). Na versão básica, retorne todas as palavras que iniciam com maiúscula. 2) Apresente um plot de alguns segundos dos dados de acelerômetro do dataset: https://archive.ics.uci.edu/...
normal
{ "blob_id": "d95d899c6eae5a90c90d3d920ee40b38bf304805", "index": 532, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n pass\n", "step-3": "#coding: utf-8\n\"\"\" \n1) Encontre em um texto os nomes próprios e os retorne em uma lista. Utilize o Regex (‘import re’) e a função...
[ 0, 1, 2 ]
# 导包 from time import sleep from selenium import webdriver # 实例化浏览器 driver = webdriver.Firefox() # 打开页面 driver.get(r"F:\BaiduYunDownload\webdriverspace\sources\注册实例.html") driver.maximize_window() sleep(2) # 定位注册A按钮并点击 driver.find_element_by_link_text("注册A网页").click() # 获取当前敞口句柄 current_handle = driver.current_windo...
normal
{ "blob_id": "f73a316b6020908472e35a7b78959a9bda6e8e56", "index": 7810, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('F:\\\\BaiduYunDownload\\\\webdriverspace\\\\sources\\\\注册实例.html')\ndriver.maximize_window()\nsleep(2)\ndriver.find_element_by_link_text('注册A网页').click()\n<mask token>\nprint(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solution(mon: int, day: int) ->str: return date(2016, mon, day).strftime('%a').upper() <|reserved_special_token_1|> from datetime import date def solution(mon: int, day: int) ->str: return date(2016, mon, day).s...
flexible
{ "blob_id": "67385d6d58cc79037660be546d41ea9ba1f790fa", "index": 5043, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(mon: int, day: int) ->str:\n return date(2016, mon, day).strftime('%a').upper()\n", "step-3": "from datetime import date\n\n\ndef solution(mon: int, day: int) ->str:...
[ 0, 1, 2, 3 ]