code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def plot_feature_VS_Observed(feature, df, linecolor): """ This function plots the 1880-2004 time series plots for the selected feature and observed earth :param Input: df -- > The dataframe of each of the fea...
flexible
{ "blob_id": "8348d353e6fdea77c9c994d541db1420ef57a797", "index": 4399, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot_feature_VS_Observed(feature, df, linecolor):\n \"\"\"\n This function plots the 1880-2004 time series plots for the selected feature and observed earth\n :param\n ...
[ 0, 1, 2, 3 ]
# -*- coding:utf-8 -*- __author__ = 'yyp' __date__ = '2018-5-26 3:42' ''' Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1. Given "pwwkew", the answer is ...
normal
{ "blob_id": "b7c43f4242e38318c9e5423ea73e9d9d86759a53", "index": 4663, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def lengthOfLongestSubstring(self, s):\n \"\"\"\n :type s: str\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for numbers in n_list: n_dict = {} for n in numbers: if n in n_dict: n_dict[n] += 1 else: n_dict[n] = 1 mode = [] if len(n_dict) == 1 or len(n_dict) == len(numbers): ...
flexible
{ "blob_id": "39f9341313e29a22ec5e05ce9371bf65e89c91bd", "index": 25, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor numbers in n_list:\n n_dict = {}\n for n in numbers:\n if n in n_dict:\n n_dict[n] += 1\n else:\n n_dict[n] = 1\n mode = []\n if len(n_di...
[ 0, 1, 2, 3 ]
from django.apps import AppConfig class AppValidationsConfig(AppConfig): name = 'app_validations'
normal
{ "blob_id": "7a6a8b5e344a7b60e369f100885d1e26afa28f46", "index": 7600, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n name = 'app_validations'\n", "step-4": "from ...
[ 0, 1, 2, 3 ]
import ast import datetime from pathlib import Path from typing import Any, Dict import yaml from .lemmatizer import LemmatizerPymorphy2, Preprocessor def get_config(path_to_config: str) -> Dict[str, Any]: """Get config. Args: path_to_config (str): Path to config. Returns: Dict[str, An...
normal
{ "blob_id": "c85d7e799a652e82bfaf58e1e8bfa9c4606a8ecb", "index": 917, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_config(path_to_config: str) ->Dict[str, Any]:\n \"\"\"Get config.\n\n Args:\n path_to_config (str): Path to config.\n\n Returns:\n Dict[str, Any]: Config...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # coding=utf-8 import sys,os dir = '/home/ellen/yjoqm/fdfs_client/pic' def scp_file(filename): cmd = 'scp ellen@61.147.182.142:/home/ellen/yjoqm/fdfs_client/pic/%s .' %filename os.system(cmd) def main(args): args = sys.argv[1] scp_file(args) print 'done~~~~' if __name_...
normal
{ "blob_id": "e2489f9d3041c45129fdd71da6652a6093c96d2d", "index": 8487, "step-1": "#!/usr/bin/env python\n# coding=utf-8\nimport sys,os\n\ndir = '/home/ellen/yjoqm/fdfs_client/pic'\n\ndef scp_file(filename):\n cmd = 'scp ellen@61.147.182.142:/home/ellen/yjoqm/fdfs_client/pic/%s .' %filename\n os.system(cmd)...
[ 0 ]
from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize from rllab.misc.instrument import run_experiment_lite from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy from rl...
normal
{ "blob_id": "9f479ad2acf4f6deb0ca4db606c3d804979c10bd", "index": 3804, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_task(*_):\n env = normalize(GymEnv('DartWalker2d-v1', record_video=False))\n policy_sep = GaussianHLCPolicy(env_spec=env.spec, hidden_sizes=(64, 32),\n sub_out_di...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def bfs(start): visited = [False] * (n + 1) visited[start] = True q = deque() q.append(start) cnt = 1 while q: now = q.popleft() for i in graph[now]: if not visited[i]: visited[i] = True q.append(i) ...
flexible
{ "blob_id": "8a631adc8d919fb1dded27177818c4cb30148e94", "index": 610, "step-1": "<mask token>\n\n\ndef bfs(start):\n visited = [False] * (n + 1)\n visited[start] = True\n q = deque()\n q.append(start)\n cnt = 1\n while q:\n now = q.popleft()\n for i in graph[now]:\n if ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python import os from subprocess import Popen, PIPE, STDOUT import time import re import telnetlib from get_sys_info import get_node_list, get_spec_node_list, get_active_tcu, get_ru_list, is_active_ru g_rg_list = [ '/SGWNetMgr', '/SS7SGU', '/MGW_CMRG', '/MGW_OMURG', '/Directory', ] status_dic...
normal
{ "blob_id": "603d904404ace88205a524d8bfbe3e621b65f425", "index": 8750, "step-1": "#!/usr/bin/python\nimport os\nfrom subprocess import Popen, PIPE, STDOUT\nimport time\nimport re\nimport telnetlib\nfrom get_sys_info import get_node_list, get_spec_node_list, get_active_tcu, get_ru_list, is_active_ru\ng_rg_list = ...
[ 0 ]
<|reserved_special_token_0|> class CourseSchedule: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CourseSchedule: <|reserved_special_token_0|> def can_finish(self, numCourses: int, prerequisites: List[List[int]] )...
flexible
{ "blob_id": "7c53c7bec6b6b2d4d6be89b750eeef83ca9115cc", "index": 2960, "step-1": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n\n def can_finish(self, numCourses: int, prerequisites: List[List[int]]\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def read_modified_alert_ids(): """ Read modified alert IDs from file, then remove them from the file.""" if not os.path.exists(MODIFIED_ALERTS_FILE): return [] lock = filelock.FileLock(MODIFIED_ALERTS_FILE, 5) lock.acquire() fp = open(MODIFIED_ALERTS_FILE, 'r+'...
flexible
{ "blob_id": "90ae14d8af163343520365a5565a7c44de57059d", "index": 5662, "step-1": "<mask token>\n\n\ndef read_modified_alert_ids():\n \"\"\" Read modified alert IDs from file, then remove them from the file.\"\"\"\n if not os.path.exists(MODIFIED_ALERTS_FILE):\n return []\n lock = filelock.FileLoc...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GerenciaLedsConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GerenciaLedsConfig(AppConfig): name = 'gerencia_leds' <|reserved_special_token_1|> ...
flexible
{ "blob_id": "0754103c2d8cef0fd23b03a8f64ade8f049bce48", "index": 4890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GerenciaLedsConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GerenciaLedsConfig(AppConfig):\n name = 'gerencia_leds'\n", "step-4": "from django...
[ 0, 1, 2, 3 ]
# using python3 class Rational: def __init__(self, numer, denom): self.numer = numer self.denom = denom def __add__(self, other): return Rational( self.numer * other.denom + other.numer * self.denom, self.denom * other.denom ) def __sub__(self, oth...
normal
{ "blob_id": "8098b9c27689dd4168ef05c03d4ec00f67f8090e", "index": 4771, "step-1": "class Rational:\n\n def __init__(self, numer, denom):\n self.numer = numer\n self.denom = denom\n <mask token>\n <mask token>\n\n def __mul__(self, other):\n return Rational(self.numer * other.numer...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def best_hits(distf, maxscore, verbose=False): """ Find the best hits """ bh = {} allph = set() with open(distf, 'r') as din: for li in din: p = li.strip().split('\t') if float(p[3]) <= maxscore: if p[0] not in bh: ...
flexible
{ "blob_id": "22523304c9e2ce1339a7527cdbd67a81c780d806", "index": 1090, "step-1": "<mask token>\n\n\ndef best_hits(distf, maxscore, verbose=False):\n \"\"\"\n Find the best hits\n \"\"\"\n bh = {}\n allph = set()\n with open(distf, 'r') as din:\n for li in din:\n p = li.strip()...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class CRFData: """ 测试用的 crf 数据 """ def __init__(self): bio_labels = [['O', 'I-X', 'B-X', 'I-Y', 'B-Y']] self.label_vocabulary = LabelVocabulary(labels=bio_labels, padding= LabelVocabulary.PADDING) self.logits = torch.tensor([[[0, 0, 0.5...
flexible
{ "blob_id": "f64138ee5a64f09deb72b47b86bd7795acddad4d", "index": 9980, "step-1": "<mask token>\n\n\nclass CRFData:\n \"\"\"\n 测试用的 crf 数据\n \"\"\"\n\n def __init__(self):\n bio_labels = [['O', 'I-X', 'B-X', 'I-Y', 'B-Y']]\n self.label_vocabulary = LabelVocabulary(labels=bio_labels, padd...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def check_image(file_type): match = re.match('image/*', file_type) return match <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def check_image(file_type): match = re.mat...
flexible
{ "blob_id": "13fa650557a4a8827c9fb2e514bed178df19a32c", "index": 1295, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_image(file_type):\n match = re.match('image/*', file_type)\n return match\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef check_image(file_type):\n match =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def version_100_iq(limit): nums = [] for x in range(2, limit): facs = 0 n = x for p in primes: if n % p == 0: facs += 1 while n % p == 0: n //= p if n == 1 or facs >= 4: ...
flexible
{ "blob_id": "ea8676a4c55bbe0ae2ff8abf924accfc0bd8f661", "index": 1272, "step-1": "<mask token>\n\n\ndef version_100_iq(limit):\n nums = []\n for x in range(2, limit):\n facs = 0\n n = x\n for p in primes:\n if n % p == 0:\n facs += 1\n while n %...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class WarmupStepLR(_LRScheduler, AbsBatchStepScheduler): <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self): return ( f'{self.__class__.__name__}(warmup_steps={self.warmup_steps}, steps_per_epoch={self.steps_per_epoch}, step_size=...
flexible
{ "blob_id": "bce16762c0739087a8309872da4ac04298c50893", "index": 7695, "step-1": "<mask token>\n\n\nclass WarmupStepLR(_LRScheduler, AbsBatchStepScheduler):\n <mask token>\n <mask token>\n\n def __repr__(self):\n return (\n f'{self.__class__.__name__}(warmup_steps={self.warmup_steps}, ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TestRoomService(BaseTestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TestDeviceService(BaseTestCase): """Test the device service""" def test_get_device(self): devic...
flexible
{ "blob_id": "332e2945e34c861b2132f6b42ef59416a38455a5", "index": 2542, "step-1": "<mask token>\n\n\nclass TestRoomService(BaseTestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestDeviceService(BaseTestCase):\n \"\"\"Test the device service\"\"\"\n\n def test_get...
[ 7, 9, 11, 12, 13 ]
<|reserved_special_token_0|> class ResizeImageBuilder: def __init__(self): pass def setOriginImagePath(self, filePath): try: img = Image.open(filePath) print('origin image mode:', img.mode) img = img.convert('RGB') print('target image mode:', i...
flexible
{ "blob_id": "47119f46cdbbb7306aef8237d4f56f0f10690ae4", "index": 9245, "step-1": "<mask token>\n\n\nclass ResizeImageBuilder:\n\n def __init__(self):\n pass\n\n def setOriginImagePath(self, filePath):\n try:\n img = Image.open(filePath)\n print('origin image mode:', img....
[ 5, 6, 8, 9, 10 ]
from project import db from project.models import User, Recipe, Association, Ingre, Recipe_ingre user=User.query.filter_by(username="xiaofan").first() recipe=Recipe.query.filter_by(recipename="Jerry").first() recipes = Recipe.query.filter(Recipe.users.any(username="xiaofan")).all() if recipe not in recipes: us...
normal
{ "blob_id": "07f8fd305e2311c0e37a785da0a826b8ea4e78ba", "index": 4154, "step-1": "<mask token>\n", "step-2": "<mask token>\nif recipe not in recipes:\n user.add_recipes([recipe])\n db.session.commit()\n", "step-3": "<mask token>\nuser = User.query.filter_by(username='xiaofan').first()\nrecipe = Recipe....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserRegistrationForm(UserCreationForm): <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = User fields = 'first_name', 'last_name', 'email', 'password1', 'password2' <|reserved_special_token_0|> class UserLoginForm(forms...
flexible
{ "blob_id": "e50517910e191594034f60a021647f4415b6f1c4", "index": 2822, "step-1": "<mask token>\n\n\nclass UserRegistrationForm(UserCreationForm):\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'first_name', 'last_name', 'email', 'password1', 'password2'\n <mas...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class LinearRegressor: <|reserved_special_token_0|> def _cost_function(self, y_pred, y, m): """ Gets the cost for the predicted values when contrasted with the correct ones. y_pred: An (1 x m) vector that corresponds to the values predicted by the Linear R...
flexible
{ "blob_id": "d805a1290c107a8d768417a432e338b182b7cd6b", "index": 5524, "step-1": "<mask token>\n\n\nclass LinearRegressor:\n <mask token>\n\n def _cost_function(self, y_pred, y, m):\n \"\"\"\n Gets the cost for the predicted values when contrasted with the correct ones.\n y_pred: An (1...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> def ftp_download(): file_remote = 'ftp_upload.jpg' file_local = ( '/home/pi/Desktop/Camera-Rasp-Arduino-sensors/test_download.jpg') bufsize = 1024 fp = open(file_local, 'wb') f.retrbinary('RETR ' + file_remote, fp.write, bufsize) fp.close() <|reserved_spe...
flexible
{ "blob_id": "a1b85d140c45f082ceac54ad8aa9aa5c3659d5cf", "index": 9661, "step-1": "<mask token>\n\n\ndef ftp_download():\n file_remote = 'ftp_upload.jpg'\n file_local = (\n '/home/pi/Desktop/Camera-Rasp-Arduino-sensors/test_download.jpg')\n bufsize = 1024\n fp = open(file_local, 'wb')\n f.re...
[ 1, 2, 3, 4, 5 ]
from random import random, randint, choice from copy import deepcopy from math import log """ Обертка для функций, которые будут находиться в узлах, представляющих функции. Его члены – имя функции, сама функция и количество принимаемых параметров. """ class fwrapper: def __init__(self, function, childcou...
normal
{ "blob_id": "89881f3cc6703b3f43f5d2dae87fa943d8a21513", "index": 5485, "step-1": "<mask token>\n\n\nclass fwrapper:\n\n def __init__(self, function, childcount, name):\n self.function = function\n self.childcount = childcount\n self.name = name\n\n\n<mask token>\n\n\nclass node:\n\n de...
[ 23, 25, 28, 31, 34 ]
# @description Exporting outline (boundary faces) of zsoil results to vtu # @input zsoil results # @output vtu unstructured grid # @author Matthias Preisig # @date 2017/10/10 import numpy as np from zsoil_tools import zsoil_results as zr from zsoil_tools import vtktools pathname = r'\\192.168.1.51\Mandats sur H RAI...
normal
{ "blob_id": "fb6dd9ec7d8dc80eace90dadc2112c7c27125efd", "index": 2055, "step-1": "<mask token>\n", "step-2": "<mask token>\nres.read_rcf()\nres.read_his()\n<mask token>\nfor kt, step in enumerate(res.steps):\n if step.conv_status in [-1]:\n if step.time in tx:\n tsteps.append(kt)\n<mask to...
[ 0, 1, 2, 3, 4 ]
""" Author: C.M. Gosmeyer Date: Mar 2018 References: "Introduction to Statistical Problem Solving in Geography", J.C. McGrew, Jr., A.J. Lembo, Jr., C.B. Monroe To Do: Should tables interpolate? y = y1 + ((x - x1) / (x2 - x1)) * (y2 - y1) """ import numpy as np import pandas as p...
normal
{ "blob_id": "adb6e33dc665f88c82fcc399688a8dbd67b1e3e3", "index": 9894, "step-1": "<mask token>\n\n\nclass LoadStudentsTTable(LoadTable):\n <mask token>\n\n def __init__(self, tails):\n \"\"\"\n\n Parameters\n ----------\n tails : int\n 1 or 2.\n \"\"\"\n ...
[ 8, 18, 19, 21, 23 ]
class default_locations: <|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|> <|reserved_special_token_0|...
flexible
{ "blob_id": "b6df9414f99294c7986d3eb5332d40288f059cd1", "index": 1245, "step-1": "class default_locations:\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>\n <ma...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 3.2 on 2021-05-03 17:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('orders', '0005_alter_orderitem_price'), ] operations = [ migrations.AddField( model_name='order', name='being_delivere...
normal
{ "blob_id": "f3b466dc5b6149be82b096791ca8445faf169380", "index": 5216, "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 = [('orders', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sortarray(arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while j >= 0 and arr[j] > key: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key return arr <|re...
flexible
{ "blob_id": "70cef88f3fe93d370e5d21a2b00b761ce530a099", "index": 6366, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sortarray(arr):\n for i in range(1, len(arr)):\n key = arr[i]\n j = i - 1\n while j >= 0 and arr[j] > key:\n arr[j + 1] = arr[j]\n j ...
[ 0, 1, 2, 3 ]
import pytest from ansiblediscover.graph.node import Node def test_build_identifier(): assert 'role:server_base' == Node.build_identifier('server_base', 'role') def test_identifier(): node = Node('server_base', 'role', 'irrelevant') assert 'role:server_base' == node.identifier() def test_add_successo...
normal
{ "blob_id": "8e22db940124f92d3048055cf72dcaa79564cdc6", "index": 1953, "step-1": "<mask token>\n\n\ndef test_build_identifier():\n assert 'role:server_base' == Node.build_identifier('server_base', 'role')\n\n\ndef test_identifier():\n node = Node('server_base', 'role', 'irrelevant')\n assert 'role:serve...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- # Copyright (c) 2018, masonarmani38@gmail.com and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class LogisticsPlanningTool(Document): def autoname(self): if self.cust...
normal
{ "blob_id": "4cbb78234ef6e63b856099060ecaeea1779d6ac5", "index": 8412, "step-1": "<mask token>\n\n\nclass LogisticsPlanningTool(Document):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass LogisticsPlanningTool(Document):\n\n def autoname(self):\n if self.customer:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def init_process(args): auto_dir = args.auto_dir monomer_name = args.monomer_name os.makedirs(os.path.join(auto_dir, 'gaussian'), exist_ok=True) os.makedirs(os.path.join(auto_dir, 'gaussview'), exist_ok=True) def get_init_para_csv(auto_dir, monomer_name): init...
flexible
{ "blob_id": "961bda96e433bb66d592ad1e99c92db0a9ab9fe9", "index": 8545, "step-1": "<mask token>\n\n\ndef init_process(args):\n auto_dir = args.auto_dir\n monomer_name = args.monomer_name\n os.makedirs(os.path.join(auto_dir, 'gaussian'), exist_ok=True)\n os.makedirs(os.path.join(auto_dir, 'gaussview'),...
[ 3, 7, 9, 10, 12 ]
<|reserved_special_token_0|> def test_verify_home_page(eyes, driver): eyes.open(driver, 'FlyDubai IBE', 'Verify Home Page') eyes.check('FZ IBE Home page', Target.window()) eyes.close(False) <|reserved_special_token_0|> def test_verify_manage_booking_widget(eyes, driver): eyes.open(driver, 'FlyDuba...
flexible
{ "blob_id": "021efe01c21db4d3bd936ba4eb75dc03dde91cc6", "index": 1475, "step-1": "<mask token>\n\n\ndef test_verify_home_page(eyes, driver):\n eyes.open(driver, 'FlyDubai IBE', 'Verify Home Page')\n eyes.check('FZ IBE Home page', Target.window())\n eyes.close(False)\n\n\n<mask token>\n\n\ndef test_verif...
[ 4, 5, 6, 7, 8 ]
import os from unittest import TestCase class TestMixin(TestCase): @classmethod def setUpClass(cls): cls.base_dir = os.path.dirname(os.path.abspath(__file__)) cls.fixtures_dir = os.path.join(cls.base_dir, 'fixtures') cls.bam_10xv2_path = os.path.join(cls.fixtures_dir, '10xv2.bam') ...
normal
{ "blob_id": "268a8252f74a2bdafdadae488f98997c91f5607c", "index": 2686, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestMixin(TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestMixin(TestCase):\n\n @classmethod\n def setUpClass(cls):\n cls.base_dir = os.pat...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib.pyplot as plt import csv category = ["Ecological Well-being", "Health & Human Services", "Arts & Culture", "Community Building", "Environment"] arr = np.empty((0, 6), str) moneyGranted = [[0]*5 for _ in range(6)] moneyRequested = [[0]*5 for _ in range(6)] perFull = [[0]*5 f...
normal
{ "blob_id": "e7b2e716fbcaf761e119003000bf1b16af57a2b7", "index": 7009, "step-1": "<mask token>\n\n\ndef task5(arr):\n for row in arr:\n moneyGranted[int(row[1]) - 2015][int(row[3]) - 1] += int(row[4])\n moneyRequested[int(row[1]) - 2015][int(row[3]) - 1] += int(row[5])\n for i in range(6):\n ...
[ 1, 2, 3, 4, 5 ]
#Function to remove spaces in a string def remove(string_input): return string_input.replace(" ", "")
normal
{ "blob_id": "f327f408ae2759407ac9f01ad4feff5c6a0845f1", "index": 9524, "step-1": "<mask token>\n", "step-2": "def remove(string_input):\n return string_input.replace(' ', '')\n", "step-3": "#Function to remove spaces in a string\n\ndef remove(string_input):\n return string_input.replace(\" \", \"\")\n"...
[ 0, 1, 2 ]
#tkinter:Label 、Button 、标签、按钮 #详见: #1、os:https://blog.csdn.net/xxlovesht/article/details/80913193 #2、shutil:https://www.jb51.net/article/157891.htm #3、tkinter:https://blog.csdn.net/mingshao104/article/details/79591965 # https://blog.csdn.net/sinat_41104353/article/details/79313424 # https:/...
normal
{ "blob_id": "6c0ca72d7f5d2373a50cd344991ad9f9e3046e8d", "index": 4087, "step-1": "<mask token>\n\n\ndef File_Open_EventC():\n FilePath = filedialog.askopenfilename(filetypes=(('C file', '*.c*'), (\n 'Text file', '*.txt*'), ('HTML files', '*.html;*.htm')))\n fp = open(FilePath, 'r')\n flag_1 = 0\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def ya_headers(): return {'Content-type': 'application/json', 'Authorization': 'OAuth {}' .format(token_ya)} def put_folder(path): url = 'https://cloud-api.yandex.net/v1/disk/resources/' headers = ya_headers() params = {'path': path, 'url': url} response = re...
flexible
{ "blob_id": "a22bc3bdb5e35060eff7f523b90d605ff2dd3878", "index": 9581, "step-1": "<mask token>\n\n\ndef ya_headers():\n return {'Content-type': 'application/json', 'Authorization': 'OAuth {}'\n .format(token_ya)}\n\n\ndef put_folder(path):\n url = 'https://cloud-api.yandex.net/v1/disk/resources/'\n ...
[ 3, 4, 5, 6, 7 ]
# ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Test create publ...
normal
{ "blob_id": "035043460805b7fe92e078e05708d368130e3527", "index": 8965, "step-1": "<mask token>\n\n\n@with_tempfile\ndef test_invalid_call(path):\n assert_raises(ValueError, create_sibling_github, 'bogus', dataset=path)\n ds = Dataset(path).create()\n assert_raises(gh.BadCredentialsException, ds.create_s...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin python import socket import json import threading import sys from db_util import DBUtil from cryptoLib import AesCtr,Hmac class Client(threading.Thread): def __init__(self, (client_conn, client_addr), sema): threading.Thread.__init__(self) self.client_conn = client_conn self.client_addr = client_ad...
normal
{ "blob_id": "1338d6578a94338c6e75acc025ddddd14097ee10", "index": 2044, "step-1": "#!/usr/bin python\n\nimport socket\nimport json\nimport threading\nimport sys\nfrom db_util import DBUtil\nfrom cryptoLib import AesCtr,Hmac\n\n\nclass Client(threading.Thread):\n\tdef __init__(self, (client_conn, client_addr), sem...
[ 0 ]
<|reserved_special_token_0|> class MRTopVisitorCount(MRJob): <|reserved_special_token_0|> <|reserved_special_token_0|> def mapper_sort(self, page, counts): top = Counter(counts).most_common(1) yield page, (top[0][0], top[0][1]) def reducer_sort(self, page, visitor_count): for...
flexible
{ "blob_id": "471ce1eeb3293a424de74e25f36b76699a97ec2b", "index": 7039, "step-1": "<mask token>\n\n\nclass MRTopVisitorCount(MRJob):\n <mask token>\n <mask token>\n\n def mapper_sort(self, page, counts):\n top = Counter(counts).most_common(1)\n yield page, (top[0][0], top[0][1])\n\n def ...
[ 3, 6, 7, 8, 10 ]
from datetime import date def solution(mon: int, day: int) -> str: return date(2016, mon, day).strftime("%a").upper()
normal
{ "blob_id": "67385d6d58cc79037660be546d41ea9ba1f790fa", "index": 5043, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(mon: int, day: int) ->str:\n return date(2016, mon, day).strftime('%a').upper()\n", "step-3": "from datetime import date\n\n\ndef solution(mon: int, day: int) ->str:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def get_analyse(curse): """ 要求curse数据中index为时间,columns为策略名称,每一列为该策略净值 """ qf_drawdown = [] qf_yeild = [] qf_std = [] date = curse.index y = curse.copy() for i in curse.columns: y['max2here'] = y[i].expanding().max(...
flexible
{ "blob_id": "56d90835e64bd80fd9a6bb3a9b414e154d314d4a", "index": 5108, "step-1": "<mask token>\n", "step-2": "def get_analyse(curse):\n \"\"\"\n 要求curse数据中index为时间,columns为策略名称,每一列为该策略净值\n\n \"\"\"\n qf_drawdown = []\n qf_yeild = []\n qf_std = []\n date = curse.index\n y = curse.copy()\...
[ 0, 1, 2 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "422873f89468b1faabed96f72f463b6294b85276", "index": 5314, "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 ]
import boto3 import json from botocore.exceptions import ClientError # upload_to_s3("abc.png", 1) def upload_to_s3(file_name, node_number): try: key_info_json = open("awsinfo.json").read() except FileNotFoundError: print("awsinfo.json is not exist in dir.") exit(-1) dat...
normal
{ "blob_id": "2f0d611fecdb5717029938d2ec2cd2db345b8f3a", "index": 8176, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef upload_to_s3(file_name, node_number):\n try:\n key_info_json = open('awsinfo.json').read()\n except FileNotFoundError:\n print('awsinfo.json is not exist in di...
[ 0, 1, 2, 3 ]
/Users/alyssaliguori/anaconda3/lib/python3.7/tokenize.py
normal
{ "blob_id": "601ef4e1000348059dcfe8d34eec5f28368f2464", "index": 8855, "step-1": "/Users/alyssaliguori/anaconda3/lib/python3.7/tokenize.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> def get_na(dataset): na_males = dataset[dataset.Sex == 'male'].loc[:, 'AgeGroup'].isnull().sum() na_females = dataset[dataset.Sex == 'female'].loc[:, 'AgeGroup'].isnull( ).sum() return {'male': na_males, 'female': na_females} def get_counts(dataset): return datas...
flexible
{ "blob_id": "05f143e28ff9c7397376ad598529c1dfb7528ee3", "index": 7269, "step-1": "<mask token>\n\n\ndef get_na(dataset):\n na_males = dataset[dataset.Sex == 'male'].loc[:, 'AgeGroup'].isnull().sum()\n na_females = dataset[dataset.Sex == 'female'].loc[:, 'AgeGroup'].isnull(\n ).sum()\n return {'ma...
[ 4, 5, 6, 7, 8 ]
##Linear Queue Data Structure #Main Queue Class class LinearQueue(): def __init__(self, length): #When initiating, user defines the length. #The head and tail pointers are set at -1 (i.e. not pointing to anything, index beginning at zero) #The queue is set as a series of None objects in a l...
normal
{ "blob_id": "0efac7d9d1a9180eafa8c9c4e3a42b4c68e718a2", "index": 4597, "step-1": "class LinearQueue:\n <mask token>\n\n def enqueue(self, *args):\n for i in args:\n if not self.isFull():\n self._tail += 1\n self._queue[self._tail] = i\n else:\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def read(): file_list = os.listdir(data_path) result_list = [] for file in file_list: with open(data_path + file) as f: content = f.readlines() dict = {} dict['title'] = content[0] dict['name'] = content[1] di...
flexible
{ "blob_id": "6f1bb9fde9ed9667ab81baa9e8ec965d711a0556", "index": 9853, "step-1": "<mask token>\n\n\ndef read():\n file_list = os.listdir(data_path)\n result_list = []\n for file in file_list:\n with open(data_path + file) as f:\n content = f.readlines()\n dict = {}\n ...
[ 4, 5, 6, 7, 8 ]
import string import random file_one_time_pad = open("encryption_file.txt","r") p_text = file_one_time_pad.read() file_one_time_pad.close() print(p_text) p_text = str.lower(p_text) main_text = [] p_text_numerical = [] temp_key = [21,25,20,15,16,14,10,26,24,9,8,13] alphabets = ['a','b','c','d','e','f','g','h','i','j','...
normal
{ "blob_id": "4b647d37d390a4df42f29bbfc7e4bae4e77c5828", "index": 8935, "step-1": "<mask token>\n", "step-2": "<mask token>\nfile_one_time_pad.close()\nprint(p_text)\n<mask token>\nfor i in p_text:\n main_text.append(i)\nfor i in range(length_p_text):\n for j in range(25):\n if main_text[i] == alph...
[ 0, 1, 2, 3, 4 ]
from django.db import models class Professor(models.Model): nome = models.CharField(max_length=100) apelido = models.CharField(max_length=30) descricao = models.TextField(max_length=1000) def __str__(self): return self.nome class ImagemProfessor(models.Model): professor = models.Foreign...
normal
{ "blob_id": "acb879cb72e5b3ac897a271dc680e4ca763d2122", "index": 7541, "step-1": "<mask token>\n\n\nclass ImagemProfessor(models.Model):\n professor = models.ForeignKey(Professor, on_delete=models.CASCADE)\n foto = models.ImageField(upload_to='fotos/%d/%m/%Y/', blank=True)\n", "step-2": "<mask token>\n\n...
[ 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def begin_chat(request, id=None): check = check_if_auth_user(request) if not check: messages.error(request, 'Perform login first to start chatting') return redirect('home:welcome') current_user = User...
flexible
{ "blob_id": "9dfb3f58127b30467651ac4209277cd947643c65", "index": 7411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef begin_chat(request, id=None):\n check = check_if_auth_user(request)\n if not check:\n messages.error(request, 'Perform login first to start chatting')\n return...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.home), path('teams', views.showTeams), path( 'teams/new', views.new), path('teams/<teamname>', views.showSpecificTeam)] <|reserved_special_token_1|> from django.urls import path from . import v...
flexible
{ "blob_id": "e267108177841110493061a4f84ae3d29850d028", "index": 1853, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home), path('teams', views.showTeams), path(\n 'teams/new', views.new), path('teams/<teamname>', views.showSpecificTeam)]\n", "step-3": "from django.url...
[ 0, 1, 2, 3 ]
from fabric.api import local,run INSTALL_STEPS = ['yes | sudo apt-get install libmysqlclient-dev python-dev python-mysqldb python-virtualenv', 'virtualenv --no-site-packages env', '. env/bin/activate;pip install -r requirements.txt'] def deps_local(): for step in INSTALL_STEPS: ...
normal
{ "blob_id": "d64140466e62b78506d0f200f451649023697a3b", "index": 1386, "step-1": "<mask token>\n\n\ndef deps_remote():\n for step in INSTALL_STEPS:\n run(step)\n", "step-2": "<mask token>\n\n\ndef deps_local():\n for step in INSTALL_STEPS:\n local(step)\n\n\ndef deps_remote():\n for step...
[ 1, 2, 3, 4, 5 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "4acdde648b5ec32c078579e725e6ae035298f25a", "index": 3997, "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 ]
# SPDX-FileCopyrightText: 2019-2021 Python201 Contributors # SPDX-License-Identifier: MIT # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path ...
normal
{ "blob_id": "1ead23c6ea4e66b24e60598ae20606e24fa41482", "index": 1024, "step-1": "<mask token>\n", "step-2": "<mask token>\nyear = datetime.datetime.now().year\nproject = 'python201'\ncopyright = f'2019-{year} Geoffrey Lentner, 2018 Ashwin Srinath'\nauthor = 'Geoffrey Lentner, Ashwin Srinath'\nversion = '0.0.1...
[ 0, 1, 2, 3 ]
from nltk.tokenize import sent_tokenize from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer import networkx as nx def summarize(text): sentences_token = sent_tokenize(text) #Feature Extraction vectorizer = CountVectorizer(min_df=1,decode_error='replace') sent_bow = v...
normal
{ "blob_id": "b75ebcd278ae92274bbbe8d1ce5cb3bb7fa14a2c", "index": 9637, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef summarize(text):\n sentences_token = sent_tokenize(text)\n vectorizer = CountVectorizer(min_df=1, decode_error='replace')\n sent_bow = vectorizer.fit_transform(sentences_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @pytest.mark.slow def test_x_noise_reg(): x_train = np.linspace(-3, 3, 300, dtype=np.float32).reshape((300, 1)) noise = tfd.MultivariateNormalDiag(loc=5 * tf.math.sin(2 * x_train), scale_diag=abs(x_train)) y_train = noise.sample().numpy() too_much_noise = Normalizi...
flexible
{ "blob_id": "303a8609cb21c60a416160264c3d3da805674920", "index": 777, "step-1": "<mask token>\n\n\n@pytest.mark.slow\ndef test_x_noise_reg():\n x_train = np.linspace(-3, 3, 300, dtype=np.float32).reshape((300, 1))\n noise = tfd.MultivariateNormalDiag(loc=5 * tf.math.sin(2 * x_train),\n scale_diag=ab...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class SequenceHeuristic(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SequenceHeuristic(object): def __init__(self, minChanges, minDuration, noMotionDelay): self._minChanges = mi...
flexible
{ "blob_id": "e07bd4cd13209bff8bc1119a619a2954abd52592", "index": 1515, "step-1": "<mask token>\n\n\nclass SequenceHeuristic(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SequenceHeuristic(object):\n\n def __init__(self, minChanges, minDuration, noMotionDelay):\n ...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 3.2.7 on 2021-09-23 07:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sms_consumer', '0006_auto_20210923_0733'), ] operations = [ migrations.RemoveField( model_name='smslogmodel', name='hello', ...
normal
{ "blob_id": "fc9742ceb3c38a5f8c1ad1f030d76103ba0a7a81", "index": 3857, "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 = [('sms_consume...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('testfile_short1.csv', 'r') as original: data = original.read() for i in range(2): with open('testfile_short3.csv', 'a') as modified: modified.write(data) <|reserved_special_token_1|> import pandas as ...
flexible
{ "blob_id": "d7b45e76f150107cd62be160e8938f17dad90623", "index": 58, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('testfile_short1.csv', 'r') as original:\n data = original.read()\nfor i in range(2):\n with open('testfile_short3.csv', 'a') as modified:\n modified.write(data)\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def getdata(url): data = requests.get(url) return data.text def get_json(): file_path = staticfiles_storage.path('coordinates.json') with open(file_path, 'r') as f: data = json.load(f) html_doc = getdata('https://www.mygov.in/covid-19') soup = BeautifulSo...
flexible
{ "blob_id": "ed80f5f898548ca012779543051ccff5b34e4fcc", "index": 730, "step-1": "<mask token>\n\n\ndef getdata(url):\n data = requests.get(url)\n return data.text\n\n\ndef get_json():\n file_path = staticfiles_storage.path('coordinates.json')\n with open(file_path, 'r') as f:\n data = json.loa...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class EVALUATOR(object): def __init__(self, detector, data): self.detector = detector self.data = data self.gt = self.data.gt self.image_ids, self.bboxes, self.prob, self.annotations = (self. prepare()) self.precision, self.recall =...
flexible
{ "blob_id": "3bb6305ceb1491db57c7f8b03e438398644c8f90", "index": 8124, "step-1": "<mask token>\n\n\nclass EVALUATOR(object):\n\n def __init__(self, detector, data):\n self.detector = detector\n self.data = data\n self.gt = self.data.gt\n self.image_ids, self.bboxes, self.prob, self...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def funct(string): dict = {} for i in string: if i in dict: dict[i] += 1 else: dict[i] = 1 return dict <|reserved_special_token_0|> def counter(): string = input('Input your string :') result = Counter(string) return resu...
flexible
{ "blob_id": "14807568af046594644095a2682e0eba4f445b26", "index": 8053, "step-1": "<mask token>\n\n\ndef funct(string):\n dict = {}\n for i in string:\n if i in dict:\n dict[i] += 1\n else:\n dict[i] = 1\n return dict\n\n\n<mask token>\n\n\ndef counter():\n string =...
[ 2, 3, 4, 5, 6 ]
import cartopy.crs as ccrs import cartopy.feature as cfeature import numpy as np import matplotlib.pyplot as plt import netCDF4 import xarray as xr import metpy from datetime import datetime import datetime as dt from metpy.units import units import scipy.ndimage as ndimage from metpy.plots import USCOUNTIES...
normal
{ "blob_id": "8771f71a69f3afdc5de4d38db6efe61b553ae880", "index": 9396, "step-1": "<mask token>\n\n\ndef mkdir_p(mypath):\n \"\"\"Creates a directory. equivalent to using mkdir -p on the command line\"\"\"\n from errno import EEXIST\n from os import makedirs, path\n try:\n makedirs(mypath)\n ...
[ 2, 3, 4, 5, 6 ]
import asyncio import logging import os from async_cron.job import CronJob from async_cron.schedule import Scheduler from sqlalchemy import asc import spider import squid import verifier from db import sess_maker from model import Proxy, STATUS_OK, STATUS_ERROR from server import run_api_server from tool import logge...
normal
{ "blob_id": "1d529e2ea5526ddcda0d0da30ed8ed4724002c63", "index": 7074, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.INFO, datefmt='%Y/%m/%d %H:%M:%S', format\n ='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n<mask token>\n\n\n@cron_wait\nasync def verify_e...
[ 0, 1, 2, 3, 4 ]
from applitools.selenium import Target, eyes from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC def test_verify_home_page(eyes, driver): eyes.open(driver, "FlyDubai IBE", "Verify Home Page") eye...
normal
{ "blob_id": "021efe01c21db4d3bd936ba4eb75dc03dde91cc6", "index": 1475, "step-1": "<mask token>\n\n\ndef test_verify_home_page(eyes, driver):\n eyes.open(driver, 'FlyDubai IBE', 'Verify Home Page')\n eyes.check('FZ IBE Home page', Target.window())\n eyes.close(False)\n\n\n<mask token>\n\n\ndef test_verif...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python number=int(input("Enter an integer")) if number<=100: print("Your number is smaller than equal to 100") else: print("Your number is greater than 100")
normal
{ "blob_id": "9666c87b4d4dc721683ea33fdbbeadefc65a0cd1", "index": 1860, "step-1": "<mask token>\n", "step-2": "<mask token>\nif number <= 100:\n print('Your number is smaller than equal to 100')\nelse:\n print('Your number is greater than 100')\n", "step-3": "number = int(input('Enter an integer'))\nif ...
[ 0, 1, 2, 3 ]
from . import preprocess from . import utils import random import pickle import feather import time import datetime import sys import os import numpy as np import pandas as pd import json from ...main import api from flask import request from flask_restplus import Resource, fields import warnings warnings.simplefilter...
normal
{ "blob_id": "c76fd9b196b50e6fcced7e56517c0cd8ab30e24e", "index": 7891, "step-1": "<mask token>\n\n\n@api.route('/predict')\n@api.expect(parser)\nclass Predict(Resource):\n <mask token>\n\n\n@api.route('/predict/<string:companyid>/<string:accountid>')\n@api.expect(parser)\nclass PredictEmployeeByCompany(Resour...
[ 6, 7, 8, 10, 15 ]
import seaborn as sns tips = sns.load_dataset('iris') sns.violinplot(x='species', y='sepal_length', data=tips, palette='rainbow')
normal
{ "blob_id": "274af2a0b758472ca4116f1dfa47069647babf57", "index": 8543, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.violinplot(x='species', y='sepal_length', data=tips, palette='rainbow')\n", "step-3": "<mask token>\ntips = sns.load_dataset('iris')\nsns.violinplot(x='species', y='sepal_length', d...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BooksaleConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BooksaleConfig(AppConfig): name = 'booksale' <|reserved_special_token_1|> from django....
flexible
{ "blob_id": "e642054dad8a2de5b01f2994348e10e9c7574ee0", "index": 4581, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BooksaleConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BooksaleConfig(AppConfig):\n name = 'booksale'\n", "step-4": "from django.apps import ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for path in sorted(contents): files_used.append(path.name) totalFiles += 1 print(files_used) print(totalFiles) <|reserved_special_token_0|> for filename in files_used: df = pd.read_csv(PATH + folder + filename, sep=';'...
flexible
{ "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|> def test_resource_not_found(petstore_client): with pytest.raises(AttributeError) as excinfo: petstore_client.foo assert 'foo not found' in str(excinfo.value) @pytest.fixture def client_tags_with_spaces(): return SwaggerClient.from_spec({'swagger': '2.0', 'info': {'ve...
flexible
{ "blob_id": "5ee1d8ef7ec4b191e0789ceb9c6dd2d58af526a0", "index": 7875, "step-1": "<mask token>\n\n\ndef test_resource_not_found(petstore_client):\n with pytest.raises(AttributeError) as excinfo:\n petstore_client.foo\n assert 'foo not found' in str(excinfo.value)\n\n\n@pytest.fixture\ndef client_tag...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def printBoard(board, pref): border = '+----+----+----+----+----+----+----+----+' for row in board: print(pref, border) cells = '|' for cell in row: if cell == 0: cell = ' ' elif cell in...
flexible
{ "blob_id": "07e875a24d0e63ef596db57c4ec402f768225eec", "index": 5103, "step-1": "<mask token>\n", "step-2": "def printBoard(board, pref):\n border = '+----+----+----+----+----+----+----+----+'\n for row in board:\n print(pref, border)\n cells = '|'\n for cell in row:\n if...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Voucher(Base): __tablename__ = 't_juju_voucher' code = Column(String(100), index=True, unique=True) serial_no = Column(String(120), index=True, unique=True) amount = Column(Float, default=0, nullable=False)...
flexible
{ "blob_id": "60d8276a5715899823b12ffdf132925c6f2693bd", "index": 8675, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Voucher(Base):\n __tablename__ = 't_juju_voucher'\n code = Column(String(100), index=True, unique=True)\n serial_no = Column(String(120), index=True, unique=True)\n ...
[ 0, 2, 3, 4, 5 ]
""" # System of national accounts (SNA) This is an end-to-end example of national accounts sequence, from output to net lending. It is based on Russian Federation data for 2014-2018. Below is a python session transcript with comments. You can fork [a github repo](https://github.com/epogrebnyak/sna-ru) to replica...
normal
{ "blob_id": "2d4187ab5d178efa4920110ccef61c608fdb14c0", "index": 8780, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef eq(df1, df2, precision=0.5) ->bool:\n \"\"\"Compare two dataframes by element with precision margin.\"\"\"\n return ((df1 - df2).abs() < precision).all()\n\n\n<mask token>\n...
[ 0, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """ Created on Wed Aug 18 16:11:44 2021 @author: ignacio """ import matplotlib.pyplot as plt from numpy.linalg import inv as invertir from time import perf_counter import numpy as np def matriz_laplaciana(N, t=np.single): # funcion obtenida de clase e=np.eye(N)-np.eye(N,N,...
normal
{ "blob_id": "86345702bcd423bc31e29b1d28aa9c438629297d", "index": 7331, "step-1": "<mask token>\n\n\ndef matriz_laplaciana(N, t=np.single):\n e = np.eye(N) - np.eye(N, N, 1)\n return t(e + e.T)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef matriz_laplaciana(N, t=np.single):\n e = np.eye(N) - n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def chessKnight(cell): pivot = 'abcdefgh' count = 8 for i in range(len(pivot)): if cell[0] == pivot[i]: vertical_4, vertical_2 = False, False if int(cell[1]) == 8 or int(cell[1]) == 1: vertical_4 = T...
flexible
{ "blob_id": "c1335a8128ad4ba6ce6942e80f3c8b68a4210902", "index": 6355, "step-1": "<mask token>\n", "step-2": "def chessKnight(cell):\n pivot = 'abcdefgh'\n count = 8\n for i in range(len(pivot)):\n if cell[0] == pivot[i]:\n vertical_4, vertical_2 = False, False\n if int(ce...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # @Author : William # @Project : TextGAN-william # @FileName : gan_loss.py # @Time : Created at 2019-07-11 # @Blog : http://zhiweil.ml/ # @Description : # Copyrights (C) 2018. All Rights Reserved. import torch import torch.nn as nn import config as cfg class ...
normal
{ "blob_id": "9cea998d7d5cad3ddc00f667ca06151a938d48a1", "index": 9424, "step-1": "<mask token>\n\n\nclass GANLoss(nn.Module):\n <mask token>\n\n def __init__(self, loss_mode, which_net, which_D, target_real_label=1.0,\n target_fake_label=0.0, CUDA=False):\n \"\"\" Initialize the GAN's Discrim...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def renew_commodity_future(year_month: str, contract_kind: str, main_code_path: str, rar_data_file_path: str, clean_data_path: str, time_range_path: str, end_date: str, commodity_bool=True): """ 用于更新月度的商品期货数据 ...
flexible
{ "blob_id": "1c2967c26c845281ceb46cc1d8c06768298ef6b6", "index": 9407, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef renew_commodity_future(year_month: str, contract_kind: str,\n main_code_path: str, rar_data_file_path: str, clean_data_path: str,\n time_range_path: str, end_date: str, comm...
[ 0, 1, 2, 3, 4 ]
import logging from random import randint import pygame from flask import Flask, render_template from flask_ask import Ask, statement, question, session from playsound import playsound app = Flask(__name__) ask = Ask(app, "/") logging.getLogger("flask_ask").setLevel(logging.DEBUG) @ask.launch def new_game(): p...
normal
{ "blob_id": "e4b6304be10ee5a741c8a193dcf65950299ef11a", "index": 1477, "step-1": "<mask token>\n\n\n@ask.launch\ndef new_game():\n pygame.mixer.init()\n pygame.mixer.music.load('haha2.mp3')\n pygame.mixer.music.play()\n welcome_msg = render_template('welcome')\n return question(welcome_msg)\n\n\n@...
[ 6, 7, 8, 9, 10 ]
import stock as stk import portfolio as portf import plot import sys import cmd import os import decision as des class CLI(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) self.prompt = '$> ' self.stk_data_coll = stk.StockDataCollection() self.add_to_plot_lst = [] ...
normal
{ "blob_id": "d386047c087155b1809d47349339eb6882cf8e26", "index": 5013, "step-1": "import stock as stk\nimport portfolio as portf\nimport plot\nimport sys\nimport cmd\nimport os\nimport decision as des\n \n \nclass CLI(cmd.Cmd):\n\n def __init__(self):\n cmd.Cmd.__init__(self)\n self.prompt =...
[ 0 ]
#!/usr/bin/env python3 import sys, os import random import numpy as np import matplotlib as mpl if os.environ.get('DISPLAY','') == '': print('no display found. Using non-interactive Agg backend') mpl.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import sha...
normal
{ "blob_id": "b4454d92ab8380e0eded2f7aed737378e1710c72", "index": 9413, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.environ.get('DISPLAY', '') == '':\n print('no display found. Using non-interactive Agg backend')\n mpl.use('Agg')\n<mask token>\nsys.path.append(path_to_utils)\n<mask token>\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for pessoas in range(1, 8): nasc = int(input(f'Qual sua data de nascimento? {pessoas}º: ')) idade = atual - nasc if idade >= 21: totmaior += 1 else: totmenor += 1 print(f'Ao todo tivemos {totmaior} ...
flexible
{ "blob_id": "f6d7ce2d020d11086640a34aac656098ab0b0f33", "index": 9495, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor pessoas in range(1, 8):\n nasc = int(input(f'Qual sua data de nascimento? {pessoas}º: '))\n idade = atual - nasc\n if idade >= 21:\n totmaior += 1\n else:\n ...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from .import views app_name='user' # user子路由 urlpatterns = [ # user首页 url(r'^$',views.index,name='index'), # 用户登录 url('login/', views.login, name='login'), # 用户注册 url('regist/', views.regist, name='regist'), # 根据id判断用户是否存在 url(r'^getuser\w*/(?P<id>\...
normal
{ "blob_id": "de7b5e44c5c213e4ab70b0f8c0c402edaf4926e0", "index": 211, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'user'\nurlpatterns = [url('^$', views.index, name='index'), url('login/', views.\n login, name='login'), url('regist/', views.regist, name='regist'), url(\n '^getuser\\\\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with Session() as ps: ps.app.runMenuItem(ps.app.stringIDToTypeID('toggleProofColors')) <|reserved_special_token_1|> <|reserved_special_token_0|> from photoshop import Session with Session() as ps: ps.app.runMenuItem(ps....
flexible
{ "blob_id": "1db866ca73bc264d474d5e5086c4a047d7e46546", "index": 2299, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith Session() as ps:\n ps.app.runMenuItem(ps.app.stringIDToTypeID('toggleProofColors'))\n", "step-3": "<mask token>\nfrom photoshop import Session\nwith Session() as ps:\n ps.app...
[ 0, 1, 2, 3 ]
#-*- coding: UTF-8 -*- #Author Motuii ''' * ┏┓   ┏┓ * ┏┛┻━━━┛┻┓ * ┃       ┃   * ┃   ━   ┃ * ┃ ┳┛ ┗┳ ┃ * ┃       ┃ * ┃   ┻   ┃ * ┃       ┃ * ┗━┓   ┏━┛ * ┃   ┃ 神兽保佑          * ┃   ┃ 代码无BUG! * ┃   ┗━━━┓ * ┃       ┣┓ * ┃       ┏┛ * ┗┓┓┏━┳┓┏┛ * ┃┫┫ ┃┫┫ * ┗┻┛ ┗┻┛ * ''' n...
normal
{ "blob_id": "131caf50cc8682cf180168a1b136b1dcdd70fa76", "index": 6837, "step-1": "#-*- coding: UTF-8 -*-\n#Author Motuii\n'''\n * ┏┓   ┏┓ \n * ┏┛┻━━━┛┻┓ \n * ┃       ┃   \n * ┃   ━   ┃ \n * ┃ ┳┛ ┗┳ ┃ \n * ┃       ┃ \n * ┃   ┻   ┃ \n * ┃       ┃ \n * ┗━┓   ┏━┛ \n * ┃   ┃ 神兽保佑          \n * ┃   ┃ 代码无BUG! \n ...
[ 0 ]
<|reserved_special_token_0|> def is_printing(): try: status = http.get('http://' + PRINTER_IP + '/api/v1/printer/status', timeout=1) if status.json() == 'printing': state = http.get('http://' + PRINTER_IP + '/api/v1/print_job/state', timeout=1).json() ...
flexible
{ "blob_id": "d443e9054481984d5372343170254268dca8a3b1", "index": 3235, "step-1": "<mask token>\n\n\ndef is_printing():\n try:\n status = http.get('http://' + PRINTER_IP + '/api/v1/printer/status',\n timeout=1)\n if status.json() == 'printing':\n state = http.get('http://' +...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--dir', type=str, required=True) parser.add_argument('--task', type=str, required=True) args = parser.parse_args() if not os.pa...
flexible
{ "blob_id": "dc3a3f5675860792ecfa7dcd5180402d89b669b1", "index": 8254, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--dir', type=str, required=True)\n parser.add_argument('--task', type=str, required=True)\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def letterToIndex(letter): return all_letters.find(letter) <|reserved_special_token_0|> class RNN(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(inpu...
flexible
{ "blob_id": "aa24442624aebeb2777f16a826cf59859d7870ba", "index": 8744, "step-1": "<mask token>\n\n\ndef letterToIndex(letter):\n return all_letters.find(letter)\n\n\n<mask token>\n\n\nclass RNN(nn.Module):\n\n def __init__(self, input_size, hidden_size, output_size):\n super(RNN, self).__init__()\n ...
[ 6, 7, 10, 11, 13 ]
import zipfile zzz = zipfile.ZipFile('channel.zip','r') filestr = '90052' comment = [] for i in range(1000): fname = filestr + ".txt" for j in zzz.infolist(): if j.filename == fname : print j.comment comment.append(j.comment) break inzzz = zzz.open(fname).read() print 'fname = ' + fname ...
normal
{ "blob_id": "34ad2e6fc7167766dac1ca962cab40511c89ad68", "index": 7551, "step-1": "import zipfile\n\nzzz = zipfile.ZipFile('channel.zip','r')\nfilestr = '90052'\ncomment = []\nfor i in range(1000):\n fname = filestr + \".txt\"\n for j in zzz.infolist():\n if j.filename == fname :\n print j.comment\n ...
[ 0 ]
""" 7-4. Pizza Toppings: Write a loop that prompts the user to enter a series of pizza toppings until they enter a 'quit' value. As they enter each topping, print a message saying you’ll add that topping to their pizza. """ if __name__ == '__main__': topping = None while topping != "quit": if topping: ...
normal
{ "blob_id": "4d07795543989fe481e1141756f988d276f82c02", "index": 5348, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n topping = None\n while topping != 'quit':\n if topping:\n print(\"I'll add %s to your pizza!\" % topping)\n topping = input(\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def _get_user_name(): """ Get the current user. """ return pwd.getpwuid(os.getuid())[0] def _user_belongs_to(group_name): """ Check that the current user belongs to the ``group_name`` group. """ user_name = _get_user_name() groups = _get_user_groups(u...
flexible
{ "blob_id": "e5921edef3d3c56a73f2674f483ea4d1f3577629", "index": 5186, "step-1": "<mask token>\n\n\ndef _get_user_name():\n \"\"\"\n Get the current user.\n \"\"\"\n return pwd.getpwuid(os.getuid())[0]\n\n\ndef _user_belongs_to(group_name):\n \"\"\"\n Check that the current user belongs to the ...
[ 17, 21, 24, 30, 34 ]
from django.shortcuts import render, redirect from .models import Courses from django.views.generic import CreateView, ListView, UpdateView, DeleteView from .forms import CourceCreateForm from django.urls import reverse_lazy from django.urls import reverse class CourceListView(ListView): model = Courses templ...
normal
{ "blob_id": "3340277df91f1421dab8d204eddce65b4604432b", "index": 369, "step-1": "<mask token>\n\n\nclass CourceCreateView(CreateView):\n template_name = 'cources/create_cource.html'\n form_class = CourceCreateForm\n success_url = reverse_lazy('cources:cource_list')\n\n\nclass CourceUpdateView(UpdateView...
[ 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Number(Value): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Number(Value): <|reserved_special_token_0|> def __str__(self): return str(self.number) <|reserved_special_token_1|...
flexible
{ "blob_id": "7da274803de80f2864471d00c9d15aff1103372f", "index": 3648, "step-1": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n\n def __str__(self):\n return str(self.number)\n", "step-3": "<mask ...
[ 1, 2, 3, 4 ]
import tkinter from tkinter import messagebox from random import randint tplyer = 0 tcomp = 0 player = 0 comp = 0 top = tkinter.Tk() top.resizable(width = False, height =False) top.geometry("200x100") def Yes(): global player global comp tplayer = randint(1,6) tcomp = randint(1,6) message ="" if tplay...
normal
{ "blob_id": "0a5baacf17d33dbf6ea69114a8632f7fcef52c3c", "index": 9419, "step-1": "<mask token>\n\n\ndef Yes():\n global player\n global comp\n tplayer = randint(1, 6)\n tcomp = randint(1, 6)\n message = ''\n if tplayer > tcomp:\n message = 'Wygrales!'\n player += 1\n elif tplay...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Person(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Person(object): def __init__(self, username): self.username = username <|reserved_special_token_0|> <|reserved_specia...
flexible
{ "blob_id": "6d2bc28e7742f1063a04ae96fc195515ad70598b", "index": 5666, "step-1": "<mask token>\n\n\nclass Person(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Person(object):\n\n def __init__(self, username):\n self.username = username\n\n\n<mask token>\n", "st...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def scrape_sas(): pprint('Scraping Events') get_mtb_events() pprint('Getting categories and stages') for event in db.session.query(SASEvent): pprint(event.event_id) get_categories_and_stages(event.event_reference, event.event_id) for event_stage in db.s...
flexible
{ "blob_id": "ecc351cf95254e0bbc5021eff11c500fa0950bd3", "index": 2653, "step-1": "<mask token>\n\n\ndef scrape_sas():\n pprint('Scraping Events')\n get_mtb_events()\n pprint('Getting categories and stages')\n for event in db.session.query(SASEvent):\n pprint(event.event_id)\n get_catego...
[ 8, 9, 10, 11, 12 ]
import pandas as pd from bokeh.models import ColumnDataSource, LinearColorMapper, HoverTool from bokeh.plotting import figure from bokeh.transform import transform from sklearn.metrics import confusion_matrix from reporter.settings import COLORS from reporter.metrics import Metric class ConfusionMatrix(Metric): d...
normal
{ "blob_id": "9a2002b5ff0fe41f2b5b568f4c278d4376bf4fb1", "index": 6117, "step-1": "<mask token>\n\n\nclass ConfusionMatrix(Metric):\n <mask token>\n <mask token>\n\n def draw(self, size=400):\n index_label = 'Predicted'\n column_label = 'Actual'\n matrix = self.generate_data()\n ...
[ 2, 3, 4, 5, 6 ]