code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from . import common_wizard
| normal | {
"blob_id": "1844cfb3e174454e0e95d91e4e55679caddcd56e",
"index": 1963,
"step-1": "<mask token>\n",
"step-2": "from . import common_wizard\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import shelve
arguments = ["self", "info", "args", "world"]
minlevel = 2
helpstring = "moneyreset"
def main(connection, info, args, world) :
"""Resets a users money"""
money = shelve.open("money-%s.db" % (world.hostnicks[connection.host]), writeback=True)
money[info["sender"]] = {"money":100000, "maxmoney"... | normal | {
"blob_id": "95021cc01c0b85b512fd466797d4d128472773c3",
"index": 2943,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main(connection, info, args, world):\n \"\"\"Resets a users money\"\"\"\n money = shelve.open('money-%s.db' % world.hostnicks[connection.host],\n writeback=True)\n ... | [
0,
1,
2,
3,
4
] |
"""
Subfunction A31 is responsible for inputting the component parameters
and then using the information about the component to determine
the pressure drop across that component
----------------------------------------------------------
Using data structure from /SysEng/jsonParameterFileFormat/ recall that each
cell is... | normal | {
"blob_id": "4b8038ddea60f371aa8da168ea4456372d6f0388",
"index": 2357,
"step-1": "<mask token>\n\n\nclass A31:\n\n def __init__(self, dict):\n self.dict = dict\n self.CID = self.dict['CID']\n self.val = self.dict['values']\n self.calc = self.val['calculated']\n self.comp = s... | [
3,
5,
6,
7,
8
] |
#"countinu" example : repeat printing "Too small" or "Input is..." according to input's lenth
while True:
s=raw_input('Enter something: ')
if s == 'quit' :
break
if len(s) <3:
print 'Too small'
continue
#continue : not exc... | normal | {
"blob_id": "915d6547057f43c1cc5d96d9cb4529c56bc85559",
"index": 3412,
"step-1": "#\"countinu\" example : repeat printing \"Too small\" or \"Input is...\" according to input's lenth\r\n\r\nwhile True:\r\n s=raw_input('Enter something: ')\r\n if s == 'quit' :\r\n break\r\n if l... | [
0
] |
# -*- coding: utf-8 -*-
import datetime
from unittest.mock import patch
from odoo.tests import common
import odoo
from .common import RunbotCase
class TestSchedule(RunbotCase):
def setUp(self):
# entering test mode to avoid that the _schedule method commits records
registry = odoo.registry()
... | normal | {
"blob_id": "aa515b1b919eb557cd8c7e5f4d22773980b5af96",
"index": 8213,
"step-1": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n\n @patch('odoo.addons.runbot.models.build.os.path.getmt... | [
1,
2,
3,
4,
5
] |
import os, tempfile, shutil
from flask import Flask, flash, request, redirect, url_for, send_from_directory, send_file
from werkzeug.utils import secure_filename
from contextlib import contextmanager
"""
Flask stores uploaded FileStorage objects in memory if they are small. Otherwise, it internally uses tempfile.gett... | normal | {
"blob_id": "9f6cfeff9e00079715827a2887263c14a1bb51ff",
"index": 7679,
"step-1": "<mask token>\n\n\n@contextmanager\ndef TemporaryDirectory():\n name = tempfile.mkdtemp()\n try:\n yield name\n finally:\n shutil.rmtree(name)\n\n\n@app.route('/safe', methods=['POST'])\ndef safe():\n f = r... | [
5,
6,
8,
9,
10
] |
from CategoryReplacer.CategoryReplcaers import CountEncoder
from CategoryReplacer.CategoryReplcaers import CombinCountEncoder
from CategoryReplacer.CategoryReplcaers import FrequencyEncoder
from CategoryReplacer.CategoryReplcaers import NullCounter
from CategoryReplacer.CategoryReplcaers import AutoCalcEncoder
from Cat... | normal | {
"blob_id": "d28e517e72c3689e973a5b1255d414648de418fb",
"index": 1658,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__all__ = ['CountEncoder', 'CombinCountEncoder', 'FrequencyEncoder',\n 'NullCounter', 'AutoCalcEncoder', 'extract_obj_cols']\n",
"step-3": "from CategoryReplacer.CategoryReplcaers im... | [
0,
1,
2,
3
] |
"""
GoldenTemplate based on the golden-layout library.
"""
from __future__ import annotations
import pathlib
from typing import TYPE_CHECKING, Literal
import param
from ...config import config
from ...io.resources import JS_URLS
from ..base import BasicTemplate
if TYPE_CHECKING:
from ...io.resources import Res... | normal | {
"blob_id": "5bfb69d1608b397d6a19e663164a30089e4f67ad",
"index": 2859,
"step-1": "<mask token>\n\n\nclass GoldenTemplate(BasicTemplate):\n <mask token>\n sidebar_width = param.Integer(default=20, constant=True, doc=\n \"\"\"\n The width of the sidebar in percent.\"\"\")\n _css = pathlib.Pa... | [
4,
5,
6,
7,
8
] |
def count_singlekey(inputDict, keyword):
# sample input
# inputDict = {
# abName1: { dna: 'atgc', protein: 'x' }
# abName2: { dna: 'ctga', protein: 'y' }
# }
countDict = {}
for abName, abInfo in inputDict.iteritems():
if countDict.has_key(abInfo[keyword]):
countDict[abInfo[keyword]... | normal | {
"blob_id": "b164dc8183c0dc460aa20883553fc73acd1e45ec",
"index": 7828,
"step-1": "<mask token>\n",
"step-2": "def count_singlekey(inputDict, keyword):\n countDict = {}\n for abName, abInfo in inputDict.iteritems():\n if countDict.has_key(abInfo[keyword]):\n countDict[abInfo[keyword]][1]... | [
0,
1,
2,
3
] |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | normal | {
"blob_id": "6a954197b13c9adf9f56b82bcea830aaf44e725f",
"index": 8999,
"step-1": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n _attribute_map = {'pipe... | [
1,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-19 15:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='OpenHu... | normal | {
"blob_id": "28854823b1edc7df6cf025175811c1858efd2c42",
"index": 862,
"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 = Tr... | [
0,
1,
2,
3,
4
] |
"""
This file contains the ScoreLoop which is used to show
the user thw at most 10 highest scores made by the player
"""
import pygame
from score_fetcher import fetch_scores
from entities.sprite_text import TextSprite
class ScoreLoop:
def __init__(self):
self.scores = fetch_scores()
self.sprites... | normal | {
"blob_id": "047b3398a73c9e7d75d43eeeab85f52c05ff90c3",
"index": 4534,
"step-1": "<mask token>\n\n\nclass ScoreLoop:\n\n def __init__(self):\n self.scores = fetch_scores()\n self.sprites = pygame.sprite.Group()\n self.get_score_sprites()\n self.space_cooldown = True\n <mask toke... | [
2,
5,
6,
7,
8
] |
decoded = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"... | normal | {
"blob_id": "23236cd8262eb414666db88215c01d973abf1d97",
"index": 1247,
"step-1": "<mask token>\n\n\ndef decode(value):\n out_value = ''\n char = [value[i:i + 2] for i in range(0, len(value), 2)]\n for i in range(0, len(char)):\n out_value += decoded[encoded.index(char[i])]\n return out_value\n... | [
1,
2,
3,
4,
5
] |
import requests
url = 'https://item.jd.com/100008348550.html'
try:
r = requests.get(url)
r.raise_for_status()
print(r.encoding)
r.encoding = r.apparent_encoding
print(r.text[:1000])
print(r.apparent_encoding)
except:
print('error')
| normal | {
"blob_id": "0271c45a21047b948946dd76f147692bb16b8bcf",
"index": 5378,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n r = requests.get(url)\n r.raise_for_status()\n print(r.encoding)\n r.encoding = r.apparent_encoding\n print(r.text[:1000])\n print(r.apparent_encoding)\nexcept:\n... | [
0,
1,
2,
3
] |
list_angle_list = RmList()
variable_flag = 0
variable_i = 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()
vari... | normal | {
"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
] |
# coding: utf8
from __future__ import absolute_import
import numpy as np
def arr2str(arr, sep=", ", fmt="{}"):
"""
Make a string from a list seperated by ``sep`` and each item formatted
with ``fmt``.
"""
return sep.join([fmt.format(v) for v in arr])
def indent_wrap(s, indent=0, wrap=80):
"... | normal | {
"blob_id": "3b4799f43ec497978bea3ac7ecf8c6aaeb2180b4",
"index": 3867,
"step-1": "<mask token>\n\n\ndef indent_wrap(s, indent=0, wrap=80):\n \"\"\"\n Wraps and indents a string ``s``.\n\n Parameters\n ----------\n s : str\n The string to wrap.\n indent : int\n How far to indent ea... | [
2,
3,
4,
5,
6
] |
"""Calculator is built using "ping pong" algorithm, without eval() etc.
Main final function: calculate_expression().
calculate_expression() uses two functions in utils.py: clear_and_convert() and calculator_without_parentheses().
calculator_without_parentheses() uses two remaining functions:
math_operation() -> ping_ca... | normal | {
"blob_id": "c336bb6cdadfb836ab68ebd5bbb210f63af3d084",
"index": 2287,
"step-1": "<mask token>\n\n\ndef ping_calculate_pong(expression, operator_index):\n \"\"\"The function takes two arguments.\n Argument 1: an expression from which we will extract one subexpression.\n Argument 2: the index of the math... | [
2,
3,
4,
5,
6
] |
from django.shortcuts import render, HttpResponse
from django.views.generic import TemplateView
from .models import Person, Stock_history
from django.http import Http404, HttpResponseRedirect
from .forms import NameForm, UploadFileForm
from .back import handle_uploaded_file, read_file
class IndexView(TemplateView):
... | normal | {
"blob_id": "2d65ffa3fc8a5360702337d749884903b2cb0423",
"index": 2353,
"step-1": "<mask token>\n\n\nclass PersonView(TemplateView):\n\n def get(self, request):\n persons = Person.objects.all()\n context = {'persons': persons}\n return render(request, 'budget/person.html', context)\n\n\ncl... | [
10,
11,
13,
14,
16
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 14:55:12 2019
@author: Furankyyy
"""
import numpy as np
import matplotlib.pyplot as plt
import timeit
###worst sort function###
#define the function that checks whether the list is in ascending order
def right_permutation(arr):
if len(arr)=... | normal | {
"blob_id": "7c82565a4184b2e779e2bb6ba70b497cc287af35",
"index": 5285,
"step-1": "<mask token>\n\n\ndef right_permutation(arr):\n if len(arr) == 1:\n return True\n for i in range(len(arr) - 1):\n if arr[i + 1] < arr[i]:\n break\n elif i == len(arr) - 2:\n return T... | [
4,
5,
6,
7,
8
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__copyright__ = """
This code is licensed under the MIT license.
Copyright University Innsbruck, Institute for General, Inorganic, and Theoretical Chemistry, Podewitz Group
See LICENSE for details
"""
from scipy.signal import argrelextrema
from typing import List, Tuple
i... | normal | {
"blob_id": "8c42e06fd92f0110b3ba8c4e7cc0ac45b9e44378",
"index": 3150,
"step-1": "<mask token>\n\n\nclass ButtonActions(object):\n <mask token>\n\n def plot_rdf(self, display):\n matplotlib.rcParams.update({'font.size': 10})\n self.fig = plt.figure(figsize=(display.width, display.height))\n ... | [
3,
8,
9,
10,
11
] |
skipped = 0
class Node(object):
"""docstring for Node"""
def __init__(self, value, indentifier):
super(Node, self).__init__()
self.value = value
self.identifier = indentifier
self.next = None
class Graph(object):
"""docstring for Graph"""
def __init__(self, values, edg... | normal | {
"blob_id": "e361215c44305f1ecc1cbe9e19345ee08bdd30f5",
"index": 2393,
"step-1": "<mask token>\n\n\nclass BalancedForestTest(unittest.TestCase):\n\n def test1(self):\n expected = 10\n c = [1, 1, 1, 18, 10, 11, 5, 6]\n edges = [[1, 2], [1, 4], [2, 3], [1, 8], [8, 7], [7, 6], [5, 7]]\n ... | [
7,
22,
24,
25,
28
] |
import random
x = int(raw_input('Please supply a number: '))
y = int(raw_input('Please supply a second number: '))
z = random.randint(x, y)
print(z)
| normal | {
"blob_id": "104c49941a79948749b27217a0c728f19435f77a",
"index": 643,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(z)\n",
"step-3": "<mask token>\nx = int(raw_input('Please supply a number: '))\ny = int(raw_input('Please supply a second number: '))\nz = random.randint(x, y)\nprint(z)\n",
"ste... | [
0,
1,
2,
3
] |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author: MSJ
# date: 2021/3/11
# desc:冒泡排序
def bubble_sort(arr):
for i in range(1, len(arr)):
for j in range(0, len(arr) - i):
if arr[j] > arr[j + 1]:
tmp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = tmp
... | normal | {
"blob_id": "6682c864a3da6f2c894a3a40359726b4eb97d040",
"index": 6109,
"step-1": "<mask token>\n",
"step-2": "def bubble_sort(arr):\n for i in range(1, len(arr)):\n for j in range(0, len(arr) - i):\n if arr[j] > arr[j + 1]:\n tmp = arr[j]\n arr[j] = arr[j + 1]... | [
0,
1,
2,
3
] |
from partyparrot import convert_with_alphabet_emojis, convert
def test_convert_char_to_alphabet():
assert convert_with_alphabet_emojis("") == ""
assert convert_with_alphabet_emojis(" ") == " "
assert convert_with_alphabet_emojis("\n") == "\n"
assert (
convert_with_alphabet_emojis(" one two")... | normal | {
"blob_id": "c3bfcb971a6b08cdf98200bd2b2a8fe6ac2dd083",
"index": 6969,
"step-1": "<mask token>\n\n\ndef test_convert_wrong_char():\n txt = convert('@!*', ':icon:', ':nbsp')\n assert txt == \"\"\":icon::icon::icon::nbsp:nbsp:icon::icon::icon::nbsp:nbsp:icon::icon::icon:\n:nbsp:nbsp:icon::nbsp:nbsp:nbsp:nbsp... | [
1,
2,
3,
4,
5
] |
import helper
__author__ = 'AdrianLeo'
helper.greeting("Hey, dummy")
| normal | {
"blob_id": "03156992355a756b2ae38735a98251eb611d4245",
"index": 2611,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nhelper.greeting('Hey, dummy')\n",
"step-3": "<mask token>\n__author__ = 'AdrianLeo'\nhelper.greeting('Hey, dummy')\n",
"step-4": "import helper\n__author__ = 'AdrianLeo'\nhelper.greet... | [
0,
1,
2,
3,
4
] |
a = ord(input().rstrip())
if a < 97:
print('A')
else:
print('a')
'''
ord(A)=65
ord(Z)=90
ord(a)=97
ord(z)=122
'''
| normal | {
"blob_id": "e7c454b2bf6cf324e1e318e374e07a83812c978b",
"index": 2381,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n",
"step-3": "a = ord(input().rstrip())\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n",
"step-4":... | [
0,
1,
2,
3
] |
import torch
import torch.nn as nn
from model.common import UpsampleBlock, conv_, SELayer
def wrapper(args):
act = None
if args.act == 'relu':
act = nn.ReLU(True)
elif args.act == 'leak_relu':
act = nn.LeakyReLU(0.2, True)
elif args.act is None:
act = None
else:
rais... | normal | {
"blob_id": "b2c0ef4a0af12b267a54a7ae3fed9edeab2fb879",
"index": 6570,
"step-1": "<mask token>\n\n\nclass AFB_L1(nn.Module):\n <mask token>\n <mask token>\n\n\nclass AFB_L2(nn.Module):\n\n def __init__(self, channels, n_l1=4, act=nn.ReLU(True)):\n super(AFB_L2, self).__init__()\n self.n = ... | [
10,
14,
17,
18,
19
] |
# -*- coding: utf-8 -*-
import scrapy
class Heiyan2Spider(scrapy.Spider):
name = 'heiyan2'
allowed_domains = ['heiyan.com']
start_urls = ['http://heiyan.com/']
def parse(self, response):
pass
| normal | {
"blob_id": "d13c6d71bb871496b0c6ad2451a2f561484e7c68",
"index": 9634,
"step-1": "<mask token>\n\n\nclass Heiyan2Spider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Heiyan2Spider(scrapy.Spider):\n <mask token>\n <mask token... | [
1,
2,
3,
4,
5
] |
#! /usr/bin/env python
t = int(raw_input())
for i in xrange(1, t+1):
N = raw_input()
N1 = N
track = set()
if N == '0':
print "Case #%s: " % i + "INSOMNIA"
continue
count = 2
while len(track) !=10:
temp = set(x for x in N1)
track = temp | track
N1 = str(co... | normal | {
"blob_id": "8c6b7032c85354740d59aa91108ad8b5279e1d45",
"index": 2570,
"step-1": "#! /usr/bin/env python\n\nt = int(raw_input())\nfor i in xrange(1, t+1):\n N = raw_input()\n N1 = N\n track = set()\n if N == '0':\n print \"Case #%s: \" % i + \"INSOMNIA\"\n continue\n count = 2\n w... | [
0
] |
from dataclasses import dataclass
from typing import Optional
@dataclass
class Music(object):
url: str
title: Optional[str] = None
| normal | {
"blob_id": "2506c5b042f04d1490ba2199a71e38829d4a0adc",
"index": 5738,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@dataclass\nclass Music(object):\n url: str\n title: Optional[str] = None\n",
"step-3": "from dataclasses import dataclass\nfrom typing import Optional\n\n\n@dataclass\nclass ... | [
0,
1,
2
] |
import math
#variables for current GPS Lat / Lon Readings
currentLat = 41.391240
currentLon = -73.956217
destLat = 41.393035
destLon = -73.953398
#variables for current UTM coordinates
currentX = 587262
currentY = 4582716
destX = 587499
destY = 4582919
#declination angle based on geographic location
#see #https://ww... | normal | {
"blob_id": "180d28ac77b6ff4488b3fd9c17a9ee4571e33631",
"index": 2694,
"step-1": "import math\n\n#variables for current GPS Lat / Lon Readings\ncurrentLat = 41.391240\ncurrentLon = -73.956217\ndestLat = 41.393035\ndestLon = -73.953398\n\n#variables for current UTM coordinates\ncurrentX = 587262\ncurrentY = 45827... | [
0
] |
#python -m marbles test_clean_rangos.py
import unittest
from marbles.mixins import mixins
import pandas as pd
import requests
from pyspark.sql import SparkSession
import psycopg2 as pg
import pandas as pd
from pyspark.sql.types import StructType, StructField, StringType
from src.features.build_features import get_clea... | normal | {
"blob_id": "f7c6990b4ddbe5ef9d79ef2326e60cdf1f761db3",
"index": 4542,
"step-1": "<mask token>\n\n\nclass Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):\n ... | [
1,
2,
3,
4,
5
] |
import os
import time
import requests
from dotenv import load_dotenv
from twilio.rest import Client
load_dotenv()
BASE_URL = 'https://api.vk.com/method/users.get'
def get_status(user_id):
params = {'user_ids': user_id, 'V': os.getenv('API_V'), 'access_token':
os.getenv('ACCESS_TOKEN'), 'fields': 'online'}... | normal | {
"blob_id": "6b2a9e8c6e95f52e9ebf999b81f9170fc669cce4",
"index": 6329,
"step-1": "<mask token>\n\n\ndef send_sms(sms_text):\n account_sid = os.getenv('TWILIO_ACCOUNT_SID')\n auth_token = os.getenv('TWILIO_AUTH_TOKEN')\n client = Client(account_sid, auth_token)\n message = client.messages.create(body=... | [
1,
3,
4,
5
] |
# -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | normal | {
"blob_id": "d6a677ed537f6493bb43bd893f3096dc058e27da",
"index": 507,
"step-1": "<mask token>\n\n\n@base.ReleaseTracks(base.ReleaseTrack.ALPHA)\nclass Describe(base.DescribeCommand):\n <mask token>\n <mask token>\n\n def Run(self, args):\n guest_policy_ref = args.CONCEPTS.guest_policy.Parse()\n ... | [
2,
3,
4,
5,
6
] |
from redstork import PageObject
class AnnotController:
def get_annotations(self, project, page_index):
page = project.doc[page_index]
yield from page.flat_iter()
| normal | {
"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
] |
from flask import Blueprint, request, render_template, session, redirect
log = Blueprint('login', __name__, )
@log.route('/login', methods=['GET', 'POST'])
def login():
print(request.path, )
if request.method == 'GET':
return render_template('exec/login.html')
else:
username = request.for... | normal | {
"blob_id": "763e2db4eb9ad5953273fb310c8e9714964a39e6",
"index": 9576,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@log.route('/login', methods=['GET', 'POST'])\ndef login():\n print(request.path)\n if request.method == 'GET':\n return render_template('exec/login.html')\n else:\n ... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
Created on Sat May 2 21:31:37 2020
@author: Emmanuel Torres Molina
"""
"""
Ejercicio 10 del TP2 de Teoría de los Circuitos II:
Un tono de 45 KHz y 200 mV de amplitud es distorsionada por un tono de 12 KHz
y 2V de amplitud. Diseñar un filtro pasa altos que atenúe la señal
inter... | normal | {
"blob_id": "dd59f3b1d8b17defe4e7f30fec594d01475319d2",
"index": 6211,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.close('all')\n<mask token>\naxs[0].plot(t, s_t)\naxs[0].grid('True')\naxs[0].set_title('Señal Original')\naxs[0].set_ylim(-0.2, 0.2)\naxs[0].set_ylabel('[V]')\naxs[1].plot(t, r_t)\nax... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# ----------------------------------------------------------
# RJGlass Main Program version 0.2 8/1/07
# ----------------------------------------------------------
# Copyright 2007 Michael LaBrie
#
# This file is part of RJGlass.
#
# RJGlass is free software; you can redistribute it and/or ... | normal | {
"blob_id": "aafadcbf946db8ed85e3df48f5411967ec35c318",
"index": 7333,
"step-1": "#!/usr/bin/env python\n# ----------------------------------------------------------\n# RJGlass Main Program version 0.2 8/1/07\n# ----------------------------------------------------------\n# Copyright 2007 Michael LaBrie\n#\n# ... | [
0
] |
#!/usr/bin/env python3
data = None
with open('./01-data.txt') as f:
data = f.read().splitlines()
ss = {}
s = 0
ss[s] = True
def check(data):
global ss
global s
for line in data:
s += int(line)
if ss.get(s, False):
return s
ss[s] = True
return None
v = chec... | normal | {
"blob_id": "7e1dd242c60ee12dfc4130e379fa35ae626a4d63",
"index": 5217,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef check(data):\n global ss\n global s\n for line in data:\n s += int(line)\n if ss.get(s, False):\n return s\n ss[s] = True\n return None... | [
0,
1,
2,
3,
4
] |
from ParseTree import ParseTree
from Node import Node
from NodeInfo import NodeInfo
from TreeAdjustor import TreeAdjustor
from model.SchemaGraph import SchemaGraph
class TreeAdjustorTest:
schema = None
def __init__(self):
return
def getAdjustedTreesTest(self):
T = ParseTree()
... | normal | {
"blob_id": "1db397df2d030b2f622e701c46c15d653cb79e55",
"index": 5079,
"step-1": "<mask token>\n\n\nclass TreeAdjustorTest:\n <mask token>\n\n def __init__(self):\n return\n\n def getAdjustedTreesTest(self):\n T = ParseTree()\n nodes = [Node(index=-1, word='DEFAULT', posTag='DEFAULT... | [
3,
4,
8,
9,
10
] |
# Generated by Django 3.2.1 on 2021-05-17 18:02
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations... | normal | {
"blob_id": "7ce471b3a6966c1a60ae2e2f3ec42369fe3d0f9c",
"index": 6377,
"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
] |
'''
def Sort(a):
i=1
while i<len(a):
j=i
while j>0 and a[j-1] > a[j]:
temp = a[j-1]
a[j-1] = a[j]
a[j] = temp
j-=1
i+=1
return a
'''
def Sort(a):
i=1
n=len(a)
while i<len(a):
j=i
print(i-1,'\t',i)
whi... | normal | {
"blob_id": "3f8b8b8cfbe712f09734d0fb7302073187d65a73",
"index": 982,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Sort(a):\n i = 1\n n = len(a)\n while i < len(a):\n j = i\n print(i - 1, '\\t', i)\n while a[j - 1] > a[j] and j >= 0:\n j -= 1\n pr... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
# @Time : 2019/3/5 上午9:55
# @Author : yidxue
from src.handler.base.base_handler import BaseHandler
from src.utils.tools import read_model
from tornado.options import options
import os
module_path = os.path.abspath(os.path.join(os.curdir))
model_path = os.path.join(module_path, 'model')
cl... | normal | {
"blob_id": "a8ae59bb525c52ef852655f0ef1e32d96c8914d6",
"index": 1356,
"step-1": "<mask token>\n\n\nclass ReloadModelHandler(BaseHandler):\n\n def __init__(self, application, request, **kwargs):\n super(ReloadModelHandler, self).__init__(application, request, **kwargs\n )\n <mask token>\n... | [
2,
3,
4,
5,
6
] |
import csv
import json,os
mylist=[]
clist=["North Indian","Italian","Continental","Chinese","Mexican","South Indian"]
for filename in os.listdir("/home/asket/Desktop/DBMS/menu"):
print(filename) | normal | {
"blob_id": "965db2523f60d83bd338bcc62ab8e5705550aa89",
"index": 6606,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor filename in os.listdir('/home/asket/Desktop/DBMS/menu'):\n print(filename)\n",
"step-3": "<mask token>\nmylist = []\nclist = ['North Indian', 'Italian', 'Continental', 'Chinese',... | [
0,
1,
2,
3,
4
] |
#Define a function max_of_three() that takes three numbers as
#arguments and returns the largest of them.
def max_of_three(a,b,c):
max=0
if a > b:
max = a
else:
max = b
if max > c :
return max
else:
return c
print max(234,124,43)
def max_of_three2(a, b, ... | normal | {
"blob_id": "00b4a57537358797bfe37eee76bbf73ef42de081",
"index": 9775,
"step-1": "\n\n\n#Define a function max_of_three() that takes three numbers as\n#arguments and returns the largest of them.\n\n\n\n\ndef max_of_three(a,b,c):\n\n max=0\n if a > b:\n max = a\n else:\n max = b\n\n if m... | [
0
] |
#!/usr/bin/python
'''Defines classes for representing metadata found in Biographies'''
class Date:
'''Object to represent dates. Dates can consist of regular day-month-year, but also descriptions (before, after, ca.). Object has attributes for regular parts and one for description, default is empty string.'''
... | normal | {
"blob_id": "9609f23463aa4c7859a8db741c7f3badd78b8553",
"index": 6527,
"step-1": "#!/usr/bin/python\n\n'''Defines classes for representing metadata found in Biographies'''\n\n\n\nclass Date:\n '''Object to represent dates. Dates can consist of regular day-month-year, but also descriptions (before, after, ca.)... | [
0
] |
from tkinter import*
from tkinter import filedialog
import sqlite3
class Gui:
def __init__(self):
global en3
self.scr = Tk()
self.scr.geometry("2000x3000")
self.scr.title("VIEWING DATABASE")
self.connection = sqlite3.connect("student_details.db")
... | normal | {
"blob_id": "4c6b04716f41c3413896f0d59f2cc9b1475d7f64",
"index": 5164,
"step-1": "<mask token>\n\n\nclass Gui:\n <mask token>\n\n def insert_data(self):\n self.id = e.get()\n self.name1 = e1.get()\n self.fathername = e2.get()\n self.mothername = e3.get()\n self.cont = e4.... | [
9,
12,
17,
18,
20
] |
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
] |
"""
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | normal | {
"blob_id": "cce40ff190f7790ac4eca7d6cb3c032955bb4849",
"index": 8288,
"step-1": "<mask token>\n\n\nclass SA360Validator(object):\n <mask token>\n\n def __init__(self, sa360_service: Resource=None, agency: int=None,\n advertiser: int=None) ->None:\n self.sa360_service = sa360_service\n ... | [
7,
8,
9,
11,
12
] |
#!/usr/bin/python
#
# Copyright 2017 Steven Watanabe
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
from MockProgram import *
command('strip', '-S', '-x', input_file('bin/darwin-4.2.1/release/target-os-darwin/t... | normal | {
"blob_id": "d2f77afd0d282b1fa4859c5368c9d2c745a5625e",
"index": 3293,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncommand('strip', '-S', '-x', input_file(\n 'bin/darwin-4.2.1/release/target-os-darwin/test'))\nmain()\n",
"step-3": "from MockProgram import *\ncommand('strip', '-S', '-x', input_fil... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Vincent Celis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | normal | {
"blob_id": "a61bc654eecb4e44dce3e62df752f80559a2d055",
"index": 9184,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nROUTE_LIST = [webapp2.Route('/api/history<name:/(?:[a-zA-Z0-9_-]+/?)*>',\n handler=handlers.HistoryApi, name='historyApi'), webapp2.Route(\n '/api<name:/(?:[a-zA-Z0-9_-]+/?)*>', han... | [
0,
1,
2,
3
] |
car_state = False
u_input = input(f'>')
if car_state == True:
print('Car is stopped!')
if u_input == 'start':
car_state = True
print('Car has started!')
elif u_input == 'stop':
car_state == False
print('Car has stopped!')
else:
print('''I don''t understand that...''') | normal | {
"blob_id": "2766339632200c26a8c6cd3abff28b1495870b9a",
"index": 9207,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif car_state == True:\n print('Car is stopped!')\nif u_input == 'start':\n car_state = True\n print('Car has started!')\nelif u_input == 'stop':\n car_state == False\n prin... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import re
def phonenumbervalidate(phone):
pattern ='^[6-9][0-9]{9}$'
phone =str(phone)
if re.match(pattern,phone):
return True
return False
print(phonenumbervalidate(998855451))
print(phonenumbervalidate(9955441))
# In[10]:
import re
def pho... | normal | {
"blob_id": "6b2161379bdd27980d3a515cdf4719ab036845fe",
"index": 8217,
"step-1": "<mask token>\n\n\ndef phonenumbervalidate(phone):\n pattern = '^[0][6-9][0-9]{9}$'\n phone = str(phone)\n if re.match(pattern, phone):\n return True\n return False\n\n\n<mask token>\n",
"step-2": "<mask token>\... | [
1,
2,
3,
4,
6
] |
n = int(input())
a = oct(n)
b = hex(n)
print(a[2:],b[2:].upper())
#.upper : 소문자 -> 대문자
| normal | {
"blob_id": "d6cea40e907a0424b2b1b8162f19aa8203443e55",
"index": 4360,
"step-1": "n = int(input())\n\na = oct(n)\nb = hex(n)\n\nprint(a[2:],b[2:].upper())\n\n#.upper : 소문자 -> 대문자\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
#Create a 3x3 identity matrix
import numpy as np
vector = np.zeros((8,8))
vector[1::2,::2]=1
vector[::2,1::2]=1
print(vector)
'''
Output
[[0. 1. 0. 1. 0. 1. 0. 1.]
[1. 0. 1. 0. 1. 0. 1. 0.]
[0. 1. 0. 1. 0. 1. 0. 1.]
[1. 0. 1. 0. 1. 0. 1. 0.]
[0. 1. 0. 1. 0. 1. 0. 1.]
[1. 0. 1. 0. 1. 0. 1. 0.]
[0. 1. 0. 1. 0.... | normal | {
"blob_id": "10d3ee459a296c26429659a202833a9570cf9454",
"index": 9639,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(vector)\n<mask token>\n",
"step-3": "<mask token>\nvector = np.zeros((8, 8))\nvector[1::2, ::2] = 1\nvector[::2, 1::2] = 1\nprint(vector)\n<mask token>\n",
"step-4": "import num... | [
0,
1,
2,
3,
4
] |
import os
from sql_interpreter.tables.csv_table import CsvTable
from sql_interpreter.interpreter import SqlInterpreter
from sql_interpreter.cli import Cli
class InterpreterTest():
def setUp(self):
self.interpreter = SqlInterpreter()
self.cli = Cli(self.interpreter)
filename = os.... | normal | {
"blob_id": "b3ee76bc0d93135d0908044a2424dd927a390007",
"index": 6357,
"step-1": "<mask token>\n\n\nclass InterpreterTest:\n <mask token>\n\n def tearDown(self):\n self.interpreter.unload_all()\n <mask token>\n\n def test_select_2(self):\n sql = \"\"\"select\n e.id, last_name... | [
4,
5,
8,
9,
10
] |
class ChartType:
Vanilla = "Vanilla"
Neopolitan = "Neopolitan"
| normal | {
"blob_id": "451a36eb205a269a05e3b3d89541278633d12aaa",
"index": 9781,
"step-1": "<mask token>\n",
"step-2": "class ChartType:\n <mask token>\n <mask token>\n",
"step-3": "class ChartType:\n Vanilla = 'Vanilla'\n Neopolitan = 'Neopolitan'\n",
"step-4": "\n\nclass ChartType:\n Vanilla = \"Vanil... | [
0,
1,
2,
3
] |
from django.shortcuts import render
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from polls.models import Poll
from .serializers import PollSerializer
# class PollView(APIView):
#
# def get(self, request):
# serializer = PollSeri... | normal | {
"blob_id": "866ff68744a16158b7917ca6defc35440208ae71",
"index": 8575,
"step-1": "<mask token>\n\n\ndef index(request):\n data = {}\n return render(request, 'polls/index.html', data)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n data = {}\n return render(request, 'polls/i... | [
1,
2,
3,
4,
5
] |
import json
import requests
import time
class TRY():
rates = list()
def __init__(self, r):
# if(TRY.rates[-1] != r):
TRY.rates.append(r)
def ls(self):
# print("TRY: "+TRY.rates[e] for e in range(1, len(TRY.rates)))
print(f"TRY: {TRY.rates}")
class USD():
rates = lis... | normal | {
"blob_id": "d56aa0f0b7c420e4021736cf8f80923121856d1c",
"index": 1286,
"step-1": "<mask token>\n\n\nclass RUB:\n rates = list()\n\n def __init__(self, r):\n RUB.rates.append(r)\n\n def ls(self):\n print(f'RUB: {RUB.rates}')\n\n\nclass INR:\n rates = list()\n\n def __init__(self, r):\... | [
10,
14,
16,
19,
22
] |
#! /usr/local/env python
#coding:utf-8
import urllib.request
import urllib.error
try:
urllib.request.urlopen("http://blog.csdn.net/jo_andy")
except urllib.error.URLError as e:
if hasattr(e,"code"):
print(e.code)
if hasattr(e,'reason'):
print(e.reason) | normal | {
"blob_id": "2ffd0de2888872cfa664919fcfc54b8e60b03280",
"index": 5256,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n urllib.request.urlopen('http://blog.csdn.net/jo_andy')\nexcept urllib.error.URLError as e:\n if hasattr(e, 'code'):\n print(e.code)\n if hasattr(e, 'reason'):\n ... | [
0,
1,
2,
3
] |
import random
class Madlib:
'''
This class generates the madlib from word lists.
'''
def get_madlib(self):
madlib = """
Once there was a {0}. It {1} at the {2}.
Then because of its {3} it {4}. Wow! You sure are {5}!
Thanks! I {6} you very much.
"""
nouns... | normal | {
"blob_id": "2b23237e697cb4ca8f1013d7be343c70fba9541d",
"index": 6342,
"step-1": "<mask token>\n\n\nclass Madlib:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Madlib:\n <mask token>\n\n def get_madlib(self):\n madlib = \"\"\"\n Once there was a {0}. It {1} at t... | [
1,
2,
3,
4,
5
] |
"""Exercise 7.2. Encapsulate this loop in a function called square_root that takes a as a parameter,
chooses a reasonable value of x, and returns an estimate of the square root of a."""
def my_square_root(a,x) :
e = 0.0001
while True :
y=(x+a/x)/2
if abs(y-x) < e :
return y
... | normal | {
"blob_id": "c9f4ae94dc901d34a3c0fb4371c8d35a7fe94507",
"index": 5095,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef my_square_root(a, x):\n e = 0.0001\n while True:\n y = (x + a / x) / 2\n if abs(y - x) < e:\n return y\n break\n x = y\n\n\n<mask ... | [
0,
1,
2,
3,
4
] |
from src import npyscreen
from src.MainForm import MainForm
from src.ContactsForm import ContactsForm
from src.SendFileForm import SendFileForm
from src.MessageInfoForm import MessageInfoForm
from src.ForwardMessageForm import ForwardMessageForm
from src.RemoveMessageForm import RemoveMessageForm
class App(npyscreen.... | normal | {
"blob_id": "dc2c429bae10ee14737583a3726eff8fde8306c7",
"index": 6940,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n\n def onStart(self):\n self.MainForm = self.addFor... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# Lesson_5 Activity 2 Mailroom Part 2
import os
def page_break():
""" Print a separator to distinguish new 'pages'"""
print("_"*75+"\n")
def get_amount():
"""Get valid donation amount from user"""
while True:
try:
amount = input("How much did they donate:... | normal | {
"blob_id": "8a192fc08a65c80b8733a9d07374156c09f36598",
"index": 2823,
"step-1": "<mask token>\n\n\ndef get_amount():\n \"\"\"Get valid donation amount from user\"\"\"\n while True:\n try:\n amount = input('How much did they donate: ')\n if str(amount).lower() == 'exit':\n ... | [
6,
7,
8,
9,
12
] |
from tqdm import tqdm
import fasttext
import codecs
import os
import hashlib
import time
def make_save_folder(prefix="", add_suffix=True) -> str:
"""
1. 現在時刻のハッシュをsuffixにした文字列の生成
2. 生成した文字列のフォルダが無かったら作る
:param prefix:save folderの系統ラベル
:param add_suffix: suffixを付与するかを選ぶフラグ, True: 付与, False: 付与しない
... | normal | {
"blob_id": "14e304f30364932910986f2dda48223b6d4b01c0",
"index": 8372,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef make_save_folder(prefix='', add_suffix=True) ->str:\n \"\"\"\n 1. 現在時刻のハッシュをsuffixにした文字列の生成\n 2. 生成した文字列のフォルダが無かったら作る\n :param prefix:save folderの系統ラベル\n :param add... | [
0,
1,
2,
3,
4
] |
import openpyxl
class TestXLUtility:
def __init__(self, driver):
self.driver = driver
def getRowCount(file, sheetname):
workbook = openpyxl.load_workbook(file)
#sheet = workbook.get_sheet_by_name(sheetname)
sheet = workbook[sheetname]
return(sheet.max_row)
def get... | normal | {
"blob_id": "adae4f9ebcbbb775fc40278ceec9a0cc30c0a503",
"index": 1541,
"step-1": "<mask token>\n\n\nclass TestXLUtility:\n <mask token>\n\n def getRowCount(file, sheetname):\n workbook = openpyxl.load_workbook(file)\n sheet = workbook[sheetname]\n return sheet.max_row\n <mask token>... | [
2,
4,
6,
7,
8
] |
import pickle
import numpy as np
import torch
import time
import torchvision
import matplotlib
import matplotlib.pyplot as plt
def load_cifar_data(data_files):
data = []
labels = []
for file in data_files:
with open(file, 'rb') as fo:
data_dict = pickle.load(fo, encoding='bytes')
... | normal | {
"blob_id": "66fe0a3b84773ee1d4f91d8fde60f1fc5b3d7e4c",
"index": 6454,
"step-1": "<mask token>\n\n\ndef load_cifar_data(data_files):\n data = []\n labels = []\n for file in data_files:\n with open(file, 'rb') as fo:\n data_dict = pickle.load(fo, encoding='bytes')\n if len(da... | [
8,
10,
12,
13,
14
] |
__author__ = 'matthias'
from tcp import *
from data import *
#SERVER = "131.225.237.31"
#PORT = 33487
data = LaserData()
#server = TCP(SERVER, PORT)
server = TCP()
server.start_server()
for i in range(100):
data = server.recv_server()
print data
| normal | {
"blob_id": "1e4d18909b72ceef729efdd7b2ab996ace45f1bd",
"index": 6367,
"step-1": "__author__ = 'matthias'\n\nfrom tcp import *\nfrom data import *\n\n#SERVER = \"131.225.237.31\"\n#PORT = 33487\n\ndata = LaserData()\n#server = TCP(SERVER, PORT)\nserver = TCP()\nserver.start_server()\nfor i in range(100):\n da... | [
0
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
lgr = logging.getLogger(__name__)
lgr.log("hello")
import database
import csv
import codecs
class Stop(object):
"""docstring for Stop"""
def __init__(self, arg):
self.fields = [
'stop_id',
'stop_name',
'stop... | normal | {
"blob_id": "39ecbf914b0b2b25ce4290eac4198199b90f95e0",
"index": 5384,
"step-1": "<mask token>\n\n\nclass Stop(object):\n \"\"\"docstring for Stop\"\"\"\n\n def __init__(self, arg):\n self.fields = ['stop_id', 'stop_name', 'stop_lat', 'stop_lon',\n 'stop_calle', 'stop_numero', 'stop_entre... | [
9,
10,
12,
13,
14
] |
import pymysql
def main():
conn = pymysql.connect(host='127.0.0.1', port=3306,user='root',password='383240gyz',db='bycicle',charset='utf8')
print(conn)
try:
with conn.cursor() as cursor: # 上下文语法否则需要 # cursor.close()
cursor.execute('''drop table if exists pymysql''')
curs... | normal | {
"blob_id": "3135483c68880eeeaf7ebc085a6cd3c0c7f0550c",
"index": 1859,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root',\n password='383240gyz', db='bycicle', charset='utf8')\n print(conn)\n try:\n with... | [
0,
1,
2,
3,
4
] |
from prediction_model import PredictionModel
import util.nlp as nlp
import re
class NLPPredictionModel(object):
def getPasswordProbabilities(self, sweetwordList):
# can not deal with sweetword that contains no letters
result = []
for s in sweetwordList:
words = re.findall(r"[... | normal | {
"blob_id": "1c01fbf7eafd49ada71cb018a62ead5988dcf251",
"index": 2968,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass NLPPredictionModel(object):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass NLPPredictionModel(object):\n\n def getPasswordProbabilities(self, sweetwordList):\n ... | [
0,
1,
2,
3,
4
] |
from django.contrib.auth import authenticate, login, logout
from django.template import loader
from django.http import (HttpResponse, JsonResponse,
HttpResponseForbidden, HttpResponseBadRequest)
from django.shortcuts import redirect
from django.views.decorators.http import require_POST
import ... | normal | {
"blob_id": "41ca762fe6865613ae4ef2f657f86b516353676f",
"index": 9784,
"step-1": "<mask token>\n\n\ndef index(request, err_msg=None):\n \"\"\"\n Renders the index page.\n \"\"\"\n template = loader.get_template('aimodel/index.html')\n context = {}\n context['err_msg'] = err_msg\n return Http... | [
13,
16,
17,
19,
22
] |
import Environment.spot_environment_model
"""This is basically the control center. All actions here are being condensed and brought in from
spot_market_model...... the BRAIN of the simulator"""
class SpotEnvironmentController():
def __init__(self, debug=False): # debug builds an error trap
self.debug = ... | normal | {
"blob_id": "7c19b9521dc874a1ff4bed87dae0452cc329224a",
"index": 6890,
"step-1": "<mask token>\n\n\nclass SpotEnvironmentController:\n\n def __init__(self, debug=False):\n self.debug = debug\n if self.debug == True:\n print('... In Controller -> __init__')\n self.sem = Environm... | [
17,
18,
24,
27,
28
] |
import sys
from collections import namedtuple
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, \
QHBoxLayout, QStackedWidget, QListWidget, QListWidgetItem
from PyQt5.QtCore import Qt, QSize
from runWidget import RunWidget
from recordWidget import RecordWidget
def QListWidget_qss():
return ... | normal | {
"blob_id": "252a6b97f108b7fdc165ccb2a7f61ce31f129d3d",
"index": 8693,
"step-1": "<mask token>\n\n\nclass MainCentralWidget(QWidget):\n\n def __init__(self):\n super().__init__()\n tab_bar = self.getTabBar(('录制', '运行'))\n tab_page = self.getTabPage()\n tab_bar.currentRowChanged.con... | [
5,
6,
7,
9,
10
] |
from quiz.schema.base import Schema
from quiz.schema.schemas import UserSchemas
class RegisterSchema(Schema):
"""
注册
"""
_schema = UserSchemas.REG_SCHEMA.value
class LoginSchema(Schema):
"""
登录
"""
_schema = UserSchemas.LOGIN_SCHEMA.value
| normal | {
"blob_id": "e0d7fb8a9799c91dca0ca0827a5149804c9efabb",
"index": 7082,
"step-1": "<mask token>\n\n\nclass RegisterSchema(Schema):\n <mask token>\n <mask token>\n\n\nclass LoginSchema(Schema):\n \"\"\"\n 登录\n \"\"\"\n _schema = UserSchemas.LOGIN_SCHEMA.value\n",
"step-2": "<mask token>\n\n\ncl... | [
4,
5,
6,
7
] |
'''
8-6. 도시 이름
도시와 국가 이름을 받는 city_country() 함수를 만드세요. 이 함수는 다음과 같은 문자열을 반환해야 합니다.
'Santiago, Chile'
- 최소한 세 개의 도시-국가 쌍으로 함수를 호출하고 반환값을 출력하세요.
Output:
santiago, chile
ushuaia, argentina
longyearbyen, svalbard
'''
| normal | {
"blob_id": "2d5abcd75dcbeb1baa3f387035bdcc3b7adbfe3f",
"index": 7856,
"step-1": "<mask token>\n",
"step-2": "'''\n8-6. 도시 이름\n도시와 국가 이름을 받는 city_country() 함수를 만드세요. 이 함수는 다음과 같은 문자열을 반환해야 합니다.\n'Santiago, Chile'\n- 최소한 세 개의 도시-국가 쌍으로 함수를 호출하고 반환값을 출력하세요.\n\nOutput:\nsantiago, chile\nushuaia, argentina\nlongye... | [
0,
1
] |
from sqlalchemy import literal, Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from common.db import Base
class Airplane(Base):
__tablename__ = 'airplanes'
id = Column(Integer, primary_key=True)
icao_code = Column(String(6), unique=True, nullable=False) # ICAO 24-bit identifi... | normal | {
"blob_id": "98dac1ea372f16ecdb818fbe3287ab7e51a0d67c",
"index": 7916,
"step-1": "<mask token>\n\n\nclass Airplane(Base):\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, icao_code, airline, manufacturer=None, ... | [
3,
4,
5,
7,
8
] |
# Create your views here.
from django.shortcuts import render_to_response, Http404, render
from django.template import RequestContext
from books.models import Book
from django.http import HttpResponse, HttpResponseRedirect
import urllib, urllib2
import json
def incr_reads(request, book_id):
if request.POST:
... | normal | {
"blob_id": "bcbcb4ea3a3b8b5c11e9b107103418ae79a3921c",
"index": 3628,
"step-1": "<mask token>\n\n\ndef incr_reads(request, book_id):\n if request.POST:\n try:\n readers = Book.objects.get(id=book_id).incr_reads()\n return HttpResponse(readers)\n except Book.DoesNotExist:\n... | [
2,
3,
4,
5,
6
] |
from sikuli import *
import logging
import myTools
from datetime import date
import reports_Compare
#---------------------------------------------------#
def fSet_BillDate(pMonth):
#---------------------------------------------------#
if pMonth == 13:
pMonth = 12
logging.debug('- change bill dat... | normal | {
"blob_id": "69721dca0f5d8396e330696cde52bfabad33c895",
"index": 3242,
"step-1": "<mask token>\n\n\ndef fSet_BillDate(pMonth):\n if pMonth == 13:\n pMonth = 12\n logging.debug('- change bill date: ' + str(pMonth) + '/27/' + Settings.\n dataYear)\n time.sleep(1)\n myTools.getFocus()\n ... | [
2,
3,
4,
5,
6
] |
from decimal import Decimal
from django.conf import settings
from blood.models import Bank, Blood
class Cart(object):
def __init__(self, request):
self.session = request.session
cart = self.session.get(settings.CART_SESSION_ID)
if not cart:
cart = self.session[settings.CART_SES... | normal | {
"blob_id": "a638504737d0069d4fa40b0fc5026203904563e8",
"index": 5537,
"step-1": "<mask token>\n\n\nclass Cart(object):\n <mask token>\n <mask token>\n\n def save(self):\n self.session[settings.CART_SESSION_ID] = self.cart\n self.session.modified = True\n <mask token>\n\n def __iter_... | [
5,
6,
8,
9,
11
] |
from django.db import models
from accounts.models import User
from cmdb.models.base import IDC
from cmdb.models.asset import Server, NetDevice
class CPU(models.Model):
# Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
version = models.CharField('型号版本', max_length=100, unique=True)
speed = models.PositiveSmallInt... | normal | {
"blob_id": "6bd423223e1ec2bb3a213158ac6da3a6483b531f",
"index": 4914,
"step-1": "<mask token>\n\n\nclass NetworkAdapter(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'cmdb_acc_network_adapter'\n verbose_name = u'配件网卡表'\n verbose_name_plural = u'配件网卡表'\... | [
15,
17,
18,
19,
27
] |
from microbit import *
import speech
while True:
speech.say("I am a DALEK - EXTERMINATE", speed=120, pitch=100, throat=100, mouth=200) #kokeile muuttaa parametrejä
| normal | {
"blob_id": "dad78d7948fb1038f9cf66732f39c18a18f2a3c8",
"index": 5233,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n speech.say('I am a DALEK - EXTERMINATE', speed=120, pitch=100, throat=\n 100, mouth=200)\n",
"step-3": "from microbit import *\nimport speech\nwhile True:\n s... | [
0,
1,
2,
3
] |
from django.conf.urls import url
from ..views import (buildings_upload, keytype_upload, key_upload, keystatus_upload, keyissue_upload)
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^buildings_csv/$', # NOQA
buildings_upload,
name="buildings_upload"),
url(r'^ke... | normal | {
"blob_id": "4a0d8e6b6205fa57b8614857e1462203a2a7d2c5",
"index": 3002,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^buildings_csv/$', buildings_upload, name=\n 'buildings_upload'), url('^keytype_csv/$', keytype_upload, name=\n 'keytype_upload'), url('^key_csv/$', key_upload, ... | [
0,
1,
2,
3
] |
OK = 200
CREATED = 201
NOT_MODIFIED = 304
UNAUTHORIZED = 401
FORBIDDEN = 403
BAD_REQUEST = 400
NOT_FOUND = 404
CONFLICT = 409
UNPROCESSABLE = 422
INTERNAL_SERVER_ERROR = 500
NOT_IMPLEMENTED = 501
SERVICE_UNAVAILABLE = 503
ADMIN = 'admin'
ELITE = 'elite'
NOOB = 'noob'
WITHDRAW = 'withdraw'
FUND = 'fund'
| normal | {
"blob_id": "d90942f22cbbd9cfc3a431b7857cd909a7690966",
"index": 92,
"step-1": "<mask token>\n",
"step-2": "OK = 200\nCREATED = 201\nNOT_MODIFIED = 304\nUNAUTHORIZED = 401\nFORBIDDEN = 403\nBAD_REQUEST = 400\nNOT_FOUND = 404\nCONFLICT = 409\nUNPROCESSABLE = 422\nINTERNAL_SERVER_ERROR = 500\nNOT_IMPLEMENTED = 5... | [
0,
1
] |
from rest_framework.views import APIView
from .serializers import UserSerializer
from rest_framework import permissions
from .models import users
from rest_framework.response import Response
from django.http import JsonResponse
from rest_framework import viewsets
from profiles.models import profile
from profiles.serial... | normal | {
"blob_id": "c5a7f269f579bd1960afa4f700b5c3436ac6d91a",
"index": 2733,
"step-1": "<mask token>\n\n\nclass GetDefaultUsers(APIView):\n <mask token>\n <mask token>\n\n\nclass GetSpecificUser(APIView):\n permission_classes = [permissions.IsAuthenticated]\n\n def post(self, request, id=None, *args, **kwa... | [
4,
5,
6,
7,
8
] |
#사각형의 면적을 구하는 프로그램을 작성하시오,
#사각형의 면적 = 높이*밑변
height=int(input('높이 입력: '))
base=int(input('밑변 입력: '))
area=height*base
print('높이는',height,' 밑변은',base,'사각형의 면적은',area,'입니다.')
| normal | {
"blob_id": "f9b48c1b6489d8981e192838cf1c734e2296ab15",
"index": 9833,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('높이는', height, ' 밑변은', base, '사각형의 면적은', area, '입니다.')\n",
"step-3": "height = int(input('높이 입력: '))\nbase = int(input('밑변 입력: '))\narea = height * base\nprint('높이는', height, ' 밑변... | [
0,
1,
2,
3
] |
# from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db import models
# from applications.models import ApplicationReview
# from profiles.models import Restaurant, Program, Courier
# Enum f... | normal | {
"blob_id": "8a1f024be00200218782c919b21161bf48fc817e",
"index": 7805,
"step-1": "<mask token>\n\n\nclass UserClass(AbstractBaseUser):\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... | [
20,
31,
32,
36,
37
] |
import mock
def exc():
print 'here should raise'
def recursion():
try:
print 'here'
return exc()
except StandardError:
print 'exc'
return recursion()
def test_recursion():
global exc
exc = mock.Mock(side_effect = [StandardError, StandardError, mock.DEFAULT])
r... | normal | {
"blob_id": "5ef7c838d8e9a05a09bd974790a85ff36d56a336",
"index": 990,
"step-1": "import mock\n\ndef exc():\n print 'here should raise'\n\ndef recursion():\n try:\n print 'here'\n return exc()\n except StandardError:\n print 'exc'\n return recursion()\n\n\ndef test_recursion()... | [
0
] |
word=input()
letter,digit=0,0
for i in word:
if('a'<=i and i<='z') or ('A'<=i and i<='Z'):
letter+=1
if '0'<=i and i<='9':
digit+=1
print("LETTERS {0} \n DIGITS {1}".format(letter,digit))
| normal | {
"blob_id": "f2a508ae99697d6ba320b158a1000379b975d568",
"index": 2227,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in word:\n if 'a' <= i and i <= 'z' or 'A' <= i and i <= 'Z':\n letter += 1\n if '0' <= i and i <= '9':\n digit += 1\nprint(\"\"\"LETTERS {0} \n DIGITS {1}\"\"\"... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
class Role:
"""
角色类
卧底
平民
"""
def __init__(self,key_word="",role_id = 0):
self.key_word = key_word
self.role_id = role_id #平民-0;卧底-1;
class User(Role):
"""
用户类
玩家
"""
def __init__(self,id,role_i... | normal | {
"blob_id": "3b5141a86948df6632612f6c9d7fc0089acc60aa",
"index": 5981,
"step-1": "<mask token>\n\n\nclass Role:\n <mask token>\n <mask token>\n\n\nclass User(Role):\n \"\"\"\n 用户类\n 玩家\n \"\"\"\n\n def __init__(self, id, role_id):\n self.id = id\n self.role_id = role_id\n",
"... | [
4,
5,
6,
7,
8
] |
# -*- coding:utf-8 -*-
__author__ = 'yyp'
__date__ = '2018-5-26 3:42'
'''
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given "abcabcbb", the answer is "abc", which the length is 3.
Given "bbbbb", the answer is "b", with the length of 1.
Given "pwwkew", the answer is ... | normal | {
"blob_id": "b7c43f4242e38318c9e5423ea73e9d9d86759a53",
"index": 4663,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def lengthOfLongestSubstring(self, s):\n \"\"\"\n :type s: str\n ... | [
1,
2,
3,
4,
5
] |
class Vehicle(object):
count_list = []
def __init__(self, registration_number):
self.registration_number = registration_number
Vehicle.count_list.append(self)
Vehicle.count = len(Vehicle.count_list)
| normal | {
"blob_id": "8b9336113f64a88eeabe6e45021938fac9efd1c6",
"index": 6442,
"step-1": "<mask token>\n",
"step-2": "class Vehicle(object):\n <mask token>\n <mask token>\n",
"step-3": "class Vehicle(object):\n <mask token>\n\n def __init__(self, registration_number):\n self.registration_number = ... | [
0,
1,
2,
3
] |
import unittest
import json
from app.tests.base import BaseTestCase
from app import db
from app.tests.utils import create_room, create_simple_device, create_rgb_device
class TestRoomService(BaseTestCase):
"""Test the room service"""
def test_get_room(self):
room = create_room()
with self.client:
response =... | normal | {
"blob_id": "332e2945e34c861b2132f6b42ef59416a38455a5",
"index": 2542,
"step-1": "<mask token>\n\n\nclass TestRoomService(BaseTestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestDeviceService(BaseTestCase):\n \"\"\"Test the device service\"\"\"\n\n def test_get... | [
7,
9,
11,
12,
13
] |
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | normal | {
"blob_id": "97ca134ffce404f4b2bc7352d4aac73a7bb764bd",
"index": 5708,
"step-1": "<mask token>\n\n\nclass OptbenchRun(MeasurementSource):\n\n def __init__(self, optbench_scenario: str, query: int):\n self._executor: Optional[Executor] = None\n self._optbench_scenario = optbench_scenario\n ... | [
7,
9,
12,
13,
14
] |
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, softwa... | normal | {
"blob_id": "c2f6fa4d9a6e2ee5f0593bef775ce8f811225613",
"index": 2047,
"step-1": "<mask token>\n\n\n@gapit_test('vkCmdCopyQueryPoolResults_test')\nclass FifthToEighthQueryResultsIn64BitWithWaitBitCopyWithZeroOffsets(GapitTest\n ):\n <mask token>\n\n\n@gapit_test('vkCmdCopyQueryPoolResults_test')\nclass All... | [
3,
5,
6,
7,
8
] |
import random
def take_second(element):
return element[1]
import string
def get_random_name():
name = ""
for i in range(random.randint(5, 15)):
name += random.choice(string.ascii_letters)
return name
imenik = [(777, "zejneba"), (324, "fahro"), (23, "fatih"), (2334, "muamer"), (435, "keri... | normal | {
"blob_id": "21ef8103a5880a07d8c681b2367c2beef727260f",
"index": 6536,
"step-1": "<mask token>\n\n\ndef take_second(element):\n return element[1]\n\n\n<mask token>\n\n\ndef get_random_name():\n name = ''\n for i in range(random.randint(5, 15)):\n name += random.choice(string.ascii_letters)\n r... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class JiayuanItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
person_id = scrapy.Field(... | normal | {
"blob_id": "9dbadb2421b04961e8e813831d06abc1ff301566",
"index": 3283,
"step-1": "<mask token>\n\n\nclass PersonInfo(scrapy.Item):\n person_id = scrapy.Field()\n buy_car = scrapy.Field()\n address = scrapy.Field()\n\n\nclass OtherItem(scrapy.Item):\n \"\"\"\n 可以定义另外一个item\n \"\"\"\n ... | [
5,
6,
7,
8,
9
] |
from bbdd import *
def usuario():
global usser
usser=input("Introduce un usuario : ")
if len(usser)<5 or len(usser)>15:
print("El usuario debe tener entre 5 y 15 caracteres")
usuario()
elif usser.isalnum()==False:
print("Los valores del usurio deben ser únicamente letras o números")
usuario()
... | normal | {
"blob_id": "ce75c23c6b0862dde797225f53c900b4ebc56428",
"index": 514,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef usuario():\n global usser\n usser = input('Introduce un usuario : ')\n if len(usser) < 5 or len(usser) > 15:\n print('El usuario debe tener entre 5 y 15 caracteres'... | [
0,
1,
2,
3,
4
] |
import hashlib
import os
def fileMD(self):
salt_ = os.urandom(32).hex()
hash_object = hashlib.md5()
hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))
print("MD5 Hash: "+hash_object.hexdigest()) | normal | {
"blob_id": "bc9718fa57046888961d1b5245abefa8f752e983",
"index": 8103,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fileMD(self):\n salt_ = os.urandom(32).hex()\n hash_object = hashlib.md5()\n hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))\n print('MD5 Hash: ' ... | [
0,
1,
2,
3
] |
import json
import os
from django.conf import settings
from django.db import models
from jsonfield import JSONField
class Word(models.Model):
value = models.CharField(
max_length=50,
verbose_name='Слово'
)
spelling = models.CharField(
max_length=250,
verbose_name='Транскри... | normal | {
"blob_id": "067e0129b1a9084bbcee28d1973504299b89afdb",
"index": 8911,
"step-1": "<mask token>\n\n\nclass Meaning(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n if self.value is None:\n return ''\n return self.value[:20]... | [
13,
14,
15,
17,
19
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.