code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from __future__ import annotations import pytest from pytest import param import ibis import ibis.expr.datatypes as dt from ibis.backends.base.sql.alchemy.geospatial import geospatial_supported DB_TYPES = [ # Exact numbers ("BIGINT", dt.int64), ("BIT", dt.boolean), ("DECIMAL", dt.Decimal(precision=18...
normal
{ "blob_id": "00e9872136e5753364117adbf60793e660c8bef0", "index": 485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize(('server_type', 'expected_type'), DB_TYPES + [\n param('GEOMETRY', dt.geometry, marks=[skipif_no_geospatial_deps]),\n param('GEOGRAPHY', dt.geography, ma...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(): """Runs all of the tests""" subsuite_list = [] for _, modname, _ in pkgutil.iter_modules(test.__path__): if modname.startswith('test_'): module = importlib.import_module('test.' + modna...
flexible
{ "blob_id": "9a7908212bf13565109cd4d9ab6de65909bc6910", "index": 3606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run():\n \"\"\"Runs all of the tests\"\"\"\n subsuite_list = []\n for _, modname, _ in pkgutil.iter_modules(test.__path__):\n if modname.startswith('test_'):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(tf.__version__) <|reserved_special_token_0|> ninapro.splitImagesLabels() print('ninapro.TrainImages shape: ', ninapro.TrainImages.shape) print('ninapro.TrainLabels shape: ', ninapro.TrainLabels.shape) print('ninapro.TestImag...
flexible
{ "blob_id": "30aa8405ccf64ce8a05204f3f9fa2ffab436ad3b", "index": 1578, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(tf.__version__)\n<mask token>\nninapro.splitImagesLabels()\nprint('ninapro.TrainImages shape: ', ninapro.TrainImages.shape)\nprint('ninapro.TrainLabels shape: ', ninapro.TrainLabels...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def count(a, b): a = int(a) b = int(b) if a == 0 and b == 0: return 0 elif a == 0 and b == 1: return 1 elif a == 1 and b == 0: return 2 elif a == 1 and b == 1: return 3 <|reserved_special_token_0|> <|reserved_special_token_1|> <...
flexible
{ "blob_id": "55977a673bb36900e1d797cb9ec330ce6d9aa717", "index": 8232, "step-1": "<mask token>\n\n\ndef count(a, b):\n a = int(a)\n b = int(b)\n if a == 0 and b == 0:\n return 0\n elif a == 0 and b == 1:\n return 1\n elif a == 1 and b == 0:\n return 2\n elif a == 1 and b ==...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-21 00:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('analysis', '0018_relatorioquedadeconsumo_justificado'), ] operations = [ mi...
normal
{ "blob_id": "a58949d25a719dc9ce0626948ab0397814e9ea0e", "index": 1574, "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 = [('analysis', ...
[ 0, 1, 2, 3, 4 ]
from time import perf_counter_ns from anthony.utility.distance import compare, compare_info from icecream import ic start = perf_counter_ns() ic(compare("tranpsosed", "transposed")) print(f"Example Time: {(perf_counter_ns() - start)/1e+9} Seconds") ic(compare_info("momther", "mother"))
normal
{ "blob_id": "98b0e42f3ed1a234f63c4d3aa76ceb9fce7c041d", "index": 3631, "step-1": "<mask token>\n", "step-2": "<mask token>\nic(compare('tranpsosed', 'transposed'))\nprint(f'Example Time: {(perf_counter_ns() - start) / 1000000000.0} Seconds')\nic(compare_info('momther', 'mother'))\n", "step-3": "<mask token>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(last4) <|reserved_special_token_1|> card = int(input()) last4 = card % 10000 print(last4)
flexible
{ "blob_id": "7b920545a0241b30b66ff99f330dbb361f747f13", "index": 8297, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(last4)\n", "step-3": "card = int(input())\nlast4 = card % 10000\nprint(last4)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> def data(): (x_train, y_train), (x_test, y_test) = cifar10.load_data() num_classes = 10 y_train = keras.utils.to_categorical(y_train, num_classes) y_test = keras.utils.to_categorical(y_test, num_classes) x_train = np.reshape(x_train, (50000, 3072)) x_test = np.resh...
flexible
{ "blob_id": "cc097b4d2a5a521a0adb83ca1b58470b4ce84f39", "index": 7143, "step-1": "<mask token>\n\n\ndef data():\n (x_train, y_train), (x_test, y_test) = cifar10.load_data()\n num_classes = 10\n y_train = keras.utils.to_categorical(y_train, num_classes)\n y_test = keras.utils.to_categorical(y_test, nu...
[ 2, 3, 4, 5, 6 ]
field = [['*', '1', '2', '3'], ['1', '-', '-', '-'], ['2', '-', '-', '-'], ['3', '-', '-', '-']] def show(a): for i in range(len(a)): for j in range(len(a[i])): print(a[i][j], end=' ') print() def askUserZero(): while True: inputX = input('Введите номер строки нолика'...
normal
{ "blob_id": "3f22bf954a8c4608ec4bd4a28bea3679a664a99a", "index": 2364, "step-1": "<mask token>\n\n\ndef show(a):\n for i in range(len(a)):\n for j in range(len(a[i])):\n print(a[i][j], end=' ')\n print()\n\n\ndef askUserZero():\n while True:\n inputX = input('Введите номер с...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> time.sleep(1) <|reserved_special_token_0|> if len(sys.argv) < 6: error_str = str(sys.argv[0] ) + ' led1_current led2_current led_stable_time int_time1 int_time2' print(error_str) else: C12880.Setup() GPIO.s...
flexible
{ "blob_id": "d250cc0aafdd48cb0eb56108d9c7148153cde002", "index": 6840, "step-1": "<mask token>\n", "step-2": "<mask token>\ntime.sleep(1)\n<mask token>\nif len(sys.argv) < 6:\n error_str = str(sys.argv[0]\n ) + ' led1_current led2_current led_stable_time int_time1 int_time2'\n print(error_str)\nel...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Metals(str, Enum): gold = 'gold' silver = 'silver' class PriceFilter(BaseModel): type: PriceSort price: float class ProductSearch(BaseModel): price: Optional[PriceFilter] metals: Optional[List[Metals]] size: Optional[Sizes] <|reserved_special_token_...
flexible
{ "blob_id": "442c6c4894fc01d0f8142f3dcedfd51ba57aedd1", "index": 3304, "step-1": "<mask token>\n\n\nclass Metals(str, Enum):\n gold = 'gold'\n silver = 'silver'\n\n\nclass PriceFilter(BaseModel):\n type: PriceSort\n price: float\n\n\nclass ProductSearch(BaseModel):\n price: Optional[PriceFilter]\n...
[ 4, 5, 8, 9, 10 ]
<|reserved_special_token_0|> class Rules: def __init__(self): self.ruleCollection = {'1': self.rule1, '2': self.rule2, '3': self. rule3, '4': self.rule4, '5': self.rule5, '6': self.rule6, '7': self.rule7, '8': self.rule8, '9': self.rule9, '10': self.rule10} <|reserved_special_...
flexible
{ "blob_id": "7747cbb1a1ed191b616b0d1bcfd51cdea05067f5", "index": 5954, "step-1": "<mask token>\n\n\nclass Rules:\n\n def __init__(self):\n self.ruleCollection = {'1': self.rule1, '2': self.rule2, '3': self.\n rule3, '4': self.rule4, '5': self.rule5, '6': self.rule6, '7':\n self.ru...
[ 8, 11, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_search_track(): sp = Spotify() t = sp.search_track('avocado') assert_equal(t.id, '1UyzA43l3OIcJ6jd3hh3ac') <|reserved_special_token_1|> <|reserved_special_token_0|> from spoetify.spotify import Spotify fr...
flexible
{ "blob_id": "337309da79ce9d90010fef5c171b6b344e6dc63f", "index": 5937, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_search_track():\n sp = Spotify()\n t = sp.search_track('avocado')\n assert_equal(t.id, '1UyzA43l3OIcJ6jd3hh3ac')\n", "step-3": "<mask token>\nfrom spoetify.spotify...
[ 0, 1, 2, 3 ]
# Packages import PySimpleGUI as sg import mysql.connector import secrets # TODO Add a view all button # TODO Catch errors (specifically for TimeDate mismatches) # TODO Add a downtime graph # TODO Add a system feedback window instead of putting this in the out id textbox error_sel_flag = False # Flag to check whether...
normal
{ "blob_id": "8fb5ef7244a8ca057f11cbcdf42d383665dade5e", "index": 6884, "step-1": "# Packages\nimport PySimpleGUI as sg\nimport mysql.connector\nimport secrets\n\n# TODO Add a view all button\n# TODO Catch errors (specifically for TimeDate mismatches)\n# TODO Add a downtime graph\n# TODO Add a system feedback win...
[ 0 ]
<|reserved_special_token_0|> class KV11Z7(Kinetis): <|reserved_special_token_0|> def __init__(self, session): super(KV11Z7, self).__init__(session, self.MEMORY_MAP) self._svd_location = SVDFile.from_builtin('MKV11Z7.svd') <|reserved_special_token_1|> <|reserved_special_token_0|> class KV...
flexible
{ "blob_id": "58aa72588357b18ab42391dfffbf2a1b66589edd", "index": 552, "step-1": "<mask token>\n\n\nclass KV11Z7(Kinetis):\n <mask token>\n\n def __init__(self, session):\n super(KV11Z7, self).__init__(session, self.MEMORY_MAP)\n self._svd_location = SVDFile.from_builtin('MKV11Z7.svd')\n", "...
[ 2, 3, 4, 5, 6 ]
from qiskit import QuantumCircuit,execute,Aer from qiskit.visualization import plot_histogram import matplotlib.pyplot as plt qc_ha=QuantumCircuit(4,2) qc_ha.x(0) qc_ha.x(1) qc_ha.barrier() qc_ha.cx(0,2) qc_ha.cx(1,2) qc_ha.ccx(0,1,3) qc_ha.barrier() qc_ha.measure(2,0) qc_ha.measure(3,1) #qc_ha.draw(output='mpl') coun...
normal
{ "blob_id": "02381f28ef20aa0c2c235ef6563e1810a5931e35", "index": 5556, "step-1": "<mask token>\n", "step-2": "<mask token>\nqc_ha.x(0)\nqc_ha.x(1)\nqc_ha.barrier()\nqc_ha.cx(0, 2)\nqc_ha.cx(1, 2)\nqc_ha.ccx(0, 1, 3)\nqc_ha.barrier()\nqc_ha.measure(2, 0)\nqc_ha.measure(3, 1)\n<mask token>\nplot_histogram(counts...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AnnotController: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AnnotController: def get_annotations(self, project, page_index): page = project.doc[page_i...
flexible
{ "blob_id": "6ca2a9040897e49c6407b9b0760240fec93b4df0", "index": 3067, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AnnotController:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AnnotController:\n\n def get_annotations(self, project, page_index):\n page = project.doc[p...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def barStdNormal(bars, timeperiod=5): """Std Normal """ close = bars['close'] result = close.rolling(timeperiod).apply(std_normalized) return result <|reserved_special_token_1|> import pandas as pd import nump...
flexible
{ "blob_id": "6fa0e1dabd178507c32c62146b404bb42f8445d4", "index": 9860, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef barStdNormal(bars, timeperiod=5):\n \"\"\"Std Normal \"\"\"\n close = bars['close']\n result = close.rolling(timeperiod).apply(std_normalized)\n return result\n", "s...
[ 0, 1, 2, 3 ]
from tkinter import * import tkinter.messagebox import apikey import tinify class Setting_GUI(Toplevel): def __init__(self,parent): super().__init__() self.parent = parent key = "Input your key here" self.keystringvar = StringVar() self.wm_title("Settings - TingImage") ...
normal
{ "blob_id": "9340c9055a7e0d74d232d878b43d91a3e6cd32e5", "index": 5785, "step-1": "<mask token>\n\n\nclass Setting_GUI(Toplevel):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Setting_GUI(Toplevel):\n\n def __init__(self, parent):\n super().__init__()\n self.parent ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def run_task(request, tid): if request.method == 'GET': task_obj = TestTask.objects.get(id=tid) cases_list = task_obj.cases.split(',') cases_list.pop(-1) task_obj.status = 1 task_obj.save() print(cases_list) all_cases_dict = {} ...
flexible
{ "blob_id": "8be70543a7aa177d9ad48fb736228b1ffba5df16", "index": 6179, "step-1": "<mask token>\n\n\ndef run_task(request, tid):\n if request.method == 'GET':\n task_obj = TestTask.objects.get(id=tid)\n cases_list = task_obj.cases.split(',')\n cases_list.pop(-1)\n task_obj.status = ...
[ 1, 2, 3, 4, 5 ]
from proxmin import nmf from proxmin.utils import Traceback from proxmin import operators as po from scipy.optimize import linear_sum_assignment import numpy as np import matplotlib.pyplot as plt import time from functools import partial # initialize and run NMF import logging logging.basicConfig() logger ...
normal
{ "blob_id": "0edc0c2f86bda0122d4b231eed700d7a5b08ec1e", "index": 8279, "step-1": "<mask token>\n\n\ndef generateComponent(m):\n \"\"\"Creates oscillating components to be mixed\"\"\"\n freq = 25 * np.random.random()\n phase = 2 * np.pi * np.random.random()\n x = np.arange(m)\n return np.cos(x / fr...
[ 3, 4, 6, 7, 8 ]
from flask import Flask, jsonify, abort, make_response from matchtype import matchtyper from db import db_handle import sys api = Flask(__name__) @api.route('/get/<key_name>', methods=['GET']) def get(key_name): li = db_handle(key_name) if li[1] is None: abort(404) else: result = matchtype...
normal
{ "blob_id": "44e9fd355bfab3f007c5428e8a5f0930c4011646", "index": 3853, "step-1": "<mask token>\n\n\n@api.route('/get/<key_name>', methods=['GET'])\ndef get(key_name):\n li = db_handle(key_name)\n if li[1] is None:\n abort(404)\n else:\n result = matchtyper(li)\n return make_response...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> class HaakePhoenix(ToolWindow): <|reserved_special_token_0|> def __init__(self, *args, **wargs): self.indicators = {} super().__init__(*args, **wargs) def init_gui(self, *args, **kwargs): statusgrid = self.builder.get_object('statusgrid') for ...
flexible
{ "blob_id": "25aa0766505b22588107d44e15c3596e9383d4e9", "index": 486, "step-1": "<mask token>\n\n\nclass HaakePhoenix(ToolWindow):\n <mask token>\n\n def __init__(self, *args, **wargs):\n self.indicators = {}\n super().__init__(*args, **wargs)\n\n def init_gui(self, *args, **kwargs):\n ...
[ 8, 10, 13, 14, 15 ]
# encoding = utf-8 """ A flask session memcached store """ from datetime import timedelta, datetime from uuid import uuid4 __author__ = 'zou' import memcache import pickle from flask.sessions import SessionMixin, SessionInterface from werkzeug.datastructures import CallbackDict class MemcachedSession(CallbackDict, S...
normal
{ "blob_id": "e4761c925643417f4fe906e8dd2c9356ae970d52", "index": 3706, "step-1": "<mask token>\n\n\nclass MemcachedSessionInterface(SessionInterface):\n <mask token>\n <mask token>\n\n def generate_sid(self):\n return str(uuid4())\n\n def get_memcache_expiration_time(self, app, session):\n ...
[ 8, 10, 12, 14, 15 ]
def calc_fib(n): fib_lis = dict() for i in range(n+1): if (i <= 1): fib_lis[i] = i else: fib_lis[i] = fib_lis[i-2] + fib_lis[i-1] return fib_lis[n] n = int(input()) print(calc_fib(n))
normal
{ "blob_id": "426b711571d3b5c4f8c7b0bad3a613951902e60b", "index": 4129, "step-1": "<mask token>\n", "step-2": "def calc_fib(n):\n fib_lis = dict()\n for i in range(n + 1):\n if i <= 1:\n fib_lis[i] = i\n else:\n fib_lis[i] = fib_lis[i - 2] + fib_lis[i - 1]\n return f...
[ 0, 1, 2, 3, 4 ]
import os, sys, datetime, csv, platform ####FUNCTIONS#### #Get Creation Time def get_lastupdate_date(path): return os.path.getmtime(path) #Get Date From String def convertIntToTimestamp(timeint): return str(datetime.datetime.fromtimestamp(timeint)) #Get Filename def getFilename(name): return os.path...
normal
{ "blob_id": "e83b6b1f4cb12fe3b932903eddddfb0dc0e7d98d", "index": 2765, "step-1": "<mask token>\n\n\ndef get_lastupdate_date(path):\n return os.path.getmtime(path)\n\n\ndef convertIntToTimestamp(timeint):\n return str(datetime.datetime.fromtimestamp(timeint))\n\n\ndef getFilename(name):\n return os.path....
[ 5, 8, 9, 11, 12 ]
<|reserved_special_token_0|> @nsLinea.route('/<int:id>') class LineasResource(Resource): <|reserved_special_token_0|> <|reserved_special_token_0|> @nsLinea.route('/baja/<int:id>') class LineasResource(Resource): def put(self, id): if repo.baja(id): repoLep.baja_by_linea(id) ...
flexible
{ "blob_id": "821e89730fde2e12b24b52b04701c1f3501e0d57", "index": 8771, "step-1": "<mask token>\n\n\n@nsLinea.route('/<int:id>')\nclass LineasResource(Resource):\n <mask token>\n <mask token>\n\n\n@nsLinea.route('/baja/<int:id>')\nclass LineasResource(Resource):\n\n def put(self, id):\n if repo.ba...
[ 3, 7, 8, 9, 12 ]
# # tests/middleware/test_static.py # import pytest import growler from pathlib import Path from unittest import mock from sys import version_info from growler.middleware.static import Static @pytest.fixture def static(tmpdir): return Static(str(tmpdir)) def test_static_fixture(static, tmpdir): assert isin...
normal
{ "blob_id": "9a7994a1e51c9cf7fe7d8b50ab26fa3d789fc8e5", "index": 1012, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef static(tmpdir):\n return Static(str(tmpdir))\n\n\ndef test_static_fixture(static, tmpdir):\n assert isinstance(static, Static)\n assert str(static.path) == str(tmpdir)\n\n\n<mask toke...
[ 4, 7, 8, 9, 10 ]
# -*- encoding: utf-8 -*- ############################################################################## # # ServerPLM, Open Source Product Lifcycle Management System # Copyright (C) 2020-2020 Didotech srl (<http://www.didotech.com>). All Rights Reserved # # Created on : 2018-03-01 # Author : Fabio ...
normal
{ "blob_id": "06643bf4b1bded757078b0974c21ddec814f5889", "index": 1762, "step-1": "<mask token>\n\n\nclass plm_component(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _insertlog(self, ids, changes={}, note={}):\n ret = False\n op_...
[ 20, 34, 38, 44, 49 ]
<|reserved_special_token_0|> class SimpleControllerHandlerAdapter(HandlerAdapter): def supports(self, handler: object) ->bool: return isinstance(handler, Controller) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Simp...
flexible
{ "blob_id": "71e7a209f928672dbf59054b120eed6a77522dde", "index": 6246, "step-1": "<mask token>\n\n\nclass SimpleControllerHandlerAdapter(HandlerAdapter):\n\n def supports(self, handler: object) ->bool:\n return isinstance(handler, Controller)\n <mask token>\n <mask token>\n", "step-2": "<mask t...
[ 2, 3, 4, 5, 6 ]
___author__ = 'acmASCIS' ''' by ahani at {9/24/2016} ''' import time class Freq(object): def __init__(self, array): self.__array = array self.__frequency_dict = {} self.__array_length = len(array) self.__running_time = round(time.time() * 1000) def get_original_array(sel...
normal
{ "blob_id": "b569f0a0dda048d6337e1028a240caabf188a174", "index": 9420, "step-1": "<mask token>\n\n\nclass Freq(object):\n\n def __init__(self, array):\n self.__array = array\n self.__frequency_dict = {}\n self.__array_length = len(array)\n self.__running_time = round(time.time() * ...
[ 3, 5, 6, 7, 10 ]
#!/usr/bin/env python """\ Simple g-code streaming script for grbl """ import serial import time import csv import json import RPi.GPIO as GPIO from multiprocessing import Process, Queue class motion(): def __init__(self): # Open grbl serial port #self.s = serial.Serial("/dev/ttyUSB0",baudrate=115...
normal
{ "blob_id": "ac2d4372f8913ea9ae1066833cca09985e521f99", "index": 383, "step-1": "#!/usr/bin/env python\n\"\"\"\\\nSimple g-code streaming script for grbl\n\"\"\"\n \nimport serial\nimport time\nimport csv\nimport json\nimport RPi.GPIO as GPIO\nfrom multiprocessing import Process, Queue\nclass motion():\n def ...
[ 0 ]
#!/usr/bin/env python from math import * import numpy as np import matplotlib.pyplot as plt import Input as para data = np.loadtxt("eff-proton.dat") #data = np.loadtxt("eff-electron.dat") show_time = data[0] show_eff = data[1] #print show_turn, show_eff #x_lower_limit = min(show_time) #x_upper_limit = max(show_time)...
normal
{ "blob_id": "bee96e817dd4d9462c1e3f8eb525c22c2117140a", "index": 9942, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure()\nplt.xlabel('Time (ms)', fontsize=30)\nplt.ylabel('Capture rate (%)', fontsize=30)\nplt.xticks(fontsize=25)\nplt.yticks(fontsize=25)\nplt.xlim(x_lower_limit, x_upper_limit)\n...
[ 0, 1, 2, 3, 4 ]
import json from examtool.api.database import get_exam, get_roster from examtool.api.extract_questions import extract_questions from examtool.api.scramble import scramble from google.cloud import firestore import warnings warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials"...
normal
{ "blob_id": "b74c759b51fb6591477757e2ff54b545f225991c", "index": 7470, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings('ignore',\n 'Your application has authenticated using end user credentials')\n<mask token>\nfor exam in exams:\n print('checking', exam)\n exam_json = jso...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> y_true = [7, 3, 3, 4, 9, 9, 2, 5, 0, 0, 6, 3, 1, 6, 8, 7, 9, 7, 4, 2, 0, 1, 4, 1, 7, 7, 5, 0, 8, 0, 1, 7, 4, 2, 2, 4, 9, 3, 1, 7, 1, 2, 1, 7, 5, 9, 9, 4, 8, 5, 7, 2, 7, 5, 5, 6, 6, 1, 2, 6, 6, 5, 3, 2, 3, 8, 8, 8, 8, 5, 3, 4, 3, 2, 8, 1, 9, 0, 6, ...
flexible
{ "blob_id": "593d3221e34c0eef51228082d767d8516ec93ca2", "index": 8002, "step-1": "<mask token>\n", "step-2": "y_true = [7, 3, 3, 4, 9, 9, 2, 5, 0, 0, 6, 3, 1, 6, 8, 7, 9, 7, 4, 2, 0, 1,\n 4, 1, 7, 7, 5, 0, 8, 0, 1, 7, 4, 2, 2, 4, 9, 3, 1, 7, 1, 2, 1, 7, 5, 9,\n 9, 4, 8, 5, 7, 2, 7, 5, 5, 6, 6, 1, 2, 6, 6...
[ 0, 1 ]
class SensorReadings: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class SensorReadings: <|reserved_special_token_0|> def printReadings(self): print('temperature from humidity sensor: ...
flexible
{ "blob_id": "f680503488a2780624b28e49b045aad75506d8c5", "index": 3248, "step-1": "class SensorReadings:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class SensorReadings:\n <mask token>\n\n def printReadings(self):\n print('temperature from humidity sensor...
[ 1, 2, 3, 4, 6 ]
<|reserved_special_token_0|> def logined(func): def wrapper(request, *args, **kwargs): session = request.session.get('user') if not session: return render(request, 'login.html') else: return func(request, *args, **kwargs) return wrapper def api_check(func): ...
flexible
{ "blob_id": "eeb87891d1a02484a61537745ec6f13387017929", "index": 705, "step-1": "<mask token>\n\n\ndef logined(func):\n\n def wrapper(request, *args, **kwargs):\n session = request.session.get('user')\n if not session:\n return render(request, 'login.html')\n else:\n ...
[ 9, 10, 12, 13, 14 ]
import os import logging from datetime import datetime import torch from naruto_skills.training_checker import TrainingChecker from data_for_train import is_question as my_dataset from model_def.lstm_attention import LSTMAttention from utils import pytorch_utils from train.new_trainer import TrainingLoop, TrainingLog...
normal
{ "blob_id": "77884dd72f5efe91fccad27e6328c4ad34378be2", "index": 6953, "step-1": "<mask token>\n\n\ndef target2_text(first_input, *params):\n return first_input\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef input2_text(first_input, *params):\n return my_dataset.voc.idx2docs(first_input)\n\n\ndef...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_data(inputloc, tablename='data'): data = spark.read.csv(inputloc, schema=schema) data.createOrReplaceTempView(tablename) return data <|reserved_special_token_0|> def resolved_max(df): df_max = df.groupBy('station').agg({'date': 'max'}).select(functions. ...
flexible
{ "blob_id": "3852ff2f3f4ac889256bd5f4e36a86d483857cef", "index": 6534, "step-1": "<mask token>\n\n\ndef get_data(inputloc, tablename='data'):\n data = spark.read.csv(inputloc, schema=schema)\n data.createOrReplaceTempView(tablename)\n return data\n\n\n<mask token>\n\n\ndef resolved_max(df):\n df_max ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('words.txt') as words_fh: lexicon = set(list(map(lambda x: x.strip().lower(), words_fh.readlines()))) <|reserved_special_token_0|> print(sorted_valid_words) <|reserved_special_token_1|> with open('words.txt') as words_fh: lexicon = set(li...
flexible
{ "blob_id": "aacd5d671090c3305a53d62c3c6c25d4c033f42d", "index": 6420, "step-1": "<mask token>\n", "step-2": "with open('words.txt') as words_fh:\n lexicon = set(list(map(lambda x: x.strip().lower(), words_fh.readlines())))\n<mask token>\nprint(sorted_valid_words)\n", "step-3": "with open('words.txt') as ...
[ 0, 1, 2, 3 ]
#This program sorts the files on Desktop on the basis of file extension and move them in separate folders in Documents folder. desktop_directory="/home/vineeth/Desktop/" #LINUX destination_folder="/home/vineeth/Documents/" #LINUX #desktop_directory="C:/Users/VINEETH/Desktop/" #Windows #destination_folder="C:/Users/VI...
normal
{ "blob_id": "805b64a7bd727a88081a6ead574fff9b1542070f", "index": 2023, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor eachfile in os.listdir(desktop_directory):\n if os.path.isfile(desktop_directory + eachfile):\n fileName, fileExtension = os.path.splitext(eachfile)\n if all(fileExte...
[ 0, 1, 2, 3, 4 ]
# coding: UTF-8 from PIL import ImageFont,Image,ImageDraw def min_element(table_d,ignoring_index = None): min_i,min_j,min_e = 0,0,max(table_d.values()) for key in table_d.keys(): # ignore if i in key or j in key if ignoring_index is not None: i,j = key if i in ignoring_index or j in ignoring_i...
normal
{ "blob_id": "aee009b37b99bf44e27c608470c43834a58e0cc7", "index": 8490, "step-1": "<mask token>\n\n\ndef to_dict(table):\n table_d = dict()\n for i in range(len(table)):\n for j in range(i):\n table_d[i, j] = table[i][j]\n table_d[j, i] = table[i][j]\n return table_d\n\n\ndef...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ app definition """ from django.apps import AppConfig class CoopHtmlEditorAppConfig(AppConfig): name = 'coop_html_editor' verbose_name = "Html Editor"
normal
{ "blob_id": "641cbe2f35925d070249820a2e3a4f1cdd1cf642", "index": 8697, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n name = 'coop_html_edito...
[ 0, 1, 2, 3, 4 ]
def twenty(): pass
normal
{ "blob_id": "3727c4413cd69305c8ee8d02f4532629da7d25de", "index": 7135, "step-1": "<mask token>\n", "step-2": "def twenty():\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.conf.urls import patterns, include, url from django.views.generic import TemplateView from . import views app_name = 'produce' urlpatterns = [ # Inbound SMS view: url(r'^sms/$', views.sms, name='sms'), # List and Detail Views: url(r'^list/', views.SeasonalView.as_view(), name='list'), url(r'^(?P<pk...
normal
{ "blob_id": "f7d0d7dda955acd07b6da010d21dc5f02254e1ed", "index": 5821, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'produce'\nurlpatterns = [url('^sms/$', views.sms, name='sms'), url('^list/', views.\n SeasonalView.as_view(), name='list'), url('^(?P<pk>[0-9]+)/$', views.\n ProduceDeta...
[ 0, 1, 2, 3 ]
file_id = '0BwwA4oUTeiV1UVNwOHItT0xfa2M' request = drive_service.files().get_media(fileId=file_id) fh = io.BytesIO() downloader = MediaIoBaseDownload(fh, request) done = False while done is False: status, done = downloader.next_chunk() print "Download %d%%." % int(status.progress() * 100)
normal
{ "blob_id": "6b3f634f3f0108e678d44ef9c89150f9fd116f76", "index": 9471, "step-1": "file_id = '0BwwA4oUTeiV1UVNwOHItT0xfa2M'\nrequest = drive_service.files().get_media(fileId=file_id)\nfh = io.BytesIO()\ndownloader = MediaIoBaseDownload(fh, request)\ndone = False\nwhile done is False:\n status, done = downloade...
[ 0 ]
# Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of so...
normal
{ "blob_id": "08b57c00beb8dfedfee1bc032b8c281d7a151931", "index": 8033, "step-1": "<mask token>\n\n\nclass Manager(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, port, options, printer):\n \"\"\"Initializes test runner data struc...
[ 14, 20, 25, 31, 33 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while a != b: if a > b: a -= b else: b -= a print(a) print('---') <|reserved_special_token_0|> while number < 100: x = number a = 3 * x + 23 b = 3 * x - 17 while a != b: if a > b: ...
flexible
{ "blob_id": "181e9ac4acf0e69576716f3589359736bfbd9bef", "index": 2380, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile a != b:\n if a > b:\n a -= b\n else:\n b -= a\nprint(a)\nprint('---')\n<mask token>\nwhile number < 100:\n x = number\n a = 3 * x + 23\n b = 3 * x - 17\...
[ 0, 1, 2, 3 ]
''' Created on 13 Dec 2016 @author: hpcosta ''' # https://www.hackerrank.com/challenges/backreferences-to-failed-groups regex = r"^\d{2}(-?)\d{2}\1\d{2}\1\d{2}$" # Do not delete 'r'. import re print(str(bool(re.search(regex, raw_input()))).lower()) # Task # # You have a test string S. # Your task is to write...
normal
{ "blob_id": "e884ce5878de75afe93085e2310b4b8d5953963a", "index": 337, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(str(bool(re.search(regex, raw_input()))).lower())\n", "step-3": "<mask token>\nregex = '^\\\\d{2}(-?)\\\\d{2}\\\\1\\\\d{2}\\\\1\\\\d{2}$'\n<mask token>\nprint(str(bool(re.search(re...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def rec_coin(target, coins): """ INPUT: Target change amount and list of coin values OUTPUT: Minimum coins needed to make change Note, this solution is not optimized. """ min_coins = target if target in coins: return 1 else: for i in [c for...
flexible
{ "blob_id": "f8c30f8ccd1b901fd750a2c9e14cab78e1d12a14", "index": 4039, "step-1": "<mask token>\n\n\ndef rec_coin(target, coins):\n \"\"\"\n INPUT: Target change amount and list of coin values\n OUTPUT: Minimum coins needed to make change\n\n Note, this solution is not optimized.\n \"\"\"\n min_...
[ 4, 6, 7, 8, 9 ]
from django.test import TestCase # Create your tests here. import pymongo client = pymongo.MongoClient(host='127.0.0.1', port=27017) db = client.NBA_china_spider collection = db.data data = [title for title in collection.find()] print(data[0]['url'])
normal
{ "blob_id": "52ebe80e2d520bf07b21dc668223348002eb6d42", "index": 2790, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(data[0]['url'])\n", "step-3": "<mask token>\nclient = pymongo.MongoClient(host='127.0.0.1', port=27017)\ndb = client.NBA_china_spider\ncollection = db.data\ndata = [title for titl...
[ 0, 1, 2, 3, 4 ]
from LinkedList import LinkedList from LinkedListHelper import CreateLinkedList class LinkedListMod(LinkedList): def remove_allnode(self): while self.head: temp = self.head self.head = self.head.next del temp def main(): l1 = LinkedListMod() CreateLinkedList(l1) ...
normal
{ "blob_id": "45b20b57a3579c2527c674d0c2af88eedddadcae", "index": 3724, "step-1": "<mask token>\n\n\nclass LinkedListMod(LinkedList):\n\n def remove_allnode(self):\n while self.head:\n temp = self.head\n self.head = self.head.next\n del temp\n\n\n<mask token>\n", "step...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: import Tkinter as tk from urllib2 import urlopen except ImportError: import tkinter as tk from urllib.request import urlopen <|reserved_special_token_0|> root.title(sf) <|reserved_special_token_0|> label.pack(...
flexible
{ "blob_id": "7764effac0b95ad8f62b91dd470c1d0e40704a7d", "index": 9705, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n import Tkinter as tk\n from urllib2 import urlopen\nexcept ImportError:\n import tkinter as tk\n from urllib.request import urlopen\n<mask token>\nroot.title(sf)\n<mask...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def a2b_base64(string: _Ascii) ->bytes: ... <|reserved_special_token_0|> def a2b_qp(string: _Ascii, header: bool=...) ->bytes: ... def b2a_qp(data: _Bytes, quotetabs: bool=..., istext: bool=..., header: bool=...) ->bytes: ... def a2b_hqx(string: _Ascii) ->bytes: ...
flexible
{ "blob_id": "9ba74c7ecbd20c59883aff4efdc7e0369ff65daf", "index": 5267, "step-1": "<mask token>\n\n\ndef a2b_base64(string: _Ascii) ->bytes:\n ...\n\n\n<mask token>\n\n\ndef a2b_qp(string: _Ascii, header: bool=...) ->bytes:\n ...\n\n\ndef b2a_qp(data: _Bytes, quotetabs: bool=..., istext: bool=..., header:\n...
[ 13, 15, 16, 17, 19 ]
N,T=map(int,input().split()) nm=1000000 for i in range(N): c,t=map(int,input().split()) if nm>c and T>=t: nm=c if nm==1000000: print("TLE") else: print(nm)
normal
{ "blob_id": "8a0e781f29c426161240e33b9d2adc7537b3d352", "index": 2513, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n c, t = map(int, input().split())\n if nm > c and T >= t:\n nm = c\nif nm == 1000000:\n print('TLE')\nelse:\n print(nm)\n", "step-3": "N, T = map(...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- __doc__ = """\ A MiniFrame is a Frame with a small title bar. It is suitable for floating toolbars that must not take up too much screen area. In other respects, it's the same as a wx.Frame. """ __wxPyOnlineDocs__ = 'https://wxpython.org/Phoenix/docs/html/wx.MiniFrame.htm...
normal
{ "blob_id": "b041e9577af72d2bcee3dda0cc78fa12800d53bd", "index": 2286, "step-1": "<mask token>\n\n\nclass TestPanel(wx.Panel):\n\n def __init__(self, parent, log):\n self.log = log\n wx.Panel.__init__(self, parent, -1)\n b1 = wx.Button(self, -1, 'Create and Show a MiniFrame', (50, 50))\n ...
[ 12, 14, 16, 19, 22 ]
import random ''' 通用文件头,浏览器访问时随机选择 ''' user_agent = [ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50", "Mozilla/5....
normal
{ "blob_id": "5ed91b98ece3ac9525e9d2c42db9c9d9912d5ed2", "index": 9029, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_user_agent():\n return {'User-Agent': random.choice(user_agent)}\n", "step-3": "<mask token>\nuser_agent = [\n 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us...
[ 0, 1, 2, 3, 4 ]
from datetime import datetime from random import seed from pandas import date_range, DataFrame import matplotlib.pyplot as plt from matplotlib import style from numpy import asarray import strategy_learner as sl from util import get_data style.use('ggplot') seed(0) def run_algo(sym, investment, start_date, end_date...
normal
{ "blob_id": "c0f9a1c39ff5d7cc99a16cf00cddcc14705937ba", "index": 3917, "step-1": "<mask token>\n\n\ndef run_algo(sym, investment, start_date, end_date, bench_sym):\n learner = sl.StrategyLearner(bench_sym=bench_sym, verbose=verbose)\n learner.add_evidence(symbol=sym, start_date=start_date, end_date=\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def rad_to_deg(rad): return rad * 180 / PI def angle_abs_difference(a1, a2): delta = sims4.math.mod_2pi(a1 - a2) if delta > sims4.math.PI: delta = sims4.math.TWO_PI - delta return delta <|reserved_special_token_0|> def vector_dot_2d(a, b): return a.x * b....
flexible
{ "blob_id": "a0310b1bab339064c36ff0fe92d275db7a6c5ba9", "index": 8734, "step-1": "<mask token>\n\n\ndef rad_to_deg(rad):\n return rad * 180 / PI\n\n\ndef angle_abs_difference(a1, a2):\n delta = sims4.math.mod_2pi(a1 - a2)\n if delta > sims4.math.PI:\n delta = sims4.math.TWO_PI - delta\n return...
[ 52, 53, 55, 64, 75 ]
<|reserved_special_token_0|> class ventaDetalle: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ventaDetalle: def __init__(self, pro, pre, cant): self.producto = pro self.precio = pre self.cantidad = cant <|reserved_special_token_1|...
flexible
{ "blob_id": "f70f66926b9e2bf8b387d481263493d7f4c65397", "index": 516, "step-1": "<mask token>\n\n\nclass ventaDetalle:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ventaDetalle:\n\n def __init__(self, pro, pre, cant):\n self.producto = pro\n self.precio = pre\n self.cantidad...
[ 1, 2, 3, 4, 5 ]
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from myfirstpython.fastapi import models, crud, schemas from myfirstpython.fastapi.dbconnection import engine, SessionLocal models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def g...
normal
{ "blob_id": "ad474f5120ca2a8c81b18071ab364e6d6cf9e653", "index": 7031, "step-1": "<mask token>\n\n\n@app.get('/jobs/', response_model=List[schemas.Job])\ndef read_jobs(skip: int=0, limit: int=100, db: Session=Depends(get_db)):\n jobs = crud.get_jobs(db, skip=skip, limit=limit)\n return jobs\n\n\n@app.get('...
[ 6, 8, 10, 11, 13 ]
import random from .action import Action from ..transition.step import Step from ..value.estimators import ValueEstimator def greedy(steps: [Step], actions: [Action], value_estimator: ValueEstimator) -> int: estimations = [value_estimator(steps, action) for action in actions] return actions[estimations.index...
normal
{ "blob_id": "eab45dafd0366af8ab904eb33719b86777ba3d65", "index": 2925, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef e_greedy(steps: [Step], actions: [Action], value_estimator:\n ValueEstimator, e: float) ->int:\n return random.sample(actions, 1) if random.uniform(0, 1) < e else greedy(\n ...
[ 0, 1, 2, 3, 4 ]
from sys import exit def hard(): print("Nice! Let's try something harder") print("Could you calculate this for me?") print("4 * 35 + 18 / 2 = ") aws = input(">") while True: if aws == "176": print("Nice, you correctly answer all the questions") exit(0) els...
normal
{ "blob_id": "5d05351cd6cd6c0d216e8bc09308532605bfd26e", "index": 3007, "step-1": "<mask token>\n\n\ndef easy():\n print('Ok, seems like you are not good at math.')\n print('What about this.')\n print('Say you have 10 apples, your Mom gave you another 2.')\n print('How many apples you have now?')\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def word_freq_improved_summarize(text): sen = text.split('.') small = [s.lower() for s in sen] punc_free = [] for p in small: punc_free.extend(token.tokenize(p)) stop_words = set(stopwords.words('english')) words = [] for x in punc_free: if x no...
flexible
{ "blob_id": "aed6e1966d9e4ce7250ae3cacaf8854cab4b590c", "index": 3513, "step-1": "<mask token>\n\n\ndef word_freq_improved_summarize(text):\n sen = text.split('.')\n small = [s.lower() for s in sen]\n punc_free = []\n for p in small:\n punc_free.extend(token.tokenize(p))\n stop_words = set(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def draw_text(text, font_u, color, surface, x, y): text_object = font_u.render(text, color) textrect = text_object[1] textrect.topleft = x, y surface.blit(text_object[0], textrect) <|reserved_special_token_0|> def draw_controls(): pygame.draw.rect(screen, (255, 255...
flexible
{ "blob_id": "d00fa29c502cc0311c54deb657b37c3c3caac7ca", "index": 3755, "step-1": "<mask token>\n\n\ndef draw_text(text, font_u, color, surface, x, y):\n text_object = font_u.render(text, color)\n textrect = text_object[1]\n textrect.topleft = x, y\n surface.blit(text_object[0], textrect)\n\n\n<mask t...
[ 6, 10, 11, 12, 13 ]
<|reserved_special_token_0|> def main(): website = input('Enter the website you want to download file from: ') div = input('Enter the div/span (be as specific as you can): ') classTag = input('Enter the class/id tag you want to extract link from: ') className = input('Enter the class/id name: ') s...
flexible
{ "blob_id": "a61f351391ca1b18359323fd9e49f1efa4c7513c", "index": 4007, "step-1": "<mask token>\n\n\ndef main():\n website = input('Enter the website you want to download file from: ')\n div = input('Enter the div/span (be as specific as you can): ')\n classTag = input('Enter the class/id tag you want to...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """ Created on Thu Nov 8 17:14:14 2018 @author: Winry """ import pandas as pd # 显示所有的列 pd.set_option('display.max_columns', None) # 读取数据 file_name = "data_11_8.csv" file_open = open(file_name) df = pd.read_csv(file_open) file_open.close() Newtaxiout_time = df['Newtaxiout_time'] time = df['t...
normal
{ "blob_id": "f5a474cdc8aa22322b252b980c0334a9db21bd5c", "index": 9300, "step-1": "<mask token>\n", "step-2": "<mask token>\npd.set_option('display.max_columns', None)\n<mask token>\nfile_open.close()\n<mask token>\nfor i in range(len(df)):\n count = []\n count = df2['Newappend1'][(df2['Newappend1'] > New...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 num = int(input()) str = input().split() table = [int(i) for i in str] list.sort(table) print(table[num-1] - table[0])
normal
{ "blob_id": "d853964d424e628d6331b27123ad045f8d945dc0", "index": 4026, "step-1": "<mask token>\n", "step-2": "<mask token>\nlist.sort(table)\nprint(table[num - 1] - table[0])\n", "step-3": "num = int(input())\nstr = input().split()\ntable = [int(i) for i in str]\nlist.sort(table)\nprint(table[num - 1] - tabl...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def matriz_laplaciana(N, t=np.single): e = np.eye(N) - np.eye(N, N, 1) return t(e + e.T) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def matriz_laplaciana(N, t=np.single): e = np.eye(N) - np.eye(N, N, 1) return t(e + e.T) ...
flexible
{ "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|> class D3D12_Resource_Mapping_Zoo(rdtest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def check_capture(self): if not self.controller.GetAPIProperties().shaderDebugging: rdtest.log.success('Shader debugging not enabled, skipping test...
flexible
{ "blob_id": "565888d771f53934805555390e48d4886a43bdb6", "index": 189, "step-1": "<mask token>\n\n\nclass D3D12_Resource_Mapping_Zoo(rdtest.TestCase):\n <mask token>\n <mask token>\n\n def check_capture(self):\n if not self.controller.GetAPIProperties().shaderDebugging:\n rdtest.log.suc...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def eval_results(time_stamps: Union[Tuple, List], excel_file_path=os.path. join(FULL_PATH_TO_CHECKPOINTS, f'xVal_results.xlsx')): with pd.ExcelWriter(excel_file_path, mode='w') as writer: for ts in time_stamps: print(f'Evaluating results for time stamp: {ts}') ...
flexible
{ "blob_id": "5447bd3b08c22913ae50ee66ee81554d2357ef3e", "index": 3991, "step-1": "<mask token>\n\n\ndef eval_results(time_stamps: Union[Tuple, List], excel_file_path=os.path.\n join(FULL_PATH_TO_CHECKPOINTS, f'xVal_results.xlsx')):\n with pd.ExcelWriter(excel_file_path, mode='w') as writer:\n for ts...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def ge_gen_in(flm_params, textured_rndr, norm_map, normal_map_cond, texture_cond): if normal_map_cond and texture_cond: return torch.cat((textured_rndr, norm_map), dim=1) elif normal_map_cond: return norm_map elif texture_cond: return textured_rndr ...
flexible
{ "blob_id": "d0991d8ea47379a0c1de836b5d215c99166ad049", "index": 5936, "step-1": "<mask token>\n\n\ndef ge_gen_in(flm_params, textured_rndr, norm_map, normal_map_cond,\n texture_cond):\n if normal_map_cond and texture_cond:\n return torch.cat((textured_rndr, norm_map), dim=1)\n elif normal_map_co...
[ 2, 3, 4, 5, 6 ]
#python的运算符实例 #'+'加号 # 俩个对象相加(可以是俩个数字,也可以是俩个字符串(将俩个字符串连接)) a=7+8 print(a) b="GOOD"+"Job" print(b) #'-'减号 #取一个数字的相反数或者实现俩个数字相减 c=-7 print(c) print(19-1) #'*'乘号 #如果是数字则进行乘法运算,字符串则复制若干次 d=4*7 print(d) e="hello"*7 print(e) #'/'除号 #表示俩个数字相除(Python 3.0中会直接输出正确的值) f=7/2 print(f) #'**'求幂运算 g=2**3 print(g) #'<'小于号 返回一个布尔值 ...
normal
{ "blob_id": "d28f5f95b375a1e075fdfcbc0350c90cf96f0212", "index": 9694, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\n<mask token>\nprint(b)\n<mask token>\nprint(c)\nprint(19 - 1)\n<mask token>\nprint(d)\n<mask token>\nprint(e)\n<mask token>\nprint(f)\n<mask token>\nprint(g)\n<mask token>\nprin...
[ 0, 1, 2, 3 ]
import requests from lxml import etree from pymongo import MongoClient from lib.rabbitmq import Rabbit from lib.log import LogHandler from lib.proxy_iterator import Proxies import yaml import json import datetime import re import time setting = yaml.load(open('config_local.yaml')) log = LogHandler('article_consumer')...
normal
{ "blob_id": "cd1d8a73b6958775a212d80b50de74f4b4de18bf", "index": 6319, "step-1": "<mask token>\n\n\nclass CrawlerDetail:\n\n def __init__(self):\n self.proxy = Proxies()\n\n def start_consume(self):\n channel = connection.channel()\n channel.queue_declare(queue='usual_article')\n ...
[ 4, 5, 6, 8, 9 ]
from flask import Flask from flask import render_template # Creates a Flask application called 'app' app = Flask(__name__, template_folder='C:\Users\jwhitehead\Documents\Webdev\Angular Web App') # The route to display the HTML template on @app.route('/') def host(): return render_template('index.html') # Run the...
normal
{ "blob_id": "3e1e2de555667bf09162cd6c62cad35dabbd0f54", "index": 2482, "step-1": "from flask import Flask\nfrom flask import render_template\n\n# Creates a Flask application called 'app'\napp = Flask(__name__, template_folder='C:\\Users\\jwhitehead\\Documents\\Webdev\\Angular Web App')\n\n# The route to display ...
[ 0 ]
# Random number guessing game. # 10 July 20 # CTI-110 P5HW1 - Random Number # Thelma Majette import random randomNumber = random.randint (1,100) # main function def main(): # Create a variable to control the loop. keep_going = 'y' while keep_going == 'y': # Ask user fo...
normal
{ "blob_id": "c09c02a36a64e9522cfc8c0951bd6c98f404f09c", "index": 367, "step-1": "<mask token>\n\n\ndef main():\n keep_going = 'y'\n while keep_going == 'y':\n guess = int(input('\\nGuess a number between 1 and 100: '))\n if guess > randomNumber:\n print('\\nToo high, try again.')\n...
[ 1, 2, 3, 4, 5 ]
from pyspark import SparkContext, SparkConf import time # Create a basic configuration conf = SparkConf().setAppName("myTestCopyApp") # Create a SparkContext using the configuration sc = SparkContext(conf=conf) print("START") time.sleep(30) print("END")
normal
{ "blob_id": "4b773fbf45d15dff27dc7bd51d6636c5f783477b", "index": 9183, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('START')\ntime.sleep(30)\nprint('END')\n", "step-3": "<mask token>\nconf = SparkConf().setAppName('myTestCopyApp')\nsc = SparkContext(conf=conf)\nprint('START')\ntime.sleep(30)\np...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate_nonce(): return hexencode(os.urandom(32)) <|reserved_special_token_1|> import os from CTFd.utils.encoding import hexencode def generate_nonce(): return hexencode(os.urandom(32))
flexible
{ "blob_id": "4f91c57ad42759654a87328d5c92de8da14ca5ea", "index": 2966, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_nonce():\n return hexencode(os.urandom(32))\n", "step-3": "import os\nfrom CTFd.utils.encoding import hexencode\n\n\ndef generate_nonce():\n return hexencode(os.u...
[ 0, 1, 2 ]
#Developer: Chritian D. Goyes ''' this script show your name and your age. ''' myName = 'Christian D. Goyes' myDate = 1998 year = 2020 age = year - myDate print ("yourname is: ", age, "and your are", "years old")
normal
{ "blob_id": "f5331b56abea41873bd3936028471d0da1c58236", "index": 4986, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('yourname is: ', age, 'and your are', 'years old')\n", "step-3": "<mask token>\nmyName = 'Christian D. Goyes'\nmyDate = 1998\nyear = 2020\nage = year - myDate\nprint('yourname is:...
[ 0, 1, 2, 3 ]
"""to get the all the module and its location""" import sys print(sys.modules)
normal
{ "blob_id": "20637e41df8a33e3837905a4729ae0b4a9f94dbb", "index": 3128, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(sys.modules)\n", "step-3": "<mask token>\nimport sys\nprint(sys.modules)\n", "step-4": "\"\"\"to get the all the module and its location\"\"\"\r\nimport sys\r\nprint(sys.modules...
[ 0, 1, 2, 3 ]
import numpy as np import urllib2 from io import StringIO def demo_polyfit0(): x, y = np.loadtxt('stock.txt', unpack=True) print '-'.join(map(str, np.polyfit(x, y, 1))) def demo_polyfit1(): d = urllib2.urlopen("http://www.qlcoder.com/download/145622513871043.txt").read().decode("utf-8") print d ...
normal
{ "blob_id": "61571ba9f647f430879b9fa5db884ec4c93c334f", "index": 9659, "step-1": "import numpy as np\nimport urllib2\nfrom io import StringIO\n\n\ndef demo_polyfit0():\n x, y = np.loadtxt('stock.txt', unpack=True)\n print '-'.join(map(str, np.polyfit(x, y, 1)))\n\n\ndef demo_polyfit1():\n d = urllib2.ur...
[ 0 ]
from tkinter.ttk import * from tkinter import * import tkinter.ttk as ttk from tkinter import messagebox import sqlite3 root = Tk() root.title('Register-Form') root.geometry("600x450+-2+86") root.minsize(120, 1) def delete(): if(Entry1.get()==''): messagebox.showerror('Register-Form', 'ID Is compolsary fo...
normal
{ "blob_id": "37cafe5d3d3342e5e4070b87caf0cfb5bcfdfd8d", "index": 1613, "step-1": "<mask token>\n\n\ndef sign_in():\n root.destroy()\n import main\n\n\n<mask token>\n", "step-2": "<mask token>\nroot.title('Register-Form')\nroot.geometry('600x450+-2+86')\nroot.minsize(120, 1)\n\n\ndef delete():\n if Ent...
[ 1, 4, 5, 6, 7 ]
def build_shift_dict(self, shift): ''' Creates a dictionary that can be used to apply a cipher to a letter. The dictionary maps every uppercase and lowercase letter to a character shifted down the alphabet by the input shift. The dictionary should have 52 keys of all the uppercase letters and all th...
normal
{ "blob_id": "07d2da14d0122ad2c8407bb13b8567ca62356bef", "index": 7515, "step-1": "<mask token>\n", "step-2": "def build_shift_dict(self, shift):\n \"\"\"\n Creates a dictionary that can be used to apply a cipher to a letter.\n The dictionary maps every uppercase and lowercase letter to a\n characte...
[ 0, 1, 2 ]
from selenium import webdriver from urllib.request import urlopen, Request from subprocess import check_output import json #from flask import Flask # https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=-32.27,-34.08,-73.15,-70.29 def get_json_aviones(north, south, west, east): #driver = webdriver.Chrom...
normal
{ "blob_id": "9ba5af7d2b6d4f61bb64a055efb15efa8e08d35c", "index": 5379, "step-1": "<mask token>\n\n\ndef get_json_buques(centerx, centery, zoom):\n count = 0\n while True:\n ignore = False\n count += 1\n print(centerx, centery, zoom)\n out = check_output(['phantomjs', 'GetBarcos....
[ 1, 2, 3, 4, 5 ]
""" A module for constants. """ # fin adding notes for keys and uncomment KEYS = [ "CM", "GM" # , # "DM", # "AM", # "EM", # "BM", # "FSM", # "CSM", # "Am", # "Em", # "Bm", # "FSm", # "CSm", # "GSm", # "DSm", # "ASm", ] NOTES_FOR_KEY = { "CM": [...
normal
{ "blob_id": "dd7ade05ef912f7c094883507768cc21f95f31f6", "index": 533, "step-1": "<mask token>\n", "step-2": "<mask token>\nKEYS = ['CM', 'GM']\nNOTES_FOR_KEY = {'CM': [21, 23, 24, 26, 28, 29, 31, 33, 35, 36, 38, 40, 41,\n 43, 45, 47, 48, 50, 52, 53, 55, 57, 59, 60, 62, 64, 65, 67, 69, 71, 72,\n 74, 76, 7...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> button6.grid(row=2, column=2, sticky=S + N + E + W) <|reserved_special_token_0|> button7.grid(row=3, column=0, sticky=S + N + E + W) <|reserved_special_token_0|> button8.grid(row=3, column=1, sticky=S + N + E + W) <|reserved_speci...
flexible
{ "blob_id": "e543c7f7f1b249e53b8ebf82641ec398abf557af", "index": 477, "step-1": "<mask token>\n", "step-2": "<mask token>\nbutton6.grid(row=2, column=2, sticky=S + N + E + W)\n<mask token>\nbutton7.grid(row=3, column=0, sticky=S + N + E + W)\n<mask token>\nbutton8.grid(row=3, column=1, sticky=S + N + E + W)\n<...
[ 0, 1, 2, 3 ]
import os import sys from flask import Flask, request, abort, flash, jsonify, Response from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_migrate import Migrate import random import unittest from models import db, Question, Category # set the number of pages fpr pagination QUESTIONS_PER_PA...
normal
{ "blob_id": "b84a2093a51e57c448ee7b4f5a89d69dfb14b1b6", "index": 4876, "step-1": "<mask token>\n\n\n@app.after_request\ndef after_request(response):\n response.headers.add('Access-Control-Allow-Headers',\n 'Content-Type, Authorization, true')\n response.headers.add('Access-Control-Allow-Methods',\n ...
[ 8, 10, 12, 14, 17 ]
import os import xml.etree.ElementTree as Et import copy from .common import CommonRouteExchangeService class DataRoutes(CommonRouteExchangeService): """Класс для работы с данными аршрутов""" def get_route_from_file(self, path_route): """Считывание маршрута из файла :param path_route: Путь до...
normal
{ "blob_id": "63069f03d17862b8ea6aa74d0acd1370bbea0dcb", "index": 836, "step-1": "<mask token>\n\n\nclass DataRoutes(CommonRouteExchangeService):\n <mask token>\n <mask token>\n <mask token>\n\n def change_status_in_route(self, tree_route, status):\n \"\"\"Замена статуса маршрута в маршруте\n ...
[ 3, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def case_study_submission(request, template_name='casestudies/submit.html'): form = SubmitCaseStudyForm(request.POST or None) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('submit_me...
flexible
{ "blob_id": "fe3e104cf213b21c33a4b5c6e1a61315c4770eda", "index": 6821, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef case_study_submission(request, template_name='casestudies/submit.html'):\n form = SubmitCaseStudyForm(request.POST or None)\n if form.is_valid():\n form.save()\n ...
[ 0, 1, 2, 3 ]
#################################################################################### # # Kaggle Competition: https://www.kaggle.com/c/msk-redefining-cancer-treatment # Sponsor : Memorial Sloan Kettering Cancer Center (MSKCC) # Author: Amrut Shintre # #####################################################################...
normal
{ "blob_id": "1305991a9cd82ddeaffff1545a35ced992e6792f", "index": 7300, "step-1": "<mask token>\n\n\ndef text_cleaning(text_df):\n corpus = []\n for i in range(len(text_df)):\n text = re.sub('[^a-zA-Z]', ' ', text_df['Text'][i])\n text = text.lower()\n text = text.split()\n ps = ...
[ 4, 5, 6, 7, 8 ]
from .ast import * # noinspection PyPep8Naming def addToClass(cls): def decorator(func): setattr(cls, func.__name__, func) return func return decorator def print_intended(to_print, intend): print(intend * "| " + to_print) # noinspection PyPep8Naming,PyUnresolvedReferences class TreeP...
normal
{ "blob_id": "1084478226777b9259274e053984ac34d461198d", "index": 42, "step-1": "<mask token>\n\n\nclass TreePrinter:\n\n @addToClass(Node)\n def printTree(self, indent=0):\n raise Exception('printTree not defined in class ' + self.__class__.\n __name__)\n\n @addToClass(Instruction)\n ...
[ 18, 21, 22, 24, 26 ]
weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] i = input('Enter a day of the week and number of days: ').split() e = int(i[-1]) starting_point = weekdays.index(i[0]) a = e + starting_point - len(weekdays) print(weekdays[a])
normal
{ "blob_id": "5f7d05c642339ce0ab02a65ca41f9ee89c2faf57", "index": 4240, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(weekdays[a])\n", "step-3": "weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',\n 'Saturday', 'Sunday']\ni = input('Enter a day of the week and number of days: ...
[ 0, 1, 2 ]
import pygame from pygame import Rect, Color from pymunk import Body, Poly from config import WIDTH, HEIGHT class Ground: def __init__ (self, space): # size self.w = WIDTH - 20 self.h = 25 # position self.x = 10 self.y = HEIGHT - self.h # pygame...
normal
{ "blob_id": "32fc0db68c32c2e644f9c1c2318fbeff41a0543d", "index": 5703, "step-1": "<mask token>\n\n\nclass Ground:\n <mask token>\n <mask token>\n\n def draw(self, window):\n pygame.draw.rect(window, self.color, self.rect)\n return\n", "step-2": "<mask token>\n\n\nclass Ground:\n\n def...
[ 2, 3, 4, 5, 6 ]
# ch14_26.py fn = 'out14_26.txt' x = 100 with open(fn, 'w') as file_Obj: file_Obj.write(x) # 直接輸出數值x產生錯誤
normal
{ "blob_id": "e4f07355300003943d2fc09f80746a1201de7e37", "index": 1678, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(fn, 'w') as file_Obj:\n file_Obj.write(x)\n", "step-3": "fn = 'out14_26.txt'\nx = 100\nwith open(fn, 'w') as file_Obj:\n file_Obj.write(x)\n", "step-4": "# ch14_26.py\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> def refined(self, nums, i, a, ans): if i >= len(nums): if len(a) == len(ans) and self.isMoreCompetitive(a, ans) == False: return False, None elif len(a) != len(ans): retur...
flexible
{ "blob_id": "f8b04f374e1c55d4985be793939f0ff9393c29e0", "index": 2571, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def refined(self, nums, i, a, ans):\n if i >= len(nums):\n if len(a) == len(ans) and self.isMoreCompetitive(a, ans) == False:\n return Fals...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class my_image_csv_dataset(Dataset): def __init__(self, data_dir, data, transforms_=None, obj=False, minorities=None, diffs=None, bal_tfms=None): self.data_dir = data_dir self.data = data self.transforms_ = transforms_ self.tfms = None ...
flexible
{ "blob_id": "5b8c95354f8b27eff8226ace52ab9e97f98ae217", "index": 80, "step-1": "<mask token>\n\n\nclass my_image_csv_dataset(Dataset):\n\n def __init__(self, data_dir, data, transforms_=None, obj=False,\n minorities=None, diffs=None, bal_tfms=None):\n self.data_dir = data_dir\n self.data ...
[ 15, 16, 19, 25, 29 ]
<|reserved_special_token_0|> class France(BigFileSpider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def start_requests(self): url = ( 'https://www.data.gouv.fr/api/1/datasets/donnees-essentielles-de-la-commande-publique-fichiers-consoli...
flexible
{ "blob_id": "369bffa21b5b8c0ca1d93da3aa30a38e2f4c82cc", "index": 9451, "step-1": "<mask token>\n\n\nclass France(BigFileSpider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://www.data.gouv.fr/api/1/datasets/donnees-essentielles-de-la...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pymysql.install_as_MySQLdb() <|reserved_special_token_1|> import pymysql pymysql.install_as_MySQLdb() <|reserved_special_token_1|> import pymysql pymysql.install_as_MySQLdb() # from keras.models import load_model # from ke...
flexible
{ "blob_id": "b7d3af29e024b0b2cf5d2c054290f799eae7fed1", "index": 4476, "step-1": "<mask token>\n", "step-2": "<mask token>\npymysql.install_as_MySQLdb()\n", "step-3": "import pymysql\npymysql.install_as_MySQLdb()\n", "step-4": "import pymysql\n\npymysql.install_as_MySQLdb()\n\n# from keras.models import lo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for j in range(0, len(df1)): print(j) user = [] proto = [] purity = [] card_name = [] card_effect = [] god = [] rarity = [] mana = [] type = [] set = [] print(df1['address'][j]) ...
flexible
{ "blob_id": "93909ab98f1141940e64e079e09834ae5ad3995f", "index": 6537, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor j in range(0, len(df1)):\n print(j)\n user = []\n proto = []\n purity = []\n card_name = []\n card_effect = []\n god = []\n rarity = []\n mana = []\n typ...
[ 0, 1, 2, 3, 4 ]
import numpy from scipy.optimize import OptimizeResult from logging import getLogger logger = getLogger(__name__) def minimize_neldermead(func, x0, args=(), callback=None, maxiter=None, maxfev=None, disp=False, return_all=False, initial_simplex=None, ...
normal
{ "blob_id": "35921b081e8e8c4da2b16afc20b27b636e9a6676", "index": 4761, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef minimize_neldermead(func, x0, args=(), callback=None, maxiter=None,\n maxfev=None, disp=False, return_all=False, initial_simplex=None, xatol=\n 0.0001, fatol=0.0001, **unkno...
[ 0, 1, 2, 3, 4 ]