code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import numpy as np from random import randint def combinacaoDeEmbralhamento(qtdeLinhas): while True: a = randint(0,qtdeLinhas) b = randint(0,qtdeLinhas) if a == b : continue else: break resp = [[a,b]] return resp def embaralhaMatriz(x): for i in range(qtdeLinhas): print(i) combinacaoDeEmbralha...
normal
{ "blob_id": "28ed494939d0928bf3ad4f07f58186374e925426", "index": 7024, "step-1": "<mask token>\n\n\ndef combinacaoDeEmbralhamento(qtdeLinhas):\n while True:\n a = randint(0, qtdeLinhas)\n b = randint(0, qtdeLinhas)\n if a == b:\n continue\n else:\n break\n ...
[ 2, 3, 4, 5, 6 ]
def pin(): print('wqeqwwqe') from tkinter import * from tkinter import messagebox from PIL import Image from PIL import ImageTk window = Tk() #创建一个窗口 window.title('爱你吆') #定义窗口标题 window.geometry('400x400+800+200') #定义窗口大小 窗口显示位置 # window.protocol('WM_DELETE_WINDOW', pin) #摧毁窗口,引到另一个函数命令 window.protocol(...
normal
{ "blob_id": "55c9fe8caf1983f22d5a752574f590fa129e8017", "index": 1443, "step-1": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\n", "step-2": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\nwindow.title('爱你吆')\nwindow.geometry('400x400+800+200')\nwindow.protocol('WM_DELETE_WINDOW')\n<mask token>\nl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> renWin.SetMultiSamples(0) renWin.AddRenderer(ren1) renWin.AddRenderer(ren2) <|reserved_special_token_0|> iren.SetRenderWindow(renWin) <|reserved_special_token_0|> pl3d.SetXYZFileName('' + str(VTK_DATA_ROOT) + '/Data/combxyz.bin') ...
flexible
{ "blob_id": "7399612f64eb8e500bc676e6d507be5fe375f40f", "index": 3746, "step-1": "<mask token>\n", "step-2": "<mask token>\nrenWin.SetMultiSamples(0)\nrenWin.AddRenderer(ren1)\nrenWin.AddRenderer(ren2)\n<mask token>\niren.SetRenderWindow(renWin)\n<mask token>\npl3d.SetXYZFileName('' + str(VTK_DATA_ROOT) + '/Da...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-07-20 08:05 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True depe...
normal
{ "blob_id": "e68d872232b3eab4c33cbbe4376be7dd788888e2", "index": 1242, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
""" Create all figures and Excel files that combine data from all embryos in a given genetic background Copyright (C) 2017 Ahmet Ay, Dong Mai, Soo Bin Kwon, Ha Vu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software ...
normal
{ "blob_id": "86928f4358e4999a5cec8bfad1fe055c9a2778d1", "index": 6230, "step-1": "<mask token>\n\n\ndef main():\n args = sys.argv[1:]\n num_args = len(args)\n req_args = [False] * 3\n num_bins = DEFAULT_NUM_BIN\n if num_args >= 6:\n i = 0\n while i < num_args - 1:\n option...
[ 2, 3, 4, 5, 6 ]
import pickle from sklearn import linear_model from sklearn.model_selection import train_test_split import random from sklearn.manifold import TSNE import matplotlib def loadXY(): zippedXY = pickle.load(open("../Vectorizer/zippedXY_wff_2k.p","rb")) #random.shuffle(zippedXY) X,Y = zip(*zippedXY) return X,Y def out...
normal
{ "blob_id": "cb13011def8fc7ed6a2e98a794343857e3e34562", "index": 3142, "step-1": "import pickle\nfrom sklearn import linear_model\nfrom sklearn.model_selection import train_test_split\nimport random\nfrom sklearn.manifold import TSNE\nimport matplotlib\n\ndef loadXY():\n\tzippedXY = pickle.load(open(\"../Vectori...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in hand: line = line.rstrip() x = re.findall('([0-9]+)', line) if len(x) > 0: for i in x: total += float(i) print('sum is', int(total)) <|reserved_special_token_1|> <|reserved_special_to...
flexible
{ "blob_id": "860908126d473e6c4ed070992a1b518683fd4c27", "index": 3275, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in hand:\n line = line.rstrip()\n x = re.findall('([0-9]+)', line)\n if len(x) > 0:\n for i in x:\n total += float(i)\nprint('sum is', int(total))\n", ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import argparse import subprocess def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: return True def quote(items): return ["'" + item + "'" for item in items] if module_exists('urllib.parse'): from url...
normal
{ "blob_id": "68371acc58da6d986d94d746abb4fea541d65fdd", "index": 3384, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef module_exists(module_name):\n try:\n __import__(module_name)\n except ImportError:\n return False\n else:\n return True\n\n\ndef quote(items):\n r...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class LaunchMovieLottery(object): <|reserved_special_token_0|> def movie_list(self): movie_list = MovieList(file_name, function) self.return_movie_list = movie_list.return_movie_list() self.full_list = movie_list.return_full_list() return [self.ret...
flexible
{ "blob_id": "e35a106a3852a7a004fdae6819d4075e1fe929d6", "index": 4373, "step-1": "<mask token>\n\n\nclass LaunchMovieLottery(object):\n <mask token>\n\n def movie_list(self):\n movie_list = MovieList(file_name, function)\n self.return_movie_list = movie_list.return_movie_list()\n self....
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> @app.route('/direct') def direct(): """ A RemoteFlowSource is used directly as DN and search filter using a oneline call to .search """ unsafe_dc = request.args['dc'] unsafe_filter = request.args['username'] dn = 'dc={}'.format(unsafe_dc) search_filter = '(user...
flexible
{ "blob_id": "b51591de921f6e153c1dd478cec7fad42ff4251a", "index": 749, "step-1": "<mask token>\n\n\n@app.route('/direct')\ndef direct():\n \"\"\"\n A RemoteFlowSource is used directly as DN and search filter using a oneline call to .search\n \"\"\"\n unsafe_dc = request.args['dc']\n unsafe_filter =...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if n % 10 == 1 and (n < 11 or n > 20): print(n, 'korova') elif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20): print(n, 'korovy') else: print(n, 'korov') <|reserved_special_token_1|> n = int(input()) if n % 10 == ...
flexible
{ "blob_id": "78037d936ee5f9b31bf00263885fbec225a4f8f2", "index": 2191, "step-1": "<mask token>\n", "step-2": "<mask token>\nif n % 10 == 1 and (n < 11 or n > 20):\n print(n, 'korova')\nelif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20):\n print(n, 'korovy')\nelse:\n print(n, 'korov')\n", "step-3"...
[ 0, 1, 2, 3 ]
# This file is Copyright (c) 2020 LambdaConcept <contact@lambdaconcept.com> # License: BSD from math import log2 from nmigen import * from nmigen.utils import log2_int from nmigen_soc import wishbone from nmigen_soc.memory import MemoryMap from lambdasoc.periph import Peripheral class gramWishbone(Peripheral, Elab...
normal
{ "blob_id": "3775ba538d6fab13e35e2f0761a1cacbe087f339", "index": 4723, "step-1": "<mask token>\n\n\nclass gramWishbone(Peripheral, Elaboratable):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass gramWishbone(Peripheral, Elaboratable):\n\n def __init__(self, core, data_width=32, gra...
[ 1, 2, 3, 4, 5 ]
from django.urls import path from .views import * urlpatterns = [ path('', ListUser.as_view() , name = 'list'), path('register/', UserRegister.as_view() , name = 'register'), path('login/', UserLogin.as_view() , name = 'login'), path('delete/' , UserDelete.as_view() , name ='delete'), path('update/...
normal
{ "blob_id": "5fe4f2738285d2f4b8bbfee2c4c6d15665737ea4", "index": 8627, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', ListUser.as_view(), name='list'), path('register/',\n UserRegister.as_view(), name='register'), path('login/', UserLogin.\n as_view(), name='login'), path('d...
[ 0, 1, 2, 3 ]
# Copyright 2017 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. DEPS = [ 'step', ] def RunSteps(api): try: api.step('test step', [{}]) except AssertionError as e: assert str(e) == 'Type <type \'...
normal
{ "blob_id": "25d210144ef209fd5e4ff7e4e4c2e77fd7eb79ac", "index": 3480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GenTests(api):\n yield api.test('basic')\n", "step-3": "<mask token>\n\n\ndef RunSteps(api):\n try:\n api.step('test step', [{}])\n except AssertionError as e:\n...
[ 0, 1, 2, 3, 4 ]
# # -*- coding: utf-8 -*- # Copyright 2019 Fortinet, Inc. # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) """ The fortios firewall monitor class It is in this file the runtime information is collected from the device for a given resource, parsed, and the facts tree is popu...
normal
{ "blob_id": "62bc8fec6833c5e8bc1598941eaad141ab6c9d5a", "index": 3758, "step-1": "<mask token>\n\n\nclass FirewallFacts(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FirewallFacts(object):\n <mask token>\n <mask token>\n\n def populate_facts(self...
[ 1, 2, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def modCount(n, m): if m <= n: inBetween = n - m dividible = [] for x in range(m + 1, n): if x % m == 0: dividible.append(x) return ( """There are {} numbers between {} and {} and ...
flexible
{ "blob_id": "0699c9f70f1c16b4cb9837edf7a4ef27f021faec", "index": 8318, "step-1": "<mask token>\n", "step-2": "def modCount(n, m):\n if m <= n:\n inBetween = n - m\n dividible = []\n for x in range(m + 1, n):\n if x % m == 0:\n dividible.append(x)\n retur...
[ 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_1|> <|reserved_special_token_0|> class Solution: def canDivideIntoSubsequences(self, nums: List[int], K: int) ->bool: return len(nums) >...
flexible
{ "blob_id": "6b55a9061bb118558e9077c77e18cfc81f3fa034", "index": 1092, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def canDivideIntoSubsequences(self, nums: List[int], K: int) ->bool:\n return len(nu...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def convertEnEntier(nombre): result = '' if nombre == 4: result = 'IV' if nombre == 3: result = 'III' if nombre == 2: result = 'II' if nombre == 1: result = 'I' return result <|reserved_special_token_0...
flexible
{ "blob_id": "ef7fad5019e79950e8fad56404e9ba5d302cfe1c", "index": 7596, "step-1": "<mask token>\n", "step-2": "def convertEnEntier(nombre):\n result = ''\n if nombre == 4:\n result = 'IV'\n if nombre == 3:\n result = 'III'\n if nombre == 2:\n result = 'II'\n if nombre == 1:\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AirflowPlugin(AirflowPlugin): name = 'airflow-plugin' operators = [] hooks = [] executors = [] macros = [] admin_views = [] flask_blueprints = [] menu_links = [] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0...
flexible
{ "blob_id": "39f1fc04911f8d22d07532add24cd1671a569e72", "index": 9414, "step-1": "<mask token>\n\n\nclass AirflowPlugin(AirflowPlugin):\n name = 'airflow-plugin'\n operators = []\n hooks = []\n executors = []\n macros = []\n admin_views = []\n flask_blueprints = []\n menu_links = []\n\n\n...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # @Time : 2019/3/21 20:12 # @Author : for # @File : test01.py # @Software: PyCharm import socket s=socket.socket() host=socket.gethostname() port=3456 s.connect((host,port)) cmd=input(">>>") s.sendall(cmd.encode()) data=s.recv(1024) print(data.decode()) s.close()
normal
{ "blob_id": "596814032218c3db746f67e54e4f1863753aea06", "index": 6299, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.connect((host, port))\n<mask token>\ns.sendall(cmd.encode())\n<mask token>\nprint(data.decode())\ns.close()\n", "step-3": "<mask token>\ns = socket.socket()\nhost = socket.gethostname...
[ 0, 1, 2, 3, 4 ]
import cv2 import numpy as np """ # Create a black image image = np.zeros((512,512,3), np.uint8) # Can we make this in black and white? image_bw = np.zeros((512,512), np.uint8) cv2.imshow("Black Rectangle (Color)", image) cv2.imshow("Black Rectangle (B&W)", image_bw) cv2.waitKey(0) cv2.destroyAllWindows() image = ...
normal
{ "blob_id": "693f2a56578dfb1e4f9c73a0d33c5585070e9f9e", "index": 5371, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.putText(image, 'Hello World!', (75, 290), cv2.FONT_HERSHEY_COMPLEX, 2,\n (100, 170, 0), 3)\ncv2.imshow('Hello World!', image)\ncv2.imwrite('Text.jpg', image)\ncv2.waitKey(0)\ncv2.d...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def on_release(key): if key == keyboard.Key.esc: write_in_file() return False def write_in_file(): file = open('strokes.txt', 'a') for k in list: file.writelines('{}\n'.format(str(k))) file.close() <|reserved_special_token_0|> <|reserved_speci...
flexible
{ "blob_id": "e60fcf19560b4826577797c8ae8b626ff984dcfd", "index": 6923, "step-1": "<mask token>\n\n\ndef on_release(key):\n if key == keyboard.Key.esc:\n write_in_file()\n return False\n\n\ndef write_in_file():\n file = open('strokes.txt', 'a')\n for k in list:\n file.writelines('{}\...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def register_handlers_for_other(dp: Dispatcher): dp.register_message_handler(new_member, content_types=['new_chat_members']) dp.register_message_handler(left_member, content_types=['left_chat_member'] ) <|reser...
flexible
{ "blob_id": "dfcfa4fa036fe8c058d66fc0b9ea73ddb9d4446e", "index": 7524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_handlers_for_other(dp: Dispatcher):\n dp.register_message_handler(new_member, content_types=['new_chat_members'])\n dp.register_message_handler(left_member, content...
[ 0, 1, 2, 3, 4 ]
from flask import Flask, render_template, request import random, requests app = Flask(__name__) @app.route('/') def hello(): # return 'Hello World' return render_template('index.html') # root 디렉토리에 있는 templates라는 폴더를 탐색하여 파일을 찾음 @app.route('/ace') def ace(): return '불기둥!' @app.route('/html') def html...
normal
{ "blob_id": "9fa3a7c57b311a47e67de73bf6083f1f151d73f4", "index": 8554, "step-1": "<mask token>\n\n\n@app.route('/html')\ndef html():\n return '<h1> 태그 사용할 수 있어요! <h1>'\n\n\n<mask token>\n\n\n@app.route('/ping')\ndef ping():\n return render_template('ping.html')\n\n\n@app.route('/pong')\ndef pong():\n us...
[ 7, 10, 14, 16, 17 ]
<|reserved_special_token_0|> class Company(models.Model): <|reserved_special_token_0|> @classmethod def create(cls, name): company = cls(name=name) return company def __str__(self): return self.name class Entry(models.Model): fetched_date = models.DateTimeField() me...
flexible
{ "blob_id": "47f6c4b3c279a065b8f21dab2faa71271db8d6ab", "index": 6680, "step-1": "<mask token>\n\n\nclass Company(models.Model):\n <mask token>\n\n @classmethod\n def create(cls, name):\n company = cls(name=name)\n return company\n\n def __str__(self):\n return self.name\n\n\ncla...
[ 7, 8, 11, 12, 13 ]
<|reserved_special_token_0|> def array_to_stack(stack, source): """ ------------------------------------------------------- Pushes contents of source onto stack. At finish, source is empty. Last value in source is at bottom of stack, first value in source is on top of stack. Use: array_to_sta...
flexible
{ "blob_id": "dab9b58b08b562d902ee0ae1104198cb1ebbffe5", "index": 1928, "step-1": "<mask token>\n\n\ndef array_to_stack(stack, source):\n \"\"\"\n -------------------------------------------------------\n Pushes contents of source onto stack. At finish, source is empty.\n Last value in source is at bo...
[ 4, 9, 12, 13, 14 ]
<|reserved_special_token_0|> class PingWindow: <|reserved_special_token_0|> def __init__(self, last_parent): self.last_parent = last_parent self.main_widget = QWidget() self.main_widget.setMaximumHeight(400) self.parent_layout = QVBoxLayout() self.ping_log_layout = QHB...
flexible
{ "blob_id": "75b1d2fb927063669a962f72deb57323001c0b7a", "index": 5657, "step-1": "<mask token>\n\n\nclass PingWindow:\n <mask token>\n\n def __init__(self, last_parent):\n self.last_parent = last_parent\n self.main_widget = QWidget()\n self.main_widget.setMaximumHeight(400)\n se...
[ 3, 4, 5, 6, 7 ]
import boto3 import pprint import yaml #initialize empty dictionary to store values new_dict = {} count = 0 new_dict2 = {} # dev = boto3.session.Session(profile_name='shipt') mybatch = boto3.client('batch') #load config properties with open('config.yml') as f: content = yaml.load(f) # pprint.pprint(content) #to...
normal
{ "blob_id": "3ba9ff00b0d6a2006c714a9818c8b561d884e252", "index": 2302, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('config.yml') as f:\n content = yaml.load(f)\n<mask token>\nfor k, v in response.items():\n if k == 'jobDefinitions':\n new_dict = v[0]['containerProperties']\nprin...
[ 0, 1, 2, 3, 4 ]
import sys sys.path.append("../circos_report/cnv_anno2conf") from cnv_anno2conf import main_cnv tarfile = {"yaml": "data/test_app.yaml"} def test_main_cnv(): main_cnv(tarfile) if __name__ == "__main__": test_main_cnv()
normal
{ "blob_id": "3c0beb7be29953ca2d7b390627305f4541b56efa", "index": 69, "step-1": "<mask token>\n\n\ndef test_main_cnv():\n main_cnv(tarfile)\n\n\n<mask token>\n", "step-2": "<mask token>\nsys.path.append('../circos_report/cnv_anno2conf')\n<mask token>\n\n\ndef test_main_cnv():\n main_cnv(tarfile)\n\n\nif _...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class CardRarityParam(CardTextParameter): <|reserved_special_token_0|> @classmethod def get_parameter_name(cls) ->str: return 'rarity' <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "c7d9bbdff9148c5d928de66f4406ee8b4e1bcdac", "index": 2672, "step-1": "<mask token>\n\n\nclass CardRarityParam(CardTextParameter):\n <mask token>\n\n @classmethod\n def get_parameter_name(cls) ->str:\n return 'rarity'\n <mask token>\n <mask token>\n <mask token>\n <mask tok...
[ 4, 5, 6, 8, 12 ]
# -*- encoding:utf-8 -*- import os import unittest from HTMLTestRunner_cn import HTMLTestRunner from time import sleep from framework.SunFlower import SunFlower from testcase.TestCRM import TestCRM class TestCRMcreateCustomer(TestCRM): # 创建客户 def createCustomer(self): # 点击客户图标 self.driver....
normal
{ "blob_id": "74bc530d53cd86c52c44ba8e98d4d8f502032340", "index": 2423, "step-1": "<mask token>\n\n\nclass TestCRMcreateCustomer(TestCRM):\n <mask token>\n\n def test_weiChat(self):\n self.login()\n self.createCustomer()\n self.logout()\n\n\n<mask token>\n", "step-2": "<mask token>\n\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('/Users/ste/Desktop/Ste/Python/AlgorithmsCourse/KargerMinCut.txt' ) as v_list_file: for line in v_list_file: node = map(int, line.split()) for adjacent in node[1:]: edges.append([node[...
flexible
{ "blob_id": "1b7b94a0331e2462f83f4f77bcfaefbeefdf24f4", "index": 3754, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('/Users/ste/Desktop/Ste/Python/AlgorithmsCourse/KargerMinCut.txt'\n ) as v_list_file:\n for line in v_list_file:\n node = map(int, line.split())\n for adjace...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def encrypt(message, passphrase): passphrase = trans(passphrase) IV = Random.new().read(BLOCK_SIZE) aes = AES.new(passphrase, AES.MODE_CFB, IV) return base64.b32encode(IV + aes.encrypt(message)).decode('utf-8') def decrypt(encrypted, passphrase): passphrase = trans(p...
flexible
{ "blob_id": "e55115a65ebee5d41dcd01a5cbabc328acf152da", "index": 6079, "step-1": "<mask token>\n\n\ndef encrypt(message, passphrase):\n passphrase = trans(passphrase)\n IV = Random.new().read(BLOCK_SIZE)\n aes = AES.new(passphrase, AES.MODE_CFB, IV)\n return base64.b32encode(IV + aes.encrypt(message)...
[ 7, 9, 10, 12, 13 ]
<|reserved_special_token_0|> def emit_all_users(channel): """emits all users""" all_users = [user.name for user in db.session.query(models.User1).all()] socketio.emit(channel, {'allUsers': all_users}) return channel <|reserved_special_token_0|> @socketio.on('new google user') def on_new_google_use...
flexible
{ "blob_id": "8d48b5b831edb62b2d9624bc23cae45d390fd224", "index": 8035, "step-1": "<mask token>\n\n\ndef emit_all_users(channel):\n \"\"\"emits all users\"\"\"\n all_users = [user.name for user in db.session.query(models.User1).all()]\n socketio.emit(channel, {'allUsers': all_users})\n return channel\...
[ 12, 13, 14, 18, 19 ]
class BaseService: def __init__(self, context): self._context = context def post(self, path, body): result = self._context.http.post(path, body) return result.json()["Data"]
normal
{ "blob_id": "5000663e3cde9c1a1100c9022707ccae13db0034", "index": 1426, "step-1": "<mask token>\n", "step-2": "class BaseService:\n <mask token>\n <mask token>\n", "step-3": "class BaseService:\n <mask token>\n\n def post(self, path, body):\n result = self._context.http.post(path, body)\n ...
[ 0, 1, 2, 3, 4 ]
# THIS FILE WAS CREATED IN THIS DIRECTORY EARLIER, NOW MOIVED TO ROOT OF THE REPO print "Hello buddy" print "Let's get started" spy_name = raw_input ("What is your spy name? ") if len(spy_name) >3: print "Welcome " + spy_name + ". Glad to have you with us." spy_salutation= raw_input("What's your titl...
normal
{ "blob_id": "79f03af05fb40f5f5247b582eabae2dc125e6b52", "index": 4522, "step-1": "# THIS FILE WAS CREATED IN THIS DIRECTORY EARLIER, NOW MOIVED TO ROOT OF THE REPO\r\n\r\n\r\nprint \"Hello buddy\"\r\nprint \"Let's get started\"\r\nspy_name = raw_input (\"What is your spy name? \")\r\nif len(spy_name) >3:\r\n ...
[ 0 ]
<|reserved_special_token_0|> @pytest.fixture def runner() ->CliRunner: """Fixture for invoking command-line interfaces.""" return CliRunner() def test_main_succeeds(runner: CliRunner) ->None: """It exits with a status code of zero.""" with runner.isolated_filesystem(): df = generate_test_dat...
flexible
{ "blob_id": "97a51d959ad642467c508cedc8786f636e4050bb", "index": 1333, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef runner() ->CliRunner:\n \"\"\"Fixture for invoking command-line interfaces.\"\"\"\n return CliRunner()\n\n\ndef test_main_succeeds(runner: CliRunner) ->None:\n \"\"\"It exits with a s...
[ 3, 6, 7, 8, 9 ]
import argparse import cv2 import numpy as np refPt = [] cropping = False def click_and_crop(event, x, y, flags, param): global refPt, cropping if event == cv2.EVENT_LBUTTONDOWN: refPt = [(x, y)] cropping = True elif event == cv2.EVENT_LBUTTONUP: refPt.append((x, y)) cropping = False cv2.rect...
normal
{ "blob_id": "986df5a41bc87ecb390dfbd1db9e1f5cd6c5b8fb", "index": 9702, "step-1": "\nimport argparse\nimport cv2\nimport numpy as np\n \n\nrefPt = []\ncropping = False\n \ndef click_and_crop(event, x, y, flags, param):\n\tglobal refPt, cropping\n \n\tif event == cv2.EVENT_LBUTTONDOWN:\n\t\trefPt = [(x, y)]\n\t\tc...
[ 0 ]
import os import closet import unittest import tempfile def in_response(response, value): return value.encode() in response.data def is_404(response): response.status_code == 404 class ClosetTestBase(unittest.TestCase): def setUp(self): """Set up test environment befor each test""" se...
normal
{ "blob_id": "a5856e12c281ed6a252f499a380f9c51082ea740", "index": 3711, "step-1": "<mask token>\n\n\nclass ModelBase(unittest.TestCase):\n <mask token>\n <mask token>\n\n def get(self, url):\n \"\"\"Process a GET request to the app\"\"\"\n return self.app.get(get_url(url), follow_redirects=...
[ 31, 43, 44, 49, 56 ]
import subprocess import logging import time import argparse import threading import os import matplotlib.pyplot as plt import numpy as np import argparse def runWeka(wekapath, modelpath, datapath): os.chdir(wekapath) proc = subprocess.Popen(['/usr/bin/java', '-classpath', 'weka.jar', 'weka.classifiers.functio...
normal
{ "blob_id": "a1f0eced5d122fe8557ebc4d707c87b4194513e3", "index": 4976, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef runWeka(wekapath, modelpath, datapath):\n os.chdir(wekapath)\n proc = subprocess.Popen(['/usr/bin/java', '-classpath', 'weka.jar',\n 'weka.classifiers.functions.Multi...
[ 0, 1, 2, 3, 4 ]
""" 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 根糖果棒的大小,B[j] 是鲍勃拥有的第 j 根糖果棒的大小。 因为他们是朋友,所以他们想交换一根糖果棒,这样交换后,他们都有相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的总和。) 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大小,ans[1] 是 Bob 必须交换的糖果棒的大小。 如果有多个答案,你可以返回其中任何一个。保证答案存在。 """ def fairCandySwap(A, B): sumA, sumB = sum(A), sum(B) setA, setB = set(A), se...
normal
{ "blob_id": "9abc5f18e2eb07afe6bc31d6bd27298350707d1d", "index": 962, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fairCandySwap(A, B):\n sumA, sumB = sum(A), sum(B)\n setA, setB = set(A), set(B)\n delta = (sumA - sumB) // 2\n for j in setB:\n if j + delta in setA:\n ...
[ 0, 1, 2, 3 ]
""" Registers $v0 and $v1 are used to return values from functions. Registers $t0 – $t9 are caller-saved registers that are used to hold temporary quantities that need not be preserved across calls Registers $s0 – $s7 (16–23) are callee-saved registers that hold long-lived values that should be preserved across calls....
normal
{ "blob_id": "63bc191a81a200d3c257de429c082cc8d13c98f4", "index": 9952, "step-1": "<mask token>\n\n\nclass MipsVisitor:\n <mask token>\n\n def __init__(self, inherit_graph, output_file='mips_code.mips'):\n self.inherit_graph, _ = inherit_graph\n self.offset = dict()\n self.type_index = ...
[ 25, 31, 32, 48, 50 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] solution = Solution.Find(6, array) <|reserved_special_token_1|> from find import Solution array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] solution = Solution.Find(6, array)
flexible
{ "blob_id": "d4361b169bf75d3af82eca3d26609961ccc2f27e", "index": 2405, "step-1": "<mask token>\n", "step-2": "<mask token>\narray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsolution = Solution.Find(6, array)\n", "step-3": "from find import Solution\narray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsolution = Solution.Fi...
[ 0, 1, 2 ]
# coding:utf-8 from flask_sqlalchemy import SQLAlchemy from config.manager import app from config.db import db class Category(db.Model): __tablename__ = 'category' id = db.Column(db.Integer, primary_key=True) # 编号 name = db.Column(db.String(20), nullable=False) # 账号 addtime = db.Column(db.DateTime, ...
normal
{ "blob_id": "743aa4ccbb9a131b5ef3d04475789d3d1da1a2fa", "index": 2407, "step-1": "<mask token>\n\n\nclass Category(db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Category(db.Model):\n __tablename__...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(5): sum_value += int(input()) print(sum_value) <|reserved_special_token_1|> sum_value = 0 for _ in range(5): sum_value += int(input()) print(sum_value)
flexible
{ "blob_id": "4add80894036e0395a6e6eb13e8a2db0d963de8c", "index": 9654, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(5):\n sum_value += int(input())\nprint(sum_value)\n", "step-3": "sum_value = 0\nfor _ in range(5):\n sum_value += int(input())\nprint(sum_value)\n", "step-4": nul...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def pdfToFolder(projectName): os.chdir('/home/gmclaughlin/Downloads') if projectName.find('DEM') != -1: shutil.move('/home/gmclaughlin/Downloads/Detail Report - Basic.pdf', '/home/gmclaughlin/Python/Safety Project/Demo/%s/%s-Detail Report.pdf' ...
flexible
{ "blob_id": "6e9fd8ee2a187888df07c9dd1c32fe59a111c869", "index": 8823, "step-1": "<mask token>\n\n\ndef pdfToFolder(projectName):\n os.chdir('/home/gmclaughlin/Downloads')\n if projectName.find('DEM') != -1:\n shutil.move('/home/gmclaughlin/Downloads/Detail Report - Basic.pdf',\n \n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(best_fit1) <|reserved_special_token_1|> <|reserved_special_token_0|> objective_func = F1 problem_size = 30 domain_range = [-15, 15] log = True epoch = 100 pop_size = 50 p = 0.8 md1 = BaseFPA(objective_func, problem_size, ...
flexible
{ "blob_id": "93b12d1e936331c81522790f3f45faa3383d249e", "index": 3515, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(best_fit1)\n", "step-3": "<mask token>\nobjective_func = F1\nproblem_size = 30\ndomain_range = [-15, 15]\nlog = True\nepoch = 100\npop_size = 50\np = 0.8\nmd1 = BaseFPA(objective_...
[ 0, 1, 2, 3, 4 ]
# # -*- coding:utf-8 -*- import sys reload(sys) sys.setdefaultencoding( "utf-8" ) import urllib import urllib2 import cookielib from excel import * from user import * List=[] cookie = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie)) postdata = urllib.urlencode({'zjh':user(0),'mm...
normal
{ "blob_id": "3c7280bbd23bd3472915da0760efbfd03bfe995d", "index": 9314, "step-1": "<mask token>\n", "step-2": "<mask token>\nreload(sys)\nsys.setdefaultencoding('utf-8')\n<mask token>\nwrite_schedule(cut(get_son(schedule[0], List)))\n", "step-3": "<mask token>\nreload(sys)\nsys.setdefaultencoding('utf-8')\n<m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "de347b41cd88947690cb42e043880a80d81e2c5c", "index": 436, "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 = [('cryptocurren...
[ 0, 1, 2, 3, 4 ]
"""This module provides constants for locale-dependent providers.""" import typing as t from mimesis.enums import Locale from mimesis.exceptions import LocaleError __all__ = ["Locale", "validate_locale"] def validate_locale(locale: t.Union[Locale, str]) -> Locale: if isinstance(locale, str): try: ...
normal
{ "blob_id": "779445aa22145d5076940ea5b214c25ad233dd0e", "index": 3087, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef validate_locale(locale: t.Union[Locale, str]) ->Locale:\n if isinstance(locale, str):\n try:\n return Locale(locale)\n except ValueError:\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # ------------------------------------------------------------------------------------------------------% # Created by "Thieu Nguyen" at 19:47, 08/04/2020 % # ...
normal
{ "blob_id": "93b12d1e936331c81522790f3f45faa3383d249e", "index": 3515, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(best_fit1)\n", "step-3": "<mask token>\nobjective_func = F1\nproblem_size = 30\ndomain_range = [-15, 15]\nlog = True\nepoch = 100\npop_size = 50\np = 0.8\nmd1 = BaseFPA(objective_...
[ 0, 1, 2, 3, 4 ]
class MedianFinder: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class MedianFinder: <|reserved_special_token_0|> <|reserved_special_token_0|> def findMedian(self) ->float: if len(self.maxheap) == len(self.minheap...
flexible
{ "blob_id": "e7699bb3f6080c78517f11445e2c48a0e40f3332", "index": 3209, "step-1": "class MedianFinder:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class MedianFinder:\n <mask token>\n <mask token>\n\n def findMedian(self) ->float:\n if len(self.maxheap) == len(self.minhe...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ZabbixItem: def __init__(self, user, password, ext_group, ext_template, zabbix_host): self.user = user self.password = password self.zabbix_host = zabbix_host self.zabbix_api = f'http://{zabbix_host}' self.connection = self.connection_ini...
flexible
{ "blob_id": "14826b5b121ba2939519492c1e1d8700c32396d2", "index": 8963, "step-1": "<mask token>\n\n\nclass ZabbixItem:\n\n def __init__(self, user, password, ext_group, ext_template, zabbix_host):\n self.user = user\n self.password = password\n self.zabbix_host = zabbix_host\n self....
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> def calc_auc(subm): preds = subm['target'].values labels = subm['labels'].values if len(set(labels)) == 1: print('warning calc_auc with single label dataset, return 0') return 0 return metrics.roc_auc_score(labels, preds) def save_submission(df, name, do_...
flexible
{ "blob_id": "fe0b21deb2e48ad74449b264265729cb328090ea", "index": 6380, "step-1": "<mask token>\n\n\ndef calc_auc(subm):\n preds = subm['target'].values\n labels = subm['labels'].values\n if len(set(labels)) == 1:\n print('warning calc_auc with single label dataset, return 0')\n return 0\n ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # coding: utf-8 # In[2]: from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU'))) # In[1]: import numpy as np import pandas as pd import matplotlib.pypl...
normal
{ "blob_id": "aea92827753e12d2dc95d63ddd0fe4eb8ced5d14", "index": 3815, "step-1": "<mask token>\n\n\ndef convolve(image, fltr):\n r_p = 0\n c_p = 0\n conv_list = []\n while r_p + 1 <= image.shape[0] - 1:\n while c_p + 1 <= image.shape[1] - 1:\n x = np.sum(np.multiply(image[r_p:r_p + ...
[ 1, 2, 3, 4, 5 ]
import openpyxl # 适用于xlsx文件 ''' 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示: { "1":["张三",150,120,100], "2":["李四",90,99,95], "3":["王五",60,66,68] } 请将上述内容写到 student.xls 文件中 ''' def read_file(): words = [] with open('15.txt', 'r') as file: content = file.read() # print(content) # print(...
normal
{ "blob_id": "f75e0ddf42cc9797cdf1c4a4477e3d16441af740", "index": 5478, "step-1": "<mask token>\n\n\ndef write_list(list):\n wb = openpyxl.Workbook()\n sheet = wb.active\n sheet.title = 'test'\n value = list\n for i in range(0, len(value)):\n for j in range(0, len(value[i])):\n sh...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Base_dfCleaner(LoggerMixIn, null_clean_methodMixIn, df_plotterMixIn): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, df: DF, df_Xs_keys, df_Ys_key, silent=False, verbose=0): LoggerMixIn.__init__(self, verbose) null_clean_met...
flexible
{ "blob_id": "198beb5a17575d781f7bce1ab36a6213ad7331b3", "index": 5853, "step-1": "<mask token>\n\n\nclass Base_dfCleaner(LoggerMixIn, null_clean_methodMixIn, df_plotterMixIn):\n <mask token>\n <mask token>\n\n def __init__(self, df: DF, df_Xs_keys, df_Ys_key, silent=False, verbose=0):\n LoggerMix...
[ 8, 15, 16, 17, 19 ]
import pandas as pd triples = pd.read_csv("SollTripel.csv", sep=",", skip_blank_lines=True, skipinitialspace=True) triples.columns = ["triple", "found"] triples = triples["#" not in triples.triple] print(triples)
normal
{ "blob_id": "97afa67cbe20900e2388994481abebe772e22818", "index": 5301, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(triples)\n", "step-3": "<mask token>\ntriples = pd.read_csv('SollTripel.csv', sep=',', skip_blank_lines=True,\n skipinitialspace=True)\ntriples.columns = ['triple', 'found']\nt...
[ 0, 1, 2, 3, 4 ]
from __future__ import unicode_literals import frappe, json def execute(): for ps in frappe.get_all('Property Setter', filters={'property': '_idx'}, fields = ['doc_type', 'value']): custom_fields = frappe.get_all('Custom Field', filters = {'dt': ps.doc_type}, fields=['name', 'fieldname']) if custom_fields: ...
normal
{ "blob_id": "6f951815d0edafb08e7734d0e95e6564ab1be1f7", "index": 2375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef execute():\n for ps in frappe.get_all('Property Setter', filters={'property': '_idx'\n }, fields=['doc_type', 'value']):\n custom_fields = frappe.get_all('Custom ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SolutionBest(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SolutionBest(object): def nextGreatestLetter(self, letters, target): """ :type letters: List[str] :type target: str :rtype...
flexible
{ "blob_id": "9cb3d8bc7af0061047136d57abfe68cbb5ae0cd7", "index": 3344, "step-1": "<mask token>\n\n\nclass SolutionBest(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SolutionBest(object):\n\n def nextGreatestLetter(self, letters, target):\n \"\"\"\n :type letters: List[str]\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def user_defined_shoot(): global variable_flag global variable_i global list_angle_list variable_i = 1 for count in range(3): gimbal_ctrl.angle_ctrl(list_angle_list[1], list_angle_list[2]) gun_ctrl.fire_once() variable_i = variable_i + 2 ...
flexible
{ "blob_id": "012e4112970a07559f27fa2127cdffcc557a1566", "index": 4638, "step-1": "<mask token>\n\n\ndef user_defined_shoot():\n global variable_flag\n global variable_i\n global list_angle_list\n variable_i = 1\n for count in range(3):\n gimbal_ctrl.angle_ctrl(list_angle_list[1], list_angle...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Agent: def __init__(self): self.model = torch.load(__file__[:-8] + '/agent.pkl') <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Agent: def __init__(self): self.model = t...
flexible
{ "blob_id": "50a4084dd3028acc2e6788e77794c100efcb3fac", "index": 132, "step-1": "<mask token>\n\n\nclass Agent:\n\n def __init__(self):\n self.model = torch.load(__file__[:-8] + '/agent.pkl')\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Agent:\n\n def __init__(self):\...
[ 2, 3, 4, 5, 6 ]
#!/bin/env python from boincvm_common.stomp.StompProtocol import StompProtocolFactory from stomp.HostStompEngine import HostStompEngine from boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService from twisted.internet import reactor from ConfigParser import SafeConfigParser import coilmq.start import loggi...
normal
{ "blob_id": "e533b7aadd1cd7137301af8862dd2987622e499e", "index": 3357, "step-1": "#!/bin/env python\n\nfrom boincvm_common.stomp.StompProtocol import StompProtocolFactory\nfrom stomp.HostStompEngine import HostStompEngine\n\nfrom boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService\n\nfrom twisted.inte...
[ 0 ]
<|reserved_special_token_0|> class SEMGaussianMixture(MyGMM): <|reserved_special_token_0|> <|reserved_special_token_0|> def _draw_conditionnal_Z(self, Y): """ Tire un échantillon de loi Z sachant Y :param Y: Observations (n_samples, n_features) :return: Z (n_samples,n_com...
flexible
{ "blob_id": "39475626b7e3e0f4c8143b300c002a2eb50cc23a", "index": 9341, "step-1": "<mask token>\n\n\nclass SEMGaussianMixture(MyGMM):\n <mask token>\n <mask token>\n\n def _draw_conditionnal_Z(self, Y):\n \"\"\"\n Tire un échantillon de loi Z sachant Y\n\n :param Y: Observations (n_s...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> start_operator >> stage_events_to_redshift >> load_songplays_table start_operator >> stage_songs_to_redshift >> load_songplays_table load_songplays_table >> load_song_dimension_table >> run_quality_checks load_songplays_table >> l...
flexible
{ "blob_id": "7994d9605c8654053c9a85f8d37983da04f8003a", "index": 2674, "step-1": "<mask token>\n", "step-2": "<mask token>\nstart_operator >> stage_events_to_redshift >> load_songplays_table\nstart_operator >> stage_songs_to_redshift >> load_songplays_table\nload_songplays_table >> load_song_dimension_table >>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Statistics(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_tok...
flexible
{ "blob_id": "728f9402b3ce4b297be82b3ba1a17c4180ac7c0d", "index": 8839, "step-1": "<mask token>\n\n\nclass Statistics(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python #coding=utf-8 from datetime import * import unittest def getSnapshot(historyData, id): data = historyData.split('\n') lines = len(data) if lines < 2 : return 'Input is too short!' index = 0 curid = '' idlist = dict() recordtime = '' animal_pos = dict() f...
normal
{ "blob_id": "ddbcc8e768f93a0b4f8776b19e752c57feb5bbf9", "index": 6362, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getSnapshot(historyData, id):\n data = historyData.split('\\n')\n lines = len(data)\n if lines < 2:\n return 'Input is too short!'\n index = 0\n curid = ''\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def v_measure(cluster_labels, true_labels): h_score = homogeneity_score(true_labels, cluster_labels) c_score = completeness_score(true_labels, cluster_labels) v_score = v_measure_score(true_labels, cluster_labels) print('Homogeneity Score: %.6f' % h_score) print('Compl...
flexible
{ "blob_id": "fe63d9b0939bc91d2da14e4d966b33575eab5394", "index": 2531, "step-1": "<mask token>\n\n\ndef v_measure(cluster_labels, true_labels):\n h_score = homogeneity_score(true_labels, cluster_labels)\n c_score = completeness_score(true_labels, cluster_labels)\n v_score = v_measure_score(true_labels, ...
[ 8, 10, 12, 13, 14 ]
from genericentity import GenericEntity as GEntity import random as ran class GenericBreeder(object): """description of class: its a classy class""" def __init__(self,nlifesize,nparentsize,nlowestscore): self.Reset(nlifesize,nparentsize,nlowestscore) def Reset(self,nlifesize,nparentsize,nlowe...
normal
{ "blob_id": "753617c189a88adee8430e994aa597c9db9410fe", "index": 6143, "step-1": "<mask token>\n\n\nclass GenericBreeder(object):\n <mask token>\n\n def __init__(self, nlifesize, nparentsize, nlowestscore):\n self.Reset(nlifesize, nparentsize, nlowestscore)\n\n def Reset(self, nlifesize, nparents...
[ 8, 10, 13, 14, 15 ]
<|reserved_special_token_0|> def get_server_ip(device_ip): import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect((device_ip, 80)) return s.getsockname()[0] def transfer_file(from_ip, to_ip, remote_file_path, cmd='ftpput'): """ Transfer file from from_ip to to_ip via te...
flexible
{ "blob_id": "3d1e6be71f92910cdc9eb2bf60ea7f8f1187f706", "index": 3698, "step-1": "<mask token>\n\n\ndef get_server_ip(device_ip):\n import socket\n s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n s.connect((device_ip, 80))\n return s.getsockname()[0]\n\n\ndef transfer_file(from_ip, to_ip, remo...
[ 6, 12, 13, 14, 16 ]
def correctLineup1(athletes: list) ->list: return [(athletes[i + 1] if i % 2 == 0 else athletes[i - 1]) for i in range(len(athletes))] <|reserved_special_token_0|> <|reserved_special_token_1|> def correctLineup1(athletes: list) ->list: return [(athletes[i + 1] if i % 2 == 0 else athletes[i - 1]) fo...
flexible
{ "blob_id": "6c5f60e7a122e3da5e6705bfacf73a361f6c1362", "index": 1120, "step-1": "def correctLineup1(athletes: list) ->list:\n return [(athletes[i + 1] if i % 2 == 0 else athletes[i - 1]) for i in\n range(len(athletes))]\n\n\n<mask token>\n", "step-2": "def correctLineup1(athletes: list) ->list:\n ...
[ 1, 2, 3, 4, 5 ]
DEFAULT_LL_URL = "https://ll.thespacedevs.com" DEFAULT_VERSION = "2.0.0" DEFAULT_API_URL = "/".join([DEFAULT_LL_URL, DEFAULT_VERSION])
normal
{ "blob_id": "1a72da7f436e6c5e73e396b771f8ce1a3affba1a", "index": 3010, "step-1": "<mask token>\n", "step-2": "DEFAULT_LL_URL = 'https://ll.thespacedevs.com'\nDEFAULT_VERSION = '2.0.0'\nDEFAULT_API_URL = '/'.join([DEFAULT_LL_URL, DEFAULT_VERSION])\n", "step-3": "DEFAULT_LL_URL = \"https://ll.thespacedevs.com\...
[ 0, 1, 2 ]
class Node: def __init__(self, dataVal=None): self.dataVal = dataVal self.nextVal = None class LinkedList: def __init__(self): self.headVal = None def atBeginning(self, data): NewNode = Node(data) NewNode.nextVal = self.headVal self.headVal = NewNode ...
normal
{ "blob_id": "00260e23614a7b0a11ff3649e71392e4892de423", "index": 4511, "step-1": "<mask token>\n\n\nclass LinkedList:\n <mask token>\n <mask token>\n\n def atEnd(self, data):\n NewNode = Node(data)\n NewNode.nextVal = None\n if self.headVal is None:\n self.headVal = NewNo...
[ 6, 9, 12, 15, 17 ]
import os import sys import glob import shutil import json import codecs from collections import OrderedDict def getRegionClass(image_path, data_id, imgName): region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect', 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard'] label_class = ['nosmok...
normal
{ "blob_id": "75833617996549167fa157ff78cc1a11f870784f", "index": 8639, "step-1": "<mask token>\n\n\ndef getRegionClass(image_path, data_id, imgName):\n region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect',\n 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard']\n label_clas...
[ 1, 2, 3, 4, 5 ]
import datetime from datetime import datetime, timedelta import time import json import base64 import requests from bson.objectid import ObjectId import urllib isinpackage = not __name__ in ['google_api', '__main__'] if isinpackage: from .settings import settings from . import util from .util import Just ...
normal
{ "blob_id": "c75c69b006734e476352de1913fd4a58021bffd6", "index": 2704, "step-1": "<mask token>\n\n\ndef get_certs_keys(kid):\n url = 'https://www.googleapis.com/oauth2/v3/certs'\n data = requests.get(url).json()['keys']\n return next(filter(lambda e: kid == e['kid']), None)\n\n\ndef get_redirect_link(re...
[ 11, 12, 14, 15, 16 ]
class Solution: def countLetters(self, S: str) ->int: ans = 0 for _, g in itertools.groupby(S): cnt = len(list(g)) ans += (1 + cnt) * cnt // 2 return ans
normal
{ "blob_id": "f9cee552dde5ecf229fda559122b4b0e780c3b88", "index": 7350, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def countLetters(self, S: str) ->int:\n ans = 0\n for _, g in itertools.groupby(S):\n cnt = len(list(g...
[ 0, 1, 2 ]
#!/usr/bin/python3 "Places module" from flask import jsonify, request, Response, abort from api.v1.views import app_views from models import storage from models.place import Place @app_views.route('cities/<city_id>/places', strict_slashes=False, methods=['GET']) def get_all_places(city_id): ''' g...
normal
{ "blob_id": "d67a2eca4e2fde443b99f5133c2657cdf4ac00de", "index": 4173, "step-1": "<mask token>\n\n\n@app_views.route('cities/<city_id>/places', strict_slashes=False, methods=[\n 'GET'])\ndef get_all_places(city_id):\n \"\"\" gets all places in a city \"\"\"\n city = storage.get('City', city_id)\n if ...
[ 3, 4, 5, 6, 7 ]
from operator import itemgetter import math def get_tf_idf_map(document, max_freq, n_docs, index): tf_idf_map = {} for term in document: tf = 0 idf = math.log(n_docs) if term in index and term not in tf_idf_map: posting_list = index[term] freq_term = sum([p...
normal
{ "blob_id": "39197b3f9f85d94457584d7e488ca376e52207f1", "index": 5832, "step-1": "<mask token>\n\n\ndef get_cosinus_simularity(tf_idf_map, key_words):\n sum_common_terms = 0\n sum_tf_idf_terms = 0\n for term in tf_idf_map:\n if term in key_words:\n sum_common_terms += tf_idf_map[term]\...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import pywikibot from pywikibot import pagegenerators import re from pywikibot import xmlreader import datetime import collections from klasa import * def fraz(data): data_slownie = data[6:8] + '.' + data[4:6] + '.' + data[0:4] lista_stron = getListFromXML(data) ...
normal
{ "blob_id": "2b928dad60bfb0ba863e9039a5462faa885644f3", "index": 4643, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fraz(data):\n data_slownie = data[6:8] + '.' + data[4:6] + '.' + data[0:4]\n lista_stron = getListFromXML(data)\n site = pywikibot.Site('pl', 'wiktionary')\n outputPag...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BubbleTypes(Enum): USER = auto() SYSTEM = auto() STATUS = auto() INFO = auto() def __str__(self): return str(self.value) class Relations(Enum): UNDERMINE = 'undermine' UNDERCUT = 'undercut' REBUT = 'rebut' SUPPORT = 'support' def _...
flexible
{ "blob_id": "10a9437453371bd7472e93af1026c778b7983cf8", "index": 1137, "step-1": "<mask token>\n\n\nclass BubbleTypes(Enum):\n USER = auto()\n SYSTEM = auto()\n STATUS = auto()\n INFO = auto()\n\n def __str__(self):\n return str(self.value)\n\n\nclass Relations(Enum):\n UNDERMINE = 'unde...
[ 29, 31, 47, 55, 60 ]
import surname_common as sc from sklearn.utils import shuffle import glob import os import re import pprint import pandas as pd import unicodedata import string def unicode_to_ascii(s): return ''.join( c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn' and c in sc.ALL_LE...
normal
{ "blob_id": "db46fbfb1acd855eebb5c9f557d70038b84e812d", "index": 8573, "step-1": "<mask token>\n\n\ndef save_df_surnames_as_pickle():\n df_surnames, df_categories = load_surnames()\n df = shuffle(df_surnames, random_state=sc.RANDOM_STATE)\n train_cnt = int(df['surname'].count() * sc.TRAIN_TEST_RATIO)\n ...
[ 1, 2, 3, 4, 5 ]
from django.db import models # Create your models here. class GeneralInformation(models.Model): name = models.CharField(max_length=100) address = models.TextField() city = models.CharField(max_length=20) class Meta: ordering = ['name'] def __str__(self): return "{} {} {}".format...
normal
{ "blob_id": "d0f83e3b7eb5e1bc81a56e46043f394757437af8", "index": 5504, "step-1": "<mask token>\n\n\nclass GeneralInformation(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = ['name']\n <mask token>\n", "step-2": "<mask token>\n\n\nclass GeneralInf...
[ 1, 2, 3, 4, 5 ]
import datetime import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm import xlrd from pandas import * from xlrd import xldate #since I messed up when first scraping the data, I have the dates and viewcounts in separate files #need to create a dictionary of 'author-title':[viewcount, date] ...
normal
{ "blob_id": "6ece524c82521b175cc7791e22c8249dd24dc714", "index": 2281, "step-1": "import datetime\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport statsmodels.api as sm\nimport xlrd\nfrom pandas import *\nfrom xlrd import xldate\n\n\n#since I messed up when first scraping the data, I have the dates a...
[ 0 ]
from .ros_publisher import *
normal
{ "blob_id": "6e7cca4f766ca89d2e2f82a73f22742b0e8f92a8", "index": 5870, "step-1": "<mask token>\n", "step-2": "from .ros_publisher import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.shortcuts import render from rest_framework.response import Response from rest_framework import status from rest_framework.decorators import api_view from rest_framework.permissions import IsAuthenticated from .models import Flight, Passenger, Reservation from .serializers import FlightSerializer, Passenger...
normal
{ "blob_id": "d437d77d5a57a6f2f4a2d530be05c3845dce93bc", "index": 1459, "step-1": "<mask token>\n\n\nclass Detailedreservation(RetrieveUpdateDestroyAPIView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ListReservation(ListCreateAPIView):\n <mask token>\n <mask token>\n\n\ncl...
[ 1, 7, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> panel.pack() root.mainloop() <|reserved_special_token_1|> <|reserved_special_token_0|> root = Tk() photo = PhotoImage(file='flag.png') panel = Label(root, image=photo) panel.pack() root.mainloop() <|reserved_special_token_1|>...
flexible
{ "blob_id": "2d192963bfe046bce1a0c82e0179380693f5c541", "index": 9518, "step-1": "<mask token>\n", "step-2": "<mask token>\npanel.pack()\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nphoto = PhotoImage(file='flag.png')\npanel = Label(root, image=photo)\npanel.pack()\nroot.mainloop()\n", "step-...
[ 0, 1, 2, 3 ]
import numpy as np import string import networkx as nx import matplotlib.pyplot as plt def PlotUndirectedGraph(A,color): NodesNames = list(string.ascii_uppercase); NNodes = A.shape[0] G = nx.DiGraph() for i in range(NNodes): G.add_node(NodesNames[i]) for i in range(NNodes): for ...
normal
{ "blob_id": "61388b2edb35055cccbdc98ed52caedcd0b02983", "index": 5624, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef PlotUndirectedGraph(A, color):\n NodesNames = list(string.ascii_uppercase)\n NNodes = A.shape[0]\n G = nx.DiGraph()\n for i in range(NNodes):\n G.add_node(Nodes...
[ 0, 1, 2, 3 ]
import random import re from datetime import datetime, timedelta from threading import Lock from telegram.ext import run_async from src.models.user import UserDB from src.models.user_stat import UserStat from src.utils.cache import cache, USER_CACHE_EXPIRE from src.utils.logger_helpers import get_logger logger = get...
normal
{ "blob_id": "109ca06685eece74034f77a98b1d7172a17aca21", "index": 7469, "step-1": "<mask token>\n\n\nclass PidorWeekly:\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def get_top_pidor(cls, cid, date=None):\n monday = cls.__get_current_monday(\n ) if date is None ...
[ 9, 12, 13, 14, 15 ]
a = int(input('점수를 입력하세요')) if a >= 70 : print:('통과입니다.') print:('축하합니다.') else : print:('불합격입니다.') print("안녕")
normal
{ "blob_id": "f8d0cc9cb0e5f8adf9077ffb39dd6abedfedaa12", "index": 5427, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a >= 70:\n print: '통과입니다.'\n print: '축하합니다.'\nelse:\n print: '불합격입니다.'\nprint('안녕')\n", "step-3": "a = int(input('점수를 입력하세요'))\nif a >= 70:\n print: '통과입니다.'\n print: ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Remove_ItemView(generic.ListView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Update_ItemView(generic.ListView): model = GPS template_name = 'inv_templates/update_item.html' context_object_name = 'unit' cl...
flexible
{ "blob_id": "67db3a66e5525d41de13df665167a0db2d81056e", "index": 2721, "step-1": "<mask token>\n\n\nclass Remove_ItemView(generic.ListView):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Update_ItemView(generic.ListView):\n model = GPS\n template_name = 'inv_templates/update_item.html'\n...
[ 7, 11, 12, 13, 14 ]
<|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": "fed94e0affa1fe6c705577a63fabee839aa9f05c", "index": 5096, "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 = [('rover', '00...
[ 0, 1, 2, 3, 4 ]
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def swapPairs(self, head: ListNode) -> ListNode: dummy_head=ListNode(0) dummy_head.next=head pre=dummy_head cur=head ...
normal
{ "blob_id": "4afc2ceed860c20af071e1d9ccaca17973cb9a8e", "index": 7553, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def swapPairs(self, head: ListNode) ->ListNode:\n dummy_head = ListNode(0)\n dummy_head.next = head\n pre ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AuthenticatorTest(absltest.TestCase): <|reserved_special_token_0|> def testGetGoogleSheetsServiceByCred_badFilePath_raisesFileNotFoundError( self): bad_file_path = './credential.json' with self.assertRaises(FileNotFoundError): authenticat...
flexible
{ "blob_id": "86b24ddaae0d3477a3f82295224b7e84805eed91", "index": 1413, "step-1": "<mask token>\n\n\nclass AuthenticatorTest(absltest.TestCase):\n <mask token>\n\n def testGetGoogleSheetsServiceByCred_badFilePath_raisesFileNotFoundError(\n self):\n bad_file_path = './credential.json'\n ...
[ 2, 3, 4, 5, 6 ]
""" This module is an intermediate layer between flopy version 3.2 and the inowas-modflow-configuration format. Author: Ralf Junghanns EMail: ralf.junghanns@gmail.com """ from .BasAdapter import BasAdapter from .ChdAdapter import ChdAdapter from .DisAdapter import DisAdapter from .GhbAdapter import GhbAdapter from .L...
normal
{ "blob_id": "fb64003c1acbddcbe952a17edcbf293a54ef28ae", "index": 2185, "step-1": "<mask token>\n\n\nclass InowasFlopyCalculationAdapter:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, versio...
[ 7, 11, 12, 13, 14 ]
from collections.abc import Iterator import json import click def print_json(obj, err=False): if isinstance(obj, Iterator): obj = list(obj) click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False), err=err) def show_fields(*fields): def show(obj, verbose=False): ...
normal
{ "blob_id": "d340ac979f57cf4650131665e4fa5b9923f22a3e", "index": 6691, "step-1": "<mask token>\n\n\ndef print_json(obj, err=False):\n if isinstance(obj, Iterator):\n obj = list(obj)\n click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False\n ), err=err)\n\n\n<mask token>\n", ...
[ 1, 2, 3, 4, 5 ]
# Let's look at the lowercase letters. import string alphabet = " " + string.ascii_lowercase
normal
{ "blob_id": "da3be0d3b815e11d292a7c7e8f5ce32b35580f98", "index": 1016, "step-1": "<mask token>\n", "step-2": "<mask token>\nalphabet = ' ' + string.ascii_lowercase\n", "step-3": "import string\nalphabet = ' ' + string.ascii_lowercase\n", "step-4": "# Let's look at the lowercase letters.\nimport string\nalp...
[ 0, 1, 2, 3 ]
import praw import config from imgurpython import ImgurClient import datetime from time import sleep def respond_to_comment(comment, album_user, album_url, num_images, num_gifs): body = "Here is an album of all unique image/gif posts made by " \ "[{user}]({album_url}). ({num_images} images" \ ...
normal
{ "blob_id": "ca009022832963934230e356f9ea9eaedac7378b", "index": 1745, "step-1": "<mask token>\n\n\ndef update_album(user, imgur_client, reddit_client):\n return\n\n\n<mask token>\n\n\ndef is_gif(url):\n return True\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef respond_to_comment(comment, album_...
[ 2, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def lab1(x): list1 = [] for i in range(4): sum = x * i list1.append(sum) return list1 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def lab1(x): list1 = [] for i in range(4): sum = x * i li...
flexible
{ "blob_id": "807e19f09f4a46b6c39457b8916714e2c54c3e8d", "index": 5802, "step-1": "<mask token>\n\n\ndef lab1(x):\n list1 = []\n for i in range(4):\n sum = x * i\n list1.append(sum)\n return list1\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef lab1(x):\n list1 = []\n for i i...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class QRCodeConfig(PluginConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "6306acd1508698687842ba6b55a839743af420cc", "index": 5840, "step-1": "<mask token>\n\n\nclass QRCodeConfig(PluginConfig):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class PrimaryCategoryAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class PlaceCategoryAdmin(admin.ModelAdmin): list_display = ('category_name', 'is_paid', 'description', 'is_active', 'image', 'prim...
flexible
{ "blob_id": "606abf8501d85c29051df4bf0276ed5b098ee6c5", "index": 8679, "step-1": "<mask token>\n\n\nclass PrimaryCategoryAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass PlaceCategoryAdmin(admin.ModelAdmin):\n list_display = ('category_name', 'is_paid', 'description', ...
[ 5, 6, 7, 8, 10 ]