code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import random
import HardMode
import EasyMode
#Intro function, gets user input of game start, instructions, and game mode
def introduction():
like_to_play = int(input ("Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) "))
#like_to_play = int(like_to_play)
#need to set y/n variables... | normal | {
"blob_id": "31246a2e022f3c5b0ce68bb06422307439cbd9b6",
"index": 4272,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef introduction():\n like_to_play = int(input(\n 'Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) '\n ))\n if like_to_play == 1:\n ... | [
0,
1,
2,
3,
4
] |
import time, json, glob, os, enum
import serial
import threading
import responder
# 環境によって書き換える変数
isMCUConnected = True # マイコンがUSBポートに接続されているか
SERIALPATH_RASPI = '/dev/ttyACM0' # ラズパイのシリアルポート
SERIALPATH_WIN = 'COM16' # Windowsのシリアルポート
# 各種定数
PIN_SERVO1 = 12 # GPIO12 PWM0 Pin
PIN_SERVO2 = 13 # GP... | normal | {
"blob_id": "25532102cc36da139a22a61d226dff613f06ab31",
"index": 4714,
"step-1": "<mask token>\n\n\nclass Meters:\n <mask token>\n\n def indicate(self, kmh=None, amp=None, led=None):\n if self.pi:\n if kmh != None:\n kmh = SPEED_MAX if kmh > SPEED_MAX else kmh\n ... | [
8,
11,
12,
13,
14
] |
import sys
from PyQt5.QtWidgets import (QMainWindow, QWidget, QHBoxLayout, QVBoxLayout, QFrame,
QSplitter, QStyleFactory, QApplication, QPushButton, QTextEdit, QLabel, QFileDialog, QMessageBox)
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QColor
import myLoadData
from UIPack import setLossParameterDia... | normal | {
"blob_id": "302605d8bb45b1529742bf9441d476f0276085b9",
"index": 9,
"step-1": "<mask token>\n\n\nclass MyMainWindow(QMainWindow):\n <mask token>\n <mask token>\n\n def initConnect(self):\n self.dataFileChooseButton.clicked.connect(self.chooseData)\n self.dataFileChooseButtonT.clicked.conne... | [
9,
11,
12,
15,
18
] |
from __future__ import absolute_import
from builtins import str
from builtins import object
import unittest
import sys, os, re
import forcebalance
import abc
import numpy
from __init__ import ForceBalanceTestCase
class TestImplemented(ForceBalanceTestCase):
def test_implemented_targets_derived_from_target(self):
... | normal | {
"blob_id": "f91e1fdc31b2fe1aef15757576d847c617a86201",
"index": 1121,
"step-1": "<mask token>\n\n\nclass TestBromineObjective(ForceBalanceTestCase, ObjectiveTests):\n\n def setUp(self):\n self.options = forcebalance.parser.gen_opts_defaults.copy()\n self.options.update({'root': os.getcwd() + '/... | [
2,
11,
12,
15,
20
] |
import pygame
import pygame.freetype
import sys
import sqlite3
from data.player_class import Player
from data.explosion_class import Explosion
from data.objects_class import Bullets, Damage
from data.enemy_class import Enemy
from data.enemy_class import Boss
from data.death_animation import Smallexplosions
from data.ex... | normal | {
"blob_id": "d00fa29c502cc0311c54deb657b37c3c3caac7ca",
"index": 3755,
"step-1": "<mask token>\n\n\ndef draw_text(text, font_u, color, surface, x, y):\n text_object = font_u.render(text, color)\n textrect = text_object[1]\n textrect.topleft = x, y\n surface.blit(text_object[0], textrect)\n\n\n<mask t... | [
6,
10,
11,
12,
13
] |
# from the top
# clean up dependencies
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "<h1>Congratulations, it's a web app!</h1>"
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8080, debug=True)
| normal | {
"blob_id": "612535d95e655f2e2d2c58f41b2aa99afa7fbcbc",
"index": 874,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return \"<h1>Congratulations, it's a web app!</h1>\"\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n return \"<h1>Congratulations, it's a w... | [
1,
2,
3,
4,
5
] |
from people.models import Medium, Profile, Staff, Instructor, Student, Alumni, Donation, Address, Award, Reference, Experience, Skill, Education, ImporterUsers
from anonymizer import Anonymizer
class MediumAnonymizer(Anonymizer):
model = Medium
attributes = [
('medium_id', "integer"),
('descr... | normal | {
"blob_id": "63182a8708729606f96794cddb163f707252ba61",
"index": 3205,
"step-1": "<mask token>\n\n\nclass DonationAnonymizer(Anonymizer):\n model = Donation\n attributes = [('id', 'SKIP'), ('profile_id', 'SKIP'), ('amount',\n 'integer'), ('date', 'date'), ('description', 'varchar'), ('notes',\n ... | [
16,
18,
28,
29,
30
] |
#!/usr/bin/python
from PyQt4 import QtCore, QtGui
import sys
import json
import re
from Interface_Recommended_Results import obtain_list
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(co... | normal | {
"blob_id": "f5e57c95e2c86aeb83872b29324b0b73a41caa47",
"index": 9001,
"step-1": "<mask token>\n\n\nclass MyApp(QtGui.QMainWindow, Ui_MainWindow):\n\n def __init__(self):\n QtGui.QMainWindow.__init__(self)\n Ui_MainWindow.__init__(self)\n self.setupUi(self)\n star_list = ['1 Star a... | [
6,
7,
9,
11,
12
] |
import numpy as np
import yaml
import pickle
import os
from flask import Flask, request, jsonify, render_template, redirect, url_for, flash
from flask_mail import Mail, Message
from flask_wtf import FlaskForm
from flask_sqlalchemy import SQLAlchemy
from flask_bootstrap import Bootstrap
from wtforms import StringField,... | normal | {
"blob_id": "f6a3693fe81e629d987067265bf4e410bf260bcf",
"index": 1663,
"step-1": "<mask token>\n\n\nclass User(UserMixin, db.Model):\n id = db.Column(db.Integer, primary_key=True)\n username = db.Column(db.String(15), unique=True)\n email = db.Column(db.String(50), unique=True)\n password = db.Column... | [
25,
26,
28,
36,
39
] |
"""
purpose :Take an string as input and construct an algorithm
to input a string of characters and check whether
it is a palindrome.
@Author : Reshma Y. Kale
"""
from com.bridgelabz.utility.Data_structure_utility import *
if __name__=="__main__":
dq = Deque()
dq.palindrom() | normal | {
"blob_id": "d4d47f7abc5c8224188430546a65bfb8f358802f",
"index": 1472,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n dq = Deque()\n dq.palindrom()\n",
"step-3": "<mask token>\nfrom com.bridgelabz.utility.Data_structure_utility import *\nif __name__ == '__main__':\n ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
from django.contrib import admin
from models import UserProfile, AuditTrail
class UserProfileAdmin(admin.ModelAdmin):
list_display = [i.name for i in UserProfile._meta.fields]
admin.site.register(UserProfile, UserProfileAdmin)
class AuditTrailUserAdmin(admin.ModelAdmin):
list_display ... | normal | {
"blob_id": "477d1629c14609db22ddd9fc57cb644508f4f490",
"index": 8905,
"step-1": "<mask token>\n\n\nclass UserProfileAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n\n\nclass AuditTrailUserAdmin(admin.ModelAdmin):\n list_display = 'id', 'date', 'user', 'level', 'message'\n list_filter = 'leve... | [
3,
4,
5,
6,
7
] |
from django.urls import path
from . import views
from .views import propertyForRent, propertyForSale, PropertyDetailView
app_name = "core"
urlpatterns = [
path("", views.index, name="home"),
path("property_for_rent/", views.propertyForRent, name="property_rent"),
path("property_for_sale/", views.propertyF... | normal | {
"blob_id": "e2671911894871c32ad933fde8e05c913a4cc942",
"index": 7149,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'core'\nurlpatterns = [path('', views.index, name='home'), path(\n 'property_for_rent/', views.propertyForRent, name='property_rent'),\n path('property_for_sale/', views.... | [
0,
1,
2,
3
] |
from django.contrib.auth import authenticate
from django.http import JsonResponse, HttpResponse
from django.shortcuts import render
import json
from userprofile.models import Profile
from .models import *
#发送私信
def sendmessage(request):
if request.method == "POST":
data = json.loads(request.body)
... | normal | {
"blob_id": "f25db7d797f1f88bd0374d540adcb396e16740a0",
"index": 8953,
"step-1": "<mask token>\n\n\ndef getmessage(request):\n if request.method == 'POST':\n data = json.loads(request.body)\n uid = data.get('userid')\n msglist = []\n mres = Message.objects.filter(tuid_id=uid).all()... | [
1,
2,
3,
4,
5
] |
import os
import re
import logging
import time
from string import replace
from settings import *
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from modules.xml2dict import *
from modules import kayak
from modules.messaging import *
from modules.cron im... | normal | {
"blob_id": "08568c31e5a404957c11eca9cbc9472c71cf088b",
"index": 9546,
"step-1": "<mask token>\n\n\nclass KayakHandler(webapp.RequestHandler):\n <mask token>\n\n\nclass ClearTripHandler(webapp.RequestHandler):\n\n def get(self):\n file = open('result.xml', 'r')\n content = file.read()\n ... | [
5,
8,
9,
11,
17
] |
import asyncio
from . import edit_or_reply, udy
plugin_category = "utils"
@udy.cod_cmd(
pattern="as$",
command=("as", plugin_category),
info={
"header": "salam.",
"usage": "{tr}as",
},
)
async def _(event):
"animation command"
event = await edit_or_reply(event, "as")
awai... | normal | {
"blob_id": "a78bbb85f4912e5f7ea23f689de65cb16a38d814",
"index": 9787,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@udy.cod_cmd(pattern='as$', command=('as', plugin_category), info={'header':\n 'salam.', 'usage': '{tr}as'})\nasync def _(event):\n \"\"\"animation command\"\"\"\n event = aw... | [
0,
1,
2,
3,
4
] |
# ARGS:
# 1: total train reviews
# 2: number of iterations (for csv output)
# 3: size of vector
# 4: good/bad sizes
# import dependencies
from gensim import utils
from gensim.models.doc2vec import LabeledSentence
from gensim.models import Doc2Vec
from matplotlib import pyplot as plt
from sklearn.manifold import TSNE
f... | normal | {
"blob_id": "95015c467dd6371f575fb5535fe652a914650ef1",
"index": 2016,
"step-1": "<mask token>\n\n\ndef compute_accuracy(model, good, bad):\n train_arrays = numpy.zeros((25000, 400))\n train_labels = numpy.zeros(25000)\n classifier = LogisticRegression()\n for i in range(25000 / 2):\n prefix_t... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 18 20:24:53 2020
@author: filip
"""
import re
texto = "Muito além, nos confins inexplorados da região mais brega da Borda Ocidental desta Galáxia, há um pequeno sol amarelo e esquecido. Girando em torno deste sol, a uma distancia de cerca de 148 milhões de quil... | normal | {
"blob_id": "e207063eb3eb1929e0e24b62e6b77a8924a80489",
"index": 1001,
"step-1": "<mask token>\n\n\ndef separa_sentencas(texto):\n \"\"\"A funcao recebe um texto e devolve uma lista das sentencas dentro do texto\"\"\"\n sentencas = re.split('[.!?]+', texto)\n if sentencas[-1] == '':\n del sentenc... | [
6,
17,
19,
22,
23
] |
import os
import flask_sqlalchemy as sqlalchemy
from flask import Flask, jsonify, request,render_template,redirect,url_for,json,flash
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class
from flask_cors import CORS
import datetime
from flask_bootstrap import Bootstrap
from flask_login i... | normal | {
"blob_id": "5dc17db0aca109720d1ba62d65b86d9b81714063",
"index": 6622,
"step-1": "<mask token>\n\n\n@login_manager.user_loader\ndef load_user(id):\n user = Student.query.get(int(id))\n if user is not None:\n return user\n else:\n return Instructor.query.get(int(id))\n\n\n<mask token>\n\n\n... | [
9,
10,
13,
17,
18
] |
import sys
import time
from cli.utils import get_container_runtime, get_containers, run_shell_cmd
runtime = get_container_runtime()
def rm(ids):
cmd = f'{runtime} rm {" ".join(ids)}'
sys.stdout.write(f'{cmd}\n')
run_shell_cmd(cmd)
def stop(ids):
cmd = f'{runtime} stop {" ".join(ids)}'
sys.stdout... | normal | {
"blob_id": "eb3a32c17d8e5e9f717e813d5612d077c8feac48",
"index": 7145,
"step-1": "<mask token>\n\n\ndef rm(ids):\n cmd = f\"{runtime} rm {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}\\n')\n run_shell_cmd(cmd)\n\n\ndef stop(ids):\n cmd = f\"{runtime} stop {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}... | [
2,
3,
5,
6,
7
] |
from django.db import models
import os
from uuid import uuid4
class Card_profile(models.Model):
def path_and_rename(self, filename):
upload_to = 'uploads'
ext = filename.split('.')[-1]
filename = '{}.{}'.format(uuid4().hex, ext)
return os.path.join(upload_to, filename)
MALE ... | normal | {
"blob_id": "01153a695b4744465b706acb4c417217c5e3cefd",
"index": 3516,
"step-1": "<mask token>\n\n\nclass Card_profile(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>... | [
2,
3,
4,
5,
6
] |
import pandas as pd
import re
import sqlite3 as lite
import os
from pybedtools import BedTool
import django
from checkprimers import CheckPrimers
from pandas import ExcelWriter
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
django.setup()
class GetPrimers(object):
"""Extracts data from e... | normal | {
"blob_id": "1d817ee09705301b574c421a9ff716748c146fdd",
"index": 9591,
"step-1": "import pandas as pd\nimport re\nimport sqlite3 as lite\nimport os\nfrom pybedtools import BedTool\nimport django\nfrom checkprimers import CheckPrimers\nfrom pandas import ExcelWriter\nimport datetime\nos.environ['DJANGO_SETTINGS_M... | [
0
] |
#encoding=utf-8
import json
import os
def get_Userid(path):
path_Divided = path.split('\\')
#print(path_Divided)
get_id= path_Divided[6].split('.')
get_id = get_id[0]
#print(get_id)
return get_id
def compose_Json_Path_ToRead(path_json_source,get_id):
json_path_to_read = path... | normal | {
"blob_id": "2e5dbd84eb1f9cc09602df8ef8d7bdd30e1b2f26",
"index": 7119,
"step-1": "<mask token>\n\n\ndef get_Userid(path):\n path_Divided = path.split('\\\\')\n get_id = path_Divided[6].split('.')\n get_id = get_id[0]\n return get_id\n\n\ndef compose_Json_Path_ToRead(path_json_source, get_id):\n js... | [
5,
6,
7,
8,
9
] |
import os
def log(text, level=2, outFile='log.txt'):
text = str(text)
if level == 0:
return True
if level == 3:
with open(outFile, 'a') as logger:
logger.write(text)
logger.close()
print(text)
return True
if level == 2:
print(text)
if... | normal | {
"blob_id": "015b06d7f08f9de60a46d8428820333621732c53",
"index": 6425,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef log(text, level=2, outFile='log.txt'):\n text = str(text)\n if level == 0:\n return True\n if level == 3:\n with open(outFile, 'a') as logger:\n ... | [
0,
1,
2,
3
] |
'''
tag名だけで変えてもいいよね??
ただし,置換するときは,「代表参照表現(参照表現)」のように,元の参照表現が分かるように配慮せよ.→何を言いたい!?
もしかして:
<mention> -> <mention representative="false"> 欲しい??「元の参照表現が分かる」とは <mention representative="true"> と区割りできればいいよね?
'''
from bs4 import BeautifulSoup, element
soup = BeautifulSoup(open("nlp.txt.xml"),"lxml")
mentions = soup.find_all('me... | normal | {
"blob_id": "04938e14f22c44437188469b53dfb05d2ecd4a5c",
"index": 4481,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor m in mentions:\n if m.has_attr('representative') == False:\n print('before: =>\\n{}'.format(m))\n m['representative'] = 'false'\n print('after: =>\\n{}'.format... | [
0,
1,
2,
3,
4
] |
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from .views import home, profile
from member.views import member
from publication.views import publication, pub_detail
from notice.views import list, notice_detail
from... | normal | {
"blob_id": "a35e86e474883d892a6ce8eb191a3a5f8a9558c8",
"index": 1105,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.STATIC_URL, document_root=settings.\n STATIC_ROOT)\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDI... | [
0,
1,
2,
3,
4
] |
from django.shortcuts import render,redirect
from .forms import UserRegisterForm, IsEmri ,TestForm,PDF_Rapor
from django.contrib import messages
from django.contrib.auth import authenticate, login ,logout
from django.http import HttpResponseRedirect, HttpResponse ,JsonResponse
from django.urls import reverse
from djang... | normal | {
"blob_id": "74dd9151195fef41862c2793621172518f1f486d",
"index": 5248,
"step-1": "<mask token>\n\n\n@login_required\ndef index(request):\n grup = request.user.grup\n birim = request.user.birim\n emirler = Emir.objects.filter(durum='Aktif')\n l = list()\n for e in emirler.values():\n data = ... | [
10,
25,
26,
33,
35
] |
"""
test_extra.py:
In this file i wrote extra tests to my calculator program.
Divided to some main parts:
- Math Errors Tests (divide in zero, factorial, complex numbers)
- Test with edge cases of minus (operator / sign)
- Big results tests: expression that their result
... | normal | {
"blob_id": "f17d59ca9bfa82848ec6a599e98f759449ccdd14",
"index": 6376,
"step-1": "<mask token>\n\n\ndef test_divide_in_zero_from_start():\n expression = '56/0'\n result = main_evaluate(expression)\n assert result.error_type == DIVIDE_ZERO\n\n\n<mask token>\n\n\ndef test_mod_in_zero():\n expression = ... | [
16,
25,
26,
33,
36
] |
from os.path import abspath, dirname, join, basename
import numpy as np
import cv2
import xiuminglib as xm
logger, thisfile = xm.config.create_logger(abspath(__file__))
class EXR():
"""Reads EXR files.
EXR files can be generic or physically meaningful, such as depth, normal, etc.
When data loaded are p... | normal | {
"blob_id": "b9cce77d4d2b9ff5563d17927e21166f9c870e3d",
"index": 5220,
"step-1": "<mask token>\n\n\nclass EXR:\n \"\"\"Reads EXR files.\n\n EXR files can be generic or physically meaningful, such as depth, normal, etc.\n When data loaded are physically meaningful, these methods assume the EXR files\n ... | [
7,
9,
10,
11,
12
] |
# coding: utf-8
from mrcnn import utils
import numpy as np
import os
import skimage
class SlicesDataset(utils.Dataset):
""" Extension of maskrcnn dataset class to be used with our provided data. """
def load_slices(self, dataset_dir, n_images, n_patches, channels = ["base"]):
"""Load a ... | normal | {
"blob_id": "8675deb69eae04a722073432eaf69ce3d24a11ad",
"index": 9041,
"step-1": "<mask token>\n\n\nclass SlicesDataset(utils.Dataset):\n <mask token>\n <mask token>\n\n def load_image(self, image_id):\n \"\"\"Returns an image with a given id.\"\"\"\n info = self.image_info[image_id]\n ... | [
2,
4,
5,
6,
7
] |
from textmagic.rest import TextmagicRestClient
username = 'lucychibukhchyan'
api_key = 'sjbEMjfNrrglXY4zCFufIw9IPlZ3SA'
client = TextmagicRestClient(username, api_key)
message = client.message.create(phones="7206337812", text="wow i sent a text from python!!!!")
| normal | {
"blob_id": "1ba39cfc1187b0efc7fc7e905a15de8dc7f80e0d",
"index": 8888,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nusername = 'lucychibukhchyan'\napi_key = 'sjbEMjfNrrglXY4zCFufIw9IPlZ3SA'\nclient = TextmagicRestClient(username, api_key)\nmessage = client.message.create(phones='7206337812', text=\n ... | [
0,
1,
2,
3
] |
# Generated by Django 3.0.7 on 2020-07-03 11:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('descriptor', '0007_auto_20200702_1653'),
]
operations = [
migrations.CreateModel(
name='Paramet... | normal | {
"blob_id": "3a5d55ea5a2f4f6cf7aaf55055593db9f8bb3562",
"index": 6308,
"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 = [('descriptor'... | [
0,
1,
2,
3,
4
] |
'''
手写识别系统
构建识别类
Recognize
调用getResult()函数即可
'''
import operator
from numpy import *
from PIL import Image
from os import listdir
from io import BytesIO
def classify(inX, dataSet, labels, k):
dataSetSize = dataSet.shape[0] #训练数据集的行数
# 计算距离
diffMat = tile(inX, (dataSetSize,1)) - dataSet
sqDiffMat = ... | normal | {
"blob_id": "1ab5147ed8ce808de9667052b6d17f320d62484f",
"index": 4694,
"step-1": "<mask token>\n\n\ndef classify(inX, dataSet, labels, k):\n dataSetSize = dataSet.shape[0]\n diffMat = tile(inX, (dataSetSize, 1)) - dataSet\n sqDiffMat = diffMat ** 2\n sqDistances = sqDiffMat.sum(axis=1)\n distances... | [
3,
5,
6,
7,
8
] |
"""
1. Если в строке больше символов в нижнем регистре - вывести все в нижнем,
если больше в верхнем - вывести все в верхнем,
если поровну - вывести в противоположных регистрах.
2. Если в строке каждое слово начинается с заглавной буквы, тогда
добавить в начало строки 'done. '.
И... | normal | {
"blob_id": "c7c405535b2ca656d4d5f18013e3e2fdef70efea",
"index": 8088,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor char in string:\n if char.isupper():\n upp_regist += 1\n elif char.islower():\n low_regist += 1\nprint('Some string:', string)\nif upp_regist > low_regist:\n pr... | [
0,
1,
2,
3
] |
x = str(input("please input your name:"))
y = int(input("please input your age:"))
p = int(2017-y+100)
print("your name is:"+x)
print (p) | normal | {
"blob_id": "929f580e8e559f8309e19f72208bf4ff0d537668",
"index": 4935,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('your name is:' + x)\nprint(p)\n",
"step-3": "x = str(input('please input your name:'))\ny = int(input('please input your age:'))\np = int(2017 - y + 100)\nprint('your name is:' +... | [
0,
1,
2,
3
] |
import os
bind = "0.0.0.0:" + str(os.environ.get("MAESTRO_PORT", 5005))
workers = os.environ.get("MAESTRO_GWORKERS", 2)
| normal | {
"blob_id": "818e6842d4a1f8978ec14bca06981ec933c00376",
"index": 6280,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005))\nworkers = os.environ.get('MAESTRO_GWORKERS', 2)\n",
"step-3": "import os\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_... | [
0,
1,
2,
3
] |
"""A number can be broken into different contiguous sub-subsequence parts.
Suppose, a number 3245 can be broken into parts like 3 2 4 5 32 24 45 324 245.
And this number is a COLORFUL number, since product of every digit of a contiguous subsequence is different
"""
def colorful(A):
sA = str(A)
len_sA = len(s... | normal | {
"blob_id": "41013469e65e45f6c909d66c2a54eaf11dfd474c",
"index": 3077,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef colorful(A):\n sA = str(A)\n len_sA = len(sA)\n if len_sA == 1:\n return 1\n dig_list = []\n for i in range(len_sA):\n for j in range(i, len_sA):\n ... | [
0,
1,
2,
3
] |
# Generic function for updating Weblogic system resources
def update_system_resources(clusterName):
print "Cluster name is " + clusterName
startTransaction()
create_JMSSystemResource("/", "DummyJMSModule")
delete_JMSModule("/JMSSystemResources", "DummyJMSModule")
endTransaction()
print "update_s... | normal | {
"blob_id": "99ddc00bf1d0141118748aa98bcc3e7b8a0ff29e",
"index": 1503,
"step-1": "# Generic function for updating Weblogic system resources\ndef update_system_resources(clusterName):\n print \"Cluster name is \" + clusterName\n startTransaction()\n create_JMSSystemResource(\"/\", \"DummyJMSModule\")\n... | [
0
] |
import math
import numpy as np
import matplotlib.pyplot as plt
def test_func(x):
# x is vector; here of length 1
x = x[0]
return math.cos(x) * x**2 + x
def run_smac(max_fun=30):
from smac.facade.func_facade import fmin_smac
x, cost, smac = fmin_smac(func=test_func,
... | normal | {
"blob_id": "90218168841dc76febab67d1e992dfc993730ea4",
"index": 2455,
"step-1": "<mask token>\n\n\ndef run_smac(max_fun=30):\n from smac.facade.func_facade import fmin_smac\n x, cost, smac = fmin_smac(func=test_func, x0=[-0], bounds=[(-5, 5)],\n maxfun=max_fun, rng=1234)\n runhistory = smac.get_... | [
3,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
import scrapy
import re
import time
import random
import hashlib
from quotetutorial.items import ScrapyItem
import requests
import os
import io
import sys
# 科学技术部
class MostSpider(scrapy.Spider):
index = 12
name = 'most'
allowed_domains = ['www.most.gov.cn']
start_urls = [
... | normal | {
"blob_id": "3583ce664bc9f42ef8f751de8642997819e08e31",
"index": 7793,
"step-1": "<mask token>\n\n\nclass MostSpider(scrapy.Spider):\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\n def downloa... | [
2,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
import os
import re
import datetime
import sys
import codecs
import logging
import logging.handlers
import fnmatch
import time
import argparse
from antlr4 import *
from antlr4.tree.Trees import Trees
from lxml import etree
from AknJudgementClass import AknJudgementXML
from AknLega... | normal | {
"blob_id": "190f0bcbac946c410d964860fd5be8718011caa8",
"index": 2862,
"step-1": "# -*- coding: utf-8 -*-\r\nimport os\r\nimport re\r\nimport datetime\r\nimport sys\r\nimport codecs\r\nimport logging\r\nimport logging.handlers\r\nimport fnmatch\r\nimport time\r\nimport argparse\r\nfrom antlr4 import *\r\nfrom an... | [
0
] |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import pickle
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_absolute_error
from pyspark.sql.functions import split, concat,col
from sklearn.svm import SVR
test = True
# In[ ]:
dbutils.widgets.removeAll()
d... | normal | {
"blob_id": "e48addecdde632607a9c782ff78a769122daab6f",
"index": 1738,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndbutils.widgets.removeAll()\ndbutils.widgets.text('input_path', 'Not found', 'input_path')\n<mask token>\ndbutils.widgets.text('model_path', 'Not found', 'model_path')\n<mask token>\nif t... | [
0,
1,
2,
3,
4
] |
# code below
#taking filename as pyscript.py
from distutils.core import setup
import py2exe
setup(console=['pyscript.py'])
# command to run
# python setup.py pytoexe
| normal | {
"blob_id": "9fbf994cb99369ba0c20383007ce52c99248bacf",
"index": 8820,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(console=['pyscript.py'])\n",
"step-3": "from distutils.core import setup\nimport py2exe\nsetup(console=['pyscript.py'])\n",
"step-4": "\n# code below \n#taking filename as pyscr... | [
0,
1,
2,
3
] |
from timemachines.skatertools.testing.allregressiontests import REGRESSION_TESTS
import time
import random
TIMEOUT = 60*5
# Regression tests run occasionally to check various parts of hyper-param spaces, etc.
if __name__=='__main__':
start_time = time.time()
elapsed = time.time()-start_time
while elapsed ... | normal | {
"blob_id": "710bb0e0efc2c4a3ba9b1ae85e1c22e81f8ca68e",
"index": 7960,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n start_time = time.time()\n elapsed = time.time() - start_time\n while elapsed < TIMEOUT:\n a_test = random.choice(REGRESSION_TESTS)\n p... | [
0,
1,
2,
3,
4
] |
import ssl
import urllib
from urllib import request, response, error, parse, robotparser
context = ssl._create_unverified_context()
url = 'https://oauth.51job.com/get_login.php?client_id=000001&redirect_uri=https%3A%2F%2Funion.yingjiesheng.com%2Fapi_login.php&from_domain=yjs_web&display=default&state=7c893ec1be7b355a91... | normal | {
"blob_id": "2a37d02c7a0840e855a80adced4794fd757e353a",
"index": 2917,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(res.read().decode('utf-8'))\n",
"step-3": "<mask token>\ncontext = ssl._create_unverified_context()\nurl = (\n 'https://oauth.51job.com/get_login.php?client_id=000001&redirect_... | [
0,
1,
2,
3,
4
] |
# =============================================================================
# ######################## Creator: Rhys Aeron Williams #######################
# ######################## Last update: 14th March 2019 #######################
# =============================================================================
... | normal | {
"blob_id": "e89ca4907373318bd55d0833730a30d981414992",
"index": 2677,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif classifier is not None:\n print('model is loaded from ', model_file)\n<mask token>\nwhile 1:\n hasFrame, frame = cap.read()\n if not hasFrame:\n break\n h, w, bpp = ... | [
0,
1,
2,
3,
4
] |
import os
import sqlite3
import datetime
directory = 'C:\PyHelp'
if not os.path.exists(directory):
os.makedirs(directory)
rand_facts = '''• Exception is used as a base class for all exceptions. It's strongly recommended (but not yet required) that user exceptions are derived from this class too.
• System... | normal | {
"blob_id": "a2c93fd632a637d47f05e0a4fda851b465d03a31",
"index": 4674,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif not os.path.exists(directory):\n os.makedirs(directory)\n<mask token>\nif not file_exists:\n x = open(op, 'w')\n x.write(rand_facts)\n",
"step-3": "<mask token>\ndirectory =... | [
0,
1,
2,
3,
4
] |
a = (5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7)
b = []
for index, elements in enumerate (a):
if elements == 5:
b.append(index)
print(b) | normal | {
"blob_id": "d7876a078af8572e44b4eb16f3ec0898db73724d",
"index": 2118,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor index, elements in enumerate(a):\n if elements == 5:\n b.append(index)\nprint(b)\n",
"step-3": "a = 5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7\nb = []\nfor index, elements i... | [
0,
1,
2,
3
] |
from farmfs.fs import Path, ensure_link, ensure_readonly, ensure_symlink, ensure_copy, ftype_selector, FILE, is_readonly
from func_prototypes import typed, returned
from farmfs.util import safetype, pipeline, fmap, first, compose, invert, partial, repeater
from os.path import sep
from s3lib import Connection as s3conn,... | normal | {
"blob_id": "4fb1ece28cd7c6e2ac3a479dcbf81ee09ba14223",
"index": 3096,
"step-1": "<mask token>\n\n\nclass FileBlobstore:\n <mask token>\n\n def _csum_to_name(self, csum):\n \"\"\"Return string name of link relative to root\"\"\"\n return _checksum_to_path(csum)\n <mask token>\n <mask to... | [
8,
12,
16,
20,
27
] |
# -*- coding: utf-8 -*-
import urllib
from pingpp import http_client, util
class WxpubOauth:
"""
用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid
WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能
详细内容可参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
"""
@staticmethod
def get_openid(a... | normal | {
"blob_id": "58058065ac78ffbf7550416b751e1440976c7898",
"index": 8467,
"step-1": "# -*- coding: utf-8 -*-\nimport urllib\n\nfrom pingpp import http_client, util\n\n\nclass WxpubOauth:\n \"\"\"\n 用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid\n WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能\n 详细内容可参考http://mp.weixi... | [
0
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('notesapp', '0008_auto_20150819_1222'),
]
operations = [
migrations.Ren... | normal | {
"blob_id": "51af54c55834c4bdb8e1cbe4ac55b86bdc61bf4d",
"index": 458,
"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 = [('notesapp', '... | [
0,
1,
2,
3,
4
] |
def factorial(num):
assert num >= 0 and int(num) == num, 'Only positive integer accept'
if num in [0, 1]:
return 1
else:
return num * factorial(num - 1)
print(factorial(4.4))
| normal | {
"blob_id": "2a799d81d963f73d8018a99cbd963af166681b35",
"index": 9416,
"step-1": "<mask token>\n",
"step-2": "def factorial(num):\n assert num >= 0 and int(num) == num, 'Only positive integer accept'\n if num in [0, 1]:\n return 1\n else:\n return num * factorial(num - 1)\n\n\n<mask toke... | [
0,
1,
2
] |
import unittest
import gym
import torch
from all.environments import DuplicateEnvironment, GymEnvironment
def make_vec_env(num_envs=3):
env = [GymEnvironment('CartPole-v0') for i in range(num_envs)]
return env
class DuplicateEnvironmentTest(unittest.TestCase):
def test_env_name(self):
env = Dupl... | normal | {
"blob_id": "e01eced7c43aae354047fbf29028c601d1daae50",
"index": 9636,
"step-1": "<mask token>\n\n\nclass DuplicateEnvironmentTest(unittest.TestCase):\n <mask token>\n\n def test_num_envs(self):\n num_envs = 5\n env = DuplicateEnvironment(make_vec_env(num_envs))\n self.assertEqual(env.... | [
4,
5,
6,
7,
9
] |
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
plus = True # In the last digit, we should add one as the quesiton requries
indexList = range(len(digits))
indexList.reverse()
for i in indexList:
... | normal | {
"blob_id": "02a228c479a6c94858f7e8ef73a7c8528def871e",
"index": 9423,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def plusOne(self, digits):\n \"\"\"\n :type digits: List[int]\n :rtype: List[int]\n ... | [
0,
1,
2,
3
] |
from __future__ import print_function, unicode_literals
import sys
import ast
import os
import tokenize
import warnings
from io import StringIO
def interleave(inter, f, seq):
"""Call f on each item in seq, calling inter() in between.
"""
seq = iter(seq)
try:
f(next(seq))
except StopIteratio... | normal | {
"blob_id": "8443d208a6a6bef82240235eeadbf6f8eaf77bcb",
"index": 2995,
"step-1": "<mask token>\n\n\nclass CodeGenerator:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask t... | [
43,
45,
82,
94,
103
] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Yuan
import time
import sys
def jindutiao(jindu,zonge):
ret = (jindu/zonge)*100
r = "\r%s%d%%"%("="*jindu,ret)
sys.stdout.write(r)
sys.stdout.flush()
if __name__ =="__main__":
for i in range(101):
time.sleep(0.1)
jindutia... | normal | {
"blob_id": "f7afd08fb8316e44c314d17ef382b98dde7eef91",
"index": 1605,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef jindutiao(jindu, zonge):\n ret = jindu / zonge * 100\n r = '\\r%s%d%%' % ('=' * jindu, ret)\n sys.stdout.write(r)\n sys.stdout.flush()\n\n\n<mask token>\n",
"step-3"... | [
0,
1,
2,
3,
4
] |
team = input("Wymien wszystkich czlonkow swojego zespolu: ").split(",")
for member in team:
print("Hello, " + member)
| normal | {
"blob_id": "5d3f7d74cf1cc2612d599c65393abed11181c981",
"index": 2300,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor member in team:\n print('Hello, ' + member)\n",
"step-3": "team = input('Wymien wszystkich czlonkow swojego zespolu: ').split(',')\nfor member in team:\n print('Hello, ' + mem... | [
0,
1,
2,
3
] |
wage=5
print("%d시간에 %d%s 벌었습니다." %(1, wage*1, "달러"))
print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달러"))
print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원"))
print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))
| normal | {
"blob_id": "2092ead8b8f268a22711b8af8052241c1ac00c15",
"index": 14,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('%d시간에 %d%s 벌었습니다.' % (1, wage * 1, '달러'))\nprint('%d시간에 %d%s 벌었습니다.' % (5, wage * 5, '달러'))\nprint('%d시간에 %.1f%s 벌었습니다' % (1, 5710.8, '원'))\nprint('%d시간에 %.1f%s 벌었습니다' % (5, 28554.0,... | [
0,
1,
2,
3
] |
b = int(input('enter anum '))
for a in range(1, 11, 1):
print(b, 'x', a, '=', a * b)
| normal | {
"blob_id": "bf83556b8e8855a0e410fcfb3b42161fbc681830",
"index": 3075,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor a in range(1, 11, 1):\n print(b, 'x', a, '=', a * b)\n",
"step-3": "b = int(input('enter anum '))\nfor a in range(1, 11, 1):\n print(b, 'x', a, '=', a * b)\n",
"step-4": nul... | [
0,
1,
2
] |
#Άσκηση 3.2: Ουρά δύο άκρων
print("Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ενώ,\nαν θέλεις να βγάλεις το τελευταιο, πληκτρολόγησε 'r'\n ")
newNumber = input("Για να ξεκιν... | normal | {
"blob_id": "87bcf53d1c93645a08b10ba0d02edf0d5b0a4906",
"index": 5664,
"step-1": "<mask token>\n",
"step-2": "print(\n \"\"\"Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import optparse
import os
import shutil
import sys
from AutoCrab.AutoCrab2 import core
def main():
parser = optparse.OptionParser()
parser.add_option("-r", "--recursive", dest="recursive", action="store_true", help="Recursively look for CRAB job files and directories.")
(opts, args) = parser... | normal | {
"blob_id": "d1fe06766958e8532c49d33e887d6c4996573c22",
"index": 4964,
"step-1": "#!/usr/bin/env python\n\nimport optparse\nimport os\nimport shutil\nimport sys\n\nfrom AutoCrab.AutoCrab2 import core\n\ndef main():\n\tparser = optparse.OptionParser()\n\tparser.add_option(\"-r\", \"--recursive\", dest=\"recursive... | [
0
] |
import requests
from bs4 import BeautifulSoup
import json
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
url = 'http://api.tvmaze.com/singlesearch/shows?q=game+of+throne&embed=episodes'
response = requests.get(url, headers = hea... | normal | {
"blob_id": "d625e6724a3fe077a6f80b6de6b1f5bb0b95d47d",
"index": 4612,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('got_info.json', 'w') as f:\n f.write(x)\n",
"step-3": "<mask token>\nheaders = {'User-Agent':\n 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gec... | [
0,
1,
2,
3,
4
] |
from azureml.core.compute import AksCompute
from azureml.core.model import Model, InferenceConfig
from azureml.core.webservice import AksWebservice
workspace_name = ""
subscription_id = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
resource_group = "XXXXXXXXXXXXXXXXX"
workspace_region = "eastus2"
https_cert = "XXXXX"
aks_nam... | normal | {
"blob_id": "2941ecde72325d46b5c3899d4b1a213daff67147",
"index": 2613,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprov_config.enable_ssl(leaf_domain_label=https_cert)\n<mask token>\naks_service.wait_for_deployment(show_output=True)\nprint(aks_service.state)\n",
"step-3": "<mask token>\nworkspace_na... | [
0,
1,
2,
3,
4
] |
from pynhost.grammars import extension
from pynhost.grammars import baseutils as bu
class AtomExtensionGrammar(extension.ExtensionGrammar):
activate = '{ctrl+alt+8}'
search_chars = bu.merge_dicts(bu.OPERATORS, bu.ALPHABET, bu.CHAR_MAP)
def __init__(self):
super().__init__()
self.app_conte... | normal | {
"blob_id": "ac5c6a534d5131438d9590b070e6b392d4ebed0c",
"index": 9764,
"step-1": "<mask token>\n\n\nclass AtomExtensionGrammar(extension.ExtensionGrammar):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass AtomExtensionGrammar(extension.ExtensionGrammar):\n <mask t... | [
1,
2,
3,
4
] |
"""A twitter bot that retweets positive tweets from cool lists."""
import sys
import os
from random import choice
from random import shuffle
import twitter
import unirest
twitter = twitter.Api(
consumer_key=os.environ['TWITTER_CONSUMER_KEY'],
consumer_secret=os.environ['TWITTER_CONSUMER_SECRET'],
access_... | normal | {
"blob_id": "9dddae5e85bda67bdbb6f0336a29949cb1f4d59e",
"index": 3798,
"step-1": "\"\"\"A twitter bot that retweets positive tweets from cool lists.\"\"\"\n\nimport sys\nimport os\nfrom random import choice\nfrom random import shuffle\nimport twitter\nimport unirest\n\n\ntwitter = twitter.Api(\n consumer_key=... | [
0
] |
'''
BMI=weight*0.45259227/(hei*0.0254)**
'''
wht=2
if wht==0:
print("wht is",wht)
else:
print("whtsdsb")
#今天也完成了100波比跳
wei=float(input("wei="))
hei=float(input("hei="))
bmi=(wei*0.45259227)/((hei*0.0254)**2)
print("BMI=",bmi)
if bmi<18.5:
print("too light")
elif bmi<25:
print("normal")
elif bmi<30:
... | normal | {
"blob_id": "48d0bfdc607a4605ef82f5c7dc7fd6fc85c4255f",
"index": 377,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif wht == 0:\n print('wht is', wht)\nelse:\n print('whtsdsb')\n<mask token>\nprint('BMI=', bmi)\nif bmi < 18.5:\n print('too light')\nelif bmi < 25:\n print('normal')\nelif bmi... | [
0,
1,
2,
3
] |
# Generated by Django 3.2.4 on 2021-06-29 13:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_blogdetail'),
]
operations = [
migrations.RenameField(
model_name='bloglist',
old_name='about',
new... | normal | {
"blob_id": "1cf5ce11b965d65426ed421ef369954c59d7eba9",
"index": 3199,
"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 = [('blog', '000... | [
0,
1,
2,
3,
4
] |
import pygame
class MenuManager():
def __init__(self, manager):
print "Menu manager created. Continue? [y/n]"
self.manager = manager
self.paused = False
self.intro_done = False
self.menus = []
self.menus.append(Pause_menu(self))
self.menus.append(St... | normal | {
"blob_id": "f0ac2e66cc7fe9730c77a8feb77a74e26986a3f8",
"index": 1380,
"step-1": "import pygame\r\n\r\nclass MenuManager():\r\n def __init__(self, manager):\r\n print \"Menu manager created. Continue? [y/n]\"\r\n self.manager = manager\r\n self.paused = False\r\n self.intro_done = ... | [
0
] |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param A : root node of tree
# @return a list of integers
def solve(self, root):
if not root:
return
result = []
result.append(root.val)
... | normal | {
"blob_id": "a49ee1e3f600d83486d0cf2396ed261c61fdf926",
"index": 1711,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def leaf_nodes_util(self, curr, result):\n if not curr:\n return\n self.leaf_nodes_util(self, curr.left, result)\n if not curr.left and not ... | [
3,
6,
7,
8,
9
] |
from django.shortcuts import render, redirect
from .models import League, Team, Player
from django.db.models import Count
from . import team_maker
def index(request):
baseball = League.objects.filter(name__contains='Baseball')
women_league = League.objects.filter(name__contains='women')
hockey_league = ... | normal | {
"blob_id": "49703775da87e8cbbe78a69c91a68128c3fd78e1",
"index": 3363,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n baseball = League.objects.filter(name__contains='Baseball')\n women_league = League.objects.filter(name__contains='women')\n hockey_league = League.obje... | [
0,
1,
2,
3,
4
] |
# 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, software
# d... | normal | {
"blob_id": "932502c93dd7dfc095adfe2ab88b4404396d9845",
"index": 8680,
"step-1": "<mask token>\n\n\nclass TestIetAdmDriver(tf.TargetDriverFixture):\n <mask token>\n\n def test_get_target(self):\n tmp_file = six.StringIO()\n tmp_file.write(\n \"\"\"tid:1 name:iqn.2010-10.org.opensta... | [
3,
7,
8,
9,
12
] |
########################################################################################################################
# DEVELOPER README: #
# This is the main script, where the GUI is initialised from. All of the main ... | normal | {
"blob_id": "cc58e3944ee2bfb55cc2867395782a94c196e635",
"index": 6784,
"step-1": "########################################################################################################################\n# DEVELOPER README: ... | [
0
] |
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
] |
# coding: UTF-8
import fileinput
import io
from locale import str
import os
__author__ = 'lidong'
def getDirList( p ):
p = p.replace( "/","\\")
if p[ -1] != "\\":
p = p+"\\"
a = os.listdir( p )
for x in a:
if(os.path.isfile( p + x )):
a, b = os.path.splitext( p + x )
... | normal | {
"blob_id": "e553da92b1bb5dfaa0fb7c702f5be4f66201c75b",
"index": 8843,
"step-1": "<mask token>\n\n\ndef getDirList(p):\n p = p.replace('/', '\\\\')\n if p[-1] != '\\\\':\n p = p + '\\\\'\n a = os.listdir(p)\n for x in a:\n if os.path.isfile(p + x):\n a, b = os.path.splitext(p... | [
2,
3,
4,
5,
6
] |
# class Mob:
# def __init__(self, name, health=10):
# self.name = name
# self.health = health
# def get_hit(self, power):
# self.health -= power
# print(
# f"I, {self.name} was hit for {power} points. {self.health} pts remaining")
# hero = Mob("Sir Barks-alot", 30)... | normal | {
"blob_id": "b1573f80395d31017ceacbb998e421daf20ab75f",
"index": 6961,
"step-1": "class Vehicle:\n\n def __init__(self, category, top_speed, acceleration, position=0, speed\n =0, wheels=4):\n self.category = category\n self.speed = speed\n self.top_speed = top_speed\n self.p... | [
3,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
"""Code handling the concurrency of data analysis."""
| normal | {
"blob_id": "2e23225ec4cd693f5e9460a13d64206f184a86a0",
"index": 3043,
"step-1": "<mask token>\n",
"step-2": "# -*- coding: utf-8 -*-\n\"\"\"Code handling the concurrency of data analysis.\"\"\"\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
# Generated by Django 3.1.4 on 2021-01-11 16:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tutorials', '0003_auto_20210111_1705'),
]
operations = [
migrations.AlterField(
model_name='tutorial',
name='upload'... | normal | {
"blob_id": "ac664cd7d62f89399e37f74e0234b3ad244fe460",
"index": 6158,
"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 = [('tutorials',... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
def check(n):
if n == 0 :
print "neither Positive nor Negative"
if n < 0 :
print "Negative"
if n > 0 :
print "Positive"
print "10 is ", check(10)
print "-5 is ", check(-5)
print "0 is ", check(0) | normal | {
"blob_id": "9c6bb885c05ee13a283b09861a5aa7c5e62677cb",
"index": 1008,
"step-1": "#!/usr/bin/python\ndef check(n):\n if n == 0 :\n print \"neither Positive nor Negative\"\n if n < 0 :\n print \"Negative\"\n if n > 0 :\n print \"Positive\"\n\n\n\nprint \"10 is \", check(10)\nprint \"... | [
0
] |
'''
HTTP Test for channel details
'''
import sys
sys.path.append('..')
from json import load, dumps
import urllib.request
import urllib.parse
import pytest
PORT_NUMBER = '5204'
BASE_URL = 'http://127.0.0.1:' + PORT_NUMBER
#BASE_URL now is 'http://127.0.0.1:5321'
@pytest.fixture
def register_loginx2_create_invite():
... | normal | {
"blob_id": "c22b37bff74de7ea99f2009652dd00e57bb316b8",
"index": 4383,
"step-1": "<mask token>\n\n\n@pytest.fixture\ndef register_loginx2_create_invite():\n \"\"\"\n Registers, logs in 2 users, creates new channel\n \"\"\"\n req = urllib.request.Request(f'{BASE_URL}/workspace/reset', headers={\n ... | [
4,
5,
6,
7,
8
] |
from flask import Flask, app
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
DBNAME = 'database.db'
def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT'
app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}'
db.init_app(app)
from .views import v... | normal | {
"blob_id": "c6fdb9c405427a3583a59065f77c75c4aa781405",
"index": 5417,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT'\n app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}'\n db.init_app(... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
""" Greets the Pep Boys.
"""
for name in "Manny", "Moe", "Jack":
print("Hi ya", name + '!')
| normal | {
"blob_id": "81ff77064a299b4fcd456f341ecb40ba5afe3295",
"index": 1714,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor name in ('Manny', 'Moe', 'Jack'):\n print('Hi ya', name + '!')\n",
"step-3": "#!/usr/bin/env python3\n\"\"\" Greets the Pep Boys.\n\"\"\"\n\nfor name in \"Manny\", \"Moe\", \"Jac... | [
0,
1,
2
] |
"""
bets.models
Models relating to bets placed
"""
import datetime
from mongoengine import *
from decimal import Decimal
from app.groups.models import Group
from app.users.models import User
from app.matches.models import Match
from app.project.config import CURRENCIES
class GroupMatch(Document):
"""Associate ea... | normal | {
"blob_id": "0e8a11c5b5a95929c533597d79ee4f3d037c13e0",
"index": 4961,
"step-1": "<mask token>\n\n\nclass Bet(Document):\n \"\"\"Bet that a user has placed\"\"\"\n OUTCOME = (-1, 'Team 2 wins'), (0, 'Draw'), (1, 'Team 1 wins')\n group_match = ReferenceField(GroupMatch)\n user = ReferenceField(User)\n... | [
9,
10,
15,
16,
17
] |
#!/usr/bin/env python
# coding: utf-8
# # Lesson 2 Demo 3: Creating Fact and Dimension Tables with Star Schema
#
# <img src="images/postgresSQLlogo.png" width="250" height="250">
# ### Walk through the basics of modeling data using Fact and Dimension tables. In this demo, we will:<br>
# <ol><li>Create both Fact and... | normal | {
"blob_id": "70964ac617847dd4bf4a60a142afc94d0f284a24",
"index": 7621,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n conn = psycopg2.connect(\n 'host=127.0.0.1 dbname=studentdb user=student password=student')\nexcept psycopg2.Error as e:\n print('Error: Could not make connection to t... | [
0,
1,
2,
3,
4
] |
from __future__ import division
__author__ = 'Vladimir Iglovikov'
import pandas as pd
from sklearn.preprocessing import LabelEncoder
import numpy as np
from sklearn.cross_validation import ShuffleSplit
from sklearn.metrics import mean_squared_error
import math
from sklearn.ensemble import RandomForestRegressor
joined... | normal | {
"blob_id": "610fde0db6e3fe0a54a008287e0c36b25b7a482f",
"index": 8200,
"step-1": "from __future__ import division\n__author__ = 'Vladimir Iglovikov'\n\nimport pandas as pd\nfrom sklearn.preprocessing import LabelEncoder\nimport numpy as np\nfrom sklearn.cross_validation import ShuffleSplit\nfrom sklearn.metrics ... | [
0
] |
# pyre-ignore-all-errors
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
from wallet.storage import db_session, engine, Base
from wallet.storage.models import User, Account
from wallet.types import RegistrationStatus
from diem_utils.types.currencies import FiatCurrency
def clear_db(... | normal | {
"blob_id": "a6bd10723bd89dd08605f7a4abf17ccf9726b3f5",
"index": 8937,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef setup_fake_data() ->None:\n clear_db()\n fake_users = [User(username='sunmi', registration_status=\n RegistrationStatus.Registered, selected_fiat_currency=FiatCurrenc... | [
0,
1,
2,
3,
4
] |
# -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1428612037.145222
_enable_loop = True
_template_filename = 'C:\\Users\\Cody\\Desktop\\Heritage\\chf\\templates/account.rentalcart.html'
_t... | normal | {
"blob_id": "57967f36a45bb3ea62708bbbb5b2f4ddb0f4bb16",
"index": 29,
"step-1": "<mask token>\n\n\ndef _mako_get_namespace(context, name):\n try:\n return context.namespaces[__name__, name]\n except KeyError:\n _mako_generate_namespaces(context)\n return context.namespaces[__name__, nam... | [
3,
5,
6,
7,
8
] |
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
t = []
while x != 0:
t.append(x % 10)
x /= 10
i, j = 0, len(t) - 1
while i < j:
if t[i]... | normal | {
"blob_id": "ef1b759872de6602646ce095823ff37f043ffd9d",
"index": 5148,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def isPalindrome(self, x):\n \"\"\"\n :type x: int\n :rtype: bool\n \"\"\"\n ... | [
0,
1,
2
] |
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
] |
def increment(number: int) ->int:
"""Increment a number.
Args:
number (int): The number to increment.
Returns:
int: The incremented number.
"""
return number + 1
| normal | {
"blob_id": "b0cc2efda4d6586b66e04b41dfe1bbce8d009e2e",
"index": 6871,
"step-1": "<mask token>\n",
"step-2": "def increment(number: int) ->int:\n \"\"\"Increment a number.\n\n Args:\n number (int): The number to increment.\n\n Returns:\n int: The incremented number.\n \"\"\"\n retu... | [
0,
1
] |
import pymel.core as pm
from alShaders import *
class AEalLayerColorTemplate(alShadersTemplate):
controls = {}
params = {}
def setup(self):
self.params.clear()
self.params["layer1"] = Param("layer1", "Layer 1", "The background layer (will be blended over black if its alpha is not 1.", "rgb", presets=None)
sel... | normal | {
"blob_id": "c847e7abe36b62c4518bb535789064e22b5f1db7",
"index": 5750,
"step-1": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <ma... | [
1,
2,
3,
4,
5
] |
class TimeInterval(object):
def __init__(self, start_time, end_time):
self.start_time = start_time
self.end_time = end_time
| normal | {
"blob_id": "9d772d5500593583907b65bc2c81490e61375e8b",
"index": 8081,
"step-1": "<mask token>\n",
"step-2": "class TimeInterval(object):\n <mask token>\n",
"step-3": "class TimeInterval(object):\n\n def __init__(self, start_time, end_time):\n self.start_time = start_time\n self.end_time ... | [
0,
1,
2
] |
import os
import re
import click
import pandas as pd
from pymongo import MongoClient
from pathlib import Path, PurePath
def extract_dir_name(input_file):
"""
creates a directory path based on the specified file name
:param input_file: file bane
:return: full path, minus extension
"""
... | normal | {
"blob_id": "f831b77850dfe22232092f66705e36970828a75b",
"index": 4975,
"step-1": "<mask token>\n\n\ndef open_dir(input_path, patterns):\n \"\"\"\n Opens the specified input path and returns any located excel file\n :param patterns: the file extensions to glob over (eg xls, csv)\n :param input_path: t... | [
1,
2,
3,
5,
6
] |
from django.contrib import admin
from orders.models import OrderModel
@admin.register(OrderModel)
class OrderAdmin(admin.ModelAdmin):
list_display = ['first_name', 'phone']
| normal | {
"blob_id": "a238175c94764137bfc8fac1ce67436016b1591a",
"index": 1519,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@admin.register(OrderModel)\nclass OrderAdmin(admin.ModelAdmin):\n <mask token>\n",
"step-3": "<mask token>\n\n\n@admin.register(OrderModel)\nclass OrderAdmin(admin.ModelAdmin):\... | [
0,
1,
2,
3
] |
# type: ignore[no-redef]
import pytest
@pytest.mark.asyncio
@pytest.mark.core
async def test_async_executor(executor):
def func():
pass
result = await executor.run(func)
assert result is None
def func():
return 1
result = await executor.run(func)
assert result == 1
def ... | normal | {
"blob_id": "67b483d9d002cc66dd368cf53fdc49ebb7b4f4d4",
"index": 9556,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.mark.asyncio\n@pytest.mark.core\nasync def test_async_executor(executor):\n\n def func():\n pass\n result = await executor.run(func)\n assert result is None\n\... | [
0,
1,
2,
3
] |
# Celery配置文件
# 指定消息队列为Redis
broker_url = "redis://120.78.168.67/10"
CELERY_RESULT_BACKEND = "redis://120.78.168.67/0"
CELERY_TIMEZONE = 'Asia/Shanghai'
| normal | {
"blob_id": "095374aa7613f163fedbd7d253219478108d4f42",
"index": 992,
"step-1": "<mask token>\n",
"step-2": "broker_url = 'redis://120.78.168.67/10'\nCELERY_RESULT_BACKEND = 'redis://120.78.168.67/0'\nCELERY_TIMEZONE = 'Asia/Shanghai'\n",
"step-3": "# Celery配置文件\n\n# 指定消息队列为Redis\nbroker_url = \"redis://120.... | [
0,
1,
2
] |
while True:
print("running")
| normal | {
"blob_id": "8917481957ecd4c9692cfa93df0b759feaa344af",
"index": 4944,
"step-1": "<mask token>\n",
"step-2": "while True:\n print('running')\n",
"step-3": "while True:\n print(\"running\")\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# Generated by Django 3.2.3 on 2021-05-16 07:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('problem', '0002_problem_... | normal | {
"blob_id": "7040db119f8fd6da78499fc732e291280228ca10",
"index": 1852,
"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 = [migrations.sw... | [
0,
1,
2,
3,
4
] |
import tkinter as tk
import cnt_script as sW
import key_script as kW
import text_script as tW
class MainWindow(tk.Tk):
def __init__(self):
super().__init__()
self.title("Main Window")
self.geometry("600x400+30+30")
tk.Button(self, text = "Count Tags", command = self.new_ta... | normal | {
"blob_id": "1482c8276f9cfc912293356d04e08307edf6d367",
"index": 5133,
"step-1": "<mask token>\n\n\nclass MainWindow(tk.Tk):\n\n def __init__(self):\n super().__init__()\n self.title('Main Window')\n self.geometry('600x400+30+30')\n tk.Button(self, text='Count Tags', command=self.n... | [
4,
5,
7,
8,
11
] |
import pathlib, binascii
from textwrap import wrap
from PIL import Image
import struct
def loadFile():
global data
x = 0
data = []
subs = ["image", "text file"]
exts = [".jpg", ".txt"]
while x < 2:
check = pathlib.Path(input(f"Enter {subs[x]} name: ")).with_suffix(exts[x]) #... | normal | {
"blob_id": "aae09dafeb10a1f9ed260439e63e4aaadadc3768",
"index": 2051,
"step-1": "<mask token>\n\n\ndef loadFile():\n global data\n x = 0\n data = []\n subs = ['image', 'text file']\n exts = ['.jpg', '.txt']\n while x < 2:\n check = pathlib.Path(input(f'Enter {subs[x]} name: ')).with_suf... | [
4,
5,
6,
7,
8
] |
with open('dwarfs.txt') as fh:
i = 1
for line in fh:
print("[%d] %s" % (i, line))
i += 1
| normal | {
"blob_id": "18c4c1e1ee0df835895397488b270a47b1620c30",
"index": 8032,
"step-1": "<mask token>\n",
"step-2": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n print('[%d] %s' % (i, line))\n i += 1\n",
"step-3": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n ... | [
0,
1,
2
] |
from mcse.core.driver import BaseDriver_
class DimerGridSearch(BaseDriver_):
"""
Generates all dimer structures that should be considered for a grid search
to find the best dimer arangements. Grid search is performed over all
x,y,z positions for the COM and all orientations of the molecule. Only
... | normal | {
"blob_id": "9db4bca3e907d70d9696f98506efb6d6042b5723",
"index": 6710,
"step-1": "<mask token>\n\n\nclass DimerGridSearch(BaseDriver_):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DimerGridSearch(BaseDriver_):\n <mask token>\n\n def __init__(self, folder='', min_sr=0.75, ma... | [
1,
2,
3,
4,
5
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.