code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.... | normal | {
"blob_id": "6743a4f3c9118e790e52b586a36d71a735101702",
"index": 1901,
"step-1": "<mask token>\n\n\nclass CompanyInfo(object):\n\n def __init__(self):\n self._alter_list = None\n self._basic_info = None\n self._case_info_list = None\n self._entinv_list = None\n self._fr_posi... | [
14,
18,
19,
20,
22
] |
#Week 5
#Task 1.1
a = 13
b = 14
calculation = a + 1 <=b
calculation2 = a + 1 >=b
calculation3 = a + 1 !=b
print (calculation)
print (calculation2)
print (calculation3)
#Task 1.2
myage = input("How old are you : ")
print ("Hi there, You are " +myage+ " years old")
#Task 1.3
num1 = input("Enter the first number : ")
num2... | normal | {
"blob_id": "03f73a55e0a0773bbdbb0d5e29a2db598ba2e080",
"index": 149,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(calculation)\nprint(calculation2)\nprint(calculation3)\n<mask token>\nprint('Hi there, You are ' + myage + ' years old')\n<mask token>\nprint('The result is ' + result)\nprint('avera... | [
0,
1,
2,
3
] |
import pickle
from sklearn import linear_model
from sklearn.model_selection import train_test_split
import random
from sklearn.manifold import TSNE
import matplotlib
def loadXY():
zippedXY = pickle.load(open("../Vectorizer/zippedXY_wff_2k.p","rb"))
#random.shuffle(zippedXY)
X,Y = zip(*zippedXY)
return X,Y
def out... | normal | {
"blob_id": "cb13011def8fc7ed6a2e98a794343857e3e34562",
"index": 3142,
"step-1": "import pickle\nfrom sklearn import linear_model\nfrom sklearn.model_selection import train_test_split\nimport random\nfrom sklearn.manifold import TSNE\nimport matplotlib\n\ndef loadXY():\n\tzippedXY = pickle.load(open(\"../Vectori... | [
0
] |
import datetime
class assignmentObject:
def __init__(self, name, day):
self.name = name
self.day = day
| normal | {
"blob_id": "1673214215043644e1a878ed7c30b69064f1a022",
"index": 5375,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass assignmentObject:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass assignmentObject:\n\n def __init__(self, name, day):\n self.name = name\n self.day ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import rospy
from racecar_control.msg import drive_param
import curses
forward = 0;
left = 0;
stdscr = curses.initscr()
curses.cbreak()
stdscr.keypad(1)
rospy.init_node('keyop', anonymous=True)
pub = rospy.Publisher('drive_parameters', drive_param, queue_size=10)
stdscr.refresh()
key = ''
... | normal | {
"blob_id": "fb332808890e369d1439d1dba61244a0f7b89301",
"index": 4524,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncurses.cbreak()\nstdscr.keypad(1)\nrospy.init_node('keyop', anonymous=True)\n<mask token>\nstdscr.refresh()\n<mask token>\nwhile key != ord('q'):\n key = stdscr.getch()\n stdscr.ref... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
print ("—— 七、Python爬虫实战演练:爬取百度百科1000个页面的数据 ——");
print ("—— 7.2、调度程序 ——");
print ("————— Python爬虫:1、总教程程序 ———————————————");
from Reptilian.baike_spider import url_manager, html_downloader, html_parser, html_outputer
class SpiderMain(object):
# 构造函数初始化各个对象
def __init__(self):
... | normal | {
"blob_id": "e99a81a5600aad6111bb2694cbda02021ccfd71c",
"index": 2817,
"step-1": "<mask token>\n\n\nclass SpiderMain(object):\n <mask token>\n\n def craw(self, root_url):\n count = 1\n self.urls.add_new_url(root_url)\n while self.urls.has_new_url():\n try:\n n... | [
2,
3,
4,
5,
6
] |
"""
bubble sort
start at beginning switch to left if smaller - very naive approach
n-1 comparisons, n-1 iterations
(n-1)^2
worst case: O(n^2) = average case
best case: O(n)
space complexity: O(1)
"""
def bubbleSort(list):
for num in range(len(list)-1,0,-1):
for i in range(num):
if list[i] > list... | normal | {
"blob_id": "29c25721a4754650f0d5d63d6cc3215cb0ea1b3e",
"index": 7849,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef bubbleSort(list):\n for num in range(len(list) - 1, 0, -1):\n for i in range(num):\n if list[i] > list[i + 1]:\n temp = list[i]\n ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
"""
This example shows how to create an unstructured grid.
"""
import vtk
import numpy as np
import pickle as pkl
colors_list = pkl.load(open('permuted_colors.pkl','rb'))
meta = pkl.load(open('v_atlas/meta_information.pkl','rb'))
def main():
colors = vtk.vtkNamedColors()
Data=np.load(... | normal | {
"blob_id": "7261c5f9ac87c8337383daec312372b345ab7652",
"index": 4109,
"step-1": "<mask token>\n\n\ndef main():\n colors = vtk.vtkNamedColors()\n Data = np.load('tessaltions_compressed.npz')\n indices = meta['sorted_keys']\n struct_D = {}\n for i, s in enumerate(set([x[0] for x in indices])):\n ... | [
1,
2,
3,
4,
5
] |
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
# Raspberry Pi pin configuration:
RST = 24
# Note the following are only used with SPI:
DC = 23
SPI_PORT = 0
SPI_DEVICE = 0
# Beaglebone Black pin configuration:
# RST = 'P9_12'
# Note the following are only used with SPI:
# DC = 'P9_15'
# SPI_PORT = 1
# SPI_DEV... | normal | {
"blob_id": "d8cbed25f4c97be5a74a6e1f097fcb9fa9439a9a",
"index": 8160,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndisp.begin()\ndisp.clear()\ndisp.display()\n",
"step-3": "<mask token>\nRST = 24\nDC = 23\nSPI_PORT = 0\nSPI_DEVICE = 0\ndisp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.S... | [
0,
1,
2,
3,
4
] |
import os
import re
import time
import numpy as np
import pandas as pd
from sklearn.cluster import AgglomerativeClustering
import math
import edlib
from progress.bar import IncrementalBar as Bar
from multiprocessing import Pool
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--pools",
... | normal | {
"blob_id": "7ae328bcfdec2d17fceb5d707f13cf495fde4469",
"index": 7490,
"step-1": "<mask token>\n\n\nclass AlignmentProfile:\n\n def __init__(self, width, df, identifier):\n self.ident = identifier\n self.profile = np.zeros((5, width))\n self.repre_sq = ''\n self.seq_alignments = No... | [
5,
7,
8,
9,
11
] |
my_list = [9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 4, 4, 4, 2, 2, 1]
new_num = int(input('Enter a new number - '))
i = 0
for n in my_list:
if new_num <= n:
i += 1
my_list.insert(i, float(new_num))
print(my_list)
| normal | {
"blob_id": "be16e13c0e03952e45f98b175975795bba19cf9a",
"index": 2775,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor n in my_list:\n if new_num <= n:\n i += 1\nmy_list.insert(i, float(new_num))\nprint(my_list)\n",
"step-3": "my_list = [9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 4, 4, 4, 2, 2, 1]\nnew... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
import os
import sys, getopt
import paho.mqtt.client as mqtt
import random
import _thread
import time
import json
HOST = '0.0.0.0'
PORT = 9090
# gb_freq = 0
CONFIG_PATH = 'config/config.cfg'
ITEMS_PATH = 'config/items.cfg'
MILISECOND = 0.001
class Item(object):
def __init__(self, string):
... | normal | {
"blob_id": "3375bc94d214b0b1c67986d35b0587714dd63bcd",
"index": 7723,
"step-1": "<mask token>\n\n\nclass Item(object):\n <mask token>\n\n def convert_string_to_item(self, string):\n tokens = str(string).split(',')\n self._platform_type = tokens[0]\n self._sensor_name = tokens[1]\n ... | [
13,
17,
18,
19,
20
] |
COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c'
DEPLOY_SLUG = 'al-qassemi'
NUM_SLIDES_AFTER_CONTENT = 2
# Configuration
AUDIO = True
VIDEO = False
FILMSTRIP = False
PROGRESS_BAR = False | normal | {
"blob_id": "f398b724fc28bc25ddb8baf492f34075db0c1f61",
"index": 7703,
"step-1": "<mask token>\n",
"step-2": "COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c'\nDEPLOY_SLUG = 'al-qassemi'\nNUM_SLIDES_AFTER_CONTENT = 2\nAUDIO = True\nVIDEO = False\nFILMSTRIP = False\nPROGRESS_BAR = False\n",
... | [
0,
1,
2
] |
#-*- coding:utf-8 -*-
'''
'''
from flask import Flask, jsonify
app = Flask(__name__)
app.debug = True
from datetime import timedelta
from flask import make_response, request, current_app, render_template
from functools import update_wrapper
import json
from subprocess import *
def crossdomain(origin=None, methods=No... | normal | {
"blob_id": "70c78021a2544ea372545b037ed55298c26391d1",
"index": 1182,
"step-1": "<mask token>\n\n\ndef getIkbResult(search_str):\n ans_list = get_search_res('ikb', 'kb', search_str)\n for i in ans_list:\n i['kb_id'] = i.pop('id')\n return ans_list\n\n\ndef get_search_res(index, doc_type, query):... | [
4,
5,
7,
8,
10
] |
from datetime import date
import config
import datetime
import numpy
import pandas
import data_sources
from data_sources import POPULATION, convert_to_ccaa_iso
import material_line_chart
import ministry_datasources
HEADER = '''<html>
<head>
<title>{}</title>
<script type="text/javascript" src="https://w... | normal | {
"blob_id": "4c5b3042a785342d6ef06fdc882e0dcf91a787c3",
"index": 7816,
"step-1": "<mask token>\n\n\ndef calc_accumulated_indicende_per_ccaa(report, num_days=15):\n ccaas = data_sources.get_ccaas_in_dset(report)\n dframe = report['dframe']\n num_cases = dframe['num_casos']\n ccaa_column = data_sources... | [
4,
9,
10,
11,
13
] |
import os
from pathlib import Path
from sphinx_testing import with_app
@with_app(buildername="html", srcdir="doc_test/doc_role_need_max_title_length_unlimited")
def test_max_title_length_unlimited(app, status, warning):
os.environ["MAX_TITLE_LENGTH"] = "-1"
app.build()
html = Path(app.outdir, "index.htm... | normal | {
"blob_id": "3346ca7cdcfe9d9627bfe08be2b282897b3c319c",
"index": 6943,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@with_app(buildername='html', srcdir=\n 'doc_test/doc_role_need_max_title_length_unlimited')\ndef test_max_title_length_unlimited(app, status, warning):\n os.environ['MAX_TITLE_... | [
0,
1,
2,
3,
4
] |
class UrlPath:
@staticmethod
def combine(*args):
result = ''
for path in args:
result += path if path.endswith('/') else '{}/'.format(path)
#result = result[:-1]
return result | normal | {
"blob_id": "aa579025cacd11486a101b2dc51b5ba4997bf84a",
"index": 95,
"step-1": "<mask token>\n",
"step-2": "class UrlPath:\n <mask token>\n",
"step-3": "class UrlPath:\n\n @staticmethod\n def combine(*args):\n result = ''\n for path in args:\n result += path if path.endswith... | [
0,
1,
2,
3
] |
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import pylab as pl
x = range(1, 19)
d = pd.read_csv('data.csv')
pl.clf()
pl.plot(x, d['reelection'], 'o-', label='reelection')
pl.plot(x, d['rerun'], 'o-', label='rerun')
pl.plot(x, d['ratio'], 'o-', label='incumbent ratio')
pl.fill... | normal | {
"blob_id": "156b3e09a65402d4f964c2886b8f5519168eb13a",
"index": 2894,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npl.clf()\npl.plot(x, d['reelection'], 'o-', label='reelection')\npl.plot(x, d['rerun'], 'o-', label='rerun')\npl.plot(x, d['ratio'], 'o-', label='incumbent ratio')\npl.fill_between(x, d['... | [
0,
1,
2,
3,
4
] |
rate=69
dollar=int(input("enter an dollars to convert:"))
inr=dollar*rate
print('INR :Rs.',inr,'/-') | normal | {
"blob_id": "62018b32bf0c66fa7ec3cc0fcbdc16e28b4ef2d6",
"index": 2396,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('INR :Rs.', inr, '/-')\n",
"step-3": "rate = 69\ndollar = int(input('enter an dollars to convert:'))\ninr = dollar * rate\nprint('INR :Rs.', inr, '/-')\n",
"step-4": "rate=69\nd... | [
0,
1,
2,
3
] |
#Aplicacion de la funcion super()
class Persona():
def __init__(self,nombre,edad,lugar_residencia):
self.nombre = nombre
self.edad = edad
self.residencia = lugar_residencia
def descripcion(self):
print("Nombre: ",self.nombre," Edad: ", self.edad," Lugar de residencia: ",s... | normal | {
"blob_id": "92a50bcdbb4c03d1a4813a93c2e0986250516f14",
"index": 1117,
"step-1": "class Persona:\n <mask token>\n <mask token>\n\n def hola(self):\n print('Hola Mundo')\n\n\nclass Empleado(Persona):\n\n def __init__(self, salario, antiguedad, nombre_empleado, edad_empleado,\n residencia... | [
5,
6,
8,
9,
10
] |
from locations.storefinders.storelocatorwidgets import StoreLocatorWidgetsSpider
class Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider):
name = "pharmacy_4_less_au"
item_attributes = {"brand": "Pharmacy 4 Less", "brand_wikidata": "Q63367608"}
key = "6c0hBJeL5yk8cmaKJGNjTu0JhWNaMQpX"
| normal | {
"blob_id": "aad3c104432a1a028d96263236133e495536ee69",
"index": 6644,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Pharmacy4LessAUSpider(StoreLocat... | [
0,
1,
2,
3,
4
] |
from typing import List, Optional
from backend.domain.well import FacilityState, Well
from backend.repository.persistence.well import WellPersistenceSchema
class WellRepository:
schema = WellPersistenceSchema()
def __init__(self, db):
self._db = db
def list(self) -> List[Well]:
return [... | normal | {
"blob_id": "5a181b0c22faa47c6c887daac675dd7374037f30",
"index": 3056,
"step-1": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass WellRepository:\n <mask token>\n\n d... | [
1,
5,
7,
8,
9
] |
# -*- coding: utf-8 -*-
"""
======================
@author : Zhang Xu
@time : 2021/9/8:16:29
@email : zxreaper@foxmail.com
@content : tensorflow subclassing 复现 NPA
======================
"""
import tensorflow as tf
from tensorflow.keras import *
from tensorflow.keras.layers import *
from keras import ... | normal | {
"blob_id": "f3789d70f784345881f705fc809c49ad4e3526bc",
"index": 1287,
"step-1": "<mask token>\n\n\nclass NewsEncoder(tf.keras.Model):\n\n def __init__(self):\n super(NewsEncoder, self).__init__(name='NewsEncoder')\n self.userid_input_layer = Input()\n self.userid_embedding_layer = Embedd... | [
5,
6,
7,
8,
9
] |
from typing import Tuple
#Creating a trie structure and it's node
class TrieNode(object):
def __init__(self, char: str):
self.char = char
self.children = []
#the last character of the word.`
self.word_finished = False
#counter for this character
self.counter = 1
... | normal | {
"blob_id": "dcda8f26a06145579a9be6e5fbfdaed83d4908da",
"index": 2459,
"step-1": "<mask token>\n\n\nclass TrieNode(object):\n\n def __init__(self, char: str):\n self.char = char\n self.children = []\n self.word_finished = False\n self.counter = 1\n self.OccurrenceList = {}\n... | [
3,
5,
6,
7,
8
] |
fname = input('Enter the file name to open')
fh = open(fname)
lst1 = list()
data = dict()
for ln in fh :
if ln.startswith("From"):
if ln.startswith('From:'):
continue
else :
word = ln.split()
lst1.append(word[1])
for word in lst1:
data[word] = dat... | normal | {
"blob_id": "4fba13d051a3aceb393a4473cdbf6d4fc684c7ac",
"index": 9473,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor ln in fh:\n if ln.startswith('From'):\n if ln.startswith('From:'):\n continue\n else:\n word = ln.split()\n lst1.append(word[1])\nfor... | [
0,
1,
2,
3
] |
#determines where the robot is located.
def sense(p, Z, colors, sensor_right):
#initialization
q = []
pHit = sensor_right;
pMiss = 1 - sensor_right;
#number of rows
m = len(colors)
#number of columns
n = len(colors[0])
#sum
s = 0
for i in range(m):
temp = []
... | normal | {
"blob_id": "10937ee1e48d23b12b76a2abc44ee8bd0647aef5",
"index": 9248,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef localize(colors, measurements, motions, sensor_right, p_move):\n p = []\n m = len(colors)\n n = len(colors[0])\n size = m * n\n for i in range(m):\n temp = [... | [
0,
1,
2,
3,
4
] |
"""Toggle the proof color.
Like operating in the menu:
**View** > **Proof Colors** (Ctrl + Y)
"""
# Import local modules
from photoshop import Session
with Session() as ps:
ps.app.runMenuItem(ps.app.stringIDToTypeID("toggleProofColors"))
| normal | {
"blob_id": "1db866ca73bc264d474d5e5086c4a047d7e46546",
"index": 2299,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith Session() as ps:\n ps.app.runMenuItem(ps.app.stringIDToTypeID('toggleProofColors'))\n",
"step-3": "<mask token>\nfrom photoshop import Session\nwith Session() as ps:\n ps.app... | [
0,
1,
2,
3
] |
import os, argparse,collections
defaults ={'color':'red','user':'guest'}
parser=argparse.ArgumentParser()
parser.add_argument('-u','--user')
parser.add_argument('-c','--color')
#a simple Namespace object will be built up from attributes parsed out of the command lin
namespace= parser.parse_args()
command_line_args= ... | normal | {
"blob_id": "3c31e3f2a6f320bc5ae33f0ba1d234a089371899",
"index": 9199,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-u', '--user')\nparser.add_argument('-c', '--color')\n<mask token>\nprint(combined['color'])\nprint(combined['user'])\n",
"step-3": "<mask token>\ndefaults = {'colo... | [
0,
1,
2,
3,
4
] |
from newspaper import Article
import random
import string
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import nltk
import numpy as np
import warnings
import speech_recognition as sr
warnings.filterwarnings('ignore')
nltk.download('pun... | normal | {
"blob_id": "53b56cf9265a658d999388f0a1e03d7ceb186213",
"index": 2836,
"step-1": "<mask token>\n\n\ndef LemNormalize(text):\n return nltk.word_tokenize(text.lower().translate(remove_punct_dict))\n\n\n<mask token>\n\n\ndef greeting(sentence):\n for word in sentence.split():\n if word.lower() in GREET... | [
3,
4,
5,
6,
7
] |
from src.secStructure import *
from suffix_trees import STree
import math
import re
def test_processData():
# Test1: ignoring peak position
data = ['example/example1.fa', 'example/example2.fa']
struct_data = ['example/exampleStrucData/exampleStructuralData1.fa',
'example/exampleStrucDat... | normal | {
"blob_id": "60b1a77d2de4a52ae9597f88917c4a3996c99923",
"index": 5626,
"step-1": "<mask token>\n\n\ndef test_createColorVector():\n k = 2\n no_sec_peak = 1\n template = 'EEESSSIIISSSBBBSSSHHHSSSSSSIIISSSEEE'\n kmer_counts = {'EE': 5, 'ES': 7, 'SS': 20, 'SI': 10, 'II': 15, 'IS': 11,\n 'SB': 5, ... | [
1,
3,
4,
5,
6
] |
from .facebook import *
| normal | {
"blob_id": "7901a2bd4ae1070c8263d3cd97351b01ffbf7bb1",
"index": 7246,
"step-1": "<mask token>\n",
"step-2": "from .facebook import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.app import App
import webbrowser
a=0.0
b="?"
n=0.0
k=""
g=""
class ghetto(GridLayout):
def matCallback(self,a):
webbrowser.open_n... | normal | {
"blob_id": "39affe139eec4cf6877646188839d79ed575235c",
"index": 8952,
"step-1": "<mask token>\n\n\nclass ghetto(GridLayout):\n <mask token>\n\n def biyoCallback(self, a):\n webbrowser.open_new(\n 'https://us04web.zoom.us/j/8651192984?pwd=cFV0bUNPTXRUOGVPZWw4dEhDQm0vUT09'\n )\n... | [
11,
12,
15,
17,
18
] |
from packer.utils import hello_world
| normal | {
"blob_id": "d549303228e860ae278a5a9497a4a3a68989aeca",
"index": 6097,
"step-1": "<mask token>\n",
"step-2": "from packer.utils import hello_world\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from django.db import models # db에 있는 models을 가져옴
from django.utils import timezone # 유틸에 있는 timezone을 가져옴
# Create your models here.
class Post(models.Model):
# Post라는 객체를 정의함 인수로 장고모델을 가져왔음
# 장고모델이기 때문에 데이터베이스에 저장된다.
author = models.ForeignKey('auth.User') # 외래키, 다른 객체에 대한 링크
title = models.Char... | normal | {
"blob_id": "3aa8c9b39174f0ed5799d6991516b34ca669b7d6",
"index": 9765,
"step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.title\n\n\nclass User(models.Mod... | [
6,
7,
8,
9,
10
] |
"""
Problem Link: https://practice.geeksforgeeks.org/problems/palindrome/0
Given an integer, check whether it is a palindrome or not.
Input:
The first line of input contains an integer T denoting the number of test cases.
For each test case there will be single line containing single integer N.
Output:
Print "Yes" ... | normal | {
"blob_id": "ea12ede51881f6e826a044df5d7aba457c434658",
"index": 6050,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor _ in range(int(input())):\n n = int(input())\n temp = n\n rev = 0\n while temp:\n rev = rev * 10 + temp % 10\n temp //= 10\n print('Yes' if rev == n else ... | [
0,
1,
2
] |
import requests
rsp = requests.get(
'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s'
% ('wx27c0e6ef6a7f0716', '6e29e232daf462652f66ee8acc11838b'))
print(rsp.text)
| normal | {
"blob_id": "d86fe165e378e56650e3b76bf3d0f72e2a50a023",
"index": 5082,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(rsp.text)\n",
"step-3": "<mask token>\nrsp = requests.get(\n 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s'\n % ('wx27c0e6ef6a7f0... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import sys
import struct
import Queue
import logging
import redis
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from threading import Thread
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import PacketList... | normal | {
"blob_id": "e4ecc1746e907f11936683384e1edb34dd637de7",
"index": 8171,
"step-1": "#!/usr/bin/env python\nimport sys\nimport struct\nimport Queue\nimport logging\nimport redis\nlogging.getLogger(\"scapy.runtime\").setLevel(logging.ERROR)\n\nfrom threading import Thread\nfrom scapy.all import sniff, sendp, hexdump... | [
0
] |
import pymysql
from app_module.models import User, Vehicle, Address, Customer, Location, Coupon, VehicleClass, Corporation, Corporate
from datetime import datetime
HOSTNAME = 'localhost'
USERNAME = 'root'
PASSWORD = '123456'
DATABASE = 'proj_p2'
def get_connection():
my_sql_connection = pymysql.connect(host=HOST... | normal | {
"blob_id": "62bad8eeb3b51a5012dad761a60639d36429d8e8",
"index": 7660,
"step-1": "<mask token>\n\n\ndef run_query(query, args=None):\n conn = get_connection()\n cur = conn.cursor()\n cur.execute(query, args)\n rs = cur.fetchall()\n if len(rs) != 0:\n return rs\n conn.commit()\n cur.cl... | [
25,
27,
37,
40,
41
] |
#!/usr/bin/env python
import sys, re, urllib, urllib2, string, time, os
from urllib2 import Request, urlopen, URLError, HTTPError
from urlparse import urlparse
joomla_version="undefined" #used for joomla veersin info
provided_url="" #the selected provided url
verbose_flag = 0 # If set to 1, prints... | normal | {
"blob_id": "9de2589cfb5bebba789ece8df9a0fcfbedb01173",
"index": 2440,
"step-1": "#!/usr/bin/env python\r\n\r\nimport sys, re, urllib, urllib2, string, time, os\r\nfrom urllib2 import Request, urlopen, URLError, HTTPError\r\nfrom urlparse import urlparse\r\n\r\njoomla_version=\"undefined\" #used for joomla... | [
0
] |
x, y = [float(x) for x in raw_input().split(" ")]
print(x*y) | normal | {
"blob_id": "1ed7fb0dd5f0fa5e60c855eceaaf3259092918ef",
"index": 1240,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(x * y)\n",
"step-3": "x, y = [float(x) for x in raw_input().split(' ')]\nprint(x * y)\n",
"step-4": "x, y = [float(x) for x in raw_input().split(\" \")]\nprint(x*y)",
"step-5"... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
import datetime
from urllib import parse
import scrapy
from scrapy import Request
from BrexitNews.items import BrexitNewsItem
def check_url(url):
if url is not None:
url = url.strip()
if url != '' and url != 'None':
return True
return False
class Theguar... | normal | {
"blob_id": "8180dac5d33334d7f16ab6bef41f1fe800879ca7",
"index": 2255,
"step-1": "<mask token>\n\n\nclass TheguardianSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def article(self, response):\n brexit_news = BrexitNewsItem()\n title = response... | [
3,
4,
5,
6,
7
] |
# Register all decoders
import ludwig.schema.decoders.base
import ludwig.schema.decoders.sequence_decoders # noqa
| normal | {
"blob_id": "53509d826b82211bac02ea5f545802007b06781c",
"index": 1630,
"step-1": "<mask token>\n",
"step-2": "import ludwig.schema.decoders.base\nimport ludwig.schema.decoders.sequence_decoders\n",
"step-3": "# Register all decoders\nimport ludwig.schema.decoders.base\nimport ludwig.schema.decoders.sequence_... | [
0,
1,
2
] |
from logupload import *
log = LogUpload()
log.uploadLogs(4)
| normal | {
"blob_id": "421837698b7fc188c84a3221271f11a40d1625d9",
"index": 7280,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nlog.uploadLogs(4)\n",
"step-3": "<mask token>\nlog = LogUpload()\nlog.uploadLogs(4)\n",
"step-4": "from logupload import *\nlog = LogUpload()\nlog.uploadLogs(4)\n",
"step-5": null,
... | [
0,
1,
2,
3
] |
from nintendo.nex import backend, authentication, friends, matchmaking, common
from nintendo.account import AccountAPI
from nintendo.games import MK8, Friends
import struct
import logging
logging.basicConfig(level=logging.INFO)
#Device id can be retrieved with a call to MCP_GetDeviceId on the Wii U
#Serial number ca... | normal | {
"blob_id": "43315abf9e096cdca89ed7f4de976d2706ff9c20",
"index": 9234,
"step-1": "<mask token>\n\n\ndef backend_login(title, use_auth_info, use_login_data, settings=None):\n api.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION)\n nex_token = api.get_nex_token(title.GAME_SERVER_ID)\n auth_info = None\n... | [
1,
2,
3,
4,
5
] |
__author__ = 'zhaobin022'
class Cmd(object):
pass
| normal | {
"blob_id": "0eca1693caffcd9fe32a8a54ca3a33687763e5ce",
"index": 6809,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Cmd(object):\n pass\n",
"step-3": "__author__ = 'zhaobin022'\n\n\nclass Cmd(object):\n pass\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
... | [
0,
1,
2
] |
'''
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million,
find the sum of the even-valued terms.
'... | normal | {
"blob_id": "02a1f84e72b412636d86b9bdb59856ae8c309255",
"index": 9373,
"step-1": "'''\nEach new term in the Fibonacci sequence is generated by adding the previous two terms. \nBy starting with 1 and 2, the first 10 terms will be:\n\n1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...\n\nBy considering the terms in the Fibona... | [
0
] |
# 217 is a prime number. In order 2017 to be a divisor of for sigma(a)=Product((p**(n+1)-1) // (p-1) for all divisors) it must be a power of a prime with (p**(a+1)-1) // (p-1) % 2017 == 0
# so we need only to check all such primes 'p' and count all k*p for k=1..N//p. We check p^n with n>=2 by brute force all primes. F... | normal | {
"blob_id": "fabd3f233753f63d731a43c8b8b311e50d9deefe",
"index": 6349,
"step-1": "<mask token>\n\n\ndef calc(N, D):\n\n def check(n):\n return not sig(factor(n)) % D\n cachePrimes(int(N ** 0.5))\n\n def a2n(a):\n return (a + 1) // D\n from math import log\n\n def genPrimeSigDivs(minA... | [
1,
3,
4,
5,
6
] |
#!/bin/python3
import socket
HOST = '127.0.0.1'
PORT= 4444
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST,PORT)) | normal | {
"blob_id": "14a39b9aa56777c8198794fe2f51c9a068500743",
"index": 4075,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ns.connect((HOST, PORT))\n",
"step-3": "<mask token>\nHOST = '127.0.0.1'\nPORT = 4444\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.connect((HOST, PORT))\n",
"step-4": "imp... | [
0,
1,
2,
3,
4
] |
import os.path
import numpy as np
import matplotlib.pyplot as plt
import util
import collections
def learn_distributions(file_lists_by_category):
"""
Estimate the parameters p_d, and q_d from the training set
Input
-----
file_lists_by_category: A two-element list. The first element is a list of
... | normal | {
"blob_id": "7ed84706ace2cbf523021887df1e13d113f9ce4c",
"index": 4172,
"step-1": "<mask token>\n\n\ndef learn_distributions(file_lists_by_category):\n \"\"\"\n Estimate the parameters p_d, and q_d from the training set\n\n Input\n -----\n file_lists_by_category: A two-element list. The first eleme... | [
1,
2,
3,
4,
5
] |
# Generated by Django 2.0.3 on 2018-04-30 16:25
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('threads', '0007_auto_20180430_1617'),
]
operations = [
migrations.AlterField(
model_name='thread',
... | normal | {
"blob_id": "6cd250b3bffd87657ec7cc28eaffe817c6d9f73f",
"index": 9794,
"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 = [('threads', '... | [
0,
1,
2,
3,
4
] |
from django.http import HttpResponse
from django.shortcuts import render
from dashboard.models import Farmer
import random, json, requests
from django.core import serializers
from collections import namedtuple
def sendSMS(message):
if message:
assert isinstance(message, (str, unicode))
payload = {... | normal | {
"blob_id": "0d07ad60c58828ce19153063fb5d7d80135cb9ec",
"index": 9737,
"step-1": "from django.http import HttpResponse\nfrom django.shortcuts import render\nfrom dashboard.models import Farmer\nimport random, json, requests\nfrom django.core import serializers\n\nfrom collections import namedtuple\n\ndef sendSMS... | [
0
] |
import random
import colorama
from termcolor import colored
from reusables.string_manipulation import int_to_words
from app.common_functions import comma_separated, add_dicts_together, remove_little_words, odds
from app.load_data import items, buildings, wild_mobs, names, adjectives
colorama.init()
def find_uniqu... | normal | {
"blob_id": "535c0975c688a19963e4c53f6029626d286b41d6",
"index": 5630,
"step-1": "<mask token>\n\n\nclass Player:\n\n def __init__(self, name, location):\n self.name = name\n self.location = location\n self.square = None\n self.money = 0\n self.quest = None\n self.job... | [
23,
31,
32,
38,
42
] |
"""
统计飞船信息
"""
class GameStats:
def __init__(self, setting):
self.setting = setting
self.ships_left = self.setting.ship_limit
self.game_active = True
| normal | {
"blob_id": "3ab26612111e3df59f41f5b5e0bf23398e015a8a",
"index": 1595,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass GameStats:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass GameStats:\n\n def __init__(self, setting):\n self.setting = setting\n self.ships_left = s... | [
0,
1,
2,
3
] |
class BaseException(Exception):
def __init__(self, message=""):
super(BaseException, self).__init__()
self.message = message
| normal | {
"blob_id": "2ee1539e051677ad38ab7727ff5edefb1aebd015",
"index": 9946,
"step-1": "<mask token>\n",
"step-2": "class BaseException(Exception):\n <mask token>\n",
"step-3": "class BaseException(Exception):\n\n def __init__(self, message=''):\n super(BaseException, self).__init__()\n self.me... | [
0,
1,
2,
3
] |
import inspect
import re
import openquake.hazardlib.source as oqsrc
# List of valid attributes for an area source
AREAS_ATTRIBUTES = set(['source_id',
'name',
'tectonic_region_type',
'mfd',
'rupture_mesh_spacing',
'magnitude_scaling_relationship',
... | normal | {
"blob_id": "8adf8cfc72d5af955bf7509d3573a9bcc7c0845e",
"index": 7537,
"step-1": "<mask token>\n\n\nclass OQtSource(object):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n if len(args):\n self.source_id = args[0]\n if len(args) > 1:\n self.source_type ... | [
2,
4,
5,
7,
8
] |
import datetime
import calendar
import re
def cardinal(ordinal):
return int(''.join([char for char in ordinal if char.isdigit()]))
def meetup_day(year, month, day_of_week, ordinal):
days = {
0: 'Monday',
1: 'Tuesday',
2: 'Wednesday',
3: 'Thursday',
4: 'Friday',
... | normal | {
"blob_id": "d4b1b6bdf125f2791c219b7db579c234eda0a73c",
"index": 9220,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef cardinal(ordinal):\n return int(''.join([char for char in ordinal if char.isdigit()]))\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef cardinal(ordinal):\n return i... | [
0,
1,
2,
3,
4
] |
import re
match = re.search(r'pi+', 'piiig')
print 'found', match.group() == "piii"
| normal | {
"blob_id": "82083f16c18db35193fa2aa45bc28c5201962f90",
"index": 6704,
"step-1": "\n\nimport re\n\n\nmatch = re.search(r'pi+', 'piiig')\nprint 'found', match.group() == \"piii\"\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
import os
import json
from page import Page
from random import choice
from os.path import join, expanduser
from file_handler import f_read, f_readlines, open_local
import config
class LetterPage(Page):
def __init__(self, page_num,n):
super(LetterPage, self).__init__(page_num)
self.title = "Letters"... | normal | {
"blob_id": "e714fe0e27ec9ea5acb3120a4d2114d3d7674fcf",
"index": 5601,
"step-1": "<mask token>\n\n\nclass LetterPage(Page):\n\n def __init__(self, page_num, n):\n super(LetterPage, self).__init__(page_num)\n self.title = 'Letters'\n self.in_index = False\n self.n = n\n self.... | [
3,
4,
5,
6,
7
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Brice Chou'
import os
import lib
import sys
import time
import getopt
import training
try:
import cv2
import h5py
except Exception as e:
error_info = 'Please install h5py/cv2 tools first. Error: {}.\n'.format(e)
print('\033[0;31m%s\033[0m' ... | normal | {
"blob_id": "398263b65fd98003f27020e46ae38e913dc5dd45",
"index": 323,
"step-1": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n__author__ = 'Brice Chou'\n\nimport os\nimport lib\nimport sys\nimport time\nimport getopt\nimport training\n\ntry:\n import cv2\n import h5py\nexcept Exception as e:\n err... | [
0
] |
var blackList = []string{
// global
"document", "window", "top", "parent", "global", "this",
//func
"console", "alert", "log", "promise", "fetch", "eval", "import",
//char
"<", ">", "`", "\\*", "&", "#", "%", "\\\\",
//key
"if", "set", "get", "with", "yield", "async", "wait", "func", "for", "error", "string",
... | normal | {
"blob_id": "f502290cc8ffa9571454a214497aff1d1c5e1c9f",
"index": 8285,
"step-1": "var blackList = []string{\n\t// global\n\t\"document\", \"window\", \"top\", \"parent\", \"global\", \"this\",\n\t//func\n\t\"console\", \"alert\", \"log\", \"promise\", \"fetch\", \"eval\", \"import\",\n\t//char\n\t\"<\", \">\", \... | [
0
] |
# 5. Write a program to implement polymorphism.
class Honda:
def __init__(self, name, color):
self.name = name
self.color = color
def display(self):
print("Honda car name is : ", self.name, " and color is : ", self.color)
class Audi:
def __init__(self, name, color):
sel... | normal | {
"blob_id": "92f59612b2697db155da1bdc625fdabc115867b0",
"index": 9600,
"step-1": "class Honda:\n <mask token>\n <mask token>\n\n\nclass Audi:\n\n def __init__(self, name, color):\n self.name = name\n self.color = color\n\n def display(self):\n print('Audi car name is : ', self.na... | [
4,
6,
7,
8,
9
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 14 20:35:10 2020
@author: Johanna
"""
import numpy as np
###############################################################################
# Complex Visibility Functions
###############################################################################
... | normal | {
"blob_id": "ea3217be80b6d1d3a400139bc4a91870cd2f1d87",
"index": 5118,
"step-1": "<mask token>\n\n\ndef compute_vis(X, F):\n vis = np.matmul(X, np.transpose(F)).astype(np.complex64)\n return vis\n\n\ndef compute_vis_grad(vis, Z, F):\n Z_vis = compute_vis(Z, F)\n grad = -np.matmul(np.conjugate(F.T), v... | [
11,
13,
15,
16,
17
] |
#!/usr/bin/env python3
def main():
A1, A2, A3 = map(int, input().split())
A=A1+A2+A3
if A >=22:
ans='bust'
else:
ans='win'
print(ans)
if __name__ == "__main__":
main()
| normal | {
"blob_id": "753e062940e0580d7d33c88c1165977142dcd202",
"index": 8060,
"step-1": "<mask token>\n",
"step-2": "def main():\n A1, A2, A3 = map(int, input().split())\n A = A1 + A2 + A3\n if A >= 22:\n ans = 'bust'\n else:\n ans = 'win'\n print(ans)\n\n\n<mask token>\n",
"step-3": "d... | [
0,
1,
2,
3
] |
def max_product(n):
lst, lstnums, res, num = [], [], [], 1
for i in range(0, n+1):
lstnums.append(i)
for j in str(i):
num *= int(j)
lst.append(num)
num = 1
maxlst = max(lst)
for i in range(len(lst)):
if lst[i] == maxlst:
res.append(lstnu... | normal | {
"blob_id": "c804391cc199a242d1b54ece8487ef74065a40ad",
"index": 840,
"step-1": "\ndef max_product(n):\n lst, lstnums, res, num = [], [], [], 1\n for i in range(0, n+1):\n lstnums.append(i)\n for j in str(i):\n num *= int(j)\n lst.append(num)\n num = 1\n\n maxlst ... | [
0
] |
import numpy as np
import sys
import os
import os.path
import json
import optparse
import time
import pandas as pd
#Randomize and split the inference set according to hor_pred
#Generate .npy file for each hp selected
#Coge valores aleatorios de la columna de etiquetas en función del horizonte de predicció... | normal | {
"blob_id": "83a92c0b645b9a2a483a01c19a47ab5c296ccbd9",
"index": 6907,
"step-1": "<mask token>\n\n\ndef addOptions(parser):\n parser.add_option('--NNfile', default='', help=\n 'Config json file for the data to pass to the model')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef addOptions(parse... | [
1,
2,
3,
4,
5
] |
#-*- coding:utf-8 -*-
from xml.etree import ElementTree
from xml.etree.ElementTree import Element
_exception = None
import os
class xmlSp:
def addNode(self,parentNode,childNode):
parentNode.append(childNode)
def createChildNode(self,key,value,propertyMap={}):
element... | normal | {
"blob_id": "0470f98247f8f835c0c052b01ddd7f1f7a515ab5",
"index": 5509,
"step-1": "<mask token>\n\n\nclass xmlSp:\n\n def addNode(self, parentNode, childNode):\n parentNode.append(childNode)\n\n def createChildNode(self, key, value, propertyMap={}):\n element = Element(key, propertyMap)\n ... | [
12,
13,
15,
16,
18
] |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
import numpy as np
from std_msgs.msg import Int32
import math
'''
This node will publish waypoints from the car's current position to some `x` distance ahead.
As men... | normal | {
"blob_id": "9ad92b23b8a02204a86af599e507eb889e5bcec7",
"index": 7565,
"step-1": "<mask token>\n\n\nclass WaypointUpdater(object):\n\n def __init__(self):\n rospy.init_node('waypoint_updater')\n rospy.Subscriber('/current_pose', PoseStamped, self.pose_cb)\n rospy.Subscriber('/base_waypoin... | [
10,
15,
16,
17,
19
] |
#!/usr/bin/env python
import mcvine.cli
from numpy import array
from mcvine_workflow.singlextal.resolution import use_res_comps as urc
beam_neutrons_path = '/SNS/users/p63/ORNL_public_research/MCViNE_Covmat_comparison/mcvine_resolution/beams/beam_125_1e9/out/neutrons'
instrument = urc.instrument('ARCS', '3.*meter', '13... | normal | {
"blob_id": "47c5fb03cb427d5c9f7703e1715e026b6f2c7a35",
"index": 4660,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurc.run(beam_neutrons_path, instrument, samplexmlpath, psi, hkl2Q, pixel,\n t_m2p, Q, E, hkl_projection, Nbuffer=100000)\n",
"step-3": "<mask token>\nbeam_neutrons_path = (\n '/SN... | [
0,
1,
2,
3,
4
] |
import BlockDeviceHandler
import json
import LocalMachine
import os
""" This module automaticly format the disk based on diskconf.json """
def module_print(text):
print_text = "[ autoformat disk ] " + str(text)
print(print_text)
def parse_config_file_from_disk(path, confname="diskconf.json"):
json_path =... | normal | {
"blob_id": "927470fe0087b17e5fe67a9b8b3cc13a40d8be1a",
"index": 7554,
"step-1": "<mask token>\n\n\ndef parse_config_file_from_disk(path, confname='diskconf.json'):\n json_path = str(path) + '/' + str(confname)\n if not os.path.exists(json_path):\n module_print('\\tPath not exists: ' + str(json_path... | [
7,
8,
9,
10,
11
] |
# Generated by Django 3.2.3 on 2021-07-02 08:18
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('khovan', '0003_nhapkho'),
]
operations = [
migrations.AddField(
model_name='phieunhaphang',
... | normal | {
"blob_id": "016255d74ccf4ac547e4b212d33bb9a39295c830",
"index": 2715,
"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 = [('khovan', '0... | [
0,
1,
2,
3,
4
] |
'''
EXERCICIO: Faça um programa que leia quantidade de pessoas que serão convidadas para uma festa.
O programa irá perguntar o nome de todas as pessoas e colcar num lista de convidados.
Após isso deve imprimir todos os nomes da lista
'''
'''
qtd = int(input("Quantas pessoas vão ser convidadas?"))
lista_pe... | normal | {
"blob_id": "426a8fb6d1adf5d4577d299083ce047c919dda67",
"index": 3525,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Programinha de controle de festinhas 1.0')\nprint('#' * 20)\n<mask token>\nwhile i <= numero_de_convidados:\n nome_do_convidado = input('Coloque o nome do convidado #' + str(i) ... | [
0,
1,
2,
3
] |
import pytest
from freezegun import freeze_time
from datetime import datetime
from khayyam import JalaliDatetime, TehranTimezone
from dilami_calendar import DilamiDatetime, dilami_to_jalali
def test_dilami_date():
gdate = datetime(2018, 2, 1)
ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone)
assert ... | normal | {
"blob_id": "7997efb00f24ecc5c4fbf3ca049eca6b5b178d53",
"index": 4088,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_dilami_date():\n gdate = datetime(2018, 2, 1)\n ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone)\n assert ddate.year == 1591\n assert ddate.month == 6\n as... | [
0,
1,
2,
3,
4
] |
import requests
import time
while 1:
r = requests.put("http://localhost:3000/api/4", data={"temperature": 24, "led": 1})
print r.text
time.sleep(1) | normal | {
"blob_id": "23a560c5f5553fc32329121ea47f8a7ae1196889",
"index": 440,
"step-1": "import requests\nimport time\n\nwhile 1:\n r = requests.put(\"http://localhost:3000/api/4\", data={\"temperature\": 24, \"led\": 1})\n print r.text\n time.sleep(1)",
"step-2": null,
"step-3": null,
"step-4": null,
"... | [
0
] |
from qcg.appscheduler.errors import *
class Node:
def __init__(self, name=None, totalCores=0, used=0):
self.__name = name
self.__totalCores = totalCores
self.__usedCores = used
self.resources = None
def __getName(self):
return self.__name
def __getTotalCores(self)... | normal | {
"blob_id": "23a7aa6b9a98bfd4fd43fea1ecfa26cb44969804",
"index": 8061,
"step-1": "<mask token>\n\n\nclass Node:\n <mask token>\n\n def __getName(self):\n return self.__name\n\n def __getTotalCores(self):\n return self.__totalCores\n\n def __setTotalCores(self, total):\n assert to... | [
21,
23,
26,
28,
29
] |
#!/usr/bin/python3
max_integer = __import__('9-max_integer').max_integer
my_list = [1, 90, 2, 13, 34, 5, -13, 3]
my_list1 = []
my_list2 = [1, 90, 2, 13, 34, 100, -13, 3]
max_value = max_integer(my_list)
max_value1 = max_integer(my_list1)
max_value2 = max_integer(my_list2)
max_value3 = max_integer()
print("Max: {}".for... | normal | {
"blob_id": "f5b74ca95cb368d70139b5d36e3c8d553b8c5393",
"index": 1393,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Max: {}'.format(max_value))\nprint('Max: {}'.format(max_value1))\nprint('Max: {}'.format(max_value2))\nprint('Max: {}'.format(max_value3))\n",
"step-3": "max_integer = __import__... | [
0,
1,
2,
3
] |
import wx
import os
# os.environ["HTTPS_PROXY"] = "http://user:pass@192.168.1.107:3128"
import wikipedia
import wolframalpha
import pyttsx3
import webbrowser
import winshell
import json
import requests
import ctypes
import random
from urllib.request import urlopen
import speech_recognition as sr
import ssl
import urlli... | normal | {
"blob_id": "8f1e6ea93b2dd7add256cb31d2c621aa69721609",
"index": 8834,
"step-1": "<mask token>\n\n\nclass MyFrame(wx.Frame):\n\n def __init__(self):\n wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(\n 450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |\n ... | [
3,
4,
5,
6,
7
] |
#!/usr/bin/env python3
import sys
import hashlib
# Usage
if len(sys.argv) != 2:
print("usage: part2.py puzzle_input")
exit(1)
# Get Secret
puzzle_input = sys.argv[1]
input_num = 0
# Calcuate
for i in range(sys.maxsize):
digest = hashlib.md5(puzzle_input.encode('utf-8')+str(i).encode('utf-8')).hexdigest()
if (d... | normal | {
"blob_id": "1219f7b7ac335f3a69e289d1ab2b6318a2aef23f",
"index": 1900,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(sys.argv) != 2:\n print('usage: part2.py puzzle_input')\n exit(1)\n<mask token>\nfor i in range(sys.maxsize):\n digest = hashlib.md5(puzzle_input.encode('utf-8') + str(i).... | [
0,
1,
2,
3,
4
] |
class Node(object):
def __init__(self,data):
self.data = data
self.left = None
self.right = None
self.parent = None
class tree(object):
def __init__(self):
self.root = None
def insert(self,root,value):
if self.root == None:
self.root = No... | normal | {
"blob_id": "64c32b3ada7fff51a7c4b07872b7688e100897d8",
"index": 81,
"step-1": "class Node(object):\n <mask token>\n\n\nclass tree(object):\n\n def __init__(self):\n self.root = None\n\n def insert(self, root, value):\n if self.root == None:\n self.root = Node(value)\n el... | [
7,
8,
9,
10,
11
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: André Pacheco
E-mail: pacheco.comp@gmail.com
This file implements the methods and functions to load the image as a PyTorch dataset
If you find any bug or have some suggestion, please, email me.
"""
from PIL import Image
from torch.utils import data
import t... | normal | {
"blob_id": "4e31c2a80bec77a1f5aafc8a91617fb4b2941788",
"index": 432,
"step-1": "<mask token>\n\n\nclass BuildDataset(data.Dataset):\n <mask token>\n\n def __init__(self, imgs_path, labels, extra_info=None, transform=None):\n \"\"\"\n The constructor gets the images path and their respectivel... | [
3,
5,
6,
7,
8
] |
import pandas as pd
import numpy
dato=pd.read_csv('medallero_Panamericanos_Lima2019.csv')
print(dato)
def calculo_suma():
print("---Funcion con Python---")
print("la sumatoria de los valores: ", dato['Bronce'].sum())
print("---Funcion con Numpy---")
print("la sumatoria de los valores: ", numpy.sum(dat... | normal | {
"blob_id": "f5542cfe6827c352cc6e6da1147e727f2b2d8247",
"index": 9586,
"step-1": "<mask token>\n\n\ndef calculo_suma():\n print('---Funcion con Python---')\n print('la sumatoria de los valores: ', dato['Bronce'].sum())\n print('---Funcion con Numpy---')\n print('la sumatoria de los valores: ', numpy.... | [
9,
10,
11,
12,
13
] |
# MolecularMatch API (MM-DATA) Python Example Sheet
# Based on documentation at https://api.molecularmatch.com
# Author: Shane Neeley, MolecularMatch Inc., Jan. 30, 2018
import requests
import json
import numpy as np
import sys
resourceURLs = {
"trialSearch": "/v2/search/trials",
"drugSearch": "/v2/search/drugs",
... | normal | {
"blob_id": "b4593b3229b88db26c5e200431d00838c357c8e0",
"index": 2359,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif apiKey == '<your api key>' and sys.argv[1]:\n apiKey = sys.argv[1]\n<mask token>\nprint(json.dumps(r.json()))\n<mask token>\nprint(r.json()['total'])\nfor i in np.arange(0, len(r.js... | [
0,
1,
2,
3,
4
] |
from .kahfm_batch import KaHFMBatch
| normal | {
"blob_id": "8e317d4d8ae8dc3d692d237e7e0abfaf37aecbb6",
"index": 7017,
"step-1": "<mask token>\n",
"step-2": "from .kahfm_batch import KaHFMBatch\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
#!/usr/bin/env python2
# coding=utf8
from __future__ import absolute_import, division, print_function
from sqlalchemy import func
from walis.model.walis import walis_session
from walis.model.zeus import zeus_session, zeus_db_handler
from walis.model.zeus.activity import (
SubsidyProcessRecord,
SubsidyPayReco... | normal | {
"blob_id": "68d537cb8488ae4f2c8300e885be78540952dec0",
"index": 450,
"step-1": "<mask token>\n\n\ndef get_new_pay_records(process_at, limit=200):\n with zeus_session() as session:\n result = session.query(SubsidyPayRecord.id, SubsidyPayRecord.\n restaurant_id, SubsidyProcessRecord.card_id,\... | [
11,
13,
14,
16,
19
] |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from connect import Connect
class Resource:
def __init__(self, row: tuple):
self.video_path = row[0]
self.pic_path = row[1]
| normal | {
"blob_id": "65aa27addaec6014fe5fd66df2c0d3632231a314",
"index": 3124,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Resource:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Resource:\n\n def __init__(self, row: tuple):\n self.video_path = row[0]\n self.pic_path = ... | [
0,
1,
2,
3,
4
] |
'''
Problem Description
Given two numbers n1 and n2
1. Find prime numbers between n1 and n2, then
2. Make all possible unique combinations of numbers from the prime
numbers list you found in step 1.
3. From this new list, again find all prime numbers.
4. Find smallest (a) and largest (b) number from the 2nd gener... | normal | {
"blob_id": "fe5050fdf010ce1c4d458b8a52ac92485a7d8cea",
"index": 5706,
"step-1": "<mask token>\n\n\ndef isPrime(n):\n if n <= 1:\n return False\n if n <= 3:\n return True\n if n % 2 == 0 or n % 3 == 0:\n return False\n i = 5\n while i * i <= n:\n if n % i == 0 or n % (i... | [
1,
2,
3,
4,
5
] |
import pymysql
db = pymysql.connect( "localhost", "root", "", "order_db",
use_unicode=True, charset="utf8")
cursor = db.cursor()
sql = "DROP TABLE custdetail"
cursor.execute(sql)
db.close()
| normal | {
"blob_id": "1aa2bff245322a34438cc836e23f430926dfac6c",
"index": 3414,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncursor.execute(sql)\ndb.close()\n",
"step-3": "<mask token>\ndb = pymysql.connect('localhost', 'root', '', 'order_db', use_unicode=True,\n charset='utf8')\ncursor = db.cursor()\nsql ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import defaultdict
from typing import List, Dict, Optional, Tuple
import torch.jit
from torch import n... | normal | {
"blob_id": "27d5ff5b0253eea36d6b492e929c4220f4b4a5eb",
"index": 1564,
"step-1": "<mask token>\n\n\nclass ModelIncrStateFlattener(BaseIncrStateFlattener):\n <mask token>\n\n def reorder_decoder_incremental_state(self, flat_incr_state: Dict[str,\n torch.Tensor], inds: torch.Tensor) ->Dict[str, torch.... | [
24,
31,
32,
36,
43
] |
#C:\utils\Python\Python27\python.exe incompletosClean.py incompletos\inc.dat incompletos\out.dat
import sys
import os
import os.path
bfTmp = ''
lsOutTmp = []
InFileName = []
lsHTMLName = []
fileNameIn= sys.argv[1]
fileNameOu= sys.argv[2]
fo = open(fileNameIn)
InFileName += [x.replace('\n', '') for x ... | normal | {
"blob_id": "031727fa42b87260abb671518b2baeff1c9524f9",
"index": 8913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nInFileName += [x.replace('\\n', '') for x in fo.readlines()]\nfo.close()\nfor bfMatFile in InFileName:\n if os.path.isfile(bfMatFile):\n lsHTMLName = []\n fo = open(bfMat... | [
0,
1,
2,
3,
4
] |
from Socket import Socket
import threading
class Server(Socket):
def __init__(self):
super(Server, self).__init__()
print("server listening")
self.users = []
def set_up(self):
self.bind(("192.168.0.109", 1337))
self.listen(0)
self.accept_sockets()
def sen... | normal | {
"blob_id": "2027904401e5be7b1c95eebec3a1e6a88c25660c",
"index": 9338,
"step-1": "<mask token>\n\n\nclass Server(Socket):\n\n def __init__(self):\n super(Server, self).__init__()\n print('server listening')\n self.users = []\n\n def set_up(self):\n self.bind(('192.168.0.109', 13... | [
5,
6,
7,
8,
9
] |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | normal | {
"blob_id": "2064fe029bc7db14505a5b38750e324b55556abb",
"index": 7032,
"step-1": "<mask token>\n\n\nclass ConcatOffsetNet(nn.Cell):\n\n def __init__(self, axis):\n super(ConcatOffsetNet, self).__init__()\n self.op = G.ConcatOffset(2, axis)\n\n def construct(self, x0, x1):\n return self... | [
3,
4,
5,
6,
7
] |
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
# motor_EN_A: Pin7 | motor_EN_B: Pin11
# motor_A: Pin8,Pin10 | motor_B: Pin13,Pin12
#Motor_A_EN = 7
Motor_B_EN = 11
#Motor_A_Pin1 = 8
#Motor_A_Pin2 = 10
Motor_B_Pin1 = 13
Motor_B_Pin2 = 12
Dir_forward = 0
Dir_backward = 1
#pwm_A = 0
pwm_B =... | normal | {
"blob_id": "7369d5a463b0f41c17d5648739d4730256e611f9",
"index": 9612,
"step-1": "<mask token>\n\n\ndef setup():\n global pwm_A, pwm_B\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(Motor_B_EN, GPIO.OUT)\n GPIO.setup(Motor_B_Pin1, GPIO.OUT)\n GPIO.setup(Motor_B_Pin2, GPIO.OUT... | [
4,
5,
6,
7,
8
] |
from flask_table import Table, Col
"""Lets suppose that we have a class that we get an iterable of from
somewhere, such as a database. We can declare a table that pulls out
the relevant entries, escapes them and displays them.
"""
class Item(object):
def __init__(self, name, category):
self.name = name... | normal | {
"blob_id": "3191fa5f9c50993d17e12e4e2e9d56cfce2108e7",
"index": 5646,
"step-1": "<mask token>\n\n\nclass Item(object):\n\n def __init__(self, name, category):\n self.name = name\n self.category = category\n\n\nclass Category(object):\n\n def __init__(self, name):\n self.name = name\n\... | [
6,
7,
8,
9,
10
] |
import shelve
from club import Club
#загальний бютжет клубів в заданій країні
#клуб який має найбільше трофеїв
country = input('country: ')
FILENAME = "clubs"
with shelve.open(FILENAME) as clubs:
clubs_by_country = list(filter(lambda s: s.country.lower() == country.lower(), clubs.values()))
if len(clubs_b... | normal | {
"blob_id": "1346bf78241b4be00f2da3c22731d2846f9d1ada",
"index": 4629,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith shelve.open(FILENAME) as clubs:\n clubs_by_country = list(filter(lambda s: s.country.lower() == country.\n lower(), clubs.values()))\n if len(clubs_by_country) == 0:\n ... | [
0,
1,
2,
3,
4
] |
from django import forms
class CommentForm(forms.Form):
name = forms.CharField(label='称呼')
email = forms.EmailField(label='邮箱')
content = forms.CharField(label='内容')
| normal | {
"blob_id": "c2ff3c5e44fa361671a3fdb38060517bcc4bc82c",
"index": 2778,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass CommentForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass CommentForm(forms.Form):\n name = forms.CharField(labe... | [
0,
1,
2,
3
] |
card = int(input())
last4 = card % 10000
print(last4)
| normal | {
"blob_id": "7b920545a0241b30b66ff99f330dbb361f747f13",
"index": 8297,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(last4)\n",
"step-3": "card = int(input())\nlast4 = card % 10000\nprint(last4)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
#!/usr/bin/env python
import numpy as np
import cv2
# Creat a Image with Pixel 512x512 RGB
image = np.zeros((512, 512, 3), np.uint8)
# Pt Definition
# x0y0, x1y0, x2 y0
# x0y1 , x1y1, x2y1
# Draw a Line in the Middle of the image
# Start Co-ordinate end Co-ordinate While Color and Line Width
cv2.line(image, (0, 0),... | normal | {
"blob_id": "f6c5c2180a1a4b05b3f103c330b455e7387713a6",
"index": 8125,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncv2.line(image, (0, 0), (512, 0), (255, 255, 255), 5)\ncv2.line(image, (0, 50), (512, 50), (255, 255, 255), 5)\ncv2.rectangle(image, (256, 0), (400, 256), (0, 255, 0), 3)\n<mask token>\nc... | [
0,
1,
2,
3,
4
] |
from flask import Flask, render_template, request
import matplotlib.pyplot as plt
import numpy as np
import sympy
from DerivTest import diff, diff2, trapz
from sympy.parsing.sympy_parser import parse_expr
from sympy import Symbol
#from ParsingClass import Parser
#from scitools.StringFunction import StringFunction
#from... | normal | {
"blob_id": "9dc8449bcc0c6c6ffb5ced5724ca632b6578bf1b",
"index": 9170,
"step-1": "<mask token>\n\n\ndef functionGraph(function, dVal1, dVal2, dVal3, dVal4, ftcVal1, ftcVal2):\n print('printing user input from functionGraph - ' + function)\n print(dVal1, dVal2, dVal3, dVal4)\n x1 = -5\n x2 = 5\n pr... | [
10,
13,
15,
16,
18
] |
from .gunicorn import *
from .server_app import *
| normal | {
"blob_id": "ed5dd954dedb00bf645f9ca14b5ca9cd122b2adc",
"index": 6183,
"step-1": "<mask token>\n",
"step-2": "from .gunicorn import *\nfrom .server_app import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from django.db import models
from django.utils import timezone
from django.db.models.signals import post_save
from django.urls import reverse
# Create your models here.
class Purchase(models.Model):
invoice = models.SmallIntegerField(primary_key=True,blank=False)
ch_no = models.SmallIntegerField(blank=True,nul... | normal | {
"blob_id": "bb3c42c9f87a463b9f18601c9e3897b6d21351d5",
"index": 7356,
"step-1": "<mask token>\n\n\nclass PurchaseDetail(models.Model):\n PRODUCT_CHOICES = ('WOOD', 'Wood'), ('GLASS', 'Glass'), ('PLASTIC',\n 'Plastic'), ('LEATHER', 'Leather'), ('FABRIC', 'Fabric'), ('STEEL',\n 'Steel')\n purc... | [
4,
6,
7,
9,
10
] |
import matplotlib.image as mpimg
import cv2
import rasterio
from ode_data_access.image_utils import view_as_blocks, is_black, align_and_crop
import os
import numpy as np
from tqdm import tqdm
class ChunkProcessor:
def write_result_blocks(self, result_blocks, window, product_name, chunk_size, save_dir=... | normal | {
"blob_id": "303e1b95c2ca60041a34b8c09e013849112a108d",
"index": 3475,
"step-1": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n\n def chunkify(self, img_file, product_name, chunk_size=2... | [
1,
2,
3,
5,
6
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.