code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from __future__ import division, print_function, absolute_import import numbers import warnings from abc import ABCMeta, abstractmethod import numpy as np from .base import check_frame from skutil.base import overrides from sklearn.externals import six from sklearn.base import _pprint from sklearn.utils.fixes import si...
normal
{ "blob_id": "c59707ba07c1659d94684c54cdd7bb2658cba935", "index": 6, "step-1": "<mask token>\n\n\nclass H2OShuffleSplit(H2OBaseShuffleSplit):\n <mask token>\n\n def _iter_indices(self, frame, y=None):\n \"\"\"Iterate the indices.\n\n Parameters\n ----------\n\n frame : H2OFrame\n...
[ 21, 29, 40, 43, 47 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def multi_strassen(A, B, check_ig=True, check_quad=True, check_pot=True, check_time=True): def Strassen(matriz_1, matriz_2): if matriz_1.shape[0] != 2 or matriz_1.shape[1] != 2 or matriz_2.shape[0 ] ...
flexible
{ "blob_id": "6707723b3d0b42271e49c08c639afc9103066dc7", "index": 4679, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef multi_strassen(A, B, check_ig=True, check_quad=True, check_pot=True,\n check_time=True):\n\n def Strassen(matriz_1, matriz_2):\n if matriz_1.shape[0] != 2 or matriz_1...
[ 0, 1, 2, 3 ]
import logging from queue import Queue import concurrent.futures """ Post processing decorater logic for FtpDownloader """ class FtpDownloaderPostProcess: def __init__(self, ftp_downloader, post_processor, num_workers=None, config_dict=None): self.post_processor = post_processor self.ftp_downlo...
normal
{ "blob_id": "56a41f432d332aaebbde15c52e133eee51b22ce1", "index": 2833, "step-1": "<mask token>\n\n\nclass FtpDownloaderPostProcess:\n <mask token>\n <mask token>\n\n @property\n def logger(self):\n return logging.getLogger(__name__)\n\n def iterate(self, *args, **kwargs):\n \"\"\"\nU...
[ 4, 6, 7, 8, 9 ]
import json, requests, math, random #import datagatherer # Constants: start_elo = 0 # Starting elo decay_factor = 0.9 # Decay % between stages k = 30 # k for elo change d = 200 # Difference in elo for 75% expected WR overall_weight = 0.60 # Weigts for different types o...
normal
{ "blob_id": "4f84cf80292e2764ca3e4da79858058850646527", "index": 8862, "step-1": "<mask token>\n\n\nclass EloCalculations:\n\n def __init__(self):\n self.teamcolors = {}\n for teamdata in colordata:\n c = teamdata['competitor']\n self.teamcolors[c['abbreviatedName']] = ['#'...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(model_file, 'rb') as fp: model_data = pkl.load(fp) <|reserved_special_token_0|> for i in range(70563, 70564): imgname = mpi_inf_valid['imgname'][i] rgb_img = cv2.imread(join(ROOT, imgname))[:, :, ::-1].copy()...
flexible
{ "blob_id": "2540e2752edaedbf2a011a25cb90f220ae770757", "index": 7611, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(model_file, 'rb') as fp:\n model_data = pkl.load(fp)\n<mask token>\nfor i in range(70563, 70564):\n imgname = mpi_inf_valid['imgname'][i]\n rgb_img = cv2.imread(join(RO...
[ 0, 1, 2, 3, 4 ]
''' Bayesian models for TWAS. Author: Kunal Bhutani <kunalbhutani@gmail.com> ''' from scipy.stats import norm import pymc3 as pm import numpy as np from theano import shared from scipy.stats.distributions import pareto from scipy import optimize import theano.tensor as t def tinvlogit(x): return t.exp(x) / (1 +...
normal
{ "blob_id": "057140ef1b8db340656b75b3a06cea481e3f20af", "index": 1689, "step-1": "<mask token>\n\n\nclass TwoStage(BayesianModel):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TwoStageBF(BayesianModel):\n \"\"\"\n Two Stage Inference.\n\n First stage: Bootstrapped ElasticNet\n Sec...
[ 28, 29, 46, 49, 55 ]
import hashlib import sys def getHashcode(string): for i in range(10000000000): hash_md5 = hashlib.md5(str(i).encode('utf-8')) res = hash_md5.hexdigest() if res[0:len(string)] == string: print(i) exit() if __name__ == '__main__': getHashcode(sys.argv[1])
normal
{ "blob_id": "4c8e3c21dd478606cf09f2e97dc9deed6597dae5", "index": 4375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getHashcode(string):\n for i in range(10000000000):\n hash_md5 = hashlib.md5(str(i).encode('utf-8'))\n res = hash_md5.hexdigest()\n if res[0:len(string)] =...
[ 0, 1, 2, 3 ]
import time import serial ser = serial.Serial( port='/dev/ttyUSB0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=None ) ser.close() ser.open() if ser.isOpen(): print "Serial is open" ser.flushInput() ser.flushOutput() while True: mimic = '' byt...
normal
{ "blob_id": "b112ca3dc603035f340444fa74a7941b1b95f5e5", "index": 6877, "step-1": "import time\nimport serial\n\nser = serial.Serial(\n\tport='/dev/ttyUSB0',\n\tbaudrate=9600,\n\tparity=serial.PARITY_NONE,\n\tstopbits=serial.STOPBITS_ONE,\n\tbytesize=serial.EIGHTBITS,\n\ttimeout=None\n)\nser.close()\nser.open()\n...
[ 0 ]
from robotcar import RobotCar import pdb class RobotCar_Stub(RobotCar): def forward(self): print("Forward") def backward(self): print("Backward") def left(self): print("Left") def right(self): print("Right") def stop(self): print("Stop") if __name__ == '__main__': ...
normal
{ "blob_id": "09b2c1e69203f440754e82506b42e7856c94639a", "index": 8623, "step-1": "<mask token>\n\n\nclass RobotCar_Stub(RobotCar):\n <mask token>\n\n def backward(self):\n print('Backward')\n\n def left(self):\n print('Left')\n\n def right(self):\n print('Right')\n\n def stop(...
[ 5, 6, 7, 8, 9 ]
# Generated by Django 3.0.1 on 2020-01-11 09:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0005_auto_20200111_1513'), ] operations = [ migrations.AlterField( model_name='post', name='photo', ...
normal
{ "blob_id": "8e8c72362dfb1587150aadaa6b8a0aeb77c3641a", "index": 1516, "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 = [('blog', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def sol(k): if k in dp: return dp[k] else: for i in range(7, k + 1): if dp[i - 3] == 'SK' and dp[i - 1] == 'SK' and dp[i - 4] == 'SK': dp[i] = 'CY' else: dp[i] = 'SK' return dp[k] <|reserved_special_...
flexible
{ "blob_id": "4b85479af7d65d208fab08c10afbf66086877329", "index": 8981, "step-1": "<mask token>\n\n\ndef sol(k):\n if k in dp:\n return dp[k]\n else:\n for i in range(7, k + 1):\n if dp[i - 3] == 'SK' and dp[i - 1] == 'SK' and dp[i - 4] == 'SK':\n dp[i] = 'CY'\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from contextlib import suppress import asyncio import shutil from aiohttp import web from bot import app from var import var from logger import update_logging_files loop = asyncio.get_event_loop() def import_handlers(): from deezer import handlers, callback_handle...
normal
{ "blob_id": "d957fd5fbcdcf2e549323677185eabb8a50536c6", "index": 5716, "step-1": "<mask token>\n\n\ndef import_handlers():\n from deezer import handlers, callback_handlers\n from spotify import handlers, integration, callback_handlers\n from vk import handlers, callback_handlers\n from soundcloud imp...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def clean_doc(text, language='english'): """ Removes unknown characters and punctuation, change capital to lower letters and remove stop words. If stem=False Inputs: sentence (string): a sting to be cleaned Returns: a string """ tokens = nltk.word_tokenize(text) tokens =...
flexible
{ "blob_id": "367c3b4da38623e78f2853f9d3464a414ad049c2", "index": 9596, "step-1": "<mask token>\n\n\ndef clean_doc(text, language='english'):\n \"\"\"\n\tRemoves unknown characters and punctuation, change capital to lower letters and remove\n\tstop words. If stem=False\n\tInputs:\n\tsentence (string): a sting ...
[ 3, 8, 10, 11, 12 ]
<|reserved_special_token_0|> class OQtSource(object): <|reserved_special_token_0|> def __init__(self, *args, **kwargs): if len(args): self.source_id = args[0] if len(args) > 1: self.source_type = args[1] if len(kwargs): self.__dict__.update(...
flexible
{ "blob_id": "8adf8cfc72d5af955bf7509d3573a9bcc7c0845e", "index": 7537, "step-1": "<mask token>\n\n\nclass OQtSource(object):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n if len(args):\n self.source_id = args[0]\n if len(args) > 1:\n self.source_type ...
[ 2, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> alias_macro = {'class': 'Application', 'method': 'alias_macro', 'doc': """ Returns or modifies the macro of a command alias. """, 'syntax': """ Rhino.AliasMacro (strAlias [, strMacro]) """, 'params': {(0): {'name': 'alias',...
flexible
{ "blob_id": "1574f034ff9b6ddb785e4c54758b2057009198ed", "index": 7587, "step-1": "<mask token>\n", "step-2": "alias_macro = {'class': 'Application', 'method': 'alias_macro', 'doc':\n \"\"\"\n Returns or modifies the macro of a command alias.\n \"\"\",\n 'syntax': \"\"\"\n Rhino.AliasMacr...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class MonitorsS(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def monitors_write_name(self, argument) ->str: """Sets the active Monitor object by name.""" result = ctypes.c_char_p(self.dss_obj.MonitorsS(ctype...
flexible
{ "blob_id": "f6f0dcb806fbc1e14c0907dd500fdc6a609a19f7", "index": 5598, "step-1": "<mask token>\n\n\nclass MonitorsS(Base):\n <mask token>\n <mask token>\n <mask token>\n\n def monitors_write_name(self, argument) ->str:\n \"\"\"Sets the active Monitor object by name.\"\"\"\n result = cty...
[ 3, 4, 6, 7, 9 ]
<|reserved_special_token_0|> def get_clusters(link, dn, inds, th=0.7): clst = fcluster(link, criterion='distance', t=th) return pandas.Series(index=inds, data=clst).iloc[dn['leaves']] def draw_significant_groups(groups, dn_ax, color='white'): for group in groups: rect = patches.Rectangle((group[...
flexible
{ "blob_id": "bfd31d0b80511721ee5117daced04eaf63679fd8", "index": 2230, "step-1": "<mask token>\n\n\ndef get_clusters(link, dn, inds, th=0.7):\n clst = fcluster(link, criterion='distance', t=th)\n return pandas.Series(index=inds, data=clst).iloc[dn['leaves']]\n\n\ndef draw_significant_groups(groups, dn_ax, ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> BLUE = '#1A94D6' GREEN = '#73AD21' PALE_GREEN = '#BBF864' PALE_BLUE = '#A2C4DA' BRIGHT_BLUE = '#04BAE3' ORANGE = '#FF8000' DARK_ORANGE = '#E65C00' LIGHT_ORANGE = '#FFAA3E' PALE_ORANGE = '#F8C381' GUAVA = '#FF4F40' FUSCIA = '#E22EFF' PALE_FUSCIA = '#DFA0E9' PU...
flexible
{ "blob_id": "6d8c32fe51fadbe6b6ee14419e1e37c65d4f57bf", "index": 2508, "step-1": "<mask token>\n", "step-2": "BLUE = '#1A94D6'\nGREEN = '#73AD21'\nPALE_GREEN = '#BBF864'\nPALE_BLUE = '#A2C4DA'\nBRIGHT_BLUE = '#04BAE3'\nORANGE = '#FF8000'\nDARK_ORANGE = '#E65C00'\nLIGHT_ORANGE = '#FFAA3E'\nPALE_ORANGE = '#F8C38...
[ 0, 1, 2 ]
class MedianFinder: def __init__(self): """ initialize your data structure here. """ self.minheap = [] self.maxheap = [] def addNum(self, num: int) -> None: heapq.heappush (self.maxheap ,-heapq.heappushpop(self.minheap , num) ) if len(self.maxheap) > len...
normal
{ "blob_id": "e7699bb3f6080c78517f11445e2c48a0e40f3332", "index": 3209, "step-1": "class MedianFinder:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class MedianFinder:\n <mask token>\n <mask token>\n\n def findMedian(self) ->float:\n if len(self.maxheap) == len(self.minhe...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def square_calculator(user_input): """ accepts input from a user to determine the square root returns the square root of the user input """ precision = 1e-12 counter = 0 low = 0 high = user_input guess = (low + high) / 2.0 ...
flexible
{ "blob_id": "2bc20f3410d068e0592c8a45e3c13c0559059f24", "index": 4498, "step-1": "<mask token>\n", "step-2": "def square_calculator(user_input):\n \"\"\"\n accepts input from a user to determine the square root\n returns the square root of the user input\n \"\"\"\n precision = 1e-12\n counter...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 24 18:46:26 2019 @author: kiran """ import matplotlib.pylab as plt import pandas as pd import numpy as np import statsmodels as sm from statsmodels.graphics.tsaplots import plot_acf, plot_pacf from statsmodels.tsa.stattools import acf, pacf from stat...
normal
{ "blob_id": "8e28135da60f8e11459697c4ae9c63e60c437d7a", "index": 9501, "step-1": "<mask token>\n\n\ndef stationarity_test(mylynxts):\n from statsmodels.tsa.stattools import adfuller\n print('Results of Dickey-Fuller Test:')\n df_test = adfuller(mylynxts, autolag='AIC')\n df_output = pd.Series(df_test...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import xmlrunner import os import sys import glob import yaml ASSETS_DIR = "" class GenerateMachineConfig(unittest.TestCase): def setUp(self): self.machine_configs = [] for machine_config_path in glob.glob( f'{ASSETS_D...
normal
{ "blob_id": "f0c082968e26d414b0dbb679d4e5077056e99979", "index": 8653, "step-1": "<mask token>\n\n\nclass GenerateMachineConfig(unittest.TestCase):\n\n def setUp(self):\n self.machine_configs = []\n for machine_config_path in glob.glob(\n f'{ASSETS_DIR}/openshift/99_openshift-machinec...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/python3 """minimum time time to write operations of copy and paste""" def minOperations(n): """ a method that calculates the fewest number of operations needed to result in exactly n H characters in the file """ if n <= 1: return 0 """loop for n number of times""" for i...
normal
{ "blob_id": "f14b9373e9bf1ad7fe2216dfefc1571f5380fb27", "index": 6528, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef minOperations(n):\n \"\"\"\n a method that calculates the fewest number of operations needed\n to result in exactly n H characters in the file\n \"\"\"\n if n <= 1:...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Focusv2(nn.Cell): def __init__(self, c1, c2, k=1, s=1, p=None, act=True): super(Focusv2, self).__init__() self.conv = Conv(c1 * 4, c2, k, s, p, act) def construct(self, x): return self.conv(x) class SiLU(nn.Cell): def __init__(self): ...
flexible
{ "blob_id": "1ea31a126417c2feb079339aa79f97ea9e38fa40", "index": 6152, "step-1": "<mask token>\n\n\nclass Focusv2(nn.Cell):\n\n def __init__(self, c1, c2, k=1, s=1, p=None, act=True):\n super(Focusv2, self).__init__()\n self.conv = Conv(c1 * 4, c2, k, s, p, act)\n\n def construct(self, x):\n ...
[ 12, 21, 27, 28, 33 ]
<|reserved_special_token_0|> class SharedSeleniumExecutionContext: <|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_speci...
flexible
{ "blob_id": "e75fb023e2e3d3fd258a316a6827b2601c9f4b2d", "index": 3762, "step-1": "<mask token>\n\n\nclass SharedSeleniumExecutionContext:\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 to...
[ 9, 12, 13, 14, 16 ]
<|reserved_special_token_0|> def convert_text_to_index(sentences, vocabulary, type): sentences_index = [] for sentence in sentences: sentence_index = [] if type == DECODER_INPUT: sentence_index.extend([vocabulary[STA]]) for word in sentence.split(): if vocabular...
flexible
{ "blob_id": "bd06030ace665a0686c894a863e5c779b6d0931c", "index": 6447, "step-1": "<mask token>\n\n\ndef convert_text_to_index(sentences, vocabulary, type):\n sentences_index = []\n for sentence in sentences:\n sentence_index = []\n if type == DECODER_INPUT:\n sentence_index.extend(...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(heightmean) print(heightmedian) print(heightmode) print(heightstdev) <|reserved_special_token_0|> print(firstpercentage) print(secondpercentage) print(thirdpercentage) <|reserved_special_token_1|> <|reserved_special_token...
flexible
{ "blob_id": "3f4b05a1d0c4c2a2b085a0265bafbf89b5635e31", "index": 8021, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(heightmean)\nprint(heightmedian)\nprint(heightmode)\nprint(heightstdev)\n<mask token>\nprint(firstpercentage)\nprint(secondpercentage)\nprint(thirdpercentage)\n", "step-3": "<mask...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @manufacturers_blueprint.route('/manufacturers', methods=['GET']) def manufacturers(): manufacturers = manufacturer_repository.select_all() return render_template('manufacturers/index.html', manufacturers= manufacturers) @manufacturers_blueprint.route('/manufacturers/<id...
flexible
{ "blob_id": "841e859feff2151667d70e7bf1829129d1f92cf7", "index": 9889, "step-1": "<mask token>\n\n\n@manufacturers_blueprint.route('/manufacturers', methods=['GET'])\ndef manufacturers():\n manufacturers = manufacturer_repository.select_all()\n return render_template('manufacturers/index.html', manufacture...
[ 5, 6, 7, 9, 10 ]
#!/usr/bin/env python import os import sys #from io import open import googleapiclient.errors import oauth2client from googleapiclient.errors import HttpError from . import auth from . import lib debug = lib.debug # modified start def get_youtube_handler(): """Return the API Youtube object.""" ...
normal
{ "blob_id": "65d08fe1a3f6e5cc2458209706307513d808bdb2", "index": 3824, "step-1": "<mask token>\n\n\ndef get_youtube_handler():\n \"\"\"Return the API Youtube object.\"\"\"\n options = {}\n home = os.path.expanduser('~')\n default_credentials = os.path.join(home, '.youtube-upload-credentials.json'\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def test(a): """ This function return square of number """ return a ** 2 <|reserved_special_token_0|> <|reserved_special_token_1|> def test(a): """ This function return square of number """ return a ** 2 print(test(2)) h...
flexible
{ "blob_id": "7b35a7f28c11be15fe2ac8d6eae4067ac5379f3e", "index": 3546, "step-1": "<mask token>\n", "step-2": "def test(a):\n \"\"\"\n This function return square of number\n \"\"\"\n return a ** 2\n\n\n<mask token>\n", "step-3": "def test(a):\n \"\"\"\n This function return square of number...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('test/<str:name>/', index, name='index'), path( 'ml/setup/', setup_fraud_detection, name='fraud_detection_setup'), path ('ml/verify/', verify_testing_works, name='fraud_verification'), path( 'class/...
flexible
{ "blob_id": "263347d1d445643f9c84e36a8cbb5304581ebaf6", "index": 3888, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('test/<str:name>/', index, name='index'), path(\n 'ml/setup/', setup_fraud_detection, name='fraud_detection_setup'), path\n ('ml/verify/', verify_testing_works, ...
[ 0, 1, 2, 3 ]
from rest_framework import serializers from .models import * class VisitaSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Visita fields = ('id', 'usuario', 'lugar', 'fecha_visita', 'hora_visita')
normal
{ "blob_id": "72bbd100a37a86dec7684257f2bec85d7367c009", "index": 5810, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass VisitaSerializer(serializers.HyperlinkedModelSerializer):\n\n\n class Meta:\n model = Visita\n fields = 'id', 'usuario', 'lugar', 'fecha_visita', 'hora_visita'\...
[ 0, 1, 2, 3 ]
class Data(object): <|reserved_special_token_0|> <|reserved_special_token_0|> class Time(Data): def getTime(self): print('Time:', self.data) <|reserved_special_token_0|> <|reserved_special_token_1|> class Data(object): def __init__(self, data): self.data = data <|reserved_sp...
flexible
{ "blob_id": "153a33b85cf8b3ef9c742f05b460e94e0c684682", "index": 1000, "step-1": "class Data(object):\n <mask token>\n <mask token>\n\n\nclass Time(Data):\n\n def getTime(self):\n print('Time:', self.data)\n\n\n<mask token>\n", "step-2": "class Data(object):\n\n def __init__(self, data):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Billings(BaseView): @expose('/') def index(self): return redirect(url_for('.billingHistory')) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @expose('/billingsDetail') def billingsDetail(self): sel...
flexible
{ "blob_id": "a9344151a997842972aa68c417a77b3ca80e6cfa", "index": 3174, "step-1": "<mask token>\n\n\nclass Billings(BaseView):\n\n @expose('/')\n def index(self):\n return redirect(url_for('.billingHistory'))\n <mask token>\n <mask token>\n <mask token>\n\n @expose('/billingsDetail')\n ...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def add(n1, n2): if n1 == '' or n2 == '': return 'Invalid Operation' elif n1 == None or n2 == None: return 'Invalid Operation' return str(int(n1) + int(n2)) <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "7bcbcbe51217b2ea9044a7e4a4bebf315069c92d", "index": 2953, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef add(n1, n2):\n if n1 == '' or n2 == '':\n return 'Invalid Operation'\n elif n1 == None or n2 == None:\n return 'Invalid Operation'\n return str(int(n1) + in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'articles' urlpatterns = [path('', articles_list, name='list'), path('create', create_article, name='create'), path('<slug:slug>', article_detail, name='detail')] <|reserved_special_token_1|> from django.urls...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'jobs' urlpatterns = [path('', job_view, name='job-index'), path('applicants/', job_applicants_view, name='job-applicants'), path('posted/', posted_job_view, name='job-posted'), path('business/', bussiness_l...
flexible
{ "blob_id": "b88af16693eca10d0bd78fd706389f5468c9b99b", "index": 144, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'jobs'\nurlpatterns = [path('', job_view, name='job-index'), path('applicants/',\n job_applicants_view, name='job-applicants'), path('posted/',\n posted_job_view, name='jo...
[ 0, 1, 2, 3 ]
from django import forms class photoForm(forms.Form): iso = forms.ChoiceField(label='ISO', choices=[("100", 100), ("200", 200), ("300", 300), ("400", 400), ...
normal
{ "blob_id": "19b55b2de3d2ed16275cef572e3518fbb2457f84", "index": 8293, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass photoForm(forms.Form):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass photoForm(forms.Form):\n iso = forms.ChoiceField(label='ISO', choices=[('1...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import fileinput mem = [int(n.strip()) for n in next(fileinput.input()).split()] size = len(mem) states = set() states.add('.'.join(str(n) for n in mem)) part2 = None steps = 0 while True: i = mem.index(max(mem)) x = mem[i] mem[i] = 0 while x > 0: i += 1 mem[i ...
normal
{ "blob_id": "0e7d4b73cedf961677e6b9ea5303cdb3a5afa788", "index": 3521, "step-1": "<mask token>\n", "step-2": "<mask token>\nstates.add('.'.join(str(n) for n in mem))\n<mask token>\nwhile True:\n i = mem.index(max(mem))\n x = mem[i]\n mem[i] = 0\n while x > 0:\n i += 1\n mem[i % size] ...
[ 0, 1, 2, 3, 4 ]
name = '' while name != 'your name' and name != 'Your name': print('Please type your name.') name = input() print('Thanks!') #while 1 == 2 or : # print('Type your name') # name = input() # if name == 'your name': # break #print('Thanks!')
normal
{ "blob_id": "f3644b42d1a6c87c6169f8d123dadf6cd209270c", "index": 2617, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile name != 'your name' and name != 'Your name':\n print('Please type your name.')\n name = input()\nprint('Thanks!')\n", "step-3": "name = ''\nwhile name != 'your name' and nam...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- #from setup_env import * #from mmlibrary import * from astropy.coordinates import SkyCoord import astropy.units as u from mmlibrary import * import numpy as np import lal from scipy.special import logsumexp import cpnest, cpnest.model # Oggetto per test: GW170817 #GW =...
normal
{ "blob_id": "fa5468741e9884f6c8bcacaf9d560b5c93ee781a", "index": 8906, "step-1": "<mask token>\n\n\nclass completeness(cpnest.model.Model):\n\n def __init__(self, catalog):\n self.names = ['z', 'h', 'om', 'ol']\n self.bounds = [[0.001, 0.012], [0.5, 1.0], [0.04, 1.0], [0.0, 1.0]]\n self.o...
[ 2, 9, 13, 15, 16 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on 2021.03.18 setup for package. @author: zoharslong """ from setuptools import setup, find_packages from os.path import join as os_join, abspath as os_abspath, dirname as os_dirname here = os_abspath(os_dirname(__file__)) with open(os_join(here, 'README.md')) ...
normal
{ "blob_id": "e0f7837731520ad76ca91d78c20327d1d9bb6d4f", "index": 9970, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(os_join(here, 'README.md')) as f:\n README = f.read()\nsetup(name='pyzohar', version='0.1.11', author='zoharslong', author_email=\n 'zoharslong@hotmail.com', description=\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Crysdata: def __init__(self, F, cb): self.start = time.time() print('Draw timer started') self.name = F self.cell = Cell(cb) self.atoms = readEl(cb) self.pos = readPos(cb) c = self.cell self.ftoc = self.get_fractio...
flexible
{ "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 ]
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
normal
{ "blob_id": "5c291dbc241a80e7f2625ba338a4b9b3a3f3b2d0", "index": 1119, "step-1": "<mask token>\n\n\nclass TestRedshiftCreateClusterTrigger:\n <mask token>\n\n @pytest.mark.asyncio\n @async_mock.patch(\n 'airflow.providers.amazon.aws.hooks.redshift_cluster.RedshiftHook.async_conn'\n )\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': auth = HTTPBasicAuth('cisco', 'cisco') headers = {'Accept': 'application/json', 'Content-Type': 'application/json' } url = 'https://asav/api/interfaces/physical/GigabitEthernet0_API_S...
flexible
{ "blob_id": "6801d68ebcc6ff52d9be92efeeb8727997a14bbd", "index": 523, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n auth = HTTPBasicAuth('cisco', 'cisco')\n headers = {'Accept': 'application/json', 'Content-Type': 'application/json'\n }\n url = 'https://asav/...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for one in data: print(one) r = requests.post('http://localhost:8080/sumari', json=one) print(r.text) <|reserved_special_token_1|> <|reserved_special_token_0|> data = json.load(open('dummy_data/data.json')) for one ...
flexible
{ "blob_id": "8bc40ed4fe1091ecdb40cd55ff9cf53010078823", "index": 361, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor one in data:\n print(one)\n r = requests.post('http://localhost:8080/sumari', json=one)\n print(r.text)\n", "step-3": "<mask token>\ndata = json.load(open('dummy_data/data.j...
[ 0, 1, 2, 3, 4 ]
import random def generate_questions(n): for _ in range(n): x = random.randint(11, 100) print(x) inp = int(input()) if inp == x ** 2: continue else: print('Wrong! the right answer is: {}'.format(x ** 2)) n = int(input()) generate_questions(n)
normal
{ "blob_id": "e98f28199075e55ddad32d9127f917c982e1e29d", "index": 8167, "step-1": "<mask token>\n\n\ndef generate_questions(n):\n for _ in range(n):\n x = random.randint(11, 100)\n print(x)\n inp = int(input())\n if inp == x ** 2:\n continue\n else:\n pr...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/', methods=['GET']) def home(): return Response(response=dumps({'msg': 'App successfull'}), status=200, mimetype='application/json') @app.route('/spamapi/', methods=['GET', 'POST']) def apicall(): try: predTxt = loads(request.data) predTxt = ...
flexible
{ "blob_id": "1552d862d3b9df45eda8c08256e8b4437ab08740", "index": 2641, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET'])\ndef home():\n return Response(response=dumps({'msg': 'App successfull'}), status=200,\n mimetype='application/json')\n\n\n@app.route('/spamapi/', methods=['GET', 'POST']...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def train_model(model, DEVICE, patience, n_epochs, csv_record=False): train_losses = [] valid_losses = [] avg_train_losses = [] avg_valid_losses = [] early_stopping = EarlyStopping(patience=patience, verbose=...
flexible
{ "blob_id": "80531ac3cc247d48ee36bff581925b8f29f9e235", "index": 8590, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train_model(model, DEVICE, patience, n_epochs, csv_record=False):\n train_losses = []\n valid_losses = []\n avg_train_losses = []\n avg_valid_losses = []\n early_st...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class H2OShuffleSplit(H2OBaseShuffleSplit): <|reserved_special_token_0|> def _iter_indices(self, frame, y=None): """Iterate the indices. Parameters ---------- frame : H2OFrame The frame to split y : string, optional (default=...
flexible
{ "blob_id": "c59707ba07c1659d94684c54cdd7bb2658cba935", "index": 6, "step-1": "<mask token>\n\n\nclass H2OShuffleSplit(H2OBaseShuffleSplit):\n <mask token>\n\n def _iter_indices(self, frame, y=None):\n \"\"\"Iterate the indices.\n\n Parameters\n ----------\n\n frame : H2OFrame\n...
[ 21, 29, 40, 43, 47 ]
<|reserved_special_token_0|> class Metric(utils.metaclass_insert(abc.ABCMeta, BaseType)): <|reserved_special_token_0|> def __init__(self): """ This is the basic method initialize the metric object @ In, none @ Out, none """ BaseType.__init__(self) self.type = sel...
flexible
{ "blob_id": "5456fb2938ae4d0f69414c153390f86437088114", "index": 4475, "step-1": "<mask token>\n\n\nclass Metric(utils.metaclass_insert(abc.ABCMeta, BaseType)):\n <mask token>\n\n def __init__(self):\n \"\"\"\n This is the basic method initialize the metric object\n @ In, none\n @ Out...
[ 4, 5, 6, 8, 9 ]
from django.forms import ModelForm from django import forms from models import * from django.forms.widgets import * class CommentForm(ModelForm): # tags = TagField(widget=TagAutocomplete()) class Meta: model=Comment # fields = ('title', 'description', 'tags', 'enable_comments', 'owner')#, 'first_card' ) # w...
normal
{ "blob_id": "81535b43437f9bcb18973ceaa5c3340ad9bd4f0f", "index": 4170, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CommentForm(ModelForm):\n\n\n class Meta:\n model = Comment\n", "step-3": "from django.forms import ModelForm\nfrom django import forms\nfrom models import *\nfrom d...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FxBuySell(FxMainPage): <|reserved_special_token_0|> def buy(self, amount): self.log.info('--> ' + inspect.stack()[0][3] + ' started') if self.driver.find_element_by_xpath( "//div[@class='visible-input']//input[contains(@id, 'uniqName')]"): ...
flexible
{ "blob_id": "5850be6aef6e4adb36a122cb8e5ffe044b1c9009", "index": 4589, "step-1": "<mask token>\n\n\nclass FxBuySell(FxMainPage):\n <mask token>\n\n def buy(self, amount):\n self.log.info('--> ' + inspect.stack()[0][3] + ' started')\n if self.driver.find_element_by_xpath(\n \"//div[...
[ 3, 5, 8, 9, 11 ]
def gen_metadata(fn): metadata = {} lines = open(fn,'r').readlines() for line in lines: line = line.rstrip() if len(line) == 0: continue elif line.startswith('#'): continue elif line.startswith('%'): continue else: # Special case RingThresh firstWord = line.split()[0] if line.startswith('...
normal
{ "blob_id": "5066c2a5219cf1b233b4985efc7a4eb494b784ca", "index": 7363, "step-1": "<mask token>\n", "step-2": "def gen_metadata(fn):\n metadata = {}\n lines = open(fn, 'r').readlines()\n for line in lines:\n line = line.rstrip()\n if len(line) == 0:\n continue\n elif lin...
[ 0, 1, 2, 3 ]
<|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": "f2c96b3133137019dc6bd462f096f3b4c5f12648", "index": 6635, "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 = [('registered_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def firstMissingPositive(self, nums: List[int]) ->int: if not nums: return 1 maxnum = max(nums) if maxnum < 1: ...
flexible
{ "blob_id": "09905d4b5ad2e59578d874db171aafb6c42db105", "index": 8609, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def firstMissingPositive(self, nums: List[int]) ->int:\n if not nums:\n return 1\n maxnum = max(nums)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('Aparcamientos.json') as data_file: data = json.load(data_file) for x in data['docs']: if x['TIPOLOGIA'] == 'Cubierto': print(x['NOMBRE']) elif x['TIPOLOGIA'] == 'Pabellón de deportes': print(...
flexible
{ "blob_id": "d111f93144a1d2790470365d0ca31bcea17713d7", "index": 8766, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('Aparcamientos.json') as data_file:\n data = json.load(data_file)\nfor x in data['docs']:\n if x['TIPOLOGIA'] == 'Cubierto':\n print(x['NOMBRE'])\n elif x['TIPOL...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 from nmigen import * from nmigen.build import * from nmigen_boards.icebreaker import ICEBreakerPlatform class SSDigitDecoder(Elaboratable): def __init__(self): self.i_num = Signal(4) self.o_disp = Signal(7) self.lut = { 0: 0b011_1111, 1: 0b000...
normal
{ "blob_id": "74bb511a9ec272020693db65a2e708f3db56931e", "index": 9954, "step-1": "<mask token>\n\n\nclass SSDigitDecoder(Elaboratable):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Blinky(Elaboratable):\n\n def __init__(self):\n self.dd0 = SSDigitDecoder()\n self.dd1 = SSDigi...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def init_zero_arrays(): radius_arr = np.zeros((ITERATIONS_NUM, TIMESTEPS_NUMB)) dot_radius_arr = np.zeros((ITERATIONS_NUM, TIMESTEPS_NUMB)) dotdot_radius_arr = np.zeros((ITERATIONS_NUM, TIMESTEPS_NUMB)) delta_rad...
flexible
{ "blob_id": "e652196f9c74be6f05c6148de152996e449670ea", "index": 3059, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef init_zero_arrays():\n radius_arr = np.zeros((ITERATIONS_NUM, TIMESTEPS_NUMB))\n dot_radius_arr = np.zeros((ITERATIONS_NUM, TIMESTEPS_NUMB))\n dotdot_radius_arr = np.zeros...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class JamfExtensionAttributeUploader(JamfUploaderBase): description = ( 'A processor for AutoPkg that will upload an Extension Attribute item to a Jamf Cloud or on-prem server.' ) input_variables = {'JSS_URL': {'required': True, 'description': 'URL to a Jam...
flexible
{ "blob_id": "31f91e67d0adde0a984a6d162ea5607f06e9208e", "index": 9876, "step-1": "<mask token>\n\n\nclass JamfExtensionAttributeUploader(JamfUploaderBase):\n description = (\n 'A processor for AutoPkg that will upload an Extension Attribute item to a Jamf Cloud or on-prem server.'\n )\n input...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def create_train_kmeans(data, number_of_clusters): k = KMeans(n_clusters=number_of_clusters, n_jobs=-1, random_state=728) start = time.time() k.fit(data) end = time.time() print('Training took {} seconds'.format(end - start)) return k <|reserved_special_token_0|>...
flexible
{ "blob_id": "9c8a213fc8a7397662eebb74d6ee1ad34cb884d9", "index": 1420, "step-1": "<mask token>\n\n\ndef create_train_kmeans(data, number_of_clusters):\n k = KMeans(n_clusters=number_of_clusters, n_jobs=-1, random_state=728)\n start = time.time()\n k.fit(data)\n end = time.time()\n print('Training ...
[ 1, 3, 4, 6, 7 ]
<|reserved_special_token_0|> def model_crossover(weights1, weights2): new_weights = [] assert len(weights1) == len(weights2) if random.uniform(0, 1) > 0.3: print('crossover') for layer in range(len(weights1)): if layer % 2 == 0: new_weights.append(weights1[layer...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def optimal_points(segments): segments = sorted(segments, key=attrgetter('end'), reverse=True) points = [] while len(segments) > 0: segement = segments.pop() point = segement.end while len(seg...
flexible
{ "blob_id": "c007dc2416d3f7c883c44dea5471927ea6f816d6", "index": 3973, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef optimal_points(segments):\n segments = sorted(segments, key=attrgetter('end'), reverse=True)\n points = []\n while len(segments) > 0:\n segement = segments.pop()\n...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getWeightMap(): with open(os.path.join(os.path.dirname(__file__), '../cells/cubor-base.dict.yaml'), 'r', encoding='utf8') as base: _lines = base.readlines() for wunit in _lines: units = wunit.split('\t') if len(units) == 3 and len(un...
flexible
{ "blob_id": "e50c1ef7368aabf53bc0cfd45e19101fa1519a1f", "index": 6245, "step-1": "<mask token>\n\n\ndef getWeightMap():\n with open(os.path.join(os.path.dirname(__file__),\n '../cells/cubor-base.dict.yaml'), 'r', encoding='utf8') as base:\n _lines = base.readlines()\n for wunit in _lines:...
[ 4, 5, 7, 8, 9 ]
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
normal
{ "blob_id": "1947bd280234189ed35277c449cd708a204ea7a4", "index": 6651, "step-1": "<mask token>\n\n\ndef create_backup(ServerName=None, Description=None):\n \"\"\"\n Creates an application-level backup of a server. While the server is BACKING_UP , the server can not be modified and no additional backup can ...
[ 11, 12, 16, 19, 20 ]
<|reserved_special_token_0|> class SQLSaver(SaverInterface): def connect(self): self.logging.info('Logging to %s@%s:%s -p %s', self.config.SQL_USER, self.config.SQL_HOST, self.config.SQL_DATABASE, self.config. SQL_PASSWD) self.db = mysql.connector.connect(host=self.config....
flexible
{ "blob_id": "e695b9458c0e98521e560dbb291f6f05bda1549f", "index": 421, "step-1": "<mask token>\n\n\nclass SQLSaver(SaverInterface):\n\n def connect(self):\n self.logging.info('Logging to %s@%s:%s -p %s', self.config.SQL_USER,\n self.config.SQL_HOST, self.config.SQL_DATABASE, self.config.\n ...
[ 10, 11, 12, 13, 16 ]
list = [3, 1, 2, 5, 4, 7, 6] def sort(list): for i in range(len(list) - 1): if list[i] > list[i + 1]: a = list[i] list[i] = list[i + 1] list[i + 1] = a print(list) sort(list)
normal
{ "blob_id": "219929d52b5f1a0690590e83b41d2b4f0b2b3a51", "index": 336, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sort(list):\n for i in range(len(list) - 1):\n if list[i] > list[i + 1]:\n a = list[i]\n list[i] = list[i + 1]\n list[i + 1] = a\n ...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from .views.show import show_article, show_articles, export_db urlpatterns = [ url(r'^$', show_articles, name='index'), url(r'^article/$', show_article, name='article'), url(r'^export/$', export_db, name='article'), ]
normal
{ "blob_id": "9fdc7c1eb68a92451d41313861164a915b85fcee", "index": 8988, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', show_articles, name='index'), url('^article/$',\n show_article, name='article'), url('^export/$', export_db, name='article')]\n", "step-3": "from django.conf...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': parser = argparse.ArgumentParser(description= 'Run learning of simple CNN implementation') parser.add_argument('--model_name', type=str, default='', help= 'Name of the model from ...
flexible
{ "blob_id": "604c94e50b1fb9b5e451c4432113498410a4ac1f", "index": 5262, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description=\n 'Run learning of simple CNN implementation')\n parser.add_argument('--model_name', type=str, defa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class editForm(forms.ModelForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = User fields = 'userna...
flexible
{ "blob_id": "ae8add3adc336c9404cd2aeab4aff81c94c8884e", "index": 7174, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass editForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'username', 'firs...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "257f18db95e069c037341d2af372269e988b0a80", "index": 536, "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 = [('asset', '000...
[ 0, 1, 2, 3, 4 ]
import numpy as np from sklearn.preprocessing import OneHotEncoder def formator(value): return "%.2f" % value def features_preprocessor(datasetLocation): data = np.genfromtxt(datasetLocation,delimiter=",",usecols=range(41)) ##!!! usecols = range(41) encoder = OneHotEncoder(categorical_features=[1,2,3]) encoder.fi...
normal
{ "blob_id": "f50c9aec85418553f4724146045ab7c3c60cbb80", "index": 4404, "step-1": "import numpy as np\nfrom sklearn.preprocessing import OneHotEncoder\n\ndef formator(value):\n\treturn \"%.2f\" % value\n\ndef features_preprocessor(datasetLocation):\n\tdata = np.genfromtxt(datasetLocation,delimiter=\",\",usecols=r...
[ 0 ]
import sys import memo from StringIO import StringIO import inspect alternate_dict = {} alternate_dict['cartesian_to_polar'] = ['cartesian_to_polar','cartesianToPolar','cartesion_to_polar','Polar_Coordinates'] alternate_dict['mercator'] = ['mercator','mercator_projection','mecartor','Mercator','Mercator_projection'] ...
normal
{ "blob_id": "eedd909e777a4127b5fd55108805314b3b196dd1", "index": 5222, "step-1": "import sys\nimport memo \nfrom StringIO import StringIO\nimport inspect\n\nalternate_dict = {}\nalternate_dict['cartesian_to_polar'] = ['cartesian_to_polar','cartesianToPolar','cartesion_to_polar','Polar_Coordinates']\nalternate_di...
[ 0 ]
<|reserved_special_token_0|> def parse_args(): """[summary] Returns: [type]: [description] """ parser = argparse.ArgumentParser() parser.add_argument('--train_dir', help= 'directory containing spacenet7 train dataset', default= '/data/spacenet7/spacenet7/train/') parse...
flexible
{ "blob_id": "71eadf5073b5ed13c7d4a58b2aeb52f550a32238", "index": 3104, "step-1": "<mask token>\n\n\ndef parse_args():\n \"\"\"[summary]\n\n Returns:\n [type]: [description]\n \"\"\"\n parser = argparse.ArgumentParser()\n parser.add_argument('--train_dir', help=\n 'directory containin...
[ 1, 2, 3, 4, 5 ]
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools # --------------------------------...
normal
{ "blob_id": "8197d918b86f0e38fb4320434b61aa4186853af9", "index": 1131, "step-1": "<mask token>\n\n\n@register_command('sig gallery-application version show')\nclass Show(AAZCommand):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 5, 8, 9, 10, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def rob(self, num): n = len(num) if n == 0: return 0 if n == 1: return num[0] f = [0] * n f[0...
flexible
{ "blob_id": "bca0baaffefed6917939614defadf9960ffa4727", "index": 8062, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def rob(self, num):\n n = len(num)\n if n == 0:\n return 0\n if n == 1:\n return num...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ZakerNewsTab(models.Model): code = models.IntegerField(blank=True, null=True) tabName = models.CharField(db_column='tabName', max_length=20, blank= True, null=True) class Meta: managed = False db_table = 'zaker_news_tab' class BxtZbgg(models.M...
flexible
{ "blob_id": "951fafe9f1b9a3273f30d101831d1e59e26fe85d", "index": 1535, "step-1": "<mask token>\n\n\nclass ZakerNewsTab(models.Model):\n code = models.IntegerField(blank=True, null=True)\n tabName = models.CharField(db_column='tabName', max_length=20, blank=\n True, null=True)\n\n\n class Meta:\n ...
[ 4, 7, 8, 9, 10 ]
from faker import Faker from generators.uniform_distribution_gen import UniformDistributionGen from generators.random_relation_gen import RandomRelationGen from base.field_base import FieldBase from generators.normal_distribution_gen import NormalDistributionGen from generators.first_name_generator import FirstNameGene...
normal
{ "blob_id": "0926606a222e1277935a48ba7f0ea886fb4e298a", "index": 5234, "step-1": "<mask token>\n\n\nclass A:\n <mask token>\n\n\nclass B:\n\n def __init__(self) ->None:\n self.alpha: str = ''\n self.C: C = None\n\n\nclass C:\n\n def __init__(self) ->None:\n self.alpha: str = ''\n ...
[ 5, 6, 7, 8, 9 ]
from django.shortcuts import render, render_to_response, get_object_or_404, redirect from .models import Club from .forms import InputForm # Create your views here. def base(request): return render(request, 'VICHealth_app/base.html') def index(request): return render(request, 'VICHealth_app/index.html') def ...
normal
{ "blob_id": "b0818b545ab47c27c705f2ccfa3b9edb741602f7", "index": 4757, "step-1": "<mask token>\n\n\ndef base(request):\n return render(request, 'VICHealth_app/base.html')\n\n\n<mask token>\n\n\ndef check_activity_level(request):\n return render(request, 'VICHealth_app/check_activity_level.html')\n\n\n<mask...
[ 2, 3, 5, 6, 7 ]
#https://www.acmicpc.net/problem/2581 def isPrime(x): if x==1: return False for d in range(1,int(x**0.5)): if x==d+1: continue if x%(d+1)==0: return False else: return True N=int(input()) M=int(input()) sum=0 min=10001 for x in range(N,M+1): if i...
normal
{ "blob_id": "37d465043eddd34c4453fd7e31b08d0ba58b725f", "index": 4351, "step-1": "<mask token>\n", "step-2": "def isPrime(x):\n if x == 1:\n return False\n for d in range(1, int(x ** 0.5)):\n if x == d + 1:\n continue\n if x % (d + 1) == 0:\n return False\n e...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.random.seed(seed) <|reserved_special_token_0|> np.random.seed(params['seed']) <|reserved_special_token_0|> for i in range(n_goals): sp_name = possible_objects[i] if use_dataset_goals: object_locations[sp_name] =...
flexible
{ "blob_id": "34a456efc72b303aed5f722bb415d30ff62addab", "index": 7391, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(seed)\n<mask token>\nnp.random.seed(params['seed'])\n<mask token>\nfor i in range(n_goals):\n sp_name = possible_objects[i]\n if use_dataset_goals:\n object_lo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get(isamAppliance, check_mode=False, force=False): """ Get information on existing snapshots """ return isamAppliance.invoke_get('Retrieving snapshots', '/snapshots') <|reserved_special_token_0|> def search(isamAppliance, comment, check_mode=False, force=False): ...
flexible
{ "blob_id": "23066cd644826bcfef1ef41f154924ac89e12069", "index": 2081, "step-1": "<mask token>\n\n\ndef get(isamAppliance, check_mode=False, force=False):\n \"\"\"\n Get information on existing snapshots\n \"\"\"\n return isamAppliance.invoke_get('Retrieving snapshots', '/snapshots')\n\n\n<mask token...
[ 9, 12, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def processToken(token): idPattern1 = re.compile('^([$]|[|]|[a-z])[A-Z0-9]*$') idPattern2 = re.compile('^([|][A-Z0-9]*[|])$') intPattern = re.compile('^(%)([0-9]|[A-Fa-f])+$') fpPattern = re.compile('^[0-9]+[.][0...
flexible
{ "blob_id": "6d543e9e24debaff7640006a3836c59ec0096255", "index": 5205, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef processToken(token):\n idPattern1 = re.compile('^([$]|[|]|[a-z])[A-Z0-9]*$')\n idPattern2 = re.compile('^([|][A-Z0-9]*[|])$')\n intPattern = re.compile('^(%)([0-9]|[A-Fa-...
[ 0, 1, 3, 4, 5 ]
<|reserved_special_token_0|> class BatchViewSet(viewsets.ModelViewSet): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def perform_destroy(self, instance): """ perform_destroy is used to performance a logic delete """ instance.is...
flexible
{ "blob_id": "3d0fe0c11e62a03b4701efb19e1c15272ccc985e", "index": 3315, "step-1": "<mask token>\n\n\nclass BatchViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n\n def perform_destroy(self, instance):\n \"\"\"\n perform_destroy is used to performance a logic ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^api/price/(?P<pk>[0-9]+)$', views.product_price), url( '^api/price_history/(?P<pk>[0-9]+)$', views.product_history)] urlpatterns = format_suffix_patterns(urlpatterns) <|reserved_special_token_1|> from d...
flexible
{ "blob_id": "9816a8265bcdb8c099f599efbe1cfe1a554e71f5", "index": 8396, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^api/price/(?P<pk>[0-9]+)$', views.product_price), url(\n '^api/price_history/(?P<pk>[0-9]+)$', views.product_history)]\nurlpatterns = format_suffix_patterns(urlpat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def makeimage(text, point_size=100, width=30): tw = textwrap.TextWrapper(width=width) text = '\n'.join(a.replace('\\n', '\n') for a in tw.wrap(text)) filename = ''.join(c for c in text.replace(' ', '-') if c.isalpha() or c.isdigit() or c in ['-', '_']) os.system(CO...
flexible
{ "blob_id": "a486ec6b27a6b84e454a1bed096be9fe22d91612", "index": 1561, "step-1": "<mask token>\n\n\ndef makeimage(text, point_size=100, width=30):\n tw = textwrap.TextWrapper(width=width)\n text = '\\n'.join(a.replace('\\\\n', '\\n') for a in tw.wrap(text))\n filename = ''.join(c for c in text.replace('...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # coding=utf-8 operators = ['-', '~', '++', '--', '*', '!', '/', '*', '%', '+', '-', '>', '>=', '<', '<=', '==', '!=', '&&', '||', '='] types = ['int ', 'double ', 'float ', 'char '] toDelete = types + ['struct '] toRepleace = [('printf(', 'print('), ('++', ' += 1'), ('--', ' -= 1')...
normal
{ "blob_id": "082e3350c5827ff2ca909084f2d6a206ae21a7e6", "index": 3240, "step-1": "<mask token>\n\n\ndef isChar(c):\n return c > 'a' and c < 'z' or c > 'A' and c < 'Z'\n\n\ndef isOperator(c):\n return c in operators\n\n\ndef isDefun(line):\n return '(' in line and ')' in line and sum([(i in line) for i i...
[ 10, 12, 15, 16, 17 ]
<|reserved_special_token_0|> def decode_contract_call(contract_abi: list, call_data: str): call_data_bin = decode_hex(call_data) method_signature = call_data_bin[:4] for description in contract_abi: if description.get('type') != 'function': continue method_name = normalize_abi_...
flexible
{ "blob_id": "6437cb90ebaed7cf59df780062ebccf77fcef084", "index": 4123, "step-1": "<mask token>\n\n\ndef decode_contract_call(contract_abi: list, call_data: str):\n call_data_bin = decode_hex(call_data)\n method_signature = call_data_bin[:4]\n for description in contract_abi:\n if description.get(...
[ 1, 2, 3, 4, 5 ]
import os, sys top=sys.argv[1] max=int(sys.argv[2]) cnts={} for d, dirs, files in os.walk(top): for f in files: i=f.find(".") if i ==-1: i=0 suf=f[i:] rec=cnts.setdefault(suf, [0,0]) fn=d+'/'+f if os.path.islink(fn): sz=0 else: sz=o...
normal
{ "blob_id": "06aa2d261e31dfe2f0ef66dca01c1fe3db1ca94e", "index": 7940, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor d, dirs, files in os.walk(top):\n for f in files:\n i = f.find('.')\n if i == -1:\n i = 0\n suf = f[i:]\n rec = cnts.setdefault(suf, [0, 0])\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @login_required def lessons_overview(request): if request.method == 'POST': if request.user.is_staff: school_class = SchoolClass.objects.get(id=request.POST['class_id']) school_class.password = request.POST['class_pwd'] school_class.save() ...
flexible
{ "blob_id": "ee417c5fff858d26ca60a78dffe4cff503a6f2b5", "index": 6824, "step-1": "<mask token>\n\n\n@login_required\ndef lessons_overview(request):\n if request.method == 'POST':\n if request.user.is_staff:\n school_class = SchoolClass.objects.get(id=request.POST['class_id'])\n sc...
[ 7, 8, 9, 10, 11 ]
def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance): # Calculate the slope and distance between two Cartesian points. # # Input: # For 2-D graphs, # dist_betwn_baseElev_elv2, Distance between two elevation points (FLOAT) # baseElev, Elevation of first ...
normal
{ "blob_id": "65b30bbe737b331447235b5c640e9c3f7f6d6f8c", "index": 5851, "step-1": "<mask token>\n", "step-2": "def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance\n ):\n import math\n numer = elv2 - baseElev\n denom = dist_betwn_baseElev_elv2\n print(numer, denom)\n ...
[ 0, 1, 2 ]
import re #lines = open("input.1").read() lines = open("input.2").read() lines = lines.splitlines() moves = {} moves["nw"] = [-1, -1] moves["ne"] = [ 0, -1] moves["w"] = [-1, 0] moves["e"] = [ 1, 0] moves["sw"] = [ 0, 1] moves["se"] = [ 1, 1] tiles = {} def fliptile(tile): if tile == "B": tile = "...
normal
{ "blob_id": "167c36627c7c3377266bde266e610792ba29b3e4", "index": 3808, "step-1": "import re\n\n#lines = open(\"input.1\").read()\nlines = open(\"input.2\").read()\nlines = lines.splitlines()\n\nmoves = {}\nmoves[\"nw\"] = [-1, -1]\nmoves[\"ne\"] = [ 0, -1]\nmoves[\"w\"] = [-1, 0]\nmoves[\"e\"] = [ 1, 0]\nmov...
[ 0 ]
<|reserved_special_token_0|> def check_passport(text): arr = text.split() dct = {} for elem in arr: key = elem.split(':')[0] val = elem.split(':')[1] dct[key] = val try: if len(dct['byr']) != 4 or int(dct['byr']) < 1920 or int(dct['byr'] ) > 2002: ...
flexible
{ "blob_id": "166329c967e83806e3482179a56ac7e5541d5010", "index": 1589, "step-1": "<mask token>\n\n\ndef check_passport(text):\n arr = text.split()\n dct = {}\n for elem in arr:\n key = elem.split(':')[0]\n val = elem.split(':')[1]\n dct[key] = val\n try:\n if len(dct['byr'...
[ 1, 2, 3, 4, 5 ]
# python /Users/lawrie_6strings/be_professional_pythonist/control_string.py # -*- coding: utf-8 -*- # 文字列を3行で書いてみたい場合 """ どないやねん。 最近の若いもんは、 ようやるやんけ。 """ # 文字列の特定の文字を取得したい場合は,インデックスを指定してあげることでなんとかする。 word = "what's up" print(word[0]) # 書式化 name = "lady gaga" print("こんにちわ、私の名前は {} です。".format(name)) "複数の文字列を挿入することもできる...
normal
{ "blob_id": "0e05eed2d6bc723fd8379e436621a6eba4aa5ab2", "index": 1929, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(word[0])\n<mask token>\nprint('こんにちわ、私の名前は {} です。'.format(name))\n<mask token>\nprint('{}/{}/{}'.format(year, month, day))\nfor i in range(0, 5):\n print('kamyu'[i])\nprint('aldo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Event(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "170716ccaaf45db2ee974de260883a8d70513f52", "index": 7583, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Event(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask t...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CartAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CartAdmin(admin.ModelAdmin): list_display = 'user_i...
flexible
{ "blob_id": "222948fb0a991bb6d7faa186c7442a303b88290b", "index": 7184, "step-1": "<mask token>\n\n\nclass CartAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass CartAdmin(admin.ModelAdmin):\n list_display = 'user_id', 'good...
[ 1, 2, 3, 4, 5 ]
# Python implementation of Bubble Sort def bubbleSort(arr): k = len(arr) # Traverse through all elements for i in range(k): # Last i elements are already in correct place for j in range(0, k - i - 1): # Swap if element is greater than next element if arr[j] > arr[j ...
normal
{ "blob_id": "178f9dcd9cbea140abebd509b56979417b5d7503", "index": 6785, "step-1": "<mask token>\n", "step-2": "def bubbleSort(arr):\n k = len(arr)\n for i in range(k):\n for j in range(0, k - i - 1):\n if arr[j] > arr[j + 1]:\n arr[j], arr[j + 1] = arr[j + 1], arr[j]\n\n\n...
[ 0, 1, 2, 3, 4 ]
#print 'g' class Client: def __init__(self, mechanize, WEBSERVICE_IP,WEBSERVICE_PORT, FORM_INPUT_PATH, dat , data_id = 'data', rasp_id_id = 'rasp_id',password = 'pass'): self.WEBSERVICE_PORT = WEBSERVICE_PORT self.mechanize = mechanize self.WEBSERVICE_IP = WEBSERVICE_IP self.FORM_INPUT_P...
normal
{ "blob_id": "3366d1d4ecc4cc9f971dff0c8adfbadc5511cc9e", "index": 5403, "step-1": "#print 'g'\nclass Client:\n def __init__(self, mechanize, WEBSERVICE_IP,WEBSERVICE_PORT, FORM_INPUT_PATH, dat , data_id = 'data', rasp_id_id = 'rasp_id',password = 'pass'):\n self.WEBSERVICE_PORT = WEBSERVICE_PORT\n ...
[ 0 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import CELERY_TIMEZONE = 'Asia/Shanghai' # CELERY_RESULT_BACKEND='redis://localhost:6379/1' # BROKER_URL='redis://localhost:6379/2' BROKER_BACKEND = 'mongodb' # mongodb作为任务队列(或者说是缓存) <<<<<<< HEAD BROKER_URL = 'mongodb://10.6.0.149:27017/' ...
normal
{ "blob_id": "9f01483aaa744972fae358577e6f093bd491f357", "index": 7514, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nCELERY_TIMEZONE = 'Asia/Shanghai'\n# CELERY_RESULT_BACKEND='redis://localhost:6379/1'\n# BROKER_URL='redis://localhost:6379/2'\nBROKER_BACKEN...
[ 0 ]
""" Name: Thomas Scola lab1.py Problem: This function calculates the area of a rectangle """ '''def calc_area():''' def calc_rec_area(): length = eval(input("Enter the length: ")) width = eval(input("Enter the width: ")) area = length * width print("Area =", area) def calc_rec_vol():...
normal
{ "blob_id": "076e10b3741542b7137f6ac517dba482f545b123", "index": 2154, "step-1": "<mask token>\n\n\ndef calc_rec_area():\n length = eval(input('Enter the length: '))\n width = eval(input('Enter the width: '))\n area = length * width\n print('Area =', area)\n\n\ndef calc_rec_vol():\n lengthh = eval...
[ 2, 3, 4, 5, 6 ]