code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ n1 = len(s) n2 = len(t) if n1 ...
flexible
{ "blob_id": "7fdddf98fc7b588e9b8816ffa22bc24f715d7efe", "index": 5210, "step-1": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution(object):\n\n def isIsomorphic(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: bool\n \"...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ Написать программу, которая принимает строку и выводит строку без пробелов и ее длину. Для удаления пробелов реализовать доп функцию. """
flexible
{ "blob_id": "1eab2ddda6fdd71db372e978caa6e7d24c7fe78e", "index": 7724, "step-1": "<mask token>\n", "step-2": "\"\"\"\n Написать программу, которая принимает строку\n и выводит строку без пробелов и ее длину.\n Для удаления пробелов реализовать доп функцию.\n\"\"\"", "step-3": null, "step-4": null,...
[ 0, 1 ]
<|reserved_special_token_0|> class ConfigApp(admin.MConfigHandler): <|reserved_special_token_0|> def handleList(self, confInfo): confDict = self.readConf('appsetup') if None != confDict: for stanza, settings in confDict.items(): for key, val in settings.items(): ...
flexible
{ "blob_id": "8d6c58e9ef4e14a089a7eb33a92214d081ed7692", "index": 8462, "step-1": "<mask token>\n\n\nclass ConfigApp(admin.MConfigHandler):\n <mask token>\n\n def handleList(self, confInfo):\n confDict = self.readConf('appsetup')\n if None != confDict:\n for stanza, settings in conf...
[ 3, 4, 5, 6, 7 ]
from __future__ import absolute_import, division, print_function import numbers import torch from torch.distributions import constraints from pyro.distributions.distribution import Distribution from pyro.distributions.score_parts import ScoreParts from pyro.distributions.util import broadcast_shape, sum_rightmost ...
normal
{ "blob_id": "0f0ea6f07f9a082042ed9aff7a95d372c32b5a13", "index": 1897, "step-1": "<mask token>\n\n\nclass ReshapedDistribution(TorchDistribution):\n <mask token>\n <mask token>\n\n def __init__(self, base_dist, sample_shape=torch.Size(),\n reinterpreted_batch_ndims=0):\n sample_shape = tor...
[ 27, 35, 36, 39, 44 ]
###########Seq_Profile_Blast_Parser_tool################################ import csv import time import re import os import sys from collections import Counter import operator from fractions import * import glob import ntpath from collections import defaultdict path = open('config.txt').read().splitlines()[0].split('...
normal
{ "blob_id": "7eb8fe491a88bcfadf2a38eaa158b74b21514a1c", "index": 8431, "step-1": "###########Seq_Profile_Blast_Parser_tool################################\nimport csv\nimport time\nimport re\nimport os\nimport sys\nfrom collections import Counter\nimport operator\nfrom fractions import *\nimport glob\nimport ntp...
[ 0 ]
'''It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. ''' import common import itertools def digits(x): return set(int(d) for d in str(x)) commo...
normal
{ "blob_id": "2ec8b9a92f8dd42faf99f0cd569ebf356e12c1d6", "index": 8042, "step-1": "<mask token>\n\n\ndef digits(x):\n return set(int(d) for d in str(x))\n\n\n<mask token>\n\n\ndef euler052():\n multiples = range(2, 7)\n for i in itertools.count(10 ** 5):\n if same_digits_as_multiples(i, multiples)...
[ 2, 3, 4, 5, 6 ]
n,m=map(int,input().split()) l=list(map(int,input().split())) t=0 result=[0 for i in range(0,n)] result.insert(0,1) while(t<m): #print(t) for i in range(l[t],n+1): result[i]=result[i]+result[i-l[t]] t=t+1 print(result[-1]) 0 1 2 3 4 1 [1,1,1,1,1] 2 [1 1 2 2 3] 3 [...
normal
{ "blob_id": "56640454efce16e0c873d557ac130775a4a2ad8d", "index": 6734, "step-1": "n,m=map(int,input().split())\r\nl=list(map(int,input().split()))\r\nt=0\r\nresult=[0 for i in range(0,n)]\r\nresult.insert(0,1)\r\nwhile(t<m):\r\n #print(t)\r\n for i in range(l[t],n+1):\r\n result[i]=result[i]+result[...
[ 0 ]
<|reserved_special_token_0|> def cloud(user_id): wall = tools.get_all('wall.get', 100, {'owner_id': user_id})['items'] wall = list(filter(lambda x: datetime.fromtimestamp(x['date']).year == current_year, wall)) tokenizer = RegexpTokenizer('[а-яА-ЯёЁ]+') morph = pymorphy2.MorphAnalyzer() d...
flexible
{ "blob_id": "03ce69924c885e59e40689dc63e50d54b89649f7", "index": 2924, "step-1": "<mask token>\n\n\ndef cloud(user_id):\n wall = tools.get_all('wall.get', 100, {'owner_id': user_id})['items']\n wall = list(filter(lambda x: datetime.fromtimestamp(x['date']).year ==\n current_year, wall))\n tokeniz...
[ 2, 4, 5, 6, 7 ]
import text nan="" section_words = {'start': -1, '1.1': 17, '1.2': 38, '1.3': 55, '1.4': 76, '1.5': 95, '1.6': 114, '1.7': 133, '1.8': 151, '1.9': 170, '1.10': 190, '1.11': 209, '1.12': 233, '1.13': 257, '1.14': 277, '1.15': 299, '1.16': 320, '1.17': 341, '1.18': 364, '1.19': 385, '1.20': 405, '1.21': 428, '2.1': 451, ...
normal
{ "blob_id": "8a0c0f5ca6a965e07f59a6c88d4dd335310cbdfc", "index": 9530, "step-1": "<mask token>\n", "step-2": "<mask token>\nnan = ''\nsection_words = {'start': -1, '1.1': 17, '1.2': 38, '1.3': 55, '1.4': 76,\n '1.5': 95, '1.6': 114, '1.7': 133, '1.8': 151, '1.9': 170, '1.10': 190,\n '1.11': 209, '1.12': ...
[ 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": "20f56ff484321a7d623cead4315e5a6b3b0653a7", "index": 2720, "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 = [('monitoring'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def backend_login(title, use_auth_info, use_login_data, settings=None): api.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION) nex_token = api.get_nex_token(title.GAME_SERVER_ID) auth_info = None login_data = None if use_auth_info: auth_info = authentication.A...
flexible
{ "blob_id": "43315abf9e096cdca89ed7f4de976d2706ff9c20", "index": 9234, "step-1": "<mask token>\n\n\ndef backend_login(title, use_auth_info, use_login_data, settings=None):\n api.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION)\n nex_token = api.get_nex_token(title.GAME_SERVER_ID)\n auth_info = None\n...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python class Bob(object): def __init__(self): self.question_response = "Sure." self.yell_response = "Woah, chill out!" self.silent_response = "Fine. Be that way!" self.whatever = "Whatever." def hey(self, question): if not(question) or question.strip()=='': ...
normal
{ "blob_id": "7ff7da216bdda5c30bf7c973c82886035b31247c", "index": 4093, "step-1": "<mask token>\n", "step-2": "class Bob(object):\n <mask token>\n <mask token>\n", "step-3": "class Bob(object):\n <mask token>\n\n def hey(self, question):\n if not question or question.strip() == '':\n ...
[ 0, 1, 2, 3, 4 ]
from sys import argv from pyspark import SparkContext import json import re import math from _datetime import datetime start_time = datetime.now() input_file = argv[1] model_file = argv[2] stopwords = argv[3] sc = SparkContext(appName='inf553') lines = sc.textFile(input_file).map(lambda x: json.loads(x)) stopwords = sc...
normal
{ "blob_id": "e877f16e604682488d85142174ce4f3f6cee3f18", "index": 7882, "step-1": "<mask token>\n\n\ndef tf_idf(words):\n word_dict = {}\n for w in words:\n if w in word_dict.keys():\n word_dict[w] += 1\n else:\n word_dict[w] = 1\n max_freq = max(word_dict.values())\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def filter(txt): output = [] for t in txt: if t == '(' or t == ')' or t == '[' or t == ']': output.append(t) return output <|reserved_special_token_0|> <|reserved_special_token_1|> def filter(txt): output = [] for ...
flexible
{ "blob_id": "9ca769ae8bbabee20b5dd4d75ab91d3c30e8d1bf", "index": 8387, "step-1": "<mask token>\n", "step-2": "def filter(txt):\n output = []\n for t in txt:\n if t == '(' or t == ')' or t == '[' or t == ']':\n output.append(t)\n return output\n\n\n<mask token>\n", "step-3": "def fi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ax.plot(times, result.expect[0]) ax.plot(times, result.expect[1]) ax.set_xlabel('Time') ax.set_ylabel('Expectation values') ax.legend(('Sigma-Z', 'Sigma-Y')) plt.show() <|reserved_special_token_1|> times = np.linspace(0.0, 10.0...
flexible
{ "blob_id": "8474205d49aef2d18755fc1a25a82718962f4120", "index": 6912, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.plot(times, result.expect[0])\nax.plot(times, result.expect[1])\nax.set_xlabel('Time')\nax.set_ylabel('Expectation values')\nax.legend(('Sigma-Z', 'Sigma-Y'))\nplt.show()\n", "step-3...
[ 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": "7d25a8eb61b6fb9069616745c2b68fd3ceeca9fb", "index": 6600, "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 = [('account', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RedisHandler(Handler): <|reserved_special_token_0|> <|reserved_special_token_0|> async def emit(self, record: ExtendedLogRecord) ->None: await self.redis_client.rpush(self.key, self.format(record)) async def close(self) ->None: self.redis_client.clo...
flexible
{ "blob_id": "fe581ca8176fed01309f0d852f72564863aa0895", "index": 8413, "step-1": "<mask token>\n\n\nclass RedisHandler(Handler):\n <mask token>\n <mask token>\n\n async def emit(self, record: ExtendedLogRecord) ->None:\n await self.redis_client.rpush(self.key, self.format(record))\n\n async de...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_app(**config_overrides): app = Flask(__name__) app.config.from_pyfile('settings.py') app.config.update(config_overrides) db.init_app(app) from user.views import user_app app.register_blueprint(...
flexible
{ "blob_id": "8b7fb0789d197e50d7bdde2791b6fac964782469", "index": 4001, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app(**config_overrides):\n app = Flask(__name__)\n app.config.from_pyfile('settings.py')\n app.config.update(config_overrides)\n db.init_app(app)\n from user...
[ 0, 1, 2, 3 ]
# Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 B # >= 0.7 C # >= 0.6 D # < 0.6 F # Vinayak Nayak # 27...
normal
{ "blob_id": "6f253da5dc1caa504a3a8aadae7bce6537b5c8c6", "index": 6237, "step-1": "<mask token>\n", "step-2": "try:\n i = float(input('Enter the score : '))\n if i > 1 or i < 0:\n print(\"Entered score isn't valid.\")\n elif i < 0.6:\n print('Grade: F')\n elif i < 0.7:\n print('...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def index(): headline = 'Hello world from a variable!' return render_template('index.html', headline=headline) @app.route('/bye/') def bye(): headline = 'Goodbye!' return render_template('index....
flexible
{ "blob_id": "83bbb6433d1577be869bf840bdd42aa86e415da6", "index": 9328, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n headline = 'Hello world from a variable!'\n return render_template('index.html', headline=headline)\n\n\n@app.route('/bye/')\ndef bye():\n hea...
[ 0, 2, 3, 4, 5 ]
from django.contrib.staticfiles.storage import CachedFilesMixin from storages.backends.s3boto3 import S3Boto3Storage class CachedS3Storage(CachedFilesMixin, S3Boto3Storage): pass StaticRootS3BotoStorage = lambda : CachedS3Storage(location='static') MediaRootS3BotoStorage = lambda : S3Boto3Storage(location='medi...
normal
{ "blob_id": "e99ff1c75d5108efc8d587d4533c34eeb15c6978", "index": 9425, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CachedS3Storage(CachedFilesMixin, S3Boto3Storage):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass CachedS3Storage(CachedFilesMixin, S3Boto3Storage):\n p...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def calculate_psf_tilts(): """ Calculate the tilt of the psf at the center of each column using all binned pixels in the given wavelength calibration file for both orders and save to file """ for order in [1, 2]: path = 'files/SOSS_PSF_tilt_order{}.npy'.for...
flexible
{ "blob_id": "9f478df4ff19cfe6c6559b6489c874d49377b90e", "index": 4949, "step-1": "<mask token>\n\n\ndef calculate_psf_tilts():\n \"\"\"\n Calculate the tilt of the psf at the center of each column\n using all binned pixels in the given wavelength calibration file\n for both orders and save to file\n ...
[ 7, 10, 11, 13, 14 ]
<|reserved_special_token_0|> class Heiyan2Spider(scrapy.Spider): <|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 Heiyan2Spider(scrapy.Spider): <|reserved_special...
flexible
{ "blob_id": "d13c6d71bb871496b0c6ad2451a2f561484e7c68", "index": 9634, "step-1": "<mask token>\n\n\nclass Heiyan2Spider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Heiyan2Spider(scrapy.Spider):\n <mask token>\n <mask token...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class GenerateMachineConfig(unittest.TestCase): def setUp(self): self.machine_configs = [] for machine_config_path in glob.glob( f'{ASSETS_DIR}/openshift/99_openshift-machineconfig_99-dual-stack-*.yaml' ): with open(machine_config_p...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TooManyArgsStrategy(CommandStrategy): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TooManyArgsStrategy(CommandStrategy): def apply(self): print('Too man...
flexible
{ "blob_id": "afd72ce2d9598f92937f3038eb0ef49b740b9977", "index": 6846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n\n def apply(self):\n print('To...
[ 0, 1, 2, 3 ]
def remove_zeros(given_list): list_without_zero = [] for element in given_list: if element != 0: list_without_zero.append(element) return list_without_zero def sort_desc(given_list): return sorted(given_list, key=None, reverse=True) def length_check(n, given_list): return n >...
flexible
{ "blob_id": "0779e516e35c41acf0529961e11541dfd1320749", "index": 6501, "step-1": "def remove_zeros(given_list):\n list_without_zero = []\n for element in given_list:\n if element != 0:\n list_without_zero.append(element)\n return list_without_zero\n\n\ndef sort_desc(given_list):\n r...
[ 5, 7, 8, 10, 11 ]
n=int(input("enter a number")) cp=n rev=0 sum=0 while(n>0): rev=n%10 sum+=rev**3 n=n//10 if(cp==sum): print("the given no is amstrong ") else: print("the given no is not amstrong ")
normal
{ "blob_id": "a8190c7c8926df18ee9439922ce8e3241e9a6140", "index": 4550, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile n > 0:\n rev = n % 10\n sum += rev ** 3\n n = n // 10\nif cp == sum:\n print('the given no is amstrong ')\nelse:\n print('the given no is not amstrong ')\n", "step-...
[ 0, 1, 2, 3 ]
### Script to convert matlab structure file (/motiongan/data/style-dataset/style_motion_database.mat') import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import argparse import math import numpy as np from collections import OrderedDict import scipy.io import pickle from core.utils.eul...
normal
{ "blob_id": "f2dac8b454805829cf5dbe2efe3c0de805ae4cb5", "index": 1727, "step-1": "<mask token>\n\n\ndef load_skeleton(mat_path):\n mat_data = scipy.io.loadmat(mat_path)['skel'][0, 0]\n skeleton = OrderedDict()\n bone_names = mat_data[1].tolist()\n for i, bone in enumerate(bone_names):\n bone =...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def divisible_by(numbers, divisor): res = [] for e in numbers: if e % divisor == 0: res.append(e) return res
flexible
{ "blob_id": "d7ff5bf5d8f397500fcac30b73f469316c908f15", "index": 5042, "step-1": "<mask token>\n", "step-2": "def divisible_by(numbers, divisor):\n res = []\n for e in numbers:\n if e % divisor == 0:\n res.append(e)\n return res\n", "step-3": null, "step-4": null, "step-5": nul...
[ 0, 1 ]
<|reserved_special_token_0|> def loadDataSet(): """解析文件 Return: dataMat 文档列表 [[1,x1,x2]...]; labelMat 类别标签列表[1,0,1...] @author:VPrincekin """ dataMat = [] labelMat = [] fr = open('testSet.txt') for line in fr.readlines(): lineArr = line.strip().split() dataMat.append([...
flexible
{ "blob_id": "d47ea763ac1a4981fc5dee67cd396ad49570f923", "index": 7821, "step-1": "<mask token>\n\n\ndef loadDataSet():\n \"\"\"解析文件\n Return: dataMat 文档列表 [[1,x1,x2]...]; labelMat 类别标签列表[1,0,1...]\n @author:VPrincekin\n \"\"\"\n dataMat = []\n labelMat = []\n fr = open('testSet.txt')\n f...
[ 4, 6, 8, 9, 11 ]
from ROOT import * import math import os,sys,time,glob,fnmatch import argparse import ROOT import sys sys.path.append("utils") from moments import * from dirhandle import * from plothandle import * from AnalysisGeneratorMT import * def doAnalysis( blabla): return blabla.DoThreatdAnalysis() if __name__ =...
normal
{ "blob_id": "7db31940aea27c10057e2ce1e02410994bd2039b", "index": 3328, "step-1": "from ROOT import *\nimport math\nimport os,sys,time,glob,fnmatch\nimport argparse\nimport ROOT\nimport sys\nsys.path.append(\"utils\")\nfrom moments import *\nfrom dirhandle import *\nfrom plothandle import *\nfrom AnalysisGene...
[ 0 ]
# adventofcode.com # day19 from collections import defaultdict INPUTFILE = 'input/input19' TEST = False TESTCASE = ('HOH', ['H => HO\n', 'H => OH\n', 'O => HH\n'], ['OHOH', 'HOOH', 'HHHH', 'HOHO']) def find_idx(string, substring): """ iterator that returns the index of the next occurence of substring wr...
normal
{ "blob_id": "e6fa1202d829fb553423998cdbad13684405437c", "index": 8483, "step-1": "# adventofcode.com\n# day19\n\nfrom collections import defaultdict\n\nINPUTFILE = 'input/input19'\n\nTEST = False\nTESTCASE = ('HOH', ['H => HO\\n', 'H => OH\\n', 'O => HH\\n'], ['OHOH', 'HOOH', 'HHHH', 'HOHO'])\n\ndef find_idx(str...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': keys = {'a', 'e', 'i', 'o', 'u', 'y'} values = [1] dictionnaire = {cle: list(values) for cle in keys} print('dictionnaire : ', dictionnaire) values.append(2) for cle in dictionna...
flexible
{ "blob_id": "468c070aebff3124927c5595d68bb94321dd75e5", "index": 4406, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n keys = {'a', 'e', 'i', 'o', 'u', 'y'}\n values = [1]\n dictionnaire = {cle: list(values) for cle in keys}\n print('dictionnaire : ', dictionnaire...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ConvLayer(object): <|reserved_special_token_0|> def apply(self, h): if self.activation_fn == False: if self.normalizer_fn == False: if self.dropout == False: h_out = slim.conv2d(h, num_outputs=self.num_outputs, ...
flexible
{ "blob_id": "9da6bfa614d64956a302abbfeeea30c0339e9db3", "index": 5583, "step-1": "<mask token>\n\n\nclass ConvLayer(object):\n <mask token>\n\n def apply(self, h):\n if self.activation_fn == False:\n if self.normalizer_fn == False:\n if self.dropout == False:\n ...
[ 19, 21, 23, 33, 35 ]
<|reserved_special_token_0|> def appendimages(im1, im2): """ Return a new image that appends the two images side-by-side. """ rows1 = im1.shape[0] rows2 = im2.shape[0] if rows1 < rows2: im1 = np.concatenate((im1, zeros((rows2 - rows1, im1.shape[1]))), axis=0) elif rows1 > rows2...
flexible
{ "blob_id": "c3e313805c6f91f9aac77922edfd09650143f905", "index": 4862, "step-1": "<mask token>\n\n\ndef appendimages(im1, im2):\n \"\"\" Return a new image that appends the two images side-by-side. \"\"\"\n rows1 = im1.shape[0]\n rows2 = im2.shape[0]\n if rows1 < rows2:\n im1 = np.concatenate(...
[ 9, 11, 12, 15, 18 ]
# Generated by Django 3.1.6 on 2021-02-15 12:13 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Book', fields=[ ...
normal
{ "blob_id": "6239cb08509b8e84a88db95479af05845876d9b6", "index": 1502, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PrivateFile2(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PrivateFile(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> class PrivateFile2(models...
flexible
{ "blob_id": "e12c397ca1ae91ce314cda5fe2cd8e0ec4cfa861", "index": 2199, "step-1": "<mask token>\n\n\nclass PrivateFile2(models.Model):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PrivateFile(models.Model):\n <mask token>\n <mask token>\n\n\nclass PrivateFile2(models.Model):\...
[ 1, 3, 4, 5, 6 ]
from selenium.webdriver.common.by import By class BasePageLocators: LOGIN_LINK = (By.CSS_SELECTOR, "#login_link") BASKET_LINK = (By.CSS_SELECTOR, '[class="btn btn-default"]:nth-child(1)') USER_ICON = (By.CSS_SELECTOR, ".icon-user") class LoginPageLocators: LOG_IN_FORM = (By.CSS_SELECTOR, "#login_for...
normal
{ "blob_id": "5d3b9005b8924da36a5885201339aa41082034cd", "index": 8692, "step-1": "<mask token>\n\n\nclass BasketPageLocators:\n BASKET_STATUS = By.CSS_SELECTOR, '#content_inner'\n NAME_OF_ADDED_SHIPMENT = (By.CSS_SELECTOR,\n '#messages .alert:nth-child(1) > .alertinner strong')\n PRICE_OF_ADDED_S...
[ 4, 5, 6, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for index in range(len(train_folder_list)): path = os.path.join(TRAIN_DIR, train_folder_list[index]) path = path + '/' img_list = os.listdir(path) for img in img_list: img_path = os.path.join(path, img) ...
flexible
{ "blob_id": "01339324ad1a11aff062e8b27efabf27c97157fb", "index": 9908, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor index in range(len(train_folder_list)):\n path = os.path.join(TRAIN_DIR, train_folder_list[index])\n path = path + '/'\n img_list = os.listdir(path)\n for img in img_list:...
[ 0, 1, 2, 3, 4 ]
from typing import Union, Tuple import numpy as np from dispim import Volume def extract_3d(data: np.ndarray, center: np.ndarray, half_size: int): """ Extract an area around a point in a 3d numpy array, zero padded as necessary such that the specified point is at the center :param data: The numpy a...
normal
{ "blob_id": "26f486131bdf514cd8e41f75d414fe647eaf1140", "index": 9243, "step-1": "<mask token>\n\n\ndef extract_3d(data: np.ndarray, center: np.ndarray, half_size: int):\n \"\"\"\n Extract an area around a point in a 3d numpy array, zero padded as necessary such that the specified point is at the\n cent...
[ 3, 4, 5, 6, 7 ]
import numpy as np import matplotlib.pyplot as plt from math import * from scipy.integrate import * from pylab import * from scipy.integrate import quad MHD = np.zeros((80, 90, 5), dtype=float) BGI = np.zeros((80, 90, 5), dtype=float) Fp = np.zeros((80), dtype=float) AngMHD = np.zeros((90,2), dtype=floa...
normal
{ "blob_id": "660334be611c30397c2f33890e1bca1fc43bd01f", "index": 2420, "step-1": "<mask token>\n\n\ndef PMHD(p, chi, b):\n return b ** 2 / p * (1 + sin(chi) ** 2)\n\n\ndef xMHD(p, chi, b):\n return -b ** 2 / p ** 2 * sin(chi) * cos(chi)\n\n\n<mask token>\n\n\ndef xBGI(p, chi, b):\n Q = 0.7 * p / b ** 0....
[ 3, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- """ current_models - library of ionic current models implemented in Python Created on Mon Apr 10 16:30:04 2017 @author: Oliver Britton """ import os import sys import pandas as pd import numpy as np from matplotlib import pyplot as plt import seaborn as sns " Voltage clamp generator function...
normal
{ "blob_id": "012ab947f7a2c9d44f54464b3e477582ffcf3d77", "index": 5589, "step-1": "<mask token>\n\n\ndef nav17vw(Y, t, voltage_clamp_func, voltage_clamp_params):\n \"\"\" Human Nav 1.7 from Vasylyev Waxman \"\"\"\n v = voltage_clamp_func(t, voltage_clamp_params)\n m = Y[0]\n h = Y[1]\n alpha_m = 10...
[ 12, 13, 14, 15, 18 ]
<|reserved_special_token_0|> def squeezenet_fire_module(input, input_channel_small=16, input_channel_large=64): channel_axis = 3 input = Conv2D(input_channel_small, (1, 1), padding='valid')(input) input = Activation('relu')(input) input_branch_1 = Conv2D(input_channel_large, (1, 1), padding='valid...
flexible
{ "blob_id": "a5f3af6fc890f61eecb35bd157fc51bb65b4c586", "index": 3958, "step-1": "<mask token>\n\n\ndef squeezenet_fire_module(input, input_channel_small=16,\n input_channel_large=64):\n channel_axis = 3\n input = Conv2D(input_channel_small, (1, 1), padding='valid')(input)\n input = Activation('relu'...
[ 2, 4, 5, 6, 8 ]
<|reserved_special_token_0|> def adjustMotorPowers(): global slave_power global en_left global en_right global kp error = en_right + en_left slave_power -= error / kp encoders.clear() time.sleep(0.1) def readEncoder(): global en_left global en_right global right_num_revs ...
flexible
{ "blob_id": "00f8a56b160cab22bf73c0d2397eb2c411e8c966", "index": 7714, "step-1": "<mask token>\n\n\ndef adjustMotorPowers():\n global slave_power\n global en_left\n global en_right\n global kp\n error = en_right + en_left\n slave_power -= error / kp\n encoders.clear()\n time.sleep(0.1)\n\...
[ 2, 3, 4, 5, 6 ]
import pathlib import shutil import os import glob import pandas as pd import sqlalchemy as sqla """ SCRIPT TO FILL THE DATABASE FROM CSV ON MEGA IF LOSE DATA IN PARTICULAR DATE """ PATH = "/home/thomas/Documents/TER/AJOUTER_CSV_BDD/" folder = "test/" files_used = [] totalFiles = 0 contents = pathlib.Path(PATH+folder...
normal
{ "blob_id": "795936dad7a9e51edf0df66207a43ac4d97e9023", "index": 3781, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor path in sorted(contents):\n files_used.append(path.name)\n totalFiles += 1\nprint(files_used)\nprint(totalFiles)\n<mask token>\nfor filename in files_used:\n df = pd.read_csv...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(""" Employee Details: Employee Id:""", id, '\nName:', employee[id][ 'empname'], '\nDepartment:', employee[id]['Department'], '\nDesignation:', DA[employee[id]['Designation Code']]['designation'], '\nSalary:', em...
flexible
{ "blob_id": "fcb0fb439db77c4d57c449ec8f720dbd3fef5abc", "index": 2871, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"\"\"\n\nEmployee Details:\nEmployee Id:\"\"\", id, '\\nName:', employee[id][\n 'empname'], '\\nDepartment:', employee[id]['Department'],\n '\\nDesignation:', DA[employee[id]...
[ 0, 1, 2, 3 ]
from random import randrange from django.core.exceptions import ValidationError from django.contrib.auth import get_user_model from rest_framework import serializers from rest_framework_simplejwt.serializers import TokenObtainPairSerializer from .models import EmailValidation from ..emails.models import Ema...
normal
{ "blob_id": "9f34bf3a0bb24db428b7af1a354aec1d3a72df98", "index": 359, "step-1": "<mask token>\n\n\nclass CreatePasswordEmailValidationSerializer(serializers.Serializer):\n <mask token>\n\n def save(self):\n validation_code = randrange(10000000, 100000000)\n email = Email.objects.create(valida...
[ 15, 16, 18, 19, 21 ]
# Generated by Django 2.2.10 on 2020-05-06 14:43 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('planner', '0023_auto_20191226_1330'), ] operations = [ migrations.AddField( model_name='employee'...
normal
{ "blob_id": "c7558486fc50623f6e64b58668153b75bb6149b9", "index": 6613, "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 = [('planner', '...
[ 0, 1, 2, 3, 4 ]
from datetime import date import config import datetime import numpy import pandas import data_sources from data_sources import POPULATION, convert_to_ccaa_iso import material_line_chart import ministry_datasources HEADER = '''<html> <head> <title>{}</title> <script type="text/javascript" src="https://w...
normal
{ "blob_id": "4c5b3042a785342d6ef06fdc882e0dcf91a787c3", "index": 7816, "step-1": "<mask token>\n\n\ndef calc_accumulated_indicende_per_ccaa(report, num_days=15):\n ccaas = data_sources.get_ccaas_in_dset(report)\n dframe = report['dframe']\n num_cases = dframe['num_casos']\n ccaa_column = data_sources...
[ 4, 9, 10, 11, 13 ]
from flask_wtf import FlaskForm from wtforms import StringField, DateField, DecimalField class HoursForm(FlaskForm): date = StringField("Date") begins = DecimalField("Begins") ends = DecimalField("Ends") class Meta: csrf = False
normal
{ "blob_id": "b1a808e76008edec02d37ec596461e3a00a1d349", "index": 4553, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass HoursForm(FlaskForm):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n csrf = False\n", "step-3": "<mask token>\n\n\nclass HoursForm(FlaskFo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Video(ABC): def __init__(self, filename: str, *, scale: float=1, w_stretch: float=2, gradient: typing.Union[int, str]=0, verbose: int=False): if not os.path.isfile(filename): raise FileNotFound(filename) self.filename = filename self....
flexible
{ "blob_id": "24368b6c607c0524f8b52b279a6dce0fde72294b", "index": 8936, "step-1": "<mask token>\n\n\nclass Video(ABC):\n\n def __init__(self, filename: str, *, scale: float=1, w_stretch: float=2,\n gradient: typing.Union[int, str]=0, verbose: int=False):\n if not os.path.isfile(filename):\n ...
[ 4, 5, 6, 7, 8 ]
""" Problem Link: https://practice.geeksforgeeks.org/problems/palindrome/0 Given an integer, check whether it is a palindrome or not. Input: The first line of input contains an integer T denoting the number of test cases. For each test case there will be single line containing single integer N. Output: Print "Yes" ...
normal
{ "blob_id": "ea12ede51881f6e826a044df5d7aba457c434658", "index": 6050, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(int(input())):\n n = int(input())\n temp = n\n rev = 0\n while temp:\n rev = rev * 10 + temp % 10\n temp //= 10\n print('Yes' if rev == n else ...
[ 0, 1, 2 ]
""" This handy script will download all wallpapears from simpledesktops.com Requirements ============ BeautifulSoup - http://www.crummy.com/software/BeautifulSoup/ Python-Requests - http://docs.python-requests.org/en/latest/index.html Usage ===== cd /path/to/the/script/ python simpledesktops.py """ from StringIO imp...
normal
{ "blob_id": "452d5d98b6c0b82a1f4ec18f29d9710a8c0f4dc9", "index": 7371, "step-1": "\"\"\"\nThis handy script will download all wallpapears from simpledesktops.com\n\nRequirements\n============\nBeautifulSoup - http://www.crummy.com/software/BeautifulSoup/\nPython-Requests - http://docs.python-requests.org/en/late...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(N): n = int(input()) arr = collections.defaultdict(list) parent = [i for i in range(n + 1)] for i in range(n - 1): a, b = map(int, input().split()) arr[a].append(b) parent[b] ...
flexible
{ "blob_id": "d60a2d4c819f701e8e439b8839415aa2838df185", "index": 6415, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(N):\n n = int(input())\n arr = collections.defaultdict(list)\n parent = [i for i in range(n + 1)]\n for i in range(n - 1):\n a, b = map(int, input().spli...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Logins(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Logins(models.Model): create...
flexible
{ "blob_id": "9a55ccf758b4b2cc440153ab3b1f97823863a848", "index": 165, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Logins(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Logins(models.Model):\n created = models.DateTimeField(aut...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python import sys import socket def handle_connection(sock): do_close = False while 1: try: data = sock.recv(4096) if not data: # closed! stop monitoring this socket. do_close = True break print 'd...
normal
{ "blob_id": "fde4c10e2ed0ed38d683a220e2985c3f3f336601", "index": 7258, "step-1": "#! /usr/bin/env python\nimport sys\nimport socket\n\ndef handle_connection(sock):\n do_close = False\n \n while 1:\n try:\n data = sock.recv(4096)\n if not data: # closed! stop ...
[ 0 ]
<|reserved_special_token_0|> class BaseSaver: <|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|> <|re...
flexible
{ "blob_id": "83fe635e35711c2c41d043a59d00a50cc87e69fa", "index": 7696, "step-1": "<mask token>\n\n\nclass BaseSaver:\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 <mask token...
[ 8, 15, 21, 22, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(180 / 4)
flexible
{ "blob_id": "509129052f97bb32b4ba0e71ecd7b1061d5f8da2", "index": 38, "step-1": "<mask token>\n", "step-2": "print(180 / 4)\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
#d #b #c #b,c
normal
{ "blob_id": "8ecd1d6b43027153e05c771eb7183c062319eebc", "index": 2716, "step-1": "#d\n#b\n#c\n#b,c", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
# -*- coding: utf-8 -*- class Config(object): def __init__(self): self.config_dict = { "data_path": { # "vocab_path": "../data/cnews/cnews.vocab.txt", "vocab_path": "../data/rumor/cnews.vocab.txt", # "trainingSet_path": "../data/cnews/cnews.trai...
normal
{ "blob_id": "9cb4e550a0d19b44ec8357882f353b04748b213b", "index": 2589, "step-1": "<mask token>\n", "step-2": "class Config(object):\n <mask token>\n <mask token>\n", "step-3": "class Config(object):\n <mask token>\n\n def get(self, section, name):\n return self.config_dict[section][name]\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class TflearnDataSourceExtraTemplate(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class TflearnDataSourceExtraTemplate(object): <|reserved_special_token_0|> def __init__(self, rewrite_data...
flexible
{ "blob_id": "70c084dab8469ca34b0e3e5174101111e695f1ca", "index": 6638, "step-1": "<mask token>\n", "step-2": "class TflearnDataSourceExtraTemplate(object):\n <mask token>\n <mask token>\n", "step-3": "class TflearnDataSourceExtraTemplate(object):\n <mask token>\n\n def __init__(self, rewrite_data...
[ 0, 1, 2, 3 ]
""" 2. Schreiben Sie die Anzahl von symmetrischen Paaren (xy) und (yx). """ def symetrisch(x, y): """ bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind :param x: ein Element der Liste :param y: ein Element der Liste :return: True- wenn x und y symetrisch False - sonst ...
normal
{ "blob_id": "2c6dc4d55f64d7c3c01b3f504a72904451cb4610", "index": 6532, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef symetrisch(x, y):\n \"\"\"\n bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind\n :param x: ein Element der Liste\n :param y: ein Element der Liste\n :...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Circle: <|reserved_special_token_0|> def __init__(self, radius=1): self.radius = radius self.area = radius * radius * Circle.pi def get_circumference(self): return self.radius * Circle.pi * 2 <|reserved_special_token_0|> class Animal: d...
flexible
{ "blob_id": "c8137aacfb0f35c9630515442d5bdda870e9908a", "index": 4827, "step-1": "<mask token>\n\n\nclass Circle:\n <mask token>\n\n def __init__(self, radius=1):\n self.radius = radius\n self.area = radius * radius * Circle.pi\n\n def get_circumference(self):\n return self.radius *...
[ 10, 11, 13, 16, 18 ]
def filter(txt): # can be improved using regular expression output = [] for t in txt: if t == "(" or t == ")" or t == "[" or t == "]": output.append(t) return output result = [] while True: raw_input = input() line = filter(raw_input) if raw_input != ".": stack = [] err = False for l in line: ...
normal
{ "blob_id": "9ca769ae8bbabee20b5dd4d75ab91d3c30e8d1bf", "index": 8387, "step-1": "<mask token>\n", "step-2": "def filter(txt):\n output = []\n for t in txt:\n if t == '(' or t == ')' or t == '[' or t == ']':\n output.append(t)\n return output\n\n\n<mask token>\n", "step-3": "def fi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(statuses) admin.site.register(sites) admin.site.register(redirects) <|reserved_special_token_1|> from django.contrib import admin from main_app.models import sites, statuses, redirects admin.site.register(st...
flexible
{ "blob_id": "2b8ca0c8c7878536da4f31652976988cdba62d89", "index": 491, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(statuses)\nadmin.site.register(sites)\nadmin.site.register(redirects)\n", "step-3": "from django.contrib import admin\nfrom main_app.models import sites, statuses, re...
[ 0, 1, 2, 3 ]
from math import ceil n, k = map(int, input().split()) d = list(map(int, input().split())) packs = [0]*k for i in d: packs[i%k] += 1 counter = packs[0]//2 if (k % 2) == 0: counter += packs[k//2]//2 for i in range(1, ceil(k/2)): counter += min(packs[i], packs[k-i]) print(counter*2)
normal
{ "blob_id": "2226382c494af33957a44d9f1682f7deacf574a2", "index": 2075, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in d:\n packs[i % k] += 1\n<mask token>\nif k % 2 == 0:\n counter += packs[k // 2] // 2\nfor i in range(1, ceil(k / 2)):\n counter += min(packs[i], packs[k - i])\nprint(cou...
[ 0, 1, 2, 3, 4 ]
[Interactive Programming with Python - Part 1] [Arithmetic Expressions] # numbers - two types, an integer or a decimal number # two correspending data types int() and float() print 3, -1, 3.14159, -2.8 # we can convert between data types using int() and float() # note that int() take the "whole" part of a decimal n...
normal
{ "blob_id": "f1396179152641abf76256dfeab346907cb1e386", "index": 2738, "step-1": "[Interactive Programming with Python - Part 1]\n\n[Arithmetic Expressions]\n\n# numbers - two types, an integer or a decimal number\n# two correspending data types int() and float()\n\nprint 3, -1, 3.14159, -2.8\n\n# we can convert...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def compute(plus, minus, total, inp): if plus == 1 and minus == 0: print(total) return elif plus == 1 and minus == 1: print('Impossible') return elif abs(plus - minus) > total: ...
flexible
{ "blob_id": "d29c8ec737b8e962d381c8fdd0999e7e01847836", "index": 5274, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef compute(plus, minus, total, inp):\n if plus == 1 and minus == 0:\n print(total)\n return\n elif plus == 1 and minus == 1:\n print('Impossible')\n ...
[ 0, 2, 3, 4, 5 ]
from core.detector import Detector from utils.augmentations import * from torchvision.transforms.transforms import Compose from config.mask_config import * from config.train_config import model_info np.random.seed(3) colors = np.random.randint(128, 256, (100, 3)) def to_image(det): size = 512 val_trans = [...
normal
{ "blob_id": "97e7ca02d85267492a0dcbbda9d8754a0a3735a5", "index": 5315, "step-1": "<mask token>\n\n\ndef to_image(det):\n size = 512\n val_trans = [Normalization([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]\n val_trans = Compose(val_trans)\n for i in range(5, 200):\n path = f'D:/temp_data/mask/test/{i}.j...
[ 2, 3, 4, 5, 6 ]
from Store import Store from MusicProduct import MusicProduct class MusicStore(Store): def make_product(self, name): '''Overides from parent - return a new MusicProduct Object'''
normal
{ "blob_id": "0a50b31155afce2558ec066267a9fd0c56964759", "index": 5653, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MusicStore(Store):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass MusicStore(Store):\n\n def make_product(self, name):\n \"\"\"Overides from parent - retur...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def analyze_commit(row): row['conventional'] = row['lax'] = False m = re.search(STRICT, row['subj']) if m: row['conventional'] = True else: m = re.search(LAX, row['subj']) if m: row['lax'] = True if m: row['label'] = m['label...
flexible
{ "blob_id": "16446c2c5612a14d4364cbefb949da0b473f7454", "index": 7934, "step-1": "<mask token>\n\n\ndef analyze_commit(row):\n row['conventional'] = row['lax'] = False\n m = re.search(STRICT, row['subj'])\n if m:\n row['conventional'] = True\n else:\n m = re.search(LAX, row['subj'])\n ...
[ 2, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
normal
{ "blob_id": "deb8ee1d6327a6406244147a819821e8d2b2890e", "index": 1385, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
def main(): x = float(input("Coordenada x: ")) y = float(input("Coordenada y: ")) if 1 <= y <= 2 and -3 <= x <= 3: print("dentro") elif (4 <= y <= 5 or 6 <= x <= 7) and ( -4 <= x <= -3 or -2 <= x <= -1 or 1 <= x <= 2 or 3 <= x <= 4): print("dentro") e...
normal
{ "blob_id": "06cb832c3adae95fcd1d1d2d0663641d3ac671ef", "index": 9132, "step-1": "<mask token>\n", "step-2": "def main():\n x = float(input('Coordenada x: '))\n y = float(input('Coordenada y: '))\n if 1 <= y <= 2 and -3 <= x <= 3:\n print('dentro')\n elif (4 <= y <= 5 or 6 <= x <= 7) and (-4...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class k_box: def __init__(self, string=0, file=0): if string != 0: if not len(string) == 64: raise Exception('Bad len') self.__priv_key = bytes.fromhex(string) else: self.__priv_key = secrets.randbits(256).to_bytes(3...
flexible
{ "blob_id": "1ff2f06349ab1906a1649bdb83828fbdb3cf584f", "index": 4516, "step-1": "<mask token>\n\n\nclass k_box:\n\n def __init__(self, string=0, file=0):\n if string != 0:\n if not len(string) == 64:\n raise Exception('Bad len')\n self.__priv_key = bytes.fromhex(st...
[ 9, 12, 14, 16, 18 ]
from typing import List, Callable #: A list of int T = List[int] C = Callable[[int], None] # a generic alias not having a doccomment
normal
{ "blob_id": "aaee69d339cf1c14e54366633155ee57026e6487", "index": 2071, "step-1": "<mask token>\n", "step-2": "<mask token>\nT = List[int]\nC = Callable[[int], None]\n", "step-3": "from typing import List, Callable\nT = List[int]\nC = Callable[[int], None]\n", "step-4": "from typing import List, Callable\n\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BaseHandler(tornado.web.RequestHandler): <|reserved_special_token_0|> class CondaHandler(BaseHandler): def get(self, filePath): with open('packages/conda/' + filePath) as f: data = json.load(f) condaPackages = {} packages = data['packag...
flexible
{ "blob_id": "44a9bb4d74d2e694f252d8726647bca13baa4df5", "index": 853, "step-1": "<mask token>\n\n\nclass BaseHandler(tornado.web.RequestHandler):\n <mask token>\n\n\nclass CondaHandler(BaseHandler):\n\n def get(self, filePath):\n with open('packages/conda/' + filePath) as f:\n data = json...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(dir_path) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gulishop.settings') <|reserved_special_token_0|> django.setup() <|reserved_special_token_0|> for lev1 in row_data: cat1 = GoodsCategory() cat1.name...
flexible
{ "blob_id": "35ae9c86594b50bbe4a67d2cc6b20efc6f6fdc64", "index": 295, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(dir_path)\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gulishop.settings')\n<mask token>\ndjango.setup()\n<mask token>\nfor lev1 in row_data:\n cat1 = GoodsCategory...
[ 0, 1, 2, 3, 4 ]
#the initial DNA sequence dnaSequence = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' #seperating the DNA sequence at the specified location firstFragment = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' [0:22] secondFragment = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' [23:100] ...
normal
{ "blob_id": "7dc99d33023dbb13938ac413af7d3e9471fdbc3d", "index": 126, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('the original DNA sequence is', dnaSequence)\nprint('the first fragment is', firstFragment, 'and is', firstFragmentLen,\n 'letters long')\nprint('the second fragment is', secondFr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def selectionSort(arr, low, high): for i in range(len(arr)): mini = i for j in range(i + 1, len(arr)): if arr[mini] > arr[j]: mini = j arr[i], arr[mini] = arr[mini], arr[i] return arr
flexible
{ "blob_id": "c91be6cc332139c5b1e7ee5a3512482d0f8620b1", "index": 7322, "step-1": "<mask token>\n", "step-2": "def selectionSort(arr, low, high):\n for i in range(len(arr)):\n mini = i\n for j in range(i + 1, len(arr)):\n if arr[mini] > arr[j]:\n mini = j\n arr[...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def project_query_lz_main(question): txt_line = ReadTxtName(PROJECT_NAMES) for project_name in txt_line: if project_name in question: GV.SHOW = True return '我们觉得您是想查' + project_name + '项目的...
flexible
{ "blob_id": "92bbccfbfebf905965c9cb0f1a85ffaa7d0cf6b5", "index": 3796, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef project_query_lz_main(question):\n txt_line = ReadTxtName(PROJECT_NAMES)\n for project_name in txt_line:\n if project_name in question:\n GV.SHOW = True\n ...
[ 0, 1, 2, 3, 4 ]
#TODO: allow workers to pull this from cache RABBITMQ_IP = '172.23.105.82' OBJECT_CACHE_IP = "172.23.105.69" OBJECT_CACHE_PORT = "11911" SERIESLY_IP = '' COUCHBASE_IP = '172.23.105.54' COUCHBASE_PORT = '8091' COUCHBASE_USER = "Administrator" COUCHBASE_PWD = "password" SSH_USER = "root" SSH_PASSWORD = "password" WORKER...
normal
{ "blob_id": "e70ebd9bb9cd7027772ec117cb91349afba7ab10", "index": 6390, "step-1": "<mask token>\n", "step-2": "RABBITMQ_IP = '172.23.105.82'\nOBJECT_CACHE_IP = '172.23.105.69'\nOBJECT_CACHE_PORT = '11911'\nSERIESLY_IP = ''\nCOUCHBASE_IP = '172.23.105.54'\nCOUCHBASE_PORT = '8091'\nCOUCHBASE_USER = 'Administrator...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. # Alex Duan <alex.duan@elico-corp.com> # # This program is free software: you can redistribute it and...
normal
{ "blob_id": "19d86c64876575ed9b3f5e33dd44e7633c96e696", "index": 2401, "step-1": "<mask token>\n\n\nclass product_product(orm.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def _get_sale_quotation_qty(self, cr, uid, product_id, context=None):\n \"\"\"get all qty of the product in all...
[ 2, 6, 8, 9, 10 ]
from sqlitedict import SqliteDict import sys import socket import urllib import argparse import zlib, pickle, sqlite3 import random from datetime import datetime import time from urllib.parse import urlparse import hashlib import subprocess import requests from multiprocessing import Pool def gz_encode(obj): retur...
normal
{ "blob_id": "295d6a66335491b406f47212064da9fd5fca6eb6", "index": 6812, "step-1": "<mask token>\n\n\ndef gz_decode(obj):\n return pickle.loads(zlib.decompress(bytes(obj)))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef gz_encode(obj):\n return sqlite3.Binary(zlib.compress(pickle.dumps(obj, pickle....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def Ret_Sister_Same_Rank(string, nodes_file, names_file): print(string) interest_taxid = Str_To_Taxid(string, names_file) print(interest_taxid) up_taxid = Return_Parent(interest_taxid, nodes_file) up_taxid = up_taxid.strip() interest_taxid = interest_taxid.strip() ...
flexible
{ "blob_id": "5c1324207e24f2d723be33175101102bd97fe7a2", "index": 4860, "step-1": "<mask token>\n\n\ndef Ret_Sister_Same_Rank(string, nodes_file, names_file):\n print(string)\n interest_taxid = Str_To_Taxid(string, names_file)\n print(interest_taxid)\n up_taxid = Return_Parent(interest_taxid, nodes_fi...
[ 2, 15, 18, 21, 27 ]
<|reserved_special_token_0|> @app.route('/unlock') def web_unlock(): if not (request.args.get('token') and request.args.get('state')): return 'Error' else: with shelve.open('Settings.conf') as settings: if 'token' in settings: token = settings['token'] e...
flexible
{ "blob_id": "ee0f90b84df73ae5783ca0b8a52fe6fe9c979f15", "index": 2576, "step-1": "<mask token>\n\n\n@app.route('/unlock')\ndef web_unlock():\n if not (request.args.get('token') and request.args.get('state')):\n return 'Error'\n else:\n with shelve.open('Settings.conf') as settings:\n ...
[ 2, 3, 4, 5, 6 ]
#! /usr/bin/python # -*- coding: utf8 -*- # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 import unittest from pyama.filereader import FileReader,Segment class TestFileReader(unittest.TestCase): def test_reads_file(self): reader = FileReader( "sample_reader_test.txt", regexe...
normal
{ "blob_id": "92dc0bd3cfcddd98f99d8152d0221f047beb4fb0", "index": 9492, "step-1": "<mask token>\n\n\nclass TestFileReader(unittest.TestCase):\n\n def test_reads_file(self):\n reader = FileReader('sample_reader_test.txt', regexes=[(\n 'name=\"(\\\\w+)\"', 'END SEGMENT'), ('\\\\s*\\\\*\\\\s*STA...
[ 2, 3, 4, 5, 6 ]
from mf_app import db from mf_app.models import User db.create_all() #test input data admin = User('admin', 'admin@admin.com', 'admin') guest = User('guest', 'guest@guest.com', 'guest') db.session.add(admin) db.session.add(guest) db.session.commit() users = User.query.all() print(users)
normal
{ "blob_id": "99c2bd56deccc327faf659e91fc1fd0f6ff7a219", "index": 3932, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.create_all()\n<mask token>\ndb.session.add(admin)\ndb.session.add(guest)\ndb.session.commit()\n<mask token>\nprint(users)\n", "step-3": "<mask token>\ndb.create_all()\nadmin = User('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(int(input())): n = int(input()) xco, yco = [], [] flagx, flagy, xans, yans = 1, 1, 0, 0 for x in range(4 * n - 1): x, y = input().split() xco.append(int(x)) yco.append(int(y))...
flexible
{ "blob_id": "d3b0a1d8b9f800c5d34732f4701ea2183405e5b4", "index": 9523, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(int(input())):\n n = int(input())\n xco, yco = [], []\n flagx, flagy, xans, yans = 1, 1, 0, 0\n for x in range(4 * n - 1):\n x, y = input().split()\n ...
[ 0, 1, 2 ]
# generated from catkin/cmake/template/order_packages.context.py.in source_root_dir = "/home/songsong/image_transport_ws/src" whitelisted_packages = "".split(';') if "" != "" else [] blacklisted_packages = "".split(';') if "" != "" else [] underlay_workspaces = "/home/songsong/image_transport_ws/devel;/home/songsong/pi...
normal
{ "blob_id": "86ca94820c05b3f63f4a733b6d1fa7eb9dea6a5d", "index": 325, "step-1": "<mask token>\n", "step-2": "source_root_dir = '/home/songsong/image_transport_ws/src'\nwhitelisted_packages = ''.split(';') if '' != '' else []\nblacklisted_packages = ''.split(';') if '' != '' else []\nunderlay_workspaces = (\n ...
[ 0, 1, 2 ]
from guet.commands.strategies.strategy import CommandStrategy class TooManyArgsStrategy(CommandStrategy): def apply(self): print('Too many arguments.')
normal
{ "blob_id": "afd72ce2d9598f92937f3038eb0ef49b740b9977", "index": 6846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TooManyArgsStrategy(CommandStrategy):\n\n def apply(self):\n print('To...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def shiftZeroesToEnd(myArray): zeroCounter = 0 shiftedArray = [] for item in myArray: if (str(item) == '0' or str(item) == '0.0') and type(item) is not str: zeroCounter += 1 else: shiftedArray.append(item) ...
flexible
{ "blob_id": "4a9c42727a28e19cf1eebcf72784b85bbae695bf", "index": 3429, "step-1": "<mask token>\n", "step-2": "def shiftZeroesToEnd(myArray):\n zeroCounter = 0\n shiftedArray = []\n for item in myArray:\n if (str(item) == '0' or str(item) == '0.0') and type(item) is not str:\n zeroCou...
[ 0, 1, 2, 3 ]
def parse_detail_for_one_course(page, course, no_info_course): print(f'{course["name"]} is processing**: {course["url"]}') map = {"Locatie": "location", "Location": "location", "Startdatum": "effective_start_date", "Start date": "effective_start_date", "Duur": "durati...
normal
{ "blob_id": "0f4fa9f8835ae22032af9faa6c7cb10af3facd79", "index": 5389, "step-1": "<mask token>\n", "step-2": "def parse_detail_for_one_course(page, course, no_info_course):\n print(f\"{course['name']} is processing**: {course['url']}\")\n map = {'Locatie': 'location', 'Location': 'location', 'Startdatum'...
[ 0, 1, 2 ]
def clear_firefox_driver_session(firefox_driver): firefox_driver.delete_all_cookies() # Note this only works if the browser is set to a location. firefox_driver.execute_script('window.localStorage.clear();') firefox_driver.execute_script('window.sessionStorage.clear();') class LocationNotSet(Exception...
normal
{ "blob_id": "6d0b9523668bd0b302fdbc196d3d7ff25be10b23", "index": 5045, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LocationNotSet(Exception):\n pass\n", "step-3": "def clear_firefox_driver_session(firefox_driver):\n firefox_driver.delete_all_cookies()\n firefox_driver.execute_scri...
[ 0, 1, 2, 3 ]
# Create your views here. from django.shortcuts import render_to_response, Http404, render from django.template import RequestContext from books.models import Book from django.http import HttpResponse, HttpResponseRedirect import urllib, urllib2 import json def incr_reads(request, book_id): if request.POST: ...
normal
{ "blob_id": "bcbcb4ea3a3b8b5c11e9b107103418ae79a3921c", "index": 3628, "step-1": "<mask token>\n\n\ndef incr_reads(request, book_id):\n if request.POST:\n try:\n readers = Book.objects.get(id=book_id).incr_reads()\n return HttpResponse(readers)\n except Book.DoesNotExist:\n...
[ 2, 3, 4, 5, 6 ]
# Core Packages import difflib import tkinter as tk from tkinter import * from tkinter import ttk from tkinter.scrolledtext import * import tkinter.filedialog import PyPDF2 from tkinter import filedialog import torch import json from transformers import T5Tokenizer, T5ForConditionalGeneration, T5Config # ...
normal
{ "blob_id": "e3dece36ba3e5b3df763e7119c485f6ed2155098", "index": 795, "step-1": "<mask token>\n\n\ndef get_summary():\n model = T5ForConditionalGeneration.from_pretrained('t5-small')\n tokenizer = T5Tokenizer.from_pretrained('t5-small')\n device = torch.device('cpu')\n text = str(url_display1.get('1....
[ 8, 9, 13, 14, 15 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-03 14:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('productores', '0002_auto_20170327_0841'), ] operations = [ migrations.AddFi...
normal
{ "blob_id": "2f7be68f08716d5d04d064d81eecb53eb9b80174", "index": 7635, "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 = [('productores...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(kamus) print(kamus['ayah']) print( """ Data ini dikirimkan server gojek, memberikan info driver di sekitar pemakai aplikasi""" ) <|reserved_special_token_0|> print(data_server_gojek) print(f"Driver di sekitar sini {d...
flexible
{ "blob_id": "67b101df690bbe9629db2cabf0060c0f2aad9722", "index": 2389, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(kamus)\nprint(kamus['ayah'])\nprint(\n \"\"\"\nData ini dikirimkan server gojek, memberikan info driver di sekitar pemakai aplikasi\"\"\"\n )\n<mask token>\nprint(data_server_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Scraper: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Entry: folder = None date = None sunspots = -1 image_path = None counted_sunspots...
flexible
{ "blob_id": "c55991e738c89ee09dabd79d514e710e0fcbac85", "index": 422, "step-1": "<mask token>\n\n\nclass Scraper:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Entry:\n folder = None\n date = None\n sunspots = -1\n image_path = None\n counted_...
[ 10, 11, 12, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def my_square_root(a, x): e = 0.0001 while True: y = (x + a / x) / 2 if abs(y - x) < e: return y break x = y <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "c9f4ae94dc901d34a3c0fb4371c8d35a7fe94507", "index": 5095, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef my_square_root(a, x):\n e = 0.0001\n while True:\n y = (x + a / x) / 2\n if abs(y - x) < e:\n return y\n break\n x = y\n\n\n<mask ...
[ 0, 1, 2, 3, 4 ]
##outcome: Hello, my name is B-max print("Hello", end="") print(", my name ", end="") print("is B-max", end="") print() ##outcome: **************************************** for i in range(40): print('*', end="") print() ##outcome: x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x* for i in range(20): print("x*", en...
normal
{ "blob_id": "41aebc4ee9cb058c3351029773be05cdc4f84ffa", "index": 7282, "step-1": "<mask token>\n", "step-2": "print('Hello', end='')\nprint(', my name ', end='')\nprint('is B-max', end='')\nprint()\nfor i in range(40):\n print('*', end='')\nprint()\nfor i in range(20):\n print('x*', end='')\nprint()\nfor...
[ 0, 1, 2 ]