code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
'''harvestPRR: analyze Public Record Requests from CSV data provided by NextRequest Created 27 Aug 20 @author: rik@electronicArtifacts.com ''' from collections import defaultdict import csv import datetime import json import random import re import requests import sys import time import urllib import re PRRDateFm...
normal
{ "blob_id": "b3758e42b52bb50d806832c6a3a76ae0537266de", "index": 8043, "step-1": "<mask token>\n\n\ndef freqHist3(tbl):\n \"\"\"python3 version\n\tASSUME: values are frequencies, returns sorted list of (val,freq) items in descending freq order\n\t\"\"\"\n from functools import cmp_to_key\n\n def cmpd1(a...
[ 10, 11, 13, 14, 16 ]
class Solution: def sumSubarrayMins(self, A: List[int]) ->int: stack = [] prev = [None] * len(A) for i in range(len(A)): while stack and A[stack[-1]] >= A[i]: stack.pop() prev[i] = stack[-1] if stack else -1 stack.append(i) stack =...
normal
{ "blob_id": "97029ac9f05037bf9304dacf86c35f5534d887c4", "index": 8303, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def sumSubarrayMins(self, A: List[int]) ->int:\n stack = []\n prev = [None] * len(A)\n for i in range(len(...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # @Time : 2022-03-09 21:51 # @Author : 袁肖瀚 # @FileName: WDCNN-DANN.py # @Software: PyCharm import torch import numpy as np import torch.nn as nn import argparse from model import WDCNN1 from torch.nn.init import xavier_uniform_ import torch.utils.data as Data import matplotlib.py...
normal
{ "blob_id": "fd45657083942dee13f9939ce2a4b71ba3f67397", "index": 3587, "step-1": "<mask token>\n\n\ndef weight_init(m):\n class_name = m.__class__.__name__\n if class_name.find('Conv') != -1:\n xavier_uniform_(m.weight.data)\n if class_name.find('Linear') != -1:\n xavier_uniform_(m.weight....
[ 3, 5, 7, 9, 10 ]
import argparse import requests from ba_bypass_bruteforce import bruteforce, stop_brute, success_queue, dict_queue, success_username from random import choice from time import sleep MAX_ROUND = 3 # 爆破的轮数 curr_round = 0 # 当前的轮数 sleep_time = 2 # 每一轮休眠的秒数 def login_limit_user(): """ 登录函数 """ try: ...
normal
{ "blob_id": "94286fc36e06598b9faa65d9e5759f9518e436c6", "index": 7979, "step-1": "<mask token>\n\n\ndef login_limit_user():\n \"\"\"\n 登录函数\n \"\"\"\n try:\n login_info = dict_queue.get(block=False)\n except Exception as e:\n print('[Error] {0}'.format(repr(e)))\n return\n ...
[ 4, 5, 6, 7, 8 ]
<|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": "b07d042c61e9e6647822989444e72db2e01c64d0", "index": 5751, "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 = [('devices_col...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @uvicore.service() class Mail: def __init__(self, *, mailer: str=None, mailer_options: Dict=None, to: List=[], cc: List=[], bcc: List=[], from_name: str=None, from_address: str=None, subject: str=None, html: str=None, text: str=None, attachments: List=[]) ->No...
flexible
{ "blob_id": "c87ede0e3c6d4cc305450f68b4cf61fb63986760", "index": 8676, "step-1": "<mask token>\n\n\n@uvicore.service()\nclass Mail:\n\n def __init__(self, *, mailer: str=None, mailer_options: Dict=None, to:\n List=[], cc: List=[], bcc: List=[], from_name: str=None,\n from_address: str=None, subj...
[ 6, 8, 9, 10, 15 ]
<|reserved_special_token_0|> class Ui_MapGraphTab(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_MapGraphTab(object): def setupUi(self, MapGraphTab): MapGraphTab.setObjectNam...
flexible
{ "blob_id": "03a13037a9a102397c8be4d9f0f4c5e150965808", "index": 8666, "step-1": "<mask token>\n\n\nclass Ui_MapGraphTab(object):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MapGraphTab(object):\n\n def setupUi(self, MapGraphTab):\n MapGraphTab.setO...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print <|reserved_special_token_1|> a = 'Hello, World!' print
flexible
{ "blob_id": "b779cfc6d6456a370092bf1cfa5904c869b7466a", "index": 9219, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint\n", "step-3": "a = 'Hello, World!'\nprint\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import json import requests class Bitcoin: coindesk = 'https://api.coindesk.com/v1/bpi/currentprice.json' def __init__(self): pass def get_current_price(self, url=coindesk): self.resp = requests.get(url) if self.resp.status_code == 200: return json.loads(self.resp.con...
normal
{ "blob_id": "3bfe4021d5cf9bd24c0fb778b252bc04c6ac47ed", "index": 1847, "step-1": "<mask token>\n\n\nclass Bitcoin:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Bitcoin:\n <mask token>\n\n def __init__(self):\n pass\n <mask token>...
[ 1, 2, 4, 5, 6 ]
import ipaddress import subprocess from subprocess import Popen, PIPE import time ip_net = ipaddress.ip_network('192.168.0.100/30') for i in ip_net.hosts(): # print(i) host_add = str(i) toping = subprocess.Popen(['ping', '-n', '3',host_add],stdout=PIPE) output = toping.communicate()[0] ...
normal
{ "blob_id": "414fb437783fcfb55f542f072aaf3a8bb02b441e", "index": 8275, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in ip_net.hosts():\n host_add = str(i)\n toping = subprocess.Popen(['ping', '-n', '3', host_add], stdout=PIPE)\n output = toping.communicate()[0]\n hostalive = toping.re...
[ 0, 1, 2, 3, 4 ]
class Solution(object): def smallestGoodBase(self, n): """ :type n: str :rtype: str """ # k is the base and the representation is # m bits of 1 # We then have from math # (k**m - 1) / (k-1) = n # m = log_k (n * k - n + 1) # m needs to b...
normal
{ "blob_id": "de287d1bc644fdfd0f47bd8667580786b74444d0", "index": 8863, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n <mask token>\n", "step-3": "class Solution(object):\n <mask token>\n\n def solve_equation(self, m, n):\n k_l, k_h = 2, n - 1\n while...
[ 0, 1, 2, 3, 4 ]
import random import cv2 img = cv2.imread('assets/logo.jpg', -1) print(img.shape) #3 channels, bgr #look at the 257. row and pixel 400 --> has bgr values: [41 98 243] print(img[257][400]) ''' # manipulate the first 100 rows, all columns, and randomize the 3 pixel values # (rows, colums, pixels) where pixels: b,g,...
normal
{ "blob_id": "35e66e5e154f5cd70f187a1cde33cef71102e1a6", "index": 6829, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(img.shape)\nprint(img[257][400])\n<mask token>\ncv2.imshow('Image', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('assets/logo.jpg', ...
[ 0, 1, 2, 3, 4 ]
from pymongo import MongoClient from modules.linkedinSearch import SearchClass from config import Config class LinkedinSearch: def __init__(self): self.client = MongoClient(Config.MONGO_URI) db = self.client.linkedin_db self.collection = db.search self.dict = {} self.obj ...
normal
{ "blob_id": "3e8860c22ff3092304df57aa7f5dbcb6ccda7dd8", "index": 5249, "step-1": "<mask token>\n\n\nclass LinkedinSearch:\n <mask token>\n <mask token>\n\n def db_fetch(self, query):\n self.collection.create_index([('name', 'text')])\n lst = []\n cursor = self.collection.find({'$tex...
[ 2, 4, 5, 6, 7 ]
import torch from torchvision import datasets, transforms import numpy as np import torch.nn as nn import torch.nn.functional as F import torchvision.models as models from PIL import Image import requests from io import BytesIO from net import Net class predict_guitar(): def __init__(self): """Model is lo...
normal
{ "blob_id": "8743be809953f59bd14431e509042c4c51d9fab4", "index": 4175, "step-1": "<mask token>\n\n\nclass predict_guitar:\n <mask token>\n\n def softmax(self, vector):\n \"\"\"Softmax function for calculating probs\"\"\"\n e = np.exp(vector)\n return e / e.sum()\n <mask token>\n", ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def gcd_naive(a, b): x = 5 while x > 1: if a % b != 0: c = a % b a = b b = c else: x = 1 return b <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def gcd_naive(a, b): ...
flexible
{ "blob_id": "c70681f5ff8d49a243b7d26164aa5430739354f4", "index": 6936, "step-1": "<mask token>\n\n\ndef gcd_naive(a, b):\n x = 5\n while x > 1:\n if a % b != 0:\n c = a % b\n a = b\n b = c\n else:\n x = 1\n return b\n\n\n<mask token>\n", "step-...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @ray.remote def run(run_config: dict, wrks: dict) ->dict: try: add_spk_role() except: print('run, spark: ignore') os.chdir(microps_dir) base_spk_config = spk.apps_config_map['sparkperfml'] base_spk_config = spk.patched_app_config(base_spk_config, {'app_...
flexible
{ "blob_id": "25595b5f86a41fee1dc43f199f3bcff73f6d256b", "index": 9418, "step-1": "<mask token>\n\n\n@ray.remote\ndef run(run_config: dict, wrks: dict) ->dict:\n try:\n add_spk_role()\n except:\n print('run, spark: ignore')\n os.chdir(microps_dir)\n base_spk_config = spk.apps_config_map[...
[ 1, 2, 3, 4, 5 ]
import numpy as np from base_test import ArkoudaTest from context import arkouda as ak """ Encapsulates unit tests for the pdarrayclass module that provide summarized values via reduction methods """ class SummarizationTest(ArkoudaTest): def setUp(self): ArkoudaTest.setUp(self) self.na = np.linsp...
normal
{ "blob_id": "88109909d0c80f25373f917426c3c3634bfc8114", "index": 6267, "step-1": "<mask token>\n\n\nclass SummarizationTest(ArkoudaTest):\n\n def setUp(self):\n ArkoudaTest.setUp(self)\n self.na = np.linspace(1, 10, 10)\n self.pda = ak.array(self.na)\n <mask token>\n\n def testMin(s...
[ 6, 7, 8, 9, 11 ]
from typing import List class Solution: def findSubsequences(self, nums: List[int]) ->List[List[int]]: res: List[List[int]] = [] s = set() def deep(pos: int, tmp: List[int]): if pos == len(nums): if len(tmp) < 2: return for ...
normal
{ "blob_id": "3edfc1098c775fa31456aa3cc938051b2dbb8697", "index": 1664, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def findSubsequences(self, nums: List[int]) ->List[List[int]]:\n res: List[List[int]] = []\n s = set()\n\n def deep(pos: int, tmp: List[int...
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> class TestTmdb(BaseTestCase): <|reserved_special_token_0|> def test_discover(self): """ Testing the TMDB API discover endpoint """ response = Tmdb.discover() self.assertTrue(int(response.status_code) == 200) data = response.json() self.asse...
flexible
{ "blob_id": "9e9403ea1c128e07803d080b337003055759c5ae", "index": 4507, "step-1": "<mask token>\n\n\nclass TestTmdb(BaseTestCase):\n <mask token>\n\n def test_discover(self):\n \"\"\" Testing the TMDB API discover endpoint \"\"\"\n response = Tmdb.discover()\n self.assertTrue(int(respon...
[ 4, 5, 6, 7, 10 ]
<|reserved_special_token_0|> class Person: def __init__(self, name, surname, job, salary): self.name = name self.surname = surname self.job = job self.salary = salary def create(name): conn = db.connect(name + '.db') c = conn.cursor() c.execute( """CREATE TAB...
flexible
{ "blob_id": "7ff19ee35422395f78dca1e17a736df20a40ea98", "index": 7569, "step-1": "<mask token>\n\n\nclass Person:\n\n def __init__(self, name, surname, job, salary):\n self.name = name\n self.surname = surname\n self.job = job\n self.salary = salary\n\n\ndef create(name):\n conn...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> @driver_api.route('/<int:driver_id>', methods=['PUT']) def update(driver_id): req_data = request.get_json() data, error = driver_schema.load(req_data, partial=True) if error: return custom_response({'Error': 'Driver not found.'}, 400) driver = DriverModel.get_one_d...
flexible
{ "blob_id": "ee7820d50b5020a787fbaf012480e8c70bc0ee41", "index": 1690, "step-1": "<mask token>\n\n\n@driver_api.route('/<int:driver_id>', methods=['PUT'])\ndef update(driver_id):\n req_data = request.get_json()\n data, error = driver_schema.load(req_data, partial=True)\n if error:\n return custom...
[ 2, 5, 7, 9, 10 ]
<|reserved_special_token_0|> class DecoderBase(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self): self._predictor = 'decoder' self._label = None pass @abstractmethod def set_label(self, label): self._label = label <|reserved...
flexible
{ "blob_id": "0d8a26ef4077b40e8255d5bb2ce9217b51118780", "index": 7364, "step-1": "<mask token>\n\n\nclass DecoderBase(object):\n <mask token>\n <mask token>\n\n def __init__(self):\n self._predictor = 'decoder'\n self._label = None\n pass\n\n @abstractmethod\n def set_label(se...
[ 4, 5, 7, 8, 10 ]
<|reserved_special_token_0|> class TestPluginFunimationNow(unittest.TestCase): def test_arguments(self): from streamlink_cli.main import setup_plugin_args session = Streamlink() parser = MagicMock() group = parser.add_argument_group('Plugin Options').add_argument_group( ...
flexible
{ "blob_id": "266add60be2b6c2de5d53504cbabf754aa62d1b0", "index": 9806, "step-1": "<mask token>\n\n\nclass TestPluginFunimationNow(unittest.TestCase):\n\n def test_arguments(self):\n from streamlink_cli.main import setup_plugin_args\n session = Streamlink()\n parser = MagicMock()\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> firebase_admin.initialize_app(cred, {'databaseURL': 'https://mikro-b4844.firebaseio.com/'}) <|reserved_special_token_0|> print(ref.get()) <|reserved_special_token_0|> while True: print(ref.get()) if ref.get() == 'Off' ...
flexible
{ "blob_id": "acff8618754658104ac36214901d346447a0134f", "index": 811, "step-1": "<mask token>\n", "step-2": "<mask token>\nfirebase_admin.initialize_app(cred, {'databaseURL':\n 'https://mikro-b4844.firebaseio.com/'})\n<mask token>\nprint(ref.get())\n<mask token>\nwhile True:\n print(ref.get())\n if re...
[ 0, 1, 2, 3, 4 ]
from __future__ import annotations import ibis from ibis import _ def test_format_sql_query_result(con, snapshot): t = con.table("airlines") query = """ SELECT carrier, mean(arrdelay) AS avg_arrdelay FROM airlines GROUP BY 1 ORDER BY 2 DESC """ schema = ibis.schema({"...
normal
{ "blob_id": "97ff8dae060475b0efbc8d39e9fc251be8ac091b", "index": 6264, "step-1": "<mask token>\n\n\ndef test_memoize_insert_sort_key(con, snapshot):\n table = con.table('airlines')\n t = table['arrdelay', 'dest']\n expr = t.group_by('dest').mutate(dest_avg=t.arrdelay.mean(), dev=t.\n arrdelay - t...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: from setuptools import setup from setuptools import find_packages has_setup_tools = true except ImportError: from distutils.core import setup has_setup_tools = false with open('README.md', 'r') as fh: long_description = fh.read() ...
flexible
{ "blob_id": "5d988d159902e4a4cb17ee0ec61153de2dda4691", "index": 9120, "step-1": "<mask token>\n", "step-2": "try:\n from setuptools import setup\n from setuptools import find_packages\n has_setup_tools = true\nexcept ImportError:\n from distutils.core import setup\n has_setup_tools = false\nwit...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def weib(x, nn, a): return a / nn * (x / nn) ** (a - 1) * n.exp(-(x / nn) ** a) <|reserved_special_token_0|> print('distancias de KS para os modelos matematicos:', diffN, diffN2, diffU, diffU2, diffW, diffP) <|reserved...
flexible
{ "blob_id": "647258ee5f2f6f1cb8118bcf146b8959c65b70cd", "index": 8045, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef weib(x, nn, a):\n return a / nn * (x / nn) ** (a - 1) * n.exp(-(x / nn) ** a)\n\n\n<mask token>\nprint('distancias de KS para os modelos matematicos:', diffN, diffN2, diffU,\n ...
[ 0, 2, 3, 4, 5 ]
import speech_recognition as sr import pyttsx3 import pywhatkit import datetime listner = sr.Recognizer() engine = pyttsx3.init() #change voices voices = engine.getProperty('voices') engine.setProperty('voice',voices[10].id) rate = engine.getProperty('rate') engine.setProperty('rate', 150) #for machine to say def t...
normal
{ "blob_id": "c4f437e6f5aaeccb6dd0948c3ed1f1d465bb29ce", "index": 1200, "step-1": "<mask token>\n\n\ndef talk(text):\n engine.say(text)\n engine.runAndWait()\n\n\ndef takeCommand():\n try:\n with sr.Microphone() as sc:\n print('Listening......')\n vc = listner.listen(sc)\n ...
[ 3, 4, 5, 6, 7 ]
""" @Description: @Author : HCQ @Contact_1: 1756260160@qq.com @Project : pytorch @File : call_test @Time : 2022/5/24 下午10:19 @Last Modify Time @Version @Desciption -------------------- -------- ----------- 2022/5/24 下午10:19 1.0 None """ class Person(): def __cal...
normal
{ "blob_id": "7b1c7228c1fc9501ab857cba62a7e073691e75c9", "index": 755, "step-1": "<mask token>\n\n\nclass Person:\n\n def __call__(self, name):\n print('__call__' + ' Hello ' + name)\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Person:\n\n def __call__(self, name):\n ...
[ 2, 3, 4, 5, 6 ]
from vmgCommanderBase import CommanderBase from vmgInstallerApt import InstallerApt from vmgInstallerYum import InstallerYum from vmgConfigLinux import ConfigLinux from runCommands import * import shutil import os import time from vmgLogging import * from writeFormat import * from vmgControlVmware import * from vmgUtil...
normal
{ "blob_id": "22fe07a237f2c5f531d189c07596a22df191d038", "index": 1140, "step-1": "from vmgCommanderBase import CommanderBase\nfrom vmgInstallerApt import InstallerApt\nfrom vmgInstallerYum import InstallerYum\nfrom vmgConfigLinux import ConfigLinux\nfrom runCommands import *\nimport shutil\nimport os\nimport tim...
[ 0 ]
# Copyright (c) 2020 Hai Nguyen # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import tensorflow.keras.backend as K def dice_coef(y_true, y_pred): smooth = 1. y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) intersection = K.sum(y_true_f * y_pred_...
normal
{ "blob_id": "18b10a68b2707b7bfeccbd31c5d15686453b3406", "index": 6253, "step-1": "<mask token>\n\n\ndef false_pos(y_true, y_pred):\n smooth = 1\n y_pred_pos = K.round(K.clip(y_pred, 0, 1))\n y_pos = K.round(K.clip(y_true, 0, 1))\n y_neg = 1 - y_pos\n fp = K.sum(y_neg * y_pred_pos)\n fp_ratio = ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('nodes_tags.csv', 'r') as f: tags = csv.DictReader(f) for row in tags: if row['key'] == 'FIXME': pp(row) <|reserved_special_token_1|> import csv from pprint import pprint as pp with open('n...
flexible
{ "blob_id": "d0981d279f7090d5309aa564252dba731a34a66b", "index": 1424, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('nodes_tags.csv', 'r') as f:\n tags = csv.DictReader(f)\n for row in tags:\n if row['key'] == 'FIXME':\n pp(row)\n", "step-3": "import csv\nfrom pprint...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mkrandom.settings') <|reserved_special_token_0|> django.setup() <|reserved_special_token_0|> for char in char_names: index = x - y + 1 name = char_names[x] if 'Yoshi (' ...
flexible
{ "blob_id": "dbda5df7dff3f8acc320ffe7b9c7c279ebed2cc2", "index": 7108, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mkrandom.settings')\n<mask token>\ndjango.setup()\n<mask token>\nfor char in char_names:\n index = x - y + 1\n name = char_names[x]\...
[ 0, 1, 2, 3, 4 ]
from rest_framework import serializers from .models import SensorValue class SensorValueSerializer(serializers.ModelSerializer): timestamp = serializers.DateTimeField(required=False) class Meta: model = SensorValue fields = ("id", "timestamp", "sensor_type", "value")
normal
{ "blob_id": "39312ec60c9ef1c9c95cf4206b6d0bbdb0aedf94", "index": 9042, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SensorValueSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = SensorValue\n fields = 'id', 'timestamp', 'sensor_type', 'valu...
[ 0, 1, 2, 3, 4 ]
# POST API for Red Alert project - NLP and Metalearning components # Insikt Intelligence S.L. 2019 import pandas as pd import pickle from flask import Flask, render_template, request, jsonify from utilities import load_data, detect_language from preprocessing import preprocess, Tagger, remove_stopwords import json fro...
normal
{ "blob_id": "b51e0ee80a2488197470627821204d1f74cd62a1", "index": 5437, "step-1": "<mask token>\n\n\n@app.route('/probability', methods=['POST'])\ndef make_probability():\n try:\n data = request.get_json()\n except Exception as e:\n raise e\n if data == {}:\n return bad_request()\n ...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def how_many_seconds(hrs_int): secs_int = None if hrs_int > 0 and hrs_int is not None: secs_int = hrs_int * 60 * 60 return secs_int else: raise TypeError('Invalid input type') <|reserved_spe...
flexible
{ "blob_id": "34c7e6b6bc687bc641b7e3b9c70fd0844af8e340", "index": 8969, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef how_many_seconds(hrs_int):\n secs_int = None\n if hrs_int > 0 and hrs_int is not None:\n secs_int = hrs_int * 60 * 60\n return secs_int\n else:\n rai...
[ 0, 1, 2 ]
# 引入基础的工作表 from openpyxl import Workbook # 引入增强的修改功能 from openpyxl.styles import Font,Alignment,Border,Side,PatternFill,colors # import openpyxl def make_example(): # 设定文件目录 addr = './example.xlsx' # 初始化文件,切换到活动的工作表 work_book = Workbook() # 读取文件采用 # work_book = openpyxl.load_workbook...
normal
{ "blob_id": "d7524a455e62594e321b67f0a32a5c3a7437c1d6", "index": 1093, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_example():\n addr = './example.xlsx'\n work_book = Workbook()\n work_sheet = work_book.active\n work_sheet['A1'] = 'Hello World!'\n select_cell = work_sheet.ce...
[ 0, 1, 2, 3, 4 ]
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 = True count -= 4 elif int(cell[1]...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while t: n = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) s = 0 for i in range(n): k = a[i] - i if k >= 0: s += k print(s % 1000000007) t -= 1 <|re...
flexible
{ "blob_id": "44bf409d627a6029ab4c4f1fff99f102b8d57279", "index": 3954, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile t:\n n = int(input())\n a = list(map(int, input().split()))\n a.sort(reverse=True)\n s = 0\n for i in range(n):\n k = a[i] - i\n if k >= 0:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', views.index_view, name='accounts.index'), url( '^login/$', views.login_view, name='accounts.login'), url('^logout/$', views.logout_view, name='accounts.logout'), url('^registro/$', views. regis...
flexible
{ "blob_id": "b4d09b6d8ad5f0584f74adc0fd8116265bb6649b", "index": 4641, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.index_view, name='accounts.index'), url(\n '^login/$', views.login_view, name='accounts.login'), url('^logout/$',\n views.logout_view, name='accounts....
[ 0, 1, 2, 3 ]
import requests import json import hashlib import os def pull_from_solr(output_directory): solr_url = 'http://54.191.81.42:8888/solr/collection1/select?q=*%3A*&wt=json&indent=true' # TODO: ask about auth for this req = requests.get(solr_url) if req.status_code != 200: raise new_data = r...
normal
{ "blob_id": "47b40e4311f76cd620b7c6ed6b39216d866fa857", "index": 8530, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef pull_from_solr(output_directory):\n solr_url = (\n 'http://54.191.81.42:8888/solr/collection1/select?q=*%3A*&wt=json&indent=true'\n )\n req = requests.get(solr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def combine(self, n: int, k: int) ->List[List[int]]: if ...
flexible
{ "blob_id": "e4a2c605ef063eee46880515dfff05562916ab81", "index": 9976, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def combine(self, n: int, k: int) ->List[List[int]]:\n if k == 0:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Auth: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/welcome/<username>/suffix/<message>') def welcome(username, message): return jsonify({'comment': f'Hello {username}, {message}!'}) ...
flexible
{ "blob_id": "8fcc2a13fd5a803e2d755a567c78c8274bd88aad", "index": 7283, "step-1": "<mask token>\n\n\nclass Auth:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/welcome/<username>/suffix/<message>')\ndef welcome(username, message):\n return jsonify({'comment': f'Hello {usern...
[ 1, 3, 6, 9, 10 ]
import cv2 import pytesseract import os from PIL import Image import numpy as np from helper_functions import Helper class ImageData: # multipliers to get portion of image with interval value __bottom_thresh = 0.9 __left_thresh = 0.35 __right_thresh = 0.65 # (words, offset) to contour interval value __words_of...
normal
{ "blob_id": "d3be26d56b3597a5d9e3a870b735a30d90d1e501", "index": 8165, "step-1": "<mask token>\n\n\nclass ImageData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, image):\n self.image = image\n self._contour_interval_dist = None\...
[ 6, 10, 11, 12, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): return render(request, 'munchiesfastfood/home.html', {'drinks': [ 'Pineapple Juice', 'Green Juice', 'Soft Drinks', 'Carlo Rosee Drinks'], 'dishes': ['Beef Steak', 'Tomato with Chic...
flexible
{ "blob_id": "e279ca43ce2c582c702f1c6a0c1acf37eb9bcefe", "index": 5603, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n return render(request, 'munchiesfastfood/home.html', {'drinks': [\n 'Pineapple Juice', 'Green Juice', 'Soft Drinks',\n 'Carlo Rosee Drinks'], 'd...
[ 0, 1, 2 ]
import sys import numpy as np import math import matplotlib.pyplot as plt import random def load_files(training, testing): tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=",") tr_feat /= 255.0 tr_feat = np.insert(tr_feat, 0, 0, axis=1) tr_exp = np.genfromtxt(training, usecols=range(-1)...
normal
{ "blob_id": "4af05a13264c249be69071447101d684ff97063e", "index": 6725, "step-1": "<mask token>\n\n\ndef load_files(training, testing):\n tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=',')\n tr_feat /= 255.0\n tr_feat = np.insert(tr_feat, 0, 0, axis=1)\n tr_exp = np.genfromtxt(traini...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- """ Description: This modules is used for testing. Testing is performed based on the list of commands given to perform in a website Version : v1.5 History : v1.0 - 08/01/2016 - Initial version v1.1 - 08/05/2016 - Modified to accept List input. ...
normal
{ "blob_id": "9e77385933cf6e381f25bea9020f909d5dc6817d", "index": 4744, "step-1": "# -*- coding: utf-8 -*-\n\"\"\"\n Description: This modules is used for testing. Testing is performed based on the list of commands given to perform in a website\n Version : v1.5\n History :\n v1.0 - 0...
[ 0 ]
import numpy as np # data I/O data = open('input.txt', 'r').read() # should be simple plain text file chars = list(set(data)) data_size, vocab_size = len(data), len(chars) print("chars: ", chars) #one-hot encoding char_to_ix = { ch:i for i,ch in enumerate(chars) } ix_to_char = { i:ch for i,ch in enumerate(chars) } it...
normal
{ "blob_id": "d988cfebeec37df700f46bbb027a4980ba624d30", "index": 6639, "step-1": "<mask token>\n\n\ndef lossFun(inputs, targets, hprev):\n x, h, yprime = {}, {}, {}\n h[-1] = np.copy(hprev)\n loss = 0\n for t in range(len(inputs)):\n x[t] = np.zeros((vocab_size, 1))\n x[t][inputs[t]] = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> lr.fit(x_train, y_train) <|reserved_special_token_0|> pickle.dump(lr, open('model.pkl', 'wb')) <|reserved_special_token_1|> <|reserved_special_token_0|> dataset = pd.read_csv('heart.csv') df = dataset.copy() X = df.drop(['targe...
flexible
{ "blob_id": "1508697f93114d7f20182a3e9c1df5617904529a", "index": 8725, "step-1": "<mask token>\n", "step-2": "<mask token>\nlr.fit(x_train, y_train)\n<mask token>\npickle.dump(lr, open('model.pkl', 'wb'))\n", "step-3": "<mask token>\ndataset = pd.read_csv('heart.csv')\ndf = dataset.copy()\nX = df.drop(['targ...
[ 0, 1, 2, 3, 4 ]
''' log.py version 1.0 - 18.03.2020 Logging fuer mehrere Szenarien ''' # Imports import datetime # Globale Variablen ERROR_FILE = "error.log" LOG_FILE = "application.log" def error(msg): __log_internal(ERROR_FILE, msg) def info(msg): __log_internal(LOG_FILE, msg) def __log_internal(filenam...
normal
{ "blob_id": "0475c6cab353f0d23a4c4b7f78c1b47ecc5f8d3b", "index": 4819, "step-1": "<mask token>\n\n\ndef error(msg):\n __log_internal(ERROR_FILE, msg)\n\n\ndef info(msg):\n __log_internal(LOG_FILE, msg)\n\n\ndef __log_internal(filename, msg):\n now = datetime.datetime.now()\n f = open(filename, 'a+')\...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Third party imports import numpy as np # Local application imports from mosqito.sound_level_meter import noct_spectrum from mosqito.sq_metrics.loudness.loudness_zwst._main_loudness import _main_loudness from mosqito.sq_metrics.loudness.loudness_zwst._calc_slopes import _calc_slopes from mosq...
normal
{ "blob_id": "75716aaaca63f8ca6d32c885021c1dc0f9a12dac", "index": 793, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef loudness_zwst(signal, fs=None, field_type='free', is_sdt_output=False):\n \"\"\"Zwicker-loudness calculation for stationary signals\n\n Calculates the acoustic loudness accor...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python2 import os import sys import textwrap COMMAND = ( 'convert -size 1920x1080 canvas:"rgb(149, 1, 1)" ' '-font Dejavu-Sans-Bold -pointsize {0} -gravity center -stroke none ' '-fill white -annotate 0 "{1}" -size 1920x1080 "{2}.png"' ) def makeimage(text, point_size=100, width=30): t...
normal
{ "blob_id": "a486ec6b27a6b84e454a1bed096be9fe22d91612", "index": 1561, "step-1": "<mask token>\n\n\ndef makeimage(text, point_size=100, width=30):\n tw = textwrap.TextWrapper(width=width)\n text = '\\n'.join(a.replace('\\\\n', '\\n') for a in tw.wrap(text))\n filename = ''.join(c for c in text.replace('...
[ 2, 3, 4, 5, 6 ]
from torch.utils.data import IterableDataset, DataLoader from torch import nn from torch.nn import functional as F from triplet_training_generator import get_train_test_apikeys, training_generator from pathlib import Path from transformers import AutoModel import torch from tqdm import tqdm import pandas as pd MEMMAP_...
normal
{ "blob_id": "650f00dd9740d62546eb58724e6e5a74398b3e59", "index": 2522, "step-1": "<mask token>\n\n\nclass DataGenerator(IterableDataset):\n <mask token>\n <mask token>\n\n\nclass CrossEncoderModel(torch.nn.Module):\n\n def __init__(self):\n super(CrossEncoderModel, self).__init__()\n self....
[ 4, 7, 9, 10, 11 ]
""" OCR that converts images to text """ from pytesseract import image_to_string from PIL import Image print image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png')) #print image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png')) #pr...
normal
{ "blob_id": "91ac4a23573abcb0ab024830dbc1daebd91bd40d", "index": 2355, "step-1": "\"\"\" OCR that converts images to text \"\"\"\n\nfrom pytesseract import image_to_string\nfrom PIL import Image\n\nprint image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png'))\n\n#print ...
[ 0 ]
#!/usr/bin/env python # Title : STACK_BostonHousing.py # Description : Stacking was the natural progression of our algorithms trial. # In here, we'll use prediction from a number of models in order # to improve accuracy as it add linearly independent data to our # ...
normal
{ "blob_id": "21c581131cff8cf2f4aa407055184d56865a6335", "index": 9783, "step-1": "<mask token>\n\n\nclass Ensemble(object):\n \"\"\"Ensemble base_models on train data than fit/predict\n\n The object input is composed of 'n_splits', 'stacker' and list of\n 'base_models'.\n\n The __init__ method self-a...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
normal
{ "blob_id": "fd391d28d76b0c1b3cf6d0b5134390ab3f1267fb", "index": 5152, "step-1": "<mask token>\n\n\nclass CliConfigManager(BaseConfigManager):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def _get_count(cls):\n config = cls.get_config_o...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(n) <|reserved_special_token_1|> <|reserved_special_token_0|> heat = Heatmodel() n = heat.get_component_name() print(n) <|reserved_special_token_1|> from pymt_heat import Heatmodel heat = Heatmodel() n = heat.get_compon...
flexible
{ "blob_id": "82801ce564f4f29e084e6f842d7868eb60f582cb", "index": 6225, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(n)\n", "step-3": "<mask token>\nheat = Heatmodel()\nn = heat.get_component_name()\nprint(n)\n", "step-4": "from pymt_heat import Heatmodel\nheat = Heatmodel()\nn = heat.get_comp...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def näita_tabelit(ttt, tabel): hetkeseis(tabel) ttt.blit(tabel, (0, 0)) pygame.display.flip() def hiire_positsioon_tabelis(Xkoordinaat, Ykoordinaat): if Ykoordinaat < 100: rida = 0 elif Ykoordinaat < 200: rida = 1 else: rida = 2 if Xko...
flexible
{ "blob_id": "a667c4cb0a30ee67fe982bb96ece6bb75f25f110", "index": 7084, "step-1": "<mask token>\n\n\ndef näita_tabelit(ttt, tabel):\n hetkeseis(tabel)\n ttt.blit(tabel, (0, 0))\n pygame.display.flip()\n\n\ndef hiire_positsioon_tabelis(Xkoordinaat, Ykoordinaat):\n if Ykoordinaat < 100:\n rida = ...
[ 6, 7, 9, 10, 11 ]
#!/usr/bin/python def check(n): if n == 0 : print "neither Positive nor Negative" if n < 0 : print "Negative" if n > 0 : print "Positive" print "10 is ", check(10) print "-5 is ", check(-5) print "0 is ", check(0)
normal
{ "blob_id": "9c6bb885c05ee13a283b09861a5aa7c5e62677cb", "index": 1008, "step-1": "#!/usr/bin/python\ndef check(n):\n if n == 0 :\n print \"neither Positive nor Negative\"\n if n < 0 :\n print \"Negative\"\n if n > 0 :\n print \"Positive\"\n\n\n\nprint \"10 is \", check(10)\nprint \"...
[ 0 ]
<|reserved_special_token_0|> class Punkt(Figura): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Linia(Figura): def __init__(self): print('Tworze obiekt klasy Linia...') def wyswietl(self): print('Me...
flexible
{ "blob_id": "774bf2b49f6e546f16294edc17e9ac34fa8a9ba8", "index": 2711, "step-1": "<mask token>\n\n\nclass Punkt(Figura):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Linia(Figura):\n\n def __init__(self):\n print('Tworze obiekt klasy Linia...')\n\n def wyswietl(...
[ 27, 30, 31, 34, 41 ]
def heapify(lst, index, heap_size): largest = index left_index = 2 * index + 1 right_index = 2 * index + 2 if left_index < heap_size and lst[left_index] > lst[largest]: largest = left_index if right_index < heap_size and lst[right_index] > lst[largest]: largest = right_index if l...
normal
{ "blob_id": "d8ea396ff8514cc10e02072ea478f0276584153d", "index": 3274, "step-1": "<mask token>\n", "step-2": "def heapify(lst, index, heap_size):\n largest = index\n left_index = 2 * index + 1\n right_index = 2 * index + 2\n if left_index < heap_size and lst[left_index] > lst[largest]:\n lar...
[ 0, 1, 2 ]
users = {1: "Tom", 2: "Bob", 3: "Bill"} elements = {"Au": "Oltin", "Fe": "Temir", "H": "Vodorod", "O": "Kislorod"}
normal
{ "blob_id": "a24ab93983546f8ae0fab042c121ac52388e62e8", "index": 2967, "step-1": "<mask token>\n", "step-2": "users = {(1): 'Tom', (2): 'Bob', (3): 'Bill'}\nelements = {'Au': 'Oltin', 'Fe': 'Temir', 'H': 'Vodorod', 'O': 'Kislorod'}\n", "step-3": "users = {1: \"Tom\", 2: \"Bob\", 3: \"Bill\"}\n\nelements = {\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class PrintTree(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PrintTree(object): def printTree(self, root): if not root: return """ 定义next_last为下一层的最后一个,cur_last为当前层最后一个 temp用...
flexible
{ "blob_id": "4ddff57790ad191fc29fc092bcc714f0b6273100", "index": 7755, "step-1": "<mask token>\n\n\nclass PrintTree(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PrintTree(object):\n\n def printTree(self, root):\n if not root:\n return\n \"\"\"\n 定义next_la...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(selected_movies) <|reserved_special_token_0|> print(selected_movies2) <|reserved_special_token_1|> movies = ['Abraham Lincoln', 'Blue Steel', 'Behind Office Doors', 'Bowery at Midnight', 'Captain Kidd', 'Debbie Does D...
flexible
{ "blob_id": "8435a69ee9793435c7483df9bb15f01ef8051479", "index": 3340, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(selected_movies)\n<mask token>\nprint(selected_movies2)\n", "step-3": "movies = ['Abraham Lincoln', 'Blue Steel', 'Behind Office Doors',\n 'Bowery at Midnight', 'Captain Kidd',...
[ 0, 1, 2, 3 ]
import webbrowser import time x=10 while x > 0: print (x), time.sleep(1) x=x-1 while x==0: print ("MEOW") webbrowser.open("https://www.youtube.com/watch?v=IuysY1BekOE")
normal
{ "blob_id": "4d31357936ce53b2be5f9a952b99df58baffe7ea", "index": 4937, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile x > 0:\n print(x), time.sleep(1)\n x = x - 1\nwhile x == 0:\n print('MEOW')\n webbrowser.open('https://www.youtube.com/watch?v=IuysY1BekOE')\n", "step-3": "<mask token...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DatabaseAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class AlarmAdmin(admin.ModelAdmin): list_display...
flexible
{ "blob_id": "e1968e0d6146ce7656505eeed8e9f31daa4b558a", "index": 5447, "step-1": "<mask token>\n\n\nclass DatabaseAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass AlarmAdmin(admin.ModelAdmin):\n list_display = ['nam...
[ 5, 7, 10, 11, 13 ]
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.core.urlresolvers import reverse import datetime class Document(models.Model): document = models.FileField(upload_to='documents/') uploaded_at = models.DateTimeField(auto_now_add...
normal
{ "blob_id": "01b14da7d081a67bab6f9921bb1a6a4c3d5ac216", "index": 3003, "step-1": "<mask token>\n\n\nclass Assignment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name + '-' + self.technology\n\n\nclass Assestment(models.Model):\n name = mo...
[ 7, 8, 11, 14, 15 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Member', fields=[ ('id', models.AutoField(verbo...
normal
{ "blob_id": "4e383130b185c6147315517d166ffe66be1be40d", "index": 4577, "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 = []\n operat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.remote_data def test_from_sbdb(): """ test from_horizons method""" data = Phys.from_sbdb('Ceres') assert len(data.table) == 1 data = Phys.from_sbdb([(n + 1) for n in range(5)]) assert len(data.ta...
flexible
{ "blob_id": "0bfb089556bfa253bf139f03cd3079ced962d858", "index": 1021, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.remote_data\ndef test_from_sbdb():\n \"\"\" test from_horizons method\"\"\"\n data = Phys.from_sbdb('Ceres')\n assert len(data.table) == 1\n data = Phys.from_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def nth_prime(n): ans = 2 known = [] for _ in range(n): while not all(ans % x != 0 for x in known): ans += 1 known.append(ans) return ans <|reserved_special_token_0|> <|reserved_special_token_1|> def nth_prime(...
flexible
{ "blob_id": "21fb9622add4d19b2914118e3afd3867b2368a50", "index": 4913, "step-1": "<mask token>\n", "step-2": "def nth_prime(n):\n ans = 2\n known = []\n for _ in range(n):\n while not all(ans % x != 0 for x in known):\n ans += 1\n known.append(ans)\n return ans\n\n\n<mask t...
[ 0, 1, 2, 3 ]
import Adafruit_BBIO.GPIO as GPIO from pydrs import SerialDRS import time import sys sys.dont_write_bytecode = True class SyncRecv: def __init__(self): self._comport = '/dev/ttyUSB0' self._baudrate = '115200' self._epwm_sync_pin = 'GPIO2_23' # Input in BBB perspective ...
normal
{ "blob_id": "c716f43dbe62f662c60653f09be946a27c3fff66", "index": 8069, "step-1": "<mask token>\n\n\nclass SyncRecv:\n\n def __init__(self):\n self._comport = '/dev/ttyUSB0'\n self._baudrate = '115200'\n self._epwm_sync_pin = 'GPIO2_23'\n self._sync_in_pin = 'GPIO2_25'\n self...
[ 2, 4, 5, 6, 7 ]
# encoding: utf-8 '''🤠 PDS Roundup: A step takes you further towards a complete roundup''' from enum import Enum from .util import commit, invoke import logging, github3, tempfile, zipfile, os _logger = logging.getLogger(__name__) class Step(object): '''An abstract step; executing steps comprises a roundup'''...
normal
{ "blob_id": "21e86e4719cda5c40f780aca6e56eb13c8c9b8e5", "index": 988, "step-1": "<mask token>\n\n\nclass StepName(Enum):\n <mask token>\n null = 'null'\n unitTest = 'unitTest'\n integrationTest = 'integrationTest'\n changeLog = 'changeLog'\n requirements = 'requirements'\n docs = 'docs'\n ...
[ 15, 20, 21, 25, 27 ]
import numpy as np import xgboost as xgb from sklearn.grid_search import GridSearchCV #Performing grid search import generateVector from sklearn.model_selection import GroupKFold from sklearn import preprocessing as pr positiveFile="../dataset/full_data/positive.csv" negativeFile="../dataset/full_data/negative.csv" ...
normal
{ "blob_id": "547844eca9eab097b814b0daa5da96d6a8ccee55", "index": 5843, "step-1": "import numpy as np\nimport xgboost as xgb\nfrom sklearn.grid_search import GridSearchCV #Performing grid search\nimport generateVector\nfrom sklearn.model_selection import GroupKFold\nfrom sklearn import preprocessing as pr\n\npo...
[ 0 ]
def func(): print("这是无参数的打印") func() def func1(a): print(f"这是有参数的打印:{a}") func1("有参数a") def func2(a, b): return a + b print(f"有返回值打印:{func2(3, 2)}") def func3(a, b): return print(f"无返回值打印:{func3(3, 2)}")
normal
{ "blob_id": "be892250c31198e801836dba24fa8218dd50e811", "index": 1178, "step-1": "<mask token>\n\n\ndef func3(a, b):\n return\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func1(a):\n print(f'这是有参数的打印:{a}')\n\n\n<mask token>\n\n\ndef func2(a, b):\n return a + b\n\n\n<mask token>\n\n\ndef func...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def download_pdf(url, folder, name): r = requests.get(url, allow_redirects=True) file_path = join(folder, name + '.pdf') open(file_path, 'wb').write(r.content) return file_path <|reserved_special_token_0|> def pdf_2_images(url, dest_path): new_file, filename = down...
flexible
{ "blob_id": "c6113088f45951bc4c787760b6ca0138265fb83f", "index": 9966, "step-1": "<mask token>\n\n\ndef download_pdf(url, folder, name):\n r = requests.get(url, allow_redirects=True)\n file_path = join(folder, name + '.pdf')\n open(file_path, 'wb').write(r.content)\n return file_path\n\n\n<mask token...
[ 2, 3, 4, 5, 6 ]
n = int(input()) s = "" for i in range(n): l = list(map(lambda x:x*x,map(int, input().split()))) l.sort() if l[0] + l[1] == l[2]: s += "YES\n" else: s += "NO\n" print(s,end="")
normal
{ "blob_id": "f8b473451a15e42319b60f44a527d715c0032614", "index": 3411, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n l = list(map(lambda x: x * x, map(int, input().split())))\n l.sort()\n if l[0] + l[1] == l[2]:\n s += 'YES\\n'\n else:\n s += 'NO\\n'\nprint...
[ 0, 1, 2, 3 ]
import sys from sklearn.svm import SVC from sklearn.model_selection import KFold,cross_validate,GridSearchCV from data_prepr import data_preprocessing import numpy as np def main(): #if dataset is not provided on call terminate if len(sys.argv)<2: print("usage: python svm_parameter_tuning.py <input_file> ") sys...
normal
{ "blob_id": "c5842b17b2587149cd13448593a6ed31b091ba77", "index": 4971, "step-1": "import sys\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import KFold,cross_validate,GridSearchCV\nfrom data_prepr import data_preprocessing\nimport numpy as np\n\n\ndef main():\n\t#if dataset is not provided on call t...
[ 0 ]
#! /usr/bin/python3 print("content-type: text/html") print() import cgi import subprocess as sp import requests import xmltodict import json db = cgi.FieldStorage() ch=db.getvalue("ch") url =("http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber={}&username=<username>" .format(ch)) u...
normal
{ "blob_id": "87a62f76027e0653f6966f76a42def2ce2a26ba3", "index": 5893, "step-1": "<mask token>\n", "step-2": "print('content-type: text/html')\nprint()\n<mask token>\nprint(output)\n", "step-3": "print('content-type: text/html')\nprint()\n<mask token>\ndb = cgi.FieldStorage()\nch = db.getvalue('ch')\nurl = (...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def line_endings(fname): """Return all line endings in the file. """ _endings = {line[-2:] for line in open(fname, 'rb').readlines()} res = set() for e in _endings: if e.endswith(b'\r'): res.add(b'\r') elif e.endswith(b'\r\n'): r...
flexible
{ "blob_id": "be279fe44b0d52c9d473e08d8b9c28d5b6386b45", "index": 5184, "step-1": "<mask token>\n\n\ndef line_endings(fname):\n \"\"\"Return all line endings in the file.\n \"\"\"\n _endings = {line[-2:] for line in open(fname, 'rb').readlines()}\n res = set()\n for e in _endings:\n if e.end...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python3 x = "Programming is like building a multilingual puzzle\n" print (x)
normal
{ "blob_id": "95c0ba757b7561ef6cc0ad312034e2695f8420c3", "index": 3933, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x)\n", "step-3": "x = 'Programming is like building a multilingual puzzle\\n'\nprint(x)\n", "step-4": "#!/usr/bin/env python3\n\nx = \"Programming is like building a multilingua...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ProxyScrapper: def __init__(self): self._proxies = [] def refresh(self): session = requests.Session() session.headers['User-Agent'] = UserAgent().random print('Rotating proxy list'...
flexible
{ "blob_id": "647dde6e3288ded29336062b78baacc3a92908a7", "index": 478, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProxyScrapper:\n\n def __init__(self):\n self._proxies = []\n\n def refresh(self):\n session = requests.Session()\n session.headers['User-Agent'] = Use...
[ 0, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('register/', RegisterUserAPIView.as_view()), path( 'get/token/', GetToken.as_view()), path('card/list/', ShowCardsAPIView. as_view()), path('card/create/', CreateCardAPIView.as_view()), path( 'card/...
flexible
{ "blob_id": "aac334256c1e05ef33a54da19925911af6645a10", "index": 9529, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('register/', RegisterUserAPIView.as_view()), path(\n 'get/token/', GetToken.as_view()), path('card/list/', ShowCardsAPIView.\n as_view()), path('card/create/', C...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('input_trees.txt') as file: map = file.readlines() map = [line.strip() for line in map] <|reserved_special_token_0|> for slope in slopes: treeCount = 0 row, column = 0, 0 while row + 1 < len(map): row += slope[1] ...
flexible
{ "blob_id": "685fa78b9c3ec141ce1e9ab568e4ad8a0565d596", "index": 4285, "step-1": "<mask token>\n", "step-2": "with open('input_trees.txt') as file:\n map = file.readlines()\n map = [line.strip() for line in map]\n<mask token>\nfor slope in slopes:\n treeCount = 0\n row, column = 0, 0\n while row...
[ 0, 1, 2, 3 ]
from pprint import pprint from collections import Counter from copy import deepcopy class Sudoku(): def __init__(self, grid): ''' Initializes the grid ''' self.grid = grid self.sub_grid = self.create_sub_grid(self.grid) def create_sub_grid(self, ...
normal
{ "blob_id": "4032503bba8a1dd273015d503f52b6ea2d932d1d", "index": 3564, "step-1": "<mask token>\n\n\nclass Sudoku:\n\n def __init__(self, grid):\n \"\"\"\n Initializes the grid\n \"\"\"\n self.grid = grid\n self.sub_grid = self.create_sub_grid(self.grid)\n\n def create...
[ 10, 12, 13, 14, 15 ]
<|reserved_special_token_0|> class MVBTest: <|reserved_special_token_0|> <|reserved_special_token_0|> def doubleSpendTest(self): """ txOutputs is the genesis output. txOutputs[0] was used twice in this test. Both Tx1 and Tx2 make txOutputs[0] as input. ...
flexible
{ "blob_id": "8ad9efbbb2d9e2a5f73ebbb999da3ed93e4c1974", "index": 9655, "step-1": "<mask token>\n\n\nclass MVBTest:\n <mask token>\n <mask token>\n\n def doubleSpendTest(self):\n \"\"\"\n txOutputs is the genesis output.\n txOutputs[0] was used twice in this test.\n ...
[ 11, 15, 17, 18, 19 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the # Pystacho Project (https://github.com/aruderman/pystacho/). # Copyright (c) 2021, Francisco Fernandez, Benjamin Marcologno, Andrés Ruderman # License: MIT # Full Text: https://github.com/aruderman/pystacho/blob/master/LICENSE # ===...
normal
{ "blob_id": "d7e24730ce9f2835d55d3995abec2a7d00eb05ef", "index": 9024, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(PATH / 'pystacho' / '__init__.py') as fp:\n for line in fp.readlines():\n if line.startswith('__version__ = '):\n VERSION = line.split('=', 1)[-1].replace('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.random.seed(7) <|reserved_special_token_0|> tf.keras.backend.set_session(tf.Session(config=config)) np.set_printoptions(threshold=np.nan) <|reserved_special_token_0|> with open('gei.txt', 'rb') as fr: x_train = pickle.load(...
flexible
{ "blob_id": "0681ab83843187701ac72018b6078f5141bf22e0", "index": 3663, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(7)\n<mask token>\ntf.keras.backend.set_session(tf.Session(config=config))\nnp.set_printoptions(threshold=np.nan)\n<mask token>\nwith open('gei.txt', 'rb') as fr:\n x_tra...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """microcms package, minimalistic flatpage enhancement. THIS SOFTWARE IS UNDER BSD LICENSE. Copyright (c) 2010-2012 Daniele Tricoli <eriol@mornie.org> Read LICENSE for more informations. """ VERSION = (0, 2, 0)
normal
{ "blob_id": "3e1c2d0c5bb30d093a99f10020af14db5436bf02", "index": 5551, "step-1": "<mask token>\n", "step-2": "<mask token>\nVERSION = 0, 2, 0\n", "step-3": "# -*- coding: utf-8 -*-\n\"\"\"microcms package, minimalistic flatpage enhancement.\n\nTHIS SOFTWARE IS UNDER BSD LICENSE.\nCopyright (c) 2010-2012 Dani...
[ 0, 1, 2 ]
from fbchat import Client class IBehaviourBase(Client): BreakFlag = False def __init__(self,email,password, kwargs): """"abstract class being parent of every user implemented behaviour; it handles logging in and tasks on behaviour loader side""" self.kwargs=kwargs Client.__init_...
normal
{ "blob_id": "e67f27eec53901f27ba5a7ee7e2a20bbb1e8f7f9", "index": 2237, "step-1": "<mask token>\n\n\nclass IBehaviourBase(Client):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IBehaviourBase(Client):\n <mask token>\n\n def __init__(self, email, password, kwa...
[ 1, 3, 4, 5, 6 ]
# Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistributions of source ...
normal
{ "blob_id": "920cd41b18f5cfb45f46c44ed707cebe682d4dd9", "index": 820, "step-1": "# Software License Agreement (BSD License)\n#\n# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.\n# All rights reserved.\n#\n# Redistribution and use of this software in source and binary forms, with or\n# without modification, ar...
[ 0 ]
<|reserved_special_token_0|> @paddle.no_grad() class Val_model_subpixel(object): <|reserved_special_token_0|> def loadModel(self): from utils.loader import modelLoader self.net = modelLoader(model=self.model, **self.params) checkpoint = paddle.load(self.weights_path) self.net....
flexible
{ "blob_id": "fc89fdf17f887ea398be5b36d4d6f0444d64b3e0", "index": 8026, "step-1": "<mask token>\n\n\n@paddle.no_grad()\nclass Val_model_subpixel(object):\n <mask token>\n\n def loadModel(self):\n from utils.loader import modelLoader\n self.net = modelLoader(model=self.model, **self.params)\n ...
[ 3, 5, 6, 7, 8 ]
# lesson 4 Mateush Vilen my_information = { 'name': 'Vilen', 'last_name': 'Mateush', 'how_old': 31, 'born_town': 'Khmelniysky' } dict_test = {key: key**2 for key in range(7)} print('dict_test: ', dict_test) elem_dict = 0 elem_dict = input('input number of elements:') user_input_dict = {} for key in ...
normal
{ "blob_id": "b000f293b50970233d5b71abc3e10e2ad57a3fc7", "index": 1767, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('dict_test: ', dict_test)\n<mask token>\nfor key in range(0, int(elem_dict)):\n key = input('dict key: ')\n user_input_dict[key] = input('dict value:')\nprint(user_input_dict)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> states.add('.'.join(str(n) for n in mem)) <|reserved_special_token_0|> while True: i = mem.index(max(mem)) x = mem[i] mem[i] = 0 while x > 0: i += 1 mem[i % size] += 1 x -= 1 steps += 1 ...
flexible
{ "blob_id": "0e7d4b73cedf961677e6b9ea5303cdb3a5afa788", "index": 3521, "step-1": "<mask token>\n", "step-2": "<mask token>\nstates.add('.'.join(str(n) for n in mem))\n<mask token>\nwhile True:\n i = mem.index(max(mem))\n x = mem[i]\n mem[i] = 0\n while x > 0:\n i += 1\n mem[i % size] ...
[ 0, 1, 2, 3, 4 ]
"""Google Scraper Usage: web_scraper.py <search> <pages> <processes> web_scraper.py (-h | --help) Arguments: <search> String to be Searched <pages> Number of pages <processes> Number of parallel processes Options: -h, --help Show this screen. """ import re from functools impo...
normal
{ "blob_id": "68dcac07bbdb4dde983939be98ece127d963c254", "index": 3610, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_urls(search_string, start):\n temp = []\n url = 'http://www.google.com/search'\n payload = {'q': search_string, 'start': start}\n my_headers = {'User-agent': 'Mozi...
[ 0, 2, 3, 4, 5 ]
from cudasim.ParsedModel import ParsedModel import re import copy class Writer: def __init__(self): pass # replace the species and parameters recursively @staticmethod def rep(string, find, replace): ex = find + "[^0-9]" while re.search(ex, string) is not None: res...
normal
{ "blob_id": "acd0b9019ef413699b47ecb2b66a0980cf3aa81f", "index": 9792, "step-1": "<mask token>\n\n\nclass Writer:\n <mask token>\n\n @staticmethod\n def rep(string, find, replace):\n ex = find + '[^0-9]'\n while re.search(ex, string) is not None:\n res = re.search(ex, string)\n ...
[ 2, 3, 4, 5, 6 ]
import datetime now = datetime.datetime.now() # Printing value of now. print ("Time now : ", now)
normal
{ "blob_id": "0110d26e17a5402c22f519d0aeb2aacca3279d00", "index": 7792, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Time now : ', now)\n", "step-3": "<mask token>\nnow = datetime.datetime.now()\nprint('Time now : ', now)\n", "step-4": "import datetime\nnow = datetime.datetime.now()\nprint('T...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python s = '''Вбс лче ,мтс ооепта т.сбзек о ып гоэятмв,те гоктеивеысокячел–аонкы оах ннлнисьрнксе ьрм отаб тёьдр ннласааосд це аЧиу нвыанзи еслкмиетл,леево ннлтпо еик:ыаырялньб пнм би на це азоватоша Вепьлаяокеолвоытрх еытодрпьтае,кллгфм ытитослРянозит нсонунс.р лунттаё ооиВяе зн етвйеетелттв еСлл...
normal
{ "blob_id": "a8bed0b5a6a95d67b5602b395f1d0ea12cd53fb0", "index": 9166, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fence_decipher(m: str, key: int) ->str:\n chunklens = [(0) for _ in range(key)]\n nfence = 0\n dx = 1\n for i in m:\n chunklens[nfence] += 1\n nfence += ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('parent Folder is : ' + parentFolderPath) <|reserved_special_token_0|> print('output folder: ' + str(outputFolder)) print('output chunk folder: ' + str(outputChunkFolder)) print('mask output folder is: ' + str(outputMaskfold...
flexible
{ "blob_id": "dcfc6d76730ba3b33e64cc8f2c166f739bbde5ff", "index": 3655, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('parent Folder is : ' + parentFolderPath)\n<mask token>\nprint('output folder: ' + str(outputFolder))\nprint('output chunk folder: ' + str(outputChunkFolder))\nprint('mask output fo...
[ 0, 1, 2, 3, 4 ]
def warshall_floyd(N): INF = 10 ** 20 path = [[INF for _ in range(N + 1)] for _ in range(N + 1)] graph = get_graph() for i in range(N + 1): path[i][i] = 0 for g in graph: x = g[0] y = g[1] l = g[2] path[x][y] = path[y][x] = l for start in range(N + 1): ...
flexible
{ "blob_id": "1e1f918ba24f5a5f13b9b01289ebfda65bae572d", "index": 301, "step-1": "def warshall_floyd(N):\n INF = 10 ** 20\n path = [[INF for _ in range(N + 1)] for _ in range(N + 1)]\n graph = get_graph()\n for i in range(N + 1):\n path[i][i] = 0\n for g in graph:\n x = g[0]\n ...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def main(): try: api = 'http://t.weather.itboy.net/api/weather/city/' city_code = '101070201' tqurl = api + city_code response = requests.get(tqurl) d = response.json() print(d['status']) if d['status'] == 200: parent...
flexible
{ "blob_id": "4048d7bfc7922ef76d98d43e1ea266e732e0982e", "index": 9111, "step-1": "<mask token>\n\n\ndef main():\n try:\n api = 'http://t.weather.itboy.net/api/weather/city/'\n city_code = '101070201'\n tqurl = api + city_code\n response = requests.get(tqurl)\n d = response.j...
[ 2, 3, 4, 5, 6 ]