code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/python # coding:utf-8 # #这个脚本主要是对apache日志文件的处理分析,过滤出需要的信息 #处理后得到的数据是: 主机IP:192.168.14.44 访问流量:814 K #使用说明 python 脚本名 文件名; eg:python python.analysis.apachelog.py access.log # # by wangdd 2016/02/02 # import os import re import sys import shelve #re 模块,利用re模块对apahce日志进行分析 #通过 re.match(……) 和 re.compile(……...
normal
{ "blob_id": "3240a7fb9fbd5cd84165e68f8406e0a146c2b6b6", "index": 1454, "step-1": "#!/usr/bin/python\n# coding:utf-8\n#\n#这个脚本主要是对apache日志文件的处理分析,过滤出需要的信息\n#处理后得到的数据是:\t主机IP:192.168.14.44 访问流量:814 K\n#使用说明 python 脚本名 文件名; eg:python python.analysis.apachelog.py access.log\n#\n#\tby wangdd 2016/02/02\n#\nimpor...
[ 0 ]
import math def Distance(t1, t2): RADIUS = 6371000. # earth's mean radius in km p1 = [0, 0] p2 = [0, 0] p1[0] = t1[0] * math.pi / 180. p1[1] = t1[1] * math.pi / 180. p2[0] = t2[0] * math.pi / 180. p2[1] = t2[1] * math.pi / 180. d_lat = (p2[0] - p1[0]) d_lon = (p2[1] - p1[1]) ...
normal
{ "blob_id": "f3f5b14917c89c5bc2866dd56e212bd3ec8af1cd", "index": 4841, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tile_number(lon_deg, lat_deg, zoom):\n n = 2.0 ** zoom\n xtile = int((lon_deg + 180.0) / 360.0 * n)\n ytile = int((lat_deg + 90.0) / 180.0 * n)\n return xtile, ytile\n...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import difflib as dl import sys def get_close(x): if len(x) == 0: return "" return x[0] list_file = sys.argv[1] rating_file = sys.argv[2] output_file = sys.argv[3] movie_list = open(list_file).read().splitlines() movie_data = pd.DataFrame({'movie': movie_list}) rating_data ...
normal
{ "blob_id": "7a9515b1f8cc196eb7551137a1418d5a387e7fd3", "index": 959, "step-1": "<mask token>\n\n\ndef get_close(x):\n if len(x) == 0:\n return ''\n return x[0]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_close(x):\n if len(x) == 0:\n return ''\n return x[0]\n\n\n<mask ...
[ 1, 2, 3, 4, 5 ]
import os, sys, time, random, subprocess def load_userdata(wallet, pool, ww, logger, adminka): with open("D:\\msys64\\xmrig-master\\src\\ex.cpp", "r") as f: file = f.read() file = file.replace("%u%", wallet) file = file.replace("%p%", pool) file = file.replace("%w%", ww) wi...
normal
{ "blob_id": "d1254e558217cce88de2f83b87d5c54333f1c677", "index": 9938, "step-1": "<mask token>\n\n\ndef load_userdata(wallet, pool, ww, logger, adminka):\n with open('D:\\\\msys64\\\\xmrig-master\\\\src\\\\ex.cpp', 'r') as f:\n file = f.read()\n file = file.replace('%u%', wallet)\n file =...
[ 6, 7, 8, 9, 11 ]
from .feature import slide_show def main(args=None): if args: slide_show(args[0])
normal
{ "blob_id": "8680c033662a89ed6fc73e65ec544b93558c4208", "index": 688, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(args=None):\n if args:\n slide_show(args[0])\n", "step-3": "from .feature import slide_show\n\n\ndef main(args=None):\n if args:\n slide_show(args[0])\n"...
[ 0, 1, 2 ]
import itertools import numpy import math import psycopg2 import podatki baza = podatki.baza dom = podatki.preberi_lokacijo() seznam_trgovin =["spar", "mercator", "tus", "hofer", "lidl"] id_in_opis = podatki.id_izdelka_v_opis() seznam_izdelkov = [el[0] for el in id_in_opis] #['cokolada', 'sladoled', ...] mnozica_izdel...
normal
{ "blob_id": "5a0702dd869862ebc27c83d10e0b1f0575de68a7", "index": 2944, "step-1": "<mask token>\n\n\ndef kombinacije_trgovin_f(mnozica_izdelkov_v_kosarici, seznam_trgovin,\n trgovine_z_izdelki):\n generator_kombinacij = (set(itertools.compress(seznam_trgovin, el)) for\n el in itertools.product(*([[0,...
[ 4, 5, 6, 8, 9 ]
from machine import Pin, PWM import time # externe LED zit op pin D1 (GPIO5) PinNum = 5 # pwm initialisatie pwm1 = PWM(Pin(PinNum)) pwm1.freq(60) pwm1.duty(0) step = 100 for i in range(10): # oplichten while step < 1000: pwm1.duty(step) time.sleep_ms(500) step+=100 # uitdoven ...
normal
{ "blob_id": "9f31694d80f2dcc50a76b32aa296871694d3644d", "index": 7838, "step-1": "<mask token>\n", "step-2": "<mask token>\npwm1.freq(60)\npwm1.duty(0)\n<mask token>\nfor i in range(10):\n while step < 1000:\n pwm1.duty(step)\n time.sleep_ms(500)\n step += 100\n while step > 0:\n ...
[ 0, 1, 2, 3, 4 ]
import importlib if __name__ == '__main__': module = importlib.import_module('UserFile') print(module.if_new_message) print(module.ID)
normal
{ "blob_id": "8a773448383a26610f4798e12fb514248e71dc4b", "index": 698, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n module = importlib.import_module('UserFile')\n print(module.if_new_message)\n print(module.ID)\n", "step-3": "import importlib\nif __name__ == '__ma...
[ 0, 1, 2 ]
smodelsOutput = {'OutputStatus': {'sigmacut': 0.01, 'minmassgap': 5.0, 'maxcond': 0.2, 'ncpus': 1, 'file status': 1, 'decomposition status': 1, 'warnings': 'Input file ok', 'input file': 'inputFiles/scanExample/slha/100968509.slha', 'database version': '1.2.0', 'smodels version': '1.2.0rc'}, 'ExptRes': ...
normal
{ "blob_id": "94d303716eac7fa72370435fe7d4d1cdac0cdc48", "index": 6151, "step-1": "<mask token>\n", "step-2": "smodelsOutput = {'OutputStatus': {'sigmacut': 0.01, 'minmassgap': 5.0,\n 'maxcond': 0.2, 'ncpus': 1, 'file status': 1, 'decomposition status': 1,\n 'warnings': 'Input file ok', 'input file':\n ...
[ 0, 1 ]
from eth_account.account import Account from nucypher.characters.lawful import Alice, Bob, Ursula from nucypher.network.middleware import RestMiddleware from nucypher.data_sources import DataSource from umbral.keys import UmbralPublicKey import sys import os import binascii import shutil import maya import datetime te...
normal
{ "blob_id": "bc843abecfc076c9413498f9ebba0da0857ad3cc", "index": 4103, "step-1": "<mask token>\n\n\nclass Author(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Book(object):\n\n def __init__(self, author):\n self.author = author\n self.content = b'PlainText of the book...
[ 14, 19, 20, 22, 23 ]
import os as os import io as io import re class Stopwords: def __init__(self, base_dir='data'): self.base_dir = base_dir def load_stopwords(self, base_dir=None, stopwords_file='stopwords.csv'): # Load stopwords from file. if base_dir is not None: self.base_dir = base_dir ...
normal
{ "blob_id": "dad4e14da734f2e2329f4cbe064c73c82a4ae27c", "index": 8119, "step-1": "<mask token>\n\n\nclass Stopwords:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Stopwords:\n\n def __init__(self, base_dir='data'):\n self.base_dir = base_dir\n <mask token>\n", "step-...
[ 1, 2, 3, 4, 5 ]
from Song import Song class FroggyWoogie(Song): def __init__(self): super(FroggyWoogie, self).__init__() self.file = 'Music/5-Sleepy_Koala_-_Froggy_Woogie.mp3' self.plan = [[0.0, 32, 'W', 16.271], [16.271, 16, 'S', 8.135], [ 24.406, 44, 'S', 22.373], [46.779, 16, 'S', 8.136], ...
normal
{ "blob_id": "1df1081308ead28c023774a8671df8a0671a1bba", "index": 4177, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FroggyWoogie(Song):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FroggyWoogie(Song):\n\n def __init__(self):\n super(FroggyWoogie, self).__init__()\n ...
[ 0, 1, 2, 3 ]
""" 2. Schreiben Sie die Anzahl von symmetrischen Paaren (xy) und (yx). """ def symetrisch(x, y): """ bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind :param x: ein Element der Liste :param y: ein Element der Liste :return: True- wenn x und y symetrisch False - sonst ...
normal
{ "blob_id": "2c6dc4d55f64d7c3c01b3f504a72904451cb4610", "index": 6532, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef symetrisch(x, y):\n \"\"\"\n bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind\n :param x: ein Element der Liste\n :param y: ein Element der Liste\n :...
[ 0, 1, 2, 3 ]
import PIL from matplotlib import pyplot as plt import matplotlib from keras.preprocessing.image import ImageDataGenerator from keras.models import load_model from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers import RMSprop from keras.layers import Dense, Dropout, Flatten...
normal
{ "blob_id": "d2f760b821fc5c599cda1091334364e18234ab06", "index": 4222, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.fit\n<mask token>\nmodel.save('./T_100_Modelo_C64k33_C128k33_d025_D256_d05_D5.h5')\nplt.plot(history.history['accuracy'], label='accuracy')\nplt.plot(history.history['val_accuracy']...
[ 0, 1, 2, 3, 4 ]
import sys sys.path.append("..") import helpers helpers.mask_busy_gpus(wait=False) import nltk import numpy as np nltk.download('brown') nltk.download('universal_tagset') data = nltk.corpus.brown.tagged_sents(tagset='universal') all_tags = ['#EOS#','#UNK#','ADV', 'NOUN', 'ADP', 'PRON', 'DET', '.', 'PRT', 'VERB', 'X...
normal
{ "blob_id": "7f7ebc6d3d69fbb19071c63a9ab235ad01f1d414", "index": 306, "step-1": "<mask token>\n\n\ndef to_matrix(lines, token_to_id, max_len=None, pad=0, dtype='int32',\n time_major=False):\n \"\"\"Converts a list of names into rnn-digestable matrix with paddings added after the end\"\"\"\n max_len = ma...
[ 4, 5, 6, 7, 9 ]
from django.apps import AppConfig class PyrpgConfig(AppConfig): name = 'PyRPG'
normal
{ "blob_id": "f8bf7e2d8f06bbd00f04047153833c07bf483fd3", "index": 259, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PyrpgConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PyrpgConfig(AppConfig):\n name = 'PyRPG'\n", "step-4": "from django.apps import AppConfig\...
[ 0, 1, 2, 3 ]
# import gmplot package import gmplot import numpy as np # generate 700 random lats and lons latitude = (np.random.random_sample(size = 700) - 0.5) * 180 longitude = (np.random.random_sample(size = 700) - 0.5) * 360 # declare the center of the map, and how much we want the map zoomed in gmap = gmplot.GoogleMapPlotter(0...
normal
{ "blob_id": "1cc77ed1c5da025d1b539df202bbd3310a174eac", "index": 3902, "step-1": "<mask token>\n", "step-2": "<mask token>\ngmap.heatmap(latitude, longitude)\ngmap.scatter(latitude, longitude, c='r', marker=True)\n<mask token>\ngmap.draw('c:\\\\users\\\\jackc\\\\desktop\\\\country_heatmap.html')\n<mask token>\...
[ 0, 1, 2, 3, 4 ]
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may # not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanyin...
normal
{ "blob_id": "6f107d0d0328c2445c0e1d0dd10e51227da58129", "index": 3900, "step-1": "<mask token>\n\n\n@service_marker\nclass TestTrainingDebuggerJob:\n\n def _wait_sagemaker_training_rule_eval_status(self, training_job_name,\n rule_type: str, expected_status: str, wait_periods: int=30,\n period_le...
[ 4, 7, 8, 9, 11 ]
print ("Hello Workls!")
normal
{ "blob_id": "c52d1c187edb17e85a8e2b47aa6731bc9a41ab1b", "index": 561, "step-1": "<mask token>\n", "step-2": "print('Hello Workls!')\n", "step-3": "print (\"Hello Workls!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from collections import namedtuple from functools import partial import inspect from itertools import product import math import os import numpy as np from numpy.testing import assert_allclose, assert_array_equal import pytest import ...
normal
{ "blob_id": "c5e7fdcbd4a9281597a35a180f2853caac68f811", "index": 7562, "step-1": "<mask token>\n\n\ndef my_kron(A, B):\n D = A[..., :, None, :, None] * B[..., None, :, None, :]\n ds = D.shape\n newshape = *ds[:-4], ds[-4] * ds[-3], ds[-2] * ds[-1]\n return D.reshape(newshape)\n\n\ndef _identity(x):\n...
[ 97, 100, 123, 125, 137 ]
#!/usr/bin/env python # Ben Suay, RAIL # May 2013 # Worcester Polytechnic Institute # # http://openrave.org/docs/latest_stable/command_line_tools/ # openrave-robot.py /your/path/to/your.robot.xml --info=joints # On that page you can find more examples on how to use openrave-robot.py. from openravepy import * import s...
normal
{ "blob_id": "6ad939ab541562efdaacb8b56865e76d1745176a", "index": 2494, "step-1": "#!/usr/bin/env python\n# Ben Suay, RAIL\n# May 2013\n# Worcester Polytechnic Institute\n#\n\n# http://openrave.org/docs/latest_stable/command_line_tools/\n# openrave-robot.py /your/path/to/your.robot.xml --info=joints\n# On that pa...
[ 0 ]
# Copyright (c) 2021, Omid Erfanmanesh, All rights reserved. import math import numpy as np import pandas as pd from data.based.based_dataset import BasedDataset from data.based.file_types import FileTypes class DengueInfection(BasedDataset): def __init__(self, cfg, development): super(DengueInfectio...
normal
{ "blob_id": "93ac8a1f795f7809a3e88b56ce90bf1d31706554", "index": 1139, "step-1": "<mask token>\n\n\nclass DengueInfection(BasedDataset):\n <mask token>\n\n def cyclic_encoder(self, col, max_val):\n self.df[col + '_sin'] = np.sin(2 * np.pi * self.df[col] / max_val)\n self.df[col + '_cos'] = np...
[ 16, 18, 22, 25, 33 ]
import json import boto3 import os import datetime regionName = os.environ['AWS_REGION'] BUCKET_PATH = os.environ['BUCKET_PATH'] SENSITIVIT = os.environ['SENSITIVIT'] s3_client = boto3.client('s3', region_name=regionName) ddb_resource = boto3.resource('dynamodb', region_name=regionName) def lambda_handler(event, co...
normal
{ "blob_id": "8c96c38a67c2eb97e30b325e4917ba4888731118", "index": 7349, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n body = event\n videoPath = str(body['videoPath'])\n templatePath = str(body['templatePath'])\n facePath = str(body['facePath'])\n ...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin # Register your models here. from .models import HuyenQuan admin.site.register(HuyenQuan)
normal
{ "blob_id": "16e5a44cb4fbe71eaa9c1f5b00505578de0d2cea", "index": 6403, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(HuyenQuan)\n", "step-3": "from django.contrib import admin\nfrom .models import HuyenQuan\nadmin.site.register(HuyenQuan)\n", "step-4": "from django.contrib import...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import random IMAGES = [''' +---+ | | | | | | =========''', ''' +---+ | | O | | | | =========''', ''' +---+ | | O | | | | | =========''', ''' ...
normal
{ "blob_id": "074defa92c8bc5afc221c9c19842d808fbf1e112", "index": 197, "step-1": "<mask token>\n\n\ndef run():\n word = randomWord()\n hiddenWord = ['-'] * len(word)\n tries = 0\n while True:\n displayBoard(hiddenWord, tries)\n currentLetter = str(raw_input('Escoge una letra: '))\n ...
[ 1, 4, 5, 6, 7 ]
""" exercise 9-7-9-2 """ fname = raw_input("Enter file name: ") filehandle = open(fname) d = dict() for line in filehandle: newline = line.split() if newline != [] and newline[0] == 'From': day = newline[2] if day not in d: d[day] = 1 else: d[day] += 1 print d
normal
{ "blob_id": "7beb9d9e24f4c9a4e1a486048371da79c35d0927", "index": 8527, "step-1": "\"\"\"\r\nexercise 9-7-9-2\r\n\r\n\"\"\"\r\n\r\nfname = raw_input(\"Enter file name: \")\r\nfilehandle = open(fname)\r\nd = dict()\r\nfor line in filehandle:\r\n newline = line.split()\r\n if newline != [] and newline[0] == 'From':...
[ 0 ]
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import random PATH = "C:\\Program Files (x86)\\chromedriver.exe" destination = "https://news.ycombinator.com/" class hackernewsUpvoter(): def __init__(self, username, password, website): self.driver = webdriver.Chro...
normal
{ "blob_id": "742b655ee6aad2575f67e7329ed7a14c4fb6aa06", "index": 7242, "step-1": "<mask token>\n\n\nclass hackernewsUpvoter:\n <mask token>\n\n def sign_in(self, login_page='https://news.ycombinator.com/login'):\n self.driver.get(login_page)\n time.sleep(2)\n account = self.driver.find...
[ 4, 5, 7, 8, 10 ]
""" file: babysit.py language: python3 author: pan7447@rit.edu Parvathi Nair author: vpb8262 Vishal Bulchandani """ """ To compute the maximum pay a brother and sister can earn considering jobs that they can work on together or separately depending on the number of children to babysit """ from operator import * clas...
normal
{ "blob_id": "f57fa2787934dc2a002f82aa1af1f1d9a7f90da5", "index": 9947, "step-1": "<mask token>\n\n\nclass Job:\n \"\"\"\n Job class which stores the attributes of the jobs\n \"\"\"\n\n def __init__(self, day, startTime, endTime, noOfChildren, hourlyRate):\n self.day = day\n self.startTi...
[ 9, 11, 12, 13, 14 ]
import pandas as pd import numpy as np import pyten.tenclass import pyten.method import pyten.tools def scalable(file_name=None, function_name=None, recover=None, omega=None, r=2, tol=1e-8, maxiter=100, init='random', printitn=0): """ Helios1 API returns CP_ALS, TUCKER_ALS, or NNCP decomposition or...
normal
{ "blob_id": "39fdb9c586c3cf92d493269ceac419e0058a763a", "index": 380, "step-1": "import pandas as pd\nimport numpy as np\n\nimport pyten.tenclass\nimport pyten.method\nimport pyten.tools\n\n\ndef scalable(file_name=None, function_name=None, recover=None, omega=None, r=2, tol=1e-8, maxiter=100, init='random',\n ...
[ 0 ]
# coding:utf-8 import jieba import os import sys import math reload(sys) sys.setdefaultencoding('utf-8') from sklearn import feature_extraction from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer #import csv #import pandas #import numpy sente...
normal
{ "blob_id": "1a7e83fe9528b177246d6374ddaf2a76a0046e83", "index": 200, "step-1": "<mask token>\n\n\ndef cos_dist(a, b):\n if len(a) != len(b):\n return None\n part_up = 0.0\n a_sq = 0.0\n b_sq = 0.0\n for a1, b1 in zip(a, b):\n part_up += a1 * b1\n a_sq += a1 ** 2\n b_sq...
[ 1, 2, 3, 4, 5 ]
import numpy as np import tkinter as tk import time HEIGHT = 100 WIDTH = 800 ROBOT_START_X = 700 ROBOT_START_Y = 50 SLEEP_TIME = 0.00001 SLEEP_TIME_RESET = 0.2 class Environment(tk.Tk, object): def __init__(self): super(Environment, self).__init__() self.action_space = ['g', 'b'] # go, break ...
normal
{ "blob_id": "ee272fe1a023d85d818a8532055dcb5dbcb6a707", "index": 4799, "step-1": "<mask token>\n\n\nclass Environment(tk.Tk, object):\n\n def __init__(self):\n super(Environment, self).__init__()\n self.action_space = ['g', 'b']\n self.num_actions = len(self.action_space)\n self.ti...
[ 4, 5, 6, 8, 10 ]
from functions2 import * import numpy as np #from functions import TermStructure,load_data import numpy as np import math from scipy import optimize import pylab as pl from IPython import display as dp class Vasicek(): def __init__(self,rs,vol): self.t = rs.columns self.ps= rs[-1:] self....
normal
{ "blob_id": "b6470ffda9040223951a99abc600ce1e99fe146b", "index": 7902, "step-1": "<mask token>\n\n\nclass Vasicek:\n\n def __init__(self, rs, vol):\n self.t = rs.columns\n self.ps = rs[-1:]\n self.sigma = vol\n <mask token>\n\n def loss(self, x):\n self.a = x[0]\n self...
[ 3, 5, 6, 8, 9 ]
"""David's first approach when I exposed the problem. Reasonable to add in the comparison? """ import numpy as np from sklearn.linear_model import RidgeCV from sklearn.model_selection import ShuffleSplit def correlation(x, y): a = (x - x.mean(0)) / x.std(0) b = (y - y.mean(0)) / y.std(0) return a.T @ b / ...
normal
{ "blob_id": "dfd2b515e08f285345c750bf00f6a55f43d60039", "index": 8379, "step-1": "<mask token>\n\n\ndef partial_correlation_loop(solver, x, y, ensemble=None):\n e_hat = np.zeros(y.shape[1])\n for i in range(y.shape[1]):\n y_i = y[:, i].reshape(-1, 1)\n y_not_i = np.delete(y, i, axis=1)\n ...
[ 4, 5, 6, 7, 9 ]
#!flask/bin/python from config import SQLALCHEMY_DATABASE_URI from app.models import Patient, Appointment, PhoneCalls from app import db import os.path db.create_all() # Patient.generate_fake(); # Appointment.generate_fake(); # PhoneCalls.generate_fake(); Patient.add_patient(); Appointment.add_appointment(); PhoneCal...
normal
{ "blob_id": "173e6017884a1a4df64018b306ea71bcaa1c5f1d", "index": 4528, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.create_all()\nPatient.add_patient()\nAppointment.add_appointment()\nPhoneCalls.add_call()\n", "step-3": "from config import SQLALCHEMY_DATABASE_URI\nfrom app.models import Patient, A...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- class Task: def __init__(self): self.title = '' self.subtasks = [] def set_title(self, title): self.title = title def set_subtasks(self, subtasks): self.subtasks = subtasks
normal
{ "blob_id": "3cf2ffbc8163c2a447016c93ff4dd13e410fff2b", "index": 7353, "step-1": "<mask token>\n", "step-2": "class Task:\n <mask token>\n <mask token>\n\n def set_subtasks(self, subtasks):\n self.subtasks = subtasks\n", "step-3": "class Task:\n\n def __init__(self):\n self.title = ...
[ 0, 2, 3, 4, 5 ]
from plumbum import local, FG, ProcessExecutionError import logging import os.path from task import app kubectl = local["kubectl"] @app.task def create_kube_from_template(file_name, *aargs): args = {} for a in aargs: args.update(a) template = open(os.path.join('..', file_name)).read() % args logging.info...
normal
{ "blob_id": "137e80b3bfdc0dba33a3108b37d21d298a8f251d", "index": 1544, "step-1": "<mask token>\n\n\n@app.task\ndef delete_kube_by_name(name):\n try:\n logging.info(kubectl['delete', name]())\n return True\n except ProcessExecutionError:\n return False\n", "step-2": "<mask token>\n\n\...
[ 1, 2, 3, 4, 5 ]
from pointsEau.models import PointEau from django.contrib.auth.models import User from rest_framework import serializers class PointEauSerializer(serializers.ModelSerializer): class Meta: model = PointEau fields = [ 'pk', 'nom', 'lat', 'long', ...
normal
{ "blob_id": "51f171b3847b3dbf5657625fdf3b7fe771e0e004", "index": 4743, "step-1": "<mask token>\n\n\nclass UserSerializer(serializers.ModelSerializer):\n pointseau = serializers.PrimaryKeyRelatedField(many=True, queryset=\n PointEau.objects.all())\n\n\n class Meta:\n model = User\n fiel...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import sys sys.path.append('./spec') # FIXME: make the spec file an argument to this script from dwarf3 import * def mandatory_fragment(mand): if mand: return "mandatory" else: return "optional" def super_attrs(tag): #sys.stderr.write("Calculating super attrs for...
normal
{ "blob_id": "223d96806631e0d249e8738e9bb7cf5b1f48a8c1", "index": 4252, "step-1": "#!/usr/bin/env python\n\nimport sys\n\nsys.path.append('./spec')\n\n# FIXME: make the spec file an argument to this script\nfrom dwarf3 import *\n\ndef mandatory_fragment(mand):\n if mand: \n return \"mandatory\"\n els...
[ 0 ]
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets Authors. # # 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 appl...
normal
{ "blob_id": "ed65d7e0de3fc792753e34b77254bccc8cee6d66", "index": 3657, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_data_dir_register():\n register = register_path.DataDirRegister(namespace_to_data_dirs={'ns1':\n [epath.Path('/path/ns1')]})\n assert {'ns1'} == register.namespa...
[ 0, 1, 2, 3 ]
# TrackwayDirectionStage.py # (C)2014-2015 # Scott Ernst from __future__ import print_function, absolute_import, unicode_literals, division from collections import namedtuple import math from pyaid.number.NumericUtils import NumericUtils from cadence.analysis.CurveOrderedAnalysisStage import CurveOrderedAnalysisSta...
normal
{ "blob_id": "a721adaaa69bf09c2ea259f12bea05515c818679", "index": 5327, "step-1": "<mask token>\n\n\nclass TrackwayDirectionStage(CurveOrderedAnalysisStage):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, key, owner, **kwargs):\n \"\"\"Creates a new instan...
[ 7, 9, 11, 13, 17 ]
#!/usr/bin/env python from LCClass import LightCurve import matplotlib.pyplot as plt import niutils def main(): lc1821 = LightCurve("PSR_B1821-24/PSR_B1821-24_combined.evt") lc0218 = LightCurve("PSR_J0218+4232/PSR_J0218+4232_combined.evt") fig, ax = plt.subplots(2, 1, figsize=(8, 8)) ax[0], _ = lc18...
normal
{ "blob_id": "48311ee17a3f2eca8db32d7672f540fa45a7a900", "index": 3524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n lc1821 = LightCurve('PSR_B1821-24/PSR_B1821-24_combined.evt')\n lc0218 = LightCurve('PSR_J0218+4232/PSR_J0218+4232_combined.evt')\n fig, ax = plt.subplots(2, 1,...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2 on 2021-06-28 04:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rrhh', '0014_alter_detallepermiso_fecha_permiso'), ] operations = [ migrations.AlterField( model_name='permiso', name=...
normal
{ "blob_id": "5db450424dc143443839e24801ece444d0d7e162", "index": 3611, "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 = [('rrhh', '001...
[ 0, 1, 2, 3, 4 ]
#!/home/porosya/.local/share/virtualenvs/checkio-VEsvC6M1/bin/checkio --domain=py run inside-block # https://py.checkio.org/mission/inside-block/ # When it comes to city planning it's import to understand the borders of various city structures. Parks, lakes or living blocks can be represented as closed polygon and...
normal
{ "blob_id": "548c4dbfc1456fead75c22927ae7c6224fafeace", "index": 7893, "step-1": "<mask token>\n", "step-2": "def is_inside(polygon, point):\n return True or False\n\n\n<mask token>\n", "step-3": "def is_inside(polygon, point):\n return True or False\n\n\nif __name__ == '__main__':\n assert is_insid...
[ 0, 1, 2, 3 ]
""" Kernel desnity estimation plots for geochemical data. """ import copy import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import MaxNLocator from ...comp.codata import close from ...util.log import Handle from ...util.meta import get_additional_params, subkwargs from ...util.plot.axes import...
normal
{ "blob_id": "ae475dc95c6a099270cf65d4b471b4b430f02303", "index": 8840, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef density(arr, ax=None, logx=False, logy=False, bins=25, mode='density',\n extent=None, contours=[], percentiles=True, relim=True, cmap=\n DEFAULT_CONT_COLORMAP, shading='auto...
[ 0, 2, 3, 4, 5 ]
from distutils.core import setup setup(name='greeker', version='0.3.2-git', description="scrambles nouns in an XML document to produce a specimen for layout testing", author="Brian Tingle", author_email="brian.tingle.cdlib.org@gmail.com", url="http://tingletech.github.com/greeker.py/", ...
normal
{ "blob_id": "1fda8274024bdf74e7fbd4ac4a27d6cfe6032a13", "index": 9790, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='greeker', version='0.3.2-git', description=\n 'scrambles nouns in an XML document to produce a specimen for layout testing'\n , author='Brian Tingle', author_email=\n ...
[ 0, 1, 2, 3 ]
from BeautifulSoup import BeautifulSoup, NavigableString from urllib2 import urlopen from time import ctime import sys import os import re restaurants = ["http://finweb.rit.edu/diningservices/brickcity", "http://finweb.rit.edu/diningservices/commons", "http://finweb.rit.edu/diningservices/crossroads", "http://finweb.r...
normal
{ "blob_id": "02e40e051c19116c9cb3a903e738232dc8f5d026", "index": 9522, "step-1": "\nfrom BeautifulSoup import BeautifulSoup, NavigableString\nfrom urllib2 import urlopen\nfrom time import ctime\nimport sys\nimport os\nimport re\nrestaurants = [\"http://finweb.rit.edu/diningservices/brickcity\",\n\"http://finweb....
[ 0 ]
# coding=utf-8 import sys if len(sys.argv) == 2: filepath = sys.argv[1] pRead = open(filepath,'r')#wordlist.txt pWrite = open("..\\pro\\hmmsdef.mmf",'w') time = 0 for line in pRead: if line != '\n': line = line[0: len(line) - 1] #去除最后的\n if line == "sil ": ...
normal
{ "blob_id": "9bd6da909baeb859153e3833f0f43d8cbcb66200", "index": 9324, "step-1": "# coding=utf-8\nimport sys\nif len(sys.argv) == 2:\n filepath = sys.argv[1]\n pRead = open(filepath,'r')#wordlist.txt\n pWrite = open(\"..\\\\pro\\\\hmmsdef.mmf\",'w')\n time = 0\n for line in pRead:\n if line...
[ 0 ]
import itertools def odds(upper_limit): return [i for i in range(1,upper_limit,2)] def evens(upper_limit): return [i for i in range(0,upper_limit,2)] nested = [i**j for i in range(1,10) for j in range(1,4)] vowels = ['a', 'e', 'i', 'o', 'u'] consonants = [chr(i) for i in range(97,123) if chr(i) not in vowe...
normal
{ "blob_id": "a2e4e4a0c49c319df2adb073b11107d3f520aa6e", "index": 1883, "step-1": "<mask token>\n\n\ndef evens(upper_limit):\n return [i for i in range(0, upper_limit, 2)]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef odds(upper_limit):\n return [i for i in range(1, upper_limit, 2)]\n\n\ndef even...
[ 1, 3, 4, 5, 6 ]
N = int(input("ingrese el numero de datos a ingresar ")) SP = 0 SO = 0 CP = 0 for i in range(1,N+1,1): NUM = int(input("ingrese un numero entero ")) if NUM > 0: SP += NUM CP += 1 else: SO += NUM PG = (SP+SO)/N PP = SP/CP print(f"hay { CP } numeros positivos, el promedio general es de...
normal
{ "blob_id": "efc0b8f1c4887810a9c85e34957d664b01c1e92e", "index": 1453, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, N + 1, 1):\n NUM = int(input('ingrese un numero entero '))\n if NUM > 0:\n SP += NUM\n CP += 1\n else:\n SO += NUM\n<mask token>\nprint(\n ...
[ 0, 1, 2, 3 ]
def test(name,message): print("用户是:" , name) print("欢迎消息是:",message) my_list = ['孙悟空','欢迎来疯狂软件'] test(*my_list) print('*****') # ########################### def foo(name,*nums): print("name参数:",name) print("nums参数:",nums) my_tuple = (1,2,3) foo('fkit',*my_tuple) print('********') foo(*my_tuple) print(...
normal
{ "blob_id": "64fb006ea5ff0d101000dd4329b3d957a326ed1a", "index": 2387, "step-1": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n", "step-2": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n\n\ndef foo(name,...
[ 1, 3, 4, 5, 6 ]
from _math import Vector2, Vector3, Quaternion, Transform, Vector3Immutable, QuaternionImmutable, minimum_distance from _math import mod_2pi from math import pi as PI, sqrt, fmod, floor, atan2, acos, asin, ceil, pi, e import operator from sims4.repr_utils import standard_repr import enum import native.animation import ...
normal
{ "blob_id": "a0310b1bab339064c36ff0fe92d275db7a6c5ba9", "index": 8734, "step-1": "<mask token>\n\n\ndef rad_to_deg(rad):\n return rad * 180 / PI\n\n\ndef angle_abs_difference(a1, a2):\n delta = sims4.math.mod_2pi(a1 - a2)\n if delta > sims4.math.PI:\n delta = sims4.math.TWO_PI - delta\n return...
[ 52, 53, 55, 64, 75 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, request, jsonify from app import Node from dbm2 import filemanager fm = filemanager() node = Node(fm) app = Flask(__name__) @app.route("/transactions/isfull",methods=['GET']) def isFull(): return jsonify(node.isFull()), 200 @app.route("/tra...
normal
{ "blob_id": "45b46a08d8b304ac12baf34e0916b249b560418f", "index": 7459, "step-1": "<mask token>\n\n\n@app.route('/transactions/isfull', methods=['GET'])\ndef isFull():\n return jsonify(node.isFull()), 200\n\n\n@app.route('/transactions/new', methods=['POST'])\ndef newTransaction():\n transaction = request.g...
[ 8, 11, 12, 13, 14 ]
import numpy as np labels = np.load('DataVariationOther/w1_s500/targetTestNP.npy') for lab in labels: print(lab)
normal
{ "blob_id": "a83988e936d9dee4838db61c8eb8ec108f5ecd3f", "index": 4669, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor lab in labels:\n print(lab)\n", "step-3": "<mask token>\nlabels = np.load('DataVariationOther/w1_s500/targetTestNP.npy')\nfor lab in labels:\n print(lab)\n", "step-4": "impo...
[ 0, 1, 2, 3 ]
__author__ = 'fshaw' import gzip import hashlib import os import uuid import json import jsonpickle from chunked_upload.models import ChunkedUpload from chunked_upload.views import ChunkedUploadView, ChunkedUploadCompleteView from django.conf import settings from django.core import serializers from django.core.files.ba...
normal
{ "blob_id": "2b7415d86f9157ae55228efdd61c9a9e9920bc5c", "index": 7716, "step-1": "<mask token>\n\n\nclass CopoChunkedUploadCompleteView(ChunkedUploadCompleteView):\n do_md5_check = False\n\n def get_response_data(self, chunked_upload, request):\n \"\"\"\n Data for the response. Should return ...
[ 12, 13, 14, 15, 18 ]
import os import config ############################ # NMJ_RNAI LOF/GOF GENE LIST def nmj_rnai_set_path(): return os.path.join(config.datadir, 'NMJ RNAi Search File.txt') def nmj_rnai_gain_of_function_set_path(): return os.path.join(config.datadir, 'NMJ_RNAi_gain_of_function_flybase_ids.txt') def get_n...
normal
{ "blob_id": "6a9d64b1ef5ae8e9d617c8b0534e96c9ce7ea629", "index": 4951, "step-1": "\nimport os\n\nimport config\n\n\n############################\n# NMJ_RNAI LOF/GOF GENE LIST\n\ndef nmj_rnai_set_path():\n return os.path.join(config.datadir, 'NMJ RNAi Search File.txt')\n\n\ndef nmj_rnai_gain_of_function_set_pa...
[ 0 ]
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt class LogisticRegression: '''LogisticRegression for binary classification max_iter: the maximum iteration times for training learning_rate: learing rate for gradiend decsend training Input's shape shoul...
normal
{ "blob_id": "1dd62264aafe8ee745a3cfdfb994ac6a40c1af42", "index": 1848, "step-1": "<mask token>\n\n\nclass LogisticRegression:\n <mask token>\n\n def __init__(self, max_iter=2000, learning_rate=0.01):\n self.max_iter = max_iter\n self.learning_rate = learning_rate\n print('LogisticRegre...
[ 7, 11, 13, 14, 15 ]
from sqlalchemy.orm import Session from fastapi import APIRouter, Depends, File from typing import List from ..models.database import ApiSession from ..schemas.images_schema import ImageReturn from . import image_service router = APIRouter() @router.get("/", response_model=List[ImageReturn]) def get_all_images(db: ...
normal
{ "blob_id": "874ca60749dba9ca8c8ebee2eecb1b80da50f11f", "index": 3782, "step-1": "<mask token>\n\n\n@router.get('/', response_model=List[ImageReturn])\ndef get_all_images(db: Session=Depends(ApiSession)):\n return image_service.get_all_images(db)\n\n\n@router.get('/{image_id}', response_model=ImageReturn)\nde...
[ 4, 5, 6, 7, 8 ]
""" Make html galleries from media directories. Organize by dates, by subdirs or by the content of a diary file. The diary file is a markdown file organized by dates, each day described by a text and some medias (photos and movies). The diary file can be exported to: * an html file with the text and subset of medias a...
normal
{ "blob_id": "6018f35afc6646d0302ca32de649ffe7d544a765", "index": 3377, "step-1": "<mask token>\n\n\nclass Post:\n\n def __init__(self, date, text, medias):\n self.date = date\n self.text = text\n self.medias = medias\n self.dcim = []\n self.daterank = 0\n self.extra =...
[ 79, 84, 88, 100, 110 ]
#! /usr/bin/python import math import sys import os import subprocess #PTYPES = [ "eth_ip_udp_head_t", "ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64ip64_64udp_head_t", "eth6464_64ip64_64udp_head_t" ] #PTYPES = [ "eth_ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64...
normal
{ "blob_id": "9101fc5b8ba04a1b72e0c79d5bf3e4118e1bad75", "index": 5676, "step-1": "#! /usr/bin/python\n\nimport math\nimport sys\nimport os\nimport subprocess\n\n\n#PTYPES = [ \"eth_ip_udp_head_t\", \"ip_udp_head_t\", \"eth_32ip_udp_head_t\", \"eth_64ip_udp_head_t\", \"eth64_64ip64_64udp_head_t\", \"eth6464_64ip...
[ 0 ]
#!/usr/bin/env python3 import sys class Parse: data = [] def __parseLine(line): """Parse the given line""" # extract name name_len = line.index(" ") name = line[:name_len] line = line[name_len + 3:] # array-ize 'electron' val elec_pos = line.index("e...
normal
{ "blob_id": "cb77696a90716acdee83a1cf6162a8f42c524e11", "index": 7612, "step-1": "<mask token>\n\n\nclass Write:\n\n def __writeHeader(fd):\n \"\"\"Write html header\"\"\"\n print('<!DOCTYPE html>', '<html>', ' <head>',\n ' <title>Super Tableau 3000</title>',\n \" <meta c...
[ 8, 11, 12, 13, 16 ]
#!/usr/bin/env python def findSubset(s0, s, t): mys0 = s0.copy() mys = s.copy() if t == 0 and mys0: return mys0 elif t == 0: # and mys0 == set() return True else: if len(mys) > 0: p = mys.pop() mys1 = mys0.copy() mys1.add(p) ...
normal
{ "blob_id": "079610f2aaebec8c6e46ccf21a9d5728df1be8de", "index": 4155, "step-1": "<mask token>\n", "step-2": "def findSubset(s0, s, t):\n mys0 = s0.copy()\n mys = s.copy()\n if t == 0 and mys0:\n return mys0\n elif t == 0:\n return True\n elif len(mys) > 0:\n p = mys.pop()\n...
[ 0, 1, 2, 3 ]
import pymarc from pymarc import JSONReader, Field, JSONWriter, XMLWriter import psycopg2 import psycopg2.extras import time import logging import json #WRITTEN W/PYTHON 3.7.3 print("...starting export"); # constructing file and log name timestr = time.strftime("%Y%m%d-%H%M%S") logging.basicConfig(filename=timestr ...
normal
{ "blob_id": "d81e8478d60c9ee778e1aeb0dd7b05f675e4ecad", "index": 2306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('...starting export')\n<mask token>\nlogging.basicConfig(filename=timestr + '-export.log')\n<mask token>\nmatCursor.execute(select_all_mat)\n<mask token>\nfor m in materialTypes:\n ...
[ 0, 1, 2, 3, 4 ]
# file /home/hep/ss4314/cmtuser/Gauss_v45r10p1/Gen/DecFiles/options/16303437.py generated: Wed, 25 Jan 2017 15:25:22 # # Event Type: 16303437 # # ASCII decay Descriptor: [Xi_b- -> (rho- -> pi- pi0) K- p+]cc # from Configurables import Generation Generation().EventType = 16303437 Generation().SampleGenerationTool = "Si...
normal
{ "blob_id": "7cc9d445d712d485eaebd090d2485dac0c38b3fb", "index": 5918, "step-1": "<mask token>\n", "step-2": "<mask token>\nGeneration().addTool(SignalRepeatedHadronization)\n<mask token>\nToolSvc().addTool(EvtGenDecay)\n<mask token>\n", "step-3": "<mask token>\nGeneration().EventType = 16303437\nGeneration(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 17/02/17 at 11:48 PM @author: neil Program description here Version 0.0.1 """ import matplotlib.pyplot as plt from matplotlib.widgets import Button import sys # detect python version # if python 3 do this: if (sys.version_info > (3, 0)): import tkint...
normal
{ "blob_id": "1576693264a334153c2752ab6b3b4b65daa7c37c", "index": 8928, "step-1": "<mask token>\n\n\nclass Add_Buttons(object):\n <mask token>\n\n def validate_inputs(self):\n try:\n self.button_labels = list(self.button_labels)\n for it in self.button_labels:\n i...
[ 6, 8, 9, 10, 13 ]
#função: Definir se o número inserido é ímpar ou par #autor: João Cândido p = 0 i = 0 numero = int(input("Insira um número: ")) if numero % 2 == 0: p = numero print (p, "é um número par") else: i = numero print (i, "é um número ímpar")
normal
{ "blob_id": "382bc321c5fd35682bc735ca4d6e293d09be64ec", "index": 9990, "step-1": "<mask token>\n", "step-2": "<mask token>\nif numero % 2 == 0:\n p = numero\n print(p, 'é um número par')\nelse:\n i = numero\n print(i, 'é um número ímpar')\n", "step-3": "p = 0\ni = 0\nnumero = int(input('Insira um...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python #coding=utf-8 """ __init__.py :license: BSD, see LICENSE for more details. """ import os import logging import sys from logging.handlers import SMTPHandler, RotatingFileHandler from flask import Flask, g, session, request, flash, redirect, jsonify, url_for from flaskext.babel import Ba...
normal
{ "blob_id": "ef124e8c15ef347efd709a5e3fb104c7fd1bccde", "index": 2753, "step-1": "<mask token>\n\n\ndef on_identity_changed(app, identity):\n g.identity = identity\n session['identity'] = identity\n\n\ndef configure_signals(app):\n identity_changed.connect(on_identity_changed, app)\n\n\n<mask token>\n\n...
[ 6, 8, 9, 10, 13 ]
import inspect import json import socket import sys import execnet import logging from remoto.process import check class BaseConnection(object): """ Base class for Connection objects. Provides a generic interface to execnet for setting up the connection """ executable = '' remote_import_system...
normal
{ "blob_id": "ae38995d153deed2e6049b7b65fb5f28dfcef470", "index": 1442, "step-1": "<mask token>\n\n\nclass BaseConnection(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, hostname, logger=None, sudo=False, threads=1, eager=\n True, detect_sudo=False, use_ssh=False, i...
[ 19, 23, 27, 30, 31 ]
"""Tasks for managing Debug Information Files from Apple App Store Connect. Users can instruct Sentry to download dSYM from App Store Connect and put them into Sentry's debug files. These tasks enable this functionality. """ import logging import pathlib import tempfile from typing import List, Mapping, Tuple impor...
normal
{ "blob_id": "51bc2668a9f9f4425166f9e6da72b7a1c37baa01", "index": 9628, "step-1": "<mask token>\n\n\ndef inner_dsym_download(project_id: int, config_id: str) ->None:\n \"\"\"Downloads the dSYMs from App Store Connect and stores them in the Project's debug files.\"\"\"\n with sdk.configure_scope() as scope:\...
[ 3, 5, 7, 9, 10 ]
from django.apps import AppConfig class ClassromConfig(AppConfig): name = 'classrom'
normal
{ "blob_id": "a995305cb5589fa0cbb246ae3ca6337f4f2c3ca1", "index": 8798, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClassromConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ClassromConfig(AppConfig):\n name = 'classrom'\n", "step-4": "from django.apps import ...
[ 0, 1, 2, 3 ]
#exceptions.py #-*- coding:utf-8 -*- #exceptions try: print u'try。。。' r = 10/0 print 'result:',r except ZeroDivisionError,e: print 'except:',e finally: print 'finally...' print 'END' try: print u'try。。。' r = 10/int('1') print 'result:',r except ValueError,e: print 'ValueError:',e ...
normal
{ "blob_id": "1568cf544a4fe7aec082ef1d7506b8484d19f198", "index": 3776, "step-1": "#exceptions.py \n#-*- coding:utf-8 -*-\n\n#exceptions\ntry:\n print u'try。。。'\n r = 10/0\n print 'result:',r\nexcept ZeroDivisionError,e:\n print 'except:',e\nfinally:\n print 'finally...'\nprint 'END'\n\ntry:\n p...
[ 0 ]
def get_value(li, row, column): if row < 0 or column < 0: return 0 try: return li[row][column] except IndexError: return 0 n = int(input()) results = {} for asdf in range(n): table = [] title, rows, columns = input().split() rows = int(rows) columns =...
normal
{ "blob_id": "badbfdbdeb8b4fd40b1c44bf7dcff6457a0c8795", "index": 7162, "step-1": "<mask token>\n", "step-2": "def get_value(li, row, column):\n if row < 0 or column < 0:\n return 0\n try:\n return li[row][column]\n except IndexError:\n return 0\n\n\n<mask token>\n", "step-3": "d...
[ 0, 1, 2, 3, 4 ]
# Identify a vowel class MainInit(object): def __init__(self): self.vowel = str(input("Please type the character: \n")) if len(self.vowel) > 1: print("Invalid number of character") else: Vowel(self.vowel) class Vowel(object): def __init__(self, vo...
normal
{ "blob_id": "8d9f4bce998857bcc7bc2fda0b519f370bf957fe", "index": 1497, "step-1": "<mask token>\n\n\nclass Vowel(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Vowel(object):\n\n def __init__(self, vowels):\n self.vowels = vowels\n self.list = ['a', 'e', 'i'...
[ 1, 2, 3, 5, 6 ]
from logging import getLogger from time import sleep from uuid import UUID from zmq import Context, Poller, POLLIN, ZMQError, ETERM # pylint: disable-msg=E0611 from zhelpers import zpipe from dcamp.service.configuration import Configuration from dcamp.types.messages.control import SOS from dcamp.types.specs import E...
normal
{ "blob_id": "fee757b91f8c2ca1c105d7e67636772a8b5eafd5", "index": 8158, "step-1": "<mask token>\n\n\n@runnable\nclass RoleMixin(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _add_service(self, cls, *args, **kwargs):\n pipe, p...
[ 4, 10, 11, 14, 15 ]
# import libraries import pandas as pd import matplotlib.pyplot as plt import numpy as np import warnings import pickle from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from sklearn.metrics import mean_squared_error impor...
normal
{ "blob_id": "1508697f93114d7f20182a3e9c1df5617904529a", "index": 8725, "step-1": "<mask token>\n", "step-2": "<mask token>\nlr.fit(x_train, y_train)\n<mask token>\npickle.dump(lr, open('model.pkl', 'wb'))\n", "step-3": "<mask token>\ndataset = pd.read_csv('heart.csv')\ndf = dataset.copy()\nX = df.drop(['targ...
[ 0, 1, 2, 3, 4 ]
PROJECT_ID = "aaet-geoscience-dev" # The tmp folder is for lasio I/O purposes DATA_PATH = "/home/airflow/gcs/data/tmp" # Credential JSON key for accessing other projects # CREDENTIALS_JSON = "gs://aaet_zexuan/flow/keys/composer_las_merge.json" CREDENTIALS_JSON = "keys/composer_las_merge.json" # Bucket name fo...
normal
{ "blob_id": "0b2a036b806cca6e7f58008040b3a261a8bc844d", "index": 4092, "step-1": "<mask token>\n", "step-2": "PROJECT_ID = 'aaet-geoscience-dev'\nDATA_PATH = '/home/airflow/gcs/data/tmp'\nCREDENTIALS_JSON = 'keys/composer_las_merge.json'\nBUCKET_LAS_MERGE = 'las_merged'\nBUCKET_LAS_SPLICE = 'us-central1-lithos...
[ 0, 1, 2 ]
from django.contrib.auth import get_user_model from django.db import models from django.db.models.signals import post_save from apps.common.constants import NOTIFICATION_TYPE_CHOICES, INFO from apps.core.models import BaseModel from apps.core.utils.helpers import get_upload_path from apps.core.utils.push_notification ...
normal
{ "blob_id": "c2260278c8dfb353f55ee9ea3495049b08169447", "index": 4115, "step-1": "<mask token>\n\n\nclass City(BaseModel):\n name = models.CharField(max_length=255, db_index=True)\n\n def __str__(self):\n return self.name\n\n\nclass Article(BaseModel):\n created_by = models.ForeignKey(User, relat...
[ 9, 10, 11, 12, 15 ]
# coding: gb18030 from setuptools import setup setup( name="qlquery", version="1.0", license="MIT", packages=['qlquery'], install_requires=[ 'my-fake-useragent', 'requests', 'beautifulsoup4' ], zip_safe=False )
normal
{ "blob_id": "f11ede752df7d9aff672eee4e230b109fcbf987b", "index": 8555, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='qlquery', version='1.0', license='MIT', packages=['qlquery'],\n install_requires=['my-fake-useragent', 'requests', 'beautifulsoup4'],\n zip_safe=False)\n", "step-3": "...
[ 0, 1, 2, 3 ]
# Autor : Kevin Oswaldo Palacios Jimenez # Fecha de creacion: 16/09/19 # Se genera un bucle con for # al no tener argumento print no genera ningun cambio # mas que continuar a la siguiente linea for i in range (1,11): encabezado="Tabla del {}" print(encabezado.format(i)) print() # ...
normal
{ "blob_id": "86f365612e9f15e7658160ecab1d3d9970ca364e", "index": 9699, "step-1": "<mask token>\n", "step-2": "for i in range(1, 11):\n encabezado = 'Tabla del {}'\n print(encabezado.format(i))\n print()\n for j in range(1, 11):\n salida = '{} x {} = {}'\n print(salida.format(i, j, i *...
[ 0, 1, 2 ]
""" """ import json import logging import re import asyncio from typing import Optional import discord from discord.ext import commands import utils logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s") log = logging.getLogger("YTEmbedFixer") client = commands.Bot...
normal
{ "blob_id": "d73832d3f0adf22085a207ab223854e11fffa2e8", "index": 6948, "step-1": "<mask token>\n\n\ndef build_embed(_video_url: str, _video_image_url: Optional[str],\n _video_title: Optional[str], _author_name: Optional[str], _author_url:\n Optional[str]) ->discord.Embed:\n embed = discord.Embed(type='v...
[ 1, 2, 3, 4, 5 ]
from random import randint, shuffle class Generator: opset = ['+', '-', '*', '/', '²', '√', 'sin', 'cos', 'tan'] @staticmethod def generate(level): """ 根据 level 生成指定等级的算术题 0:小学;1:初中;2:高中 """ """ 生成操作数序列以及二元运算符序列 """ length = randint(0 if lev...
normal
{ "blob_id": "6e3bb17696953256af6d8194128427acebf1daac", "index": 524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Generator:\n <mask token>\n\n @staticmethod\n def generate(level):\n \"\"\"\n 根据 level 生成指定等级的算术题\n 0:小学;1:初中;2:高中\n \"\"\"\n \"\"\"\n...
[ 0, 2, 3, 4 ]
# -*- coding: utf-8 -*- """Module providing views for asset storage folder""" from Products.Five.browser import BrowserView from plone import api from plone.app.contenttypes.interfaces import IImage class AssetRepositoryView(BrowserView): """ Folderish content page default view """ def contained_items(self, u...
normal
{ "blob_id": "70c20b38edb01552a8c7531b3e87a9302ffaf6c5", "index": 5062, "step-1": "<mask token>\n\n\nclass AssetRepositoryView(BrowserView):\n <mask token>\n\n def contained_items(self, uid):\n stack = api.content.get(UID=uid)\n return stack.restrictedTraverse('@@folderListing')()\n\n def i...
[ 3, 4, 5, 6, 7 ]
import json import time from keySender import PressKey,ReleaseKey,dk config = { "Up": "W", "Down": "S", "Left": "A", "Right": "D", "Grab": "LBRACKET", "Drop": "RBRACKET" } ### Commands # Move def Move(direction,delay=.2): PressKey(dk[config[direction]]) time.sleep(delay) # Replace with a better condition Rele...
normal
{ "blob_id": "1e7789b154271eb8407a027c6ddf6c941cc69a41", "index": 3070, "step-1": "<mask token>\n\n\ndef Move(direction, delay=0.2):\n PressKey(dk[config[direction]])\n time.sleep(delay)\n ReleaseKey(dk[config[direction]])\n\n\ndef Action(direction, pull=None):\n delay = 0.6\n if pull:\n del...
[ 2, 3, 4, 5, 6 ]
# collectd-vcenter - vcenter.py # # Author : Loic Lambiel @ exoscale # Contributor : Josh VanderLinden # Description : This is a collectd python module to gather stats from Vmware # vcenter import logging import ssl import time from pysphere import VIServer try: import collectd COLLECTD_ENABLED...
normal
{ "blob_id": "55f76ae1ffe0fb2d2ca2c7a20aab45ffb00cf178", "index": 613, "step-1": "<mask token>\n\n\nclass CollectdCollector(Collector):\n \"\"\"\n Handle dispatching statistics to collectd.\n\n \"\"\"\n NAME = 'vCenter'\n\n def __init__(self, *args, **kwargs):\n super(CollectdCollector, self...
[ 11, 13, 19, 20, 24 ]
import numpy as np import cv2 as cv import random import time random.seed(0) def displayImage(winName, img): """ Helper function to display image arguments: winName -- Name of display window img -- Source Image """ cv.imshow(winName, img) cv.waitKey(0) ################################...
normal
{ "blob_id": "f7886f8d98ad0519f4635064f768f25dad101a3d", "index": 2612, "step-1": "<mask token>\n\n\ndef displayImage(winName, img):\n \"\"\" Helper function to display image\n arguments:\n winName -- Name of display window\n img -- Source Image\n \"\"\"\n cv.imshow(winName, img)\n cv.wai...
[ 7, 8, 10, 12, 13 ]
import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import datasets, models, transforms #import matplotlib.pyplot as plt import time import os import copy import torch.nn.functional as F from PIL import Image, ExifTag...
normal
{ "blob_id": "d807a363c08d117c848ffdc0a768c696ea7746bd", "index": 1787, "step-1": "<mask token>\n\n\ndef train_model_snapshot(model, criterion, lr, dataloaders, dataset_sizes,\n device, num_cycles, num_epochs_per_cycle):\n since = time.time()\n best_model_wts = copy.deepcopy(model.state_dict())\n best...
[ 2, 3, 4, 5, 6 ]
""" Написать программу, которая принимает строку и выводит строку без пробелов и ее длину. Для удаления пробелов реализовать доп функцию. """
normal
{ "blob_id": "1eab2ddda6fdd71db372e978caa6e7d24c7fe78e", "index": 7724, "step-1": "<mask token>\n", "step-2": "\"\"\"\n Написать программу, которая принимает строку\n и выводит строку без пробелов и ее длину.\n Для удаления пробелов реализовать доп функцию.\n\"\"\"", "step-3": null, "step-4": null,...
[ 0, 1 ]
from os import path from sklearn.model_selection import StratifiedShuffleSplit from sklearn.pipeline import Pipeline from sta211.datasets import load_train_dataset, load_test_dataset, find_best_train_dataset from sklearn.model_selection import GridSearchCV from sta211.selection import get_naive_bayes, get_mlp, get_svm,...
normal
{ "blob_id": "c99878dbd5610c8a58f00912e111b1eef9d3893e", "index": 7782, "step-1": "<mask token>\n", "step-2": "<mask token>\ngrid.fit(X, y)\n<mask token>\nprint('Result for {} configurations'.format(len(parameters)))\nfor p in parameters:\n print('{};{:.2f}%;{:.4f}%;±{:.4f}%'.format(', '.join(map(lambda k:\n...
[ 0, 1, 2, 3, 4 ]
""" You can perform the following operations on the string, : Capitalize zero or more of 's lowercase letters. Delete all of the remaining lowercase letters in . Given two strings, and , determine if it's possible to make equal to as described. If so, print YES on a new line. Otherwise, print NO. For example, give...
normal
{ "blob_id": "5fb998fa761b989c6dd423634824197bade4f8a5", "index": 23, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef abbreviation(a, b):\n m, n = len(a), len(b)\n dp = [([False] * (m + 1)) for _ in range(n + 1)]\n dp[0][0] = True\n for i in range(n + 1):\n for j in range(1, m + ...
[ 0, 1, 2, 3, 4 ]
import pandas as pd df1 = pd.read_csv("../final/your_no.tsv", '\t') df2 = pd.read_csv("../../Downloads/me.csv", '\t') final = pd.concat([df1, df2]) final.to_csv('../../Downloads/final_con_final.tsv', sep='\t', index=False)
normal
{ "blob_id": "cd5945631a9dd505bf67089bab8c5a37ad375129", "index": 410, "step-1": "<mask token>\n", "step-2": "<mask token>\nfinal.to_csv('../../Downloads/final_con_final.tsv', sep='\\t', index=False)\n", "step-3": "<mask token>\ndf1 = pd.read_csv('../final/your_no.tsv', '\\t')\ndf2 = pd.read_csv('../../Downlo...
[ 0, 1, 2, 3, 4 ]
import time,pickle from CNN_GPU.CNN_C_Wrapper import * from pathlib import Path FSIGMOIG = 0 FTANH = 2 FRELU = 4 REQUEST_INPUT = 0 REQUEST_GRAD_INPUT = 1 REQUEST_OUTPUT = 2 REQUEST_WEIGTH = 3 class CNN: def __init__(self, inputSize, hitLearn=.1, momentum=.9, weigthDecay=.5, multip=1.0): file = '%s/%s' %...
normal
{ "blob_id": "32db21ed7f57f29260d70513d8c34de53adf12d7", "index": 5740, "step-1": "<mask token>\n\n\nclass CNN:\n\n def __init__(self, inputSize, hitLearn=0.1, momentum=0.9, weigthDecay=\n 0.5, multip=1.0):\n file = '%s/%s' % (DIR_LIBRARY, 'gpu_function.cl')\n file = file.encode('utf-8')\n...
[ 7, 12, 20, 21, 27 ]
a = 1 b = 2 print(a + b) print("hello") list = [1, 2, 3, 4, 5] for i in list: if i % 2 != 0: print(i) print("branch")
normal
{ "blob_id": "03b325094bd3e77f467e17ce54deb95bf2b5c727", "index": 1724, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a + b)\nprint('hello')\n<mask token>\nfor i in list:\n if i % 2 != 0:\n print(i)\nprint('branch')\n", "step-3": "a = 1\nb = 2\nprint(a + b)\nprint('hello')\nlist = [1, 2...
[ 0, 1, 2, 3 ]
from __future__ import print_function from __future__ import absolute_import from __future__ import division __all__ = [ 'mesh_add_vertex_to_face_edge' ] def mesh_add_vertex_to_face_edge(mesh, key, fkey, v): """Add an existing vertex of the mesh to an existing face. Parameters ---------- mesh :...
normal
{ "blob_id": "d9b6efce92e30267a9f992c4fea698fe14e0c3e4", "index": 1398, "step-1": "<mask token>\n\n\ndef mesh_add_vertex_to_face_edge(mesh, key, fkey, v):\n \"\"\"Add an existing vertex of the mesh to an existing face.\n\n Parameters\n ----------\n mesh : compas.datastructures.Mesh\n The mesh d...
[ 1, 2, 3, 4, 5 ]
from enum import Enum class ImageTaggingChoice(str, Enum): Disabled = "disabled", Basic = "basic", Enhanced = "enhanced", UnknownFutureValue = "unknownFutureValue",
normal
{ "blob_id": "e3fe77867926d9d82963c8125048148de6998e2b", "index": 4374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ImageTaggingChoice(str, Enum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ImageTaggingChoice(str, Enum):\n ...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import subprocess import statsmodels.api as sm import numpy as np import math ''' This function prcesses the gene file Output is a one-row file for a gene Each individual is in a column Input file must have rowname gene: gene ENSG ID of interest start_col: column number which the gene exp value st...
normal
{ "blob_id": "2f64aac7032ac099870269659a84b8c7c38b2bf0", "index": 8385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lm_res(snps, gene, cov):\n res = pd.DataFrame(np.zeros([snps.shape[0], 2], dtype=np.float32))\n res.index = snps.index\n res.columns = ['beta', 'pval']\n for i in rang...
[ 0, 1, 2, 3, 4 ]
import cgi import os import math import sys from datetime import datetime sys.path.append(os.path.join(os.path.dirname(__file__), 'pygooglechart-0.2.1')) from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from pygooglechart import PieChart3D from LPData import Totals fr...
normal
{ "blob_id": "d8c9e1098dde9d61341ebc3c55eada5592f4b71a", "index": 2891, "step-1": "<mask token>\n\n\ndef stacked_vertical():\n total = Totals.get_or_insert('total')\n if len(total.shirts) == 0:\n shirts = sorted(T_Shirts, key=lambda shirt: shirt[0])\n for shirt in shirts:\n total.sh...
[ 4, 5, 6, 7, 8 ]
import pygame from pygame import Rect, Color from pymunk import Body, Poly from config import WIDTH, HEIGHT class Ground: def __init__ (self, space): # size self.w = WIDTH - 20 self.h = 25 # position self.x = 10 self.y = HEIGHT - self.h # pygame...
normal
{ "blob_id": "32fc0db68c32c2e644f9c1c2318fbeff41a0543d", "index": 5703, "step-1": "<mask token>\n\n\nclass Ground:\n <mask token>\n <mask token>\n\n def draw(self, window):\n pygame.draw.rect(window, self.color, self.rect)\n return\n", "step-2": "<mask token>\n\n\nclass Ground:\n\n def...
[ 2, 3, 4, 5, 6 ]
from auction_type import AuctionType from bid import Bid class Auction(object): def __init__(self, name, type, status, start_price, buy_now_price): self.name = name self.type = type self.status = status if AuctionType.BID == type: self.start_price = start_price ...
normal
{ "blob_id": "9e05f883d80d7583c9f7e16b2fb5d3f67896388d", "index": 5629, "step-1": "<mask token>\n\n\nclass Auction(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Auction(object):\n\n def __init__(self, name, type, status, start_price, buy_now_price):\n self.name = ...
[ 1, 2, 3, 4 ]
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def splitListToParts(self, root, k): """ :type root: ListNode :type k: int :rtype: List[ListNode] """ if not root: return [None]*k res...
normal
{ "blob_id": "6a609c91122f8b66f57279cff221ee76e7fadb8c", "index": 7059, "step-1": "# Definition for singly-linked list.\n# class ListNode(object):\n# def __init__(self, x):\n# self.val = x\n# self.next = None\n\nclass Solution(object):\n\tdef splitListToParts(self, root, k):\n\t\t\"\"\"\n\t\t...
[ 0 ]
#!/usr/bin/env python import rospy import numpy as np from sensor_msgs.msg import Image import cv2, cv_bridge from geometry_msgs.msg import Twist, Pose2D from std_msgs.msg import String import pytesseract as ocr from PIL import Image as imagePil import os import time from roseli.srv import CreateMap, CreateMapRequest ...
normal
{ "blob_id": "83ce5ee4d2a18caeb364b74c3739015fc0e1474c", "index": 1344, "step-1": "#!/usr/bin/env python\n\nimport rospy\nimport numpy as np\nfrom sensor_msgs.msg import Image\nimport cv2, cv_bridge\nfrom geometry_msgs.msg import Twist, Pose2D\nfrom std_msgs.msg import String\nimport pytesseract as ocr\nfrom PIL ...
[ 0 ]
import datetime from django.shortcuts import render from lims.models import * import os import zipfile def getpicture(word): if word.split(".")[1] not in ["doc","docx"]: return None word_zip = word.split(".")[0] + ".zip" path = "" for i in word.split("/")[0:-1]: path += i ...
normal
{ "blob_id": "e32c73abdcd384ee7c369182527cca6495f067b3", "index": 1977, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getData(request):\n index = request.GET.get('index')\n msg = '未查找到数据'\n if ExtExecute.objects.filter(query_code=index):\n ext = ExtExecute.objects.filter(query_cod...
[ 0, 1, 2, 3, 4 ]