code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from MultisizerReader import MultiSizerReader
import os
import matplotlib.pyplot as plt
#Get all spread sheet files in fodler and create multisizer files for each
folder = "./Data_Organised/DilutionTestingLowOD"
allFiles = os.listdir(folder)
multiSizerFiles = [allFiles[i] for i in range(len(allFiles)) if allFiles[i].e... | normal | {
"blob_id": "2f0aa1f294f34a4f3ffb47c15ab74fc792765f10",
"index": 9195,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor files in multiSizerFiles:\n data.append(MultiSizerReader(path=os.path.join(folder, files)))\n<mask token>\nfor d in data:\n OD = d.name.split('_')[4] + '.' + d.name.split('_')[5... | [
0,
1,
2,
3,
4
] |
from secrets import randbelow
print(randbelow(100))
| normal | {
"blob_id": "18ae982c7fac7a31e0d257f500da0be0851388c2",
"index": 8985,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(randbelow(100))\n",
"step-3": "from secrets import randbelow\nprint(randbelow(100))\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Test create publ... | normal | {
"blob_id": "035043460805b7fe92e078e05708d368130e3527",
"index": 8965,
"step-1": "<mask token>\n\n\n@with_tempfile\ndef test_invalid_call(path):\n assert_raises(ValueError, create_sibling_github, 'bogus', dataset=path)\n ds = Dataset(path).create()\n assert_raises(gh.BadCredentialsException, ds.create_s... | [
1,
2,
3,
4,
5
] |
def parse_detail_for_one_course(page, course, no_info_course):
print(f'{course["name"]} is processing**: {course["url"]}')
map = {"Locatie": "location",
"Location": "location",
"Startdatum": "effective_start_date",
"Start date": "effective_start_date",
"Duur": "durati... | normal | {
"blob_id": "0f4fa9f8835ae22032af9faa6c7cb10af3facd79",
"index": 5389,
"step-1": "<mask token>\n",
"step-2": "def parse_detail_for_one_course(page, course, no_info_course):\n print(f\"{course['name']} is processing**: {course['url']}\")\n map = {'Locatie': 'location', 'Location': 'location', 'Startdatum'... | [
0,
1,
2
] |
from nltk.tokenize import RegexpTokenizer
from stop_words import get_stop_words
from nltk.stem.porter import PorterStemmer
from gensim import corpora, models
import gensim
tokenizer = RegexpTokenizer(r'\w+')
# create English stop words list
en_stop = get_stop_words('en')
# Create p_stemmer of class PorterStemmer
p_s... | normal | {
"blob_id": "3035ac8044b5629d0b5de7934e46890ad36ed551",
"index": 7798,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in doc_set:\n raw = i.lower()\n tokens = tokenizer.tokenize(raw)\n stopped_tokens = [i for i in tokens if not i in en_stop]\n stemmed_tokens = [p_stemmer.stem(i) for i i... | [
0,
1,
2,
3,
4
] |
#-*-coding:utf-8 -*-
import subprocess
def get_audio(text):
stat = subprocess.call(['./tts', text])
if stat == 0:
return "Success"
else:
print "Failed"
if __name__ == '__main__':
text = "我是聊天机器人"
get_audio(text) | normal | {
"blob_id": "93eafb5b23bac513fc5dcc177a4e8a080b2a49b4",
"index": 9054,
"step-1": "#-*-coding:utf-8 -*-\n\nimport subprocess\n\ndef get_audio(text):\n stat = subprocess.call(['./tts', text])\n \n if stat == 0:\n return \"Success\"\n else:\n print \"Failed\"\n\nif __name__ == '__main__':\... | [
0
] |
import glob
import json
import pickle
import gzip
import os
import hashlib
import re
import bs4, lxml
import concurrent.futures
URL = 'http://mangamura.org'
def _map(arg):
key, names = arg
size = len(names)
urls = set()
for index, name in enumerate(names):
html = gzip.decompress(open('htmls/' + name... | normal | {
"blob_id": "3acd592594ae4f12b9b694aed1aa0d48ebf485f5",
"index": 5787,
"step-1": "<mask token>\n\n\ndef _map(arg):\n key, names = arg\n size = len(names)\n urls = set()\n for index, name in enumerate(names):\n html = gzip.decompress(open('htmls/' + name, 'rb').read()).decode()\n soup = ... | [
1,
2,
3,
4,
5
] |
default_app_config = 'reman.apps.RemanConfig'
| normal | {
"blob_id": "0b0b928aef9a4e9953b02639bf5e7769cc4389d7",
"index": 2488,
"step-1": "<mask token>\n",
"step-2": "default_app_config = 'reman.apps.RemanConfig'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from keras.models import load_model
from DataManager import *
def loadModel(name):
model = load_model('./Model/%s.h5' % name)
return model
def predict(tag):
test = getPIData(tag, '2019-11-05', '2019-11-06')
test_arg = addFeature(test)
test_norm = normalize(test_arg)
X_test, Y_test = buildTra... | normal | {
"blob_id": "a6154c5d855dc53d73db08bbb5b5d7437056e156",
"index": 1566,
"step-1": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n return model\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n ... | [
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ==============================================================================
# Created By : Karl Thompson
# Created Date: Mon March 25 17:34:00 CDT 2019
# ==============================================================================
"""nasdaq_itch_vwap - Genera... | normal | {
"blob_id": "806124926008078e592141d80d08ccfbb3046dbf",
"index": 7092,
"step-1": "<mask token>\n\n\ndef calculate_vwap():\n add_order_df = pd.read_csv('add_order_data.csv', index_col=None, names=\n ['Stock', 'Timestamp', 'Reference', 'Shares', 'Price'])\n ord_exec_df = pd.read_csv('ord_exec_data.csv... | [
1,
2,
3,
4,
5
] |
##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... | normal | {
"blob_id": "e15ea7d167aad470d0a2d95a8a328b35181e4dc3",
"index": 7832,
"step-1": "<mask token>\n\n\ndef info(msg):\n if config['log_level'] not in ('ERROR', 'WARNING', 'WARN'):\n print(config['prefix'] + 'INFO> ' + msg)\n log_count['INFO'] += 1\n\n\n<mask token>\n\n\ndef warning(msg):\n if co... | [
2,
4,
8,
9,
10
] |
# 예시 입력값
board = [[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]]
moves = [1,5,3,5,1,2,1,4]
# 로직
resultList = []
count = 0
for nth in moves:
for i in range(len(board)):
selected = board[i][nth - 1]
if selected == 0:
continue
else:
# 인형을 resultList에 넣고
... | normal | {
"blob_id": "18e032b7ff7ae9d3f5fecc86f63d12f4da7b8067",
"index": 6180,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor nth in moves:\n for i in range(len(board)):\n selected = board[i][nth - 1]\n if selected == 0:\n continue\n else:\n resultList.append(sel... | [
0,
1,
2,
3
] |
"""
# System of national accounts (SNA)
This is an end-to-end example of national accounts sequence,
from output to net lending. It is based on Russian Federation data
for 2014-2018.
Below is a python session transcript with comments.
You can fork [a github repo](https://github.com/epogrebnyak/sna-ru)
to replica... | normal | {
"blob_id": "2d4187ab5d178efa4920110ccef61c608fdb14c0",
"index": 8780,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef eq(df1, df2, precision=0.5) ->bool:\n \"\"\"Compare two dataframes by element with precision margin.\"\"\"\n return ((df1 - df2).abs() < precision).all()\n\n\n<mask token>\n... | [
0,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-02 14:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields
class Migration(migrations.Migration):
dependencies = [
('barriers', '0011_auto_20170904_1658'),
... | normal | {
"blob_id": "645f8f1ebd3bfa0ba32d5be8058b07e2a30ba9b5",
"index": 1314,
"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 = [('barriers', ... | [
0,
1,
2,
3,
4
] |
"""Файл, который запускается при python qtester
""" | normal | {
"blob_id": "90fc6590dab51141124ca73082b8d937008ae782",
"index": 7400,
"step-1": "<mask token>\n",
"step-2": "\"\"\"Файл, который запускается при python qtester\n\"\"\"",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
"""Derivation of variable ``co2s``."""
import dask.array as da
import iris
import numpy as np
import stratify
from ._baseclass import DerivedVariableBase
def _get_first_unmasked_data(array, axis):
"""Get first unmasked value of an array along an axis."""
mask = da.ma.getmaskarray(array)
numerical_mask = ... | normal | {
"blob_id": "7c9b68b2d32d8e435f332d4412ea1ba899607ec4",
"index": 9395,
"step-1": "<mask token>\n\n\nclass DerivedVariable(DerivedVariableBase):\n <mask token>\n\n @staticmethod\n def required(project):\n \"\"\"Declare the variables needed for derivation.\"\"\"\n required = [{'short_name': ... | [
3,
4,
5,
6,
7
] |
#from graph import *
#ex = open('ex_K.py', 'r')
#ex.read()
import ex_K
ex = ex_K
print "digraph K {"
print (str(ex.K))
print "}"
| normal | {
"blob_id": "44dbb7587530fac9e538dfe31c7df15b1a016251",
"index": 7091,
"step-1": "#from graph import *\r\n#ex = open('ex_K.py', 'r')\r\n#ex.read()\r\nimport ex_K\r\nex = ex_K\r\n\r\nprint \"digraph K {\"\r\nprint (str(ex.K))\r\nprint \"}\"\r\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": n... | [
0
] |
class Solution:
def maxSideLength(self, mat: List[List[int]], threshold: int) -> int:
def squareSum(r1: int, c1: int, r2: int, c2: int) -> int:
return prefixSum[r2 + 1][c2 + 1] - prefixSum[r1][c2 + 1] - prefixSum[r2 + 1][c1] + prefixSum[r1][c1]
m = len(mat)
n = len(mat[0])
... | normal | {
"blob_id": "c8f2df1471a9581d245d52437470b6c67b341ece",
"index": 7297,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def maxSideLength(self, mat: List[List[int]], threshold: int) ->int:\n\n def squareSum(r1: int, c1: int, r2: int, c2: in... | [
0,
1,
2,
3
] |
/Users/sterlingbutters/anaconda3/lib/python3.6/encodings/cp037.py | normal | {
"blob_id": "85dfb30a380dc73f5a465c8f4be84decccfbcb59",
"index": 1290,
"step-1": "/Users/sterlingbutters/anaconda3/lib/python3.6/encodings/cp037.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
# Copyright 2017 Klarna AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | normal | {
"blob_id": "d5d12e2269b343dde78534eddf2cce06759eb264",
"index": 9128,
"step-1": "<mask token>\n\n\n@override_settings(RETHINK_DB_DB=os.environ.get('RETHINK_DB_DB',\n 'django_rethinkci'))\nclass APITests(TestCase):\n\n @classmethod\n def setUpClass(cls):\n super(APITests, cls).setUpClass()\n ... | [
8,
12,
14,
18,
19
] |
# -*- coding: utf-8 -*-
import scrapy
import os
from topdb.items import BiqugeItem
class NovelsSpider(scrapy.Spider):
name = 'novels'
allowed_domains = ['xbiquge.la']
start_urls = ['http://www.xbiquge.la/xiaoshuodaquan/']
def parse(self, response):
# 小说分类
path = '/Users/qx/Documents... | normal | {
"blob_id": "af668751074df6f182c7121821587270734ea5af",
"index": 1075,
"step-1": "<mask token>\n\n\nclass NovelsSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n path = '/Users/qx/Documents/小说/new/'\n all = response.xpath(\".//div[@clas... | [
3,
4,
5,
6,
7
] |
from .plutotv_html import PlutoTV_HTML
class Plugin_OBJ():
def __init__(self, fhdhr, plugin_utils):
self.fhdhr = fhdhr
self.plugin_utils = plugin_utils
self.plutotv_html = PlutoTV_HTML(fhdhr, plugin_utils)
| normal | {
"blob_id": "ee0cf2325c94821fa9f5115e8848c71143eabdbf",
"index": 4775,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Plugin_OBJ:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Plugin_OBJ:\n\n def __init__(self, fhdhr, plugin_utils):\n self.fhdhr = fhdhr\n self.plug... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
import sys
import getopt
import datetime
import gettext
import math
import datetime
import json
import gettext
from datetime import datetime
FIELD_INDEX_DATE = 0
FIELD_INDEX_DATA = 1
def getPercentile(arr, percentile):
percentile = min(100, max(0, percentile))
index = (percentile / 10... | normal | {
"blob_id": "a801ca6ae90556d41fd278032af4e58a63709cec",
"index": 7977,
"step-1": "<mask token>\n\n\ndef write(output_filename, content):\n with open(output_filename, 'w') as outfile:\n outfile.write(content)\n\n\ndef main(argv):\n \"\"\"\n WebPerf Core Carbon Percentiles\n\n\n Usage:\n * ru... | [
2,
4,
5,
6,
7
] |
_method_adaptors = dict()
def register_dist_adaptor(method_name):
def decorator(func):
_method_adaptors[method_name] = func
def wrapper(*args, **kwargs):
func(*args, **kwargs)
return wrapper
return decorator
def get_nearest_method(method_name, parser):
"""
all c... | normal | {
"blob_id": "ed2f3bbc7eb0a4d8f5ccdb7a12e00cbddab04dd0",
"index": 577,
"step-1": "<mask token>\n\n\ndef get_nearest_method(method_name, parser):\n \"\"\"\n all candidates toked\n all protocol untoked\n input:\n queries:\n [\n (protocol, (candidate, sen_id, start, K), (candidate, sen_id, s... | [
1,
2,
3,
4
] |
# Generated by Django 3.1.1 on 2021-03-25 14:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Experiment",
fields=[
... | normal | {
"blob_id": "b308d81fb8eab9f52aa0ad4f88e25d6757ef703a",
"index": 1761,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T... | [
0,
1,
2,
3,
4
] |
from lib.utility import start_time, end_time
from lib.prime import read_primes
from bisect import bisect_left
start_time()
primes = read_primes(100)
# limit = 10 ** 16
import random
# limit = random.randint(1000, 10 ** 5)
limit = 43268
# limit = 10 ** 16
print('limit=', limit)
v1 = set()
v2 = set()
def version_100_i... | normal | {
"blob_id": "ea8676a4c55bbe0ae2ff8abf924accfc0bd8f661",
"index": 1272,
"step-1": "<mask token>\n\n\ndef version_100_iq(limit):\n nums = []\n for x in range(2, limit):\n facs = 0\n n = x\n for p in primes:\n if n % p == 0:\n facs += 1\n while n %... | [
4,
5,
6,
7,
8
] |
import random
responses = ['Seems so','Never','Untrue','Always no matter what','You decide your fate','Not sure','Yep','Nope','Maybe','Nein','Qui','Ask the person next to you','That question is not for me']
def answer():
question = input('Ask me anything: ')
print(random.choice(responses))
answer()
secondQues... | normal | {
"blob_id": "41eef711c79fb084c9780b6d2638d863266e569d",
"index": 837,
"step-1": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print(random.choice(responses))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print... | [
1,
2,
3,
4,
5
] |
from math import gcd
from random import randint, choice
task = """6. Реализовать алгоритм построения ПСП методом Фиббоначи с
запаздываниями. Обосновать выбор коэффициентов алгоритма. Для
начального заполнения использовать стандартную линейную конгруэнтную
ПСП с выбранным периодом. Реализовать возможность для пользоват... | normal | {
"blob_id": "11e9d25c30c8c9945cfa3c234ffa1aab98d1869e",
"index": 8023,
"step-1": "<mask token>\n\n\ndef factor(n):\n result = []\n d = 2\n while d * d <= n:\n if n % d == 0:\n result.append(d)\n n //= d\n else:\n d += 1\n if n > 1:\n result.append... | [
4,
5,
6,
7,
8
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 09:53:10 2021
@author: kaouther
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
#path = '/home/kaouther/Documents/Internship/pre_process/input_files/heart_forKaouther.xlsx'
#path = '/home/k... | normal | {
"blob_id": "a3588a521a87765d215fd2048407e5e54fb87e94",
"index": 4276,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_rep_name(string):\n return string[-1:]\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef get_rep_name(string):\n return string[-1:]\n\n\n<mask token>\nfor name in... | [
0,
1,
2,
3,
5
] |
from openfermion import QubitOperator, FermionOperator
from openfermion.transforms import jordan_wigner
from src.utils import QasmUtils, MatrixUtils
from src.ansatz_elements import AnsatzElement, DoubleExchange
import itertools
import numpy
class EfficientDoubleExchange(AnsatzElement):
def __init__(self, qubit_... | normal | {
"blob_id": "24cdbbadc8ff1c7ad5d42eeb518cb6c2b34724a2",
"index": 263,
"step-1": "<mask token>\n\n\nclass EfficientDoubleExcitation2(AnsatzElement):\n\n def __init__(self, qubit_pair_1, qubit_pair_2):\n self.qubit_pair_1 = qubit_pair_1\n self.qubit_pair_2 = qubit_pair_2\n super(EfficientDo... | [
3,
5,
6,
7,
11
] |
import random
import copy
random.seed(42)
import csv
import torch
import time
import statistics
import wandb
from model import Net, LinearRegression, LogisticRegression
def byGuide(data, val=None, test=None):
val_guides = val
if val == None:
val_guides = [
"GGGTGGGGGGAGTTTGCTCCTGG",
"GA... | normal | {
"blob_id": "a0059563b2eed4ca185a8e0971e8e0c80f5fb8f8",
"index": 6668,
"step-1": "<mask token>\n\n\ndef byGuide(data, val=None, test=None):\n val_guides = val\n if val == None:\n val_guides = ['GGGTGGGGGGAGTTTGCTCCTGG', 'GACCCCCTCCACCCCGCCTCCGG',\n 'GGCCTCCCCAAAGCCTGGCCAGG', 'GAACACAAAGCA... | [
15,
16,
19,
21,
24
] |
#!/usr/bin/env python3.4
from flask import Flask, render_template, request, jsonify
from time import time
application = Flask(__name__)
@application.route("/chutesnladders")
@application.route("/cnl")
@application.route("/snakesnladders")
@application.route("/snl")
def chutesnladders():
response = application.m... | normal | {
"blob_id": "a2c62091b14929942b49853c4a30b851ede0004b",
"index": 4563,
"step-1": "<mask token>\n\n\n@application.route('/chutesnladders')\n@application.route('/cnl')\n@application.route('/snakesnladders')\n@application.route('/snl')\ndef chutesnladders():\n response = application.make_response(render_template... | [
1,
3,
4,
5,
6
] |
from email.mime.text import MIMEText
import smtplib
def init_mail(server, user, pwd, port=25):
server = smtplib.SMTP(server, port)
server.starttls()
server.login(user, pwd)
return server
def send_email(mconn, mailto, mailfrom, mailsub, msgbody):
msg = MIMEText(msgbody)
msg['Subject'] = mails... | normal | {
"blob_id": "ec604aea28dfb2909ac9e4b0f15e6b5bbe1c3446",
"index": 2934,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef send_email(mconn, mailto, mailfrom, mailsub, msgbody):\n msg = MIMEText(msgbody)\n msg['Subject'] = mailsub\n msg['To'] = mailto\n msg['From'] = mailfrom\n mconn.se... | [
0,
1,
2,
3
] |
from django.shortcuts import render
from django.http import HttpResponse
from chats.models import Chat
from usuario.models import Usuario
# Create your views here.
def chat(request):
chat_list = Chat.objects.order_by("id_chat")
chat_dict = {'chat': chat_list}
return render(request,'chats/Chat.html', ... | normal | {
"blob_id": "4a14265a9a2338be66e31110bba696e224b6a70f",
"index": 8395,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef chat(request):\n chat_list = Chat.objects.order_by('id_chat')\n chat_dict = {'chat': chat_list}\n return render(request, 'chats/Chat.html', context=chat_dict)\n",
"step... | [
0,
1,
2,
3
] |
from selenium import webdriver
import time
with webdriver.Chrome() as browser:
browser.get("http://suninjuly.github.io/selects1.html")
time.sleep(1)
x = int(browser.find_element_by_id("num1").text)
y = int(browser.find_element_by_id("num2").text)
sum_xy = str(int(x)+int(y))
browser.find_element... | normal | {
"blob_id": "42be9077ec51a9be1d4923011a38cd64d829f876",
"index": 1529,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith webdriver.Chrome() as browser:\n browser.get('http://suninjuly.github.io/selects1.html')\n time.sleep(1)\n x = int(browser.find_element_by_id('num1').text)\n y = int(brow... | [
0,
1,
2,
3
] |
def encrypt(key,plaintext):
ciphertext=""
for i in plaintext:
if i.isalpha():
alphabet = ord(i)+key
if alphabet > ord("Z"):
alphabet -= 26
letter = chr(alphabet)
ciphertext+=letter
return ciphertext
def decrypt(key,ciphertext):
plaintext=""
for i i... | normal | {
"blob_id": "ac31cba94ee8ff7a2903a675954c937c567b5a56",
"index": 6739,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef decrypt(key, ciphertext):\n plaintext = ''\n for i in ciphertext:\n if i.isalpha():\n alphabet = ord(i) - key\n if alphabet < ord('A'):\n ... | [
0,
1,
2,
3
] |
from flask_marshmallow import Marshmallow
from models import Uservet
ma = Marshmallow()
class UserVetSchema(ma.Schema):
class Meta:
model = Uservet
user_vet_1 = ['dni', 'email', 'nombre', 'apellidos', 'telefono', 'tipo_uservet'
]
| normal | {
"blob_id": "677154aa99a5a4876532f3e1edfec45b1790384c",
"index": 9511,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass UserVetSchema(ma.Schema):\n\n\n class Meta:\n model = Uservet\n\n\n<mask token>\n",
"step-3": "<mask token>\nma = Marshmallow()\n\n\nclass UserVetSchema(ma.Schema):\... | [
0,
1,
2,
3
] |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | normal | {
"blob_id": "2a6b373c443a1bbafe644cb770bc163536dd5573",
"index": 3348,
"step-1": "<mask token>\n\n\ndef qInitResources():\n QtCore.qRegisterResourceData(1, qt_resource_struct, qt_resource_name,\n qt_resource_data)\n\n\ndef qCleanupResources():\n QtCore.qUnregisterResourceData(1, qt_resource_struct, ... | [
2,
3,
4,
5,
6
] |
#
# Copyright (c) 2018 Intel Corporation
#
# 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": "a38a5010c9edbed0929da225b4288396bb0d814e",
"index": 6989,
"step-1": "<mask token>\n\n\nclass Lenet(nn.Module):\n <mask token>\n\n def forward(self, x):\n layer_w = self.fc2.weight\n sigma = layer_w.std().data.cpu().numpy()\n layer_w_numpy = layer_w.data.cpu().numpy()\n ... | [
2,
4,
5,
6,
7
] |
from typing import Tuple
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def lcaDeepestLeaves(self, root: TreeNode) ->TreeNode:
_, lca = self.get_lca(root, 0)
return lca
def get_lca(self, node: TreeNode, de... | normal | {
"blob_id": "0a528fb7fe4a318af8bd3111e8d67f6af6bd7416",
"index": 304,
"step-1": "<mask token>\n\n\nclass Solution:\n\n def lcaDeepestLeaves(self, root: TreeNode) ->TreeNode:\n _, lca = self.get_lca(root, 0)\n return lca\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TreeNode:\n <m... | [
2,
4,
5,
6
] |
from numpy import *
import KNN_1
import KNN_3
import KNN_suanfa as clf
def datingClassTest():
horatio = 0.1
data, datalabels = KNN_1.filel2matrix("datingTestSet2.txt")
normMat = KNN_3.autoNorm(data)
ml = normMat.shape[0]
numTestset = int(ml*horatio)
errorcount = 0
a=clf.classify0(normMat[0:n... | normal | {
"blob_id": "3086f62d4057812fc7fb4e21a18bc7d0ba786865",
"index": 2526,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef datingClassTest():\n horatio = 0.1\n data, datalabels = KNN_1.filel2matrix('datingTestSet2.txt')\n normMat = KNN_3.autoNorm(data)\n ml = normMat.shape[0]\n numTests... | [
0,
2,
3,
4,
5
] |
from django.contrib import admin
from apap.models import *
# Register your models here.
admin.site.register(Doggo)
admin.site.register(Profile) | normal | {
"blob_id": "22504b466cdeb380b976e23e2708e94131722e11",
"index": 8147,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Doggo)\nadmin.site.register(Profile)\n",
"step-3": "from django.contrib import admin\nfrom apap.models import *\nadmin.site.register(Doggo)\nadmin.site.register(Prof... | [
0,
1,
2,
3
] |
# Downloads images from http://www.verseoftheday.com/ and saves it into a DailyBibleVerse folder
import requests, os, bs4
os.chdir('c:\\users\\patty\\desktop') #modify location where you want to create the folder
if not os.path.isdir('DailyBibleVerse'):
os.makedirs('DailyBibleVerse')
res = request... | normal | {
"blob_id": "a8fb8ac3c102e460d44e533b1e6b3f8780b1145d",
"index": 4609,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nos.chdir('c:\\\\users\\\\patty\\\\desktop')\nif not os.path.isdir('DailyBibleVerse'):\n os.makedirs('DailyBibleVerse')\n<mask token>\nres.raise_for_status()\n<mask token>\nwhile os.pat... | [
0,
1,
2,
3,
4
] |
# Задание 1
# Выучите основные стандартные исключения, которые перечислены в данном уроке.
# Задание 2
# Напишите программу-калькулятор, которая поддерживает следующие операции: сложение, вычитание,
# умножение, деление и возведение в степень. Программа должна выдавать сообщения об ошибке и
# продолжать работу при ввод... | normal | {
"blob_id": "a8341bf422a4d31a83ff412c6aac75e5cb8c5e0f",
"index": 5876,
"step-1": "<mask token>\n\n\ndef adding(user_list):\n sumnum = 0\n for item in user_list:\n sumnum += item\n return sumnum\n\n\ndef subtraction(user_list):\n subtractnum = user_list[0]\n for item in user_list[1:]:\n ... | [
3,
5,
6,
7,
8
] |
import subprocess
from whoosh.index import create_in
from whoosh.fields import *
import os
import codecs
from whoosh.qparser import QueryParser
import whoosh.index as index
import json
from autosub.autosub import autosub
from azure.storage.blob import AppendBlobService
vedio_formats = ['mp4','avi','wmv','mov'] # 1
aud... | normal | {
"blob_id": "7b5a16fdc536eb4ae3fdc08f827663613560187a",
"index": 8642,
"step-1": "import subprocess\nfrom whoosh.index import create_in\nfrom whoosh.fields import *\nimport os\nimport codecs\nfrom whoosh.qparser import QueryParser\nimport whoosh.index as index\nimport json\nfrom autosub.autosub import autosub\nf... | [
0
] |
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db.models import (
Model,
BaseManager,
UUIDField,
sane_repr,
)
class MonitorLocation(Model):
__core__ = True
guid = UUIDField(unique=True, auto_add=True)
nam... | normal | {
"blob_id": "1a4132358fa9bd4cd74970286ec8bb212b1857cd",
"index": 5247,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MonitorLocation(Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n app_label = 'sentry'\n db_... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.1.7 on 2021-02-20 02:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('usuarios', '0001_initial'),
('plataforma', '0005_auto_20210219_2343'),
]
operations = [
migrations.... | normal | {
"blob_id": "3f9be81c86852a758440c6a144b8caba736b3868",
"index": 972,
"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 = [('usuarios', '... | [
0,
1,
2,
3,
4
] |
# -*- coding:utf-8 -*-
# Classe com os dados de um cliente que entra no sistema simulado.
class Client:
def __init__(self, id, color):
# Identificador do cliente, usada para o teste de correção.
self.id = id
# Tempo de chegada ao servidor (fila 1 e fila 2)
self.arrival = {}
... | normal | {
"blob_id": "5dc201f743705d6a57dfb61ec2cc2a827db0ba25",
"index": 7234,
"step-1": "class Client:\n\n def __init__(self, id, color):\n self.id = id\n self.arrival = {}\n self.leave = {}\n self.server = {}\n self.queue = 0\n self.served = 0\n self.color = color\n\... | [
5,
6,
7,
8,
9
] |
def koodrinate(kraj, kraji):
for ime, x, y in kraji:
if ime == kraj:
return x, y
kraji = {
'Brežice': (68.66, 7.04),
'Lenart': (85.20, 78.75),
'Rateče': (-65.04, 70.04),
'Ljutomer': (111.26, 71.82),
'Rogaška Slatina': (71.00, 42.00),
'Ribnica': (7.10, -10.50),
'Duto... | normal | {
"blob_id": "2cfc1bea6dd1571eff67c3f49b2a1899560c7ba7",
"index": 3469,
"step-1": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n return x, y\n\n\n<mask token>\n",
"step-2": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n ... | [
1,
2,
3,
4,
5
] |
# ----------------------------------------------------------------------------
# Written by Khanh Nguyen Le
# May 4th 2019
# Discord: https://discord.io/skyrst
# ----------------------------------------------------------------------------
import operator
def validInput(x):
if x=="a": return True
elif x=... | normal | {
"blob_id": "5209638ec97a666783c102bec7a2b00991c41a08",
"index": 5438,
"step-1": "<mask token>\n\n\ndef takeInput():\n x = input()\n while not validInput(x):\n print('Invalid input. Try another one:')\n x = input()\n return x\n\n\ndef main():\n stats = {'Council': 0, 'United': 0, 'Facel... | [
2,
3,
4,
5,
6
] |
from estmd import ESTMD
input_directory = "test.avi"
e = ESTMD()
e.open_movie(input_directory)
e.run(by_frame=True)
r = e.create_list_of_arrays()
print "Done testing!"
| normal | {
"blob_id": "1fd4d1a44270ef29512e601af737accb916dc441",
"index": 974,
"step-1": "from estmd import ESTMD\n\ninput_directory = \"test.avi\"\ne = ESTMD()\ne.open_movie(input_directory)\ne.run(by_frame=True)\nr = e.create_list_of_arrays()\n\nprint \"Done testing!\"\n",
"step-2": null,
"step-3": null,
"step-4"... | [
0
] |
# Required python libraries for attack.py
import socket
import os
import sys
from termcolor import colored
import StringIO
import time
# need to find Python equivalent libraries for these
import stdio
import stdlib
import unistd
# need to find Python equivalent libraries for these
import includes
import killer
impor... | normal | {
"blob_id": "6d25b0fedf0d5081a3a0a93ddacc49748464d9d0",
"index": 405,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef checksum_tcp_udp(ip_header, buffer_name, data_length, lenth):\n return sum_checksum_tcp_udp\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef checksum_tcp_udp(ip_header, ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
occl_frac = 0.445188
result = [1-occl_frac, occl_frac, 0]
#Reading res_data.txt
mnfa = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] #min NN factor array
nna = [2,3,4,5,6,7,8,9,10,11,12,1... | normal | {
"blob_id": "1c8b843174521f1056e2bac472c87d0b5ec9603e",
"index": 3370,
"step-1": "#!/usr/bin/python\nimport matplotlib.pyplot as plt\nfrom matplotlib import cm\nfrom mpl_toolkits.mplot3d import Axes3D\nimport numpy as np\n\noccl_frac = 0.445188\nresult = [1-occl_frac, occl_frac, 0]\n\n#Reading res_data.txt\nmnfa... | [
0
] |
import uuid
from datetime import date
import os
import humanize
class Context:
def __init__(self, function_name, function_version):
self.function_name = function_name
self.function_version = function_version
self.invoked_function_arn = "arn:aws:lambda:eu-north-1:000000000000:function:{}".f... | normal | {
"blob_id": "1c685514f53a320226402a4e4d8f3b3187fad615",
"index": 7814,
"step-1": "<mask token>\n\n\nclass Context:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Context:\n\n def __init__(self, function_name, function_version):\n self.function_name = function_name\n ... | [
1,
2,
3,
4,
5
] |
from e19_pizza import *
print("\n----------导入模块中的所有函数----------")
# 由于导入了每个函数,可通过名称来调用每个函数,无需使用句点表示法
make_pizza(16, 'pepperoni')
make_pizza(12, 'mushrooms', 'green peppers', 'extra cheese')
# 注意:
# 使用并非自己编写的大型模块时,最好不要采用这种导入方法,如果模块中
# 有函数的名称与你的项目中使用的名称相同,可能导致意想不到的结果。
# Python可能遇到多个名称相同的函数或变量,进而覆盖函数,而不是分别导
# 入所有... | normal | {
"blob_id": "c54a046ebde1be94ec87061b4fba9e22bf0f4d0a",
"index": 3508,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(\"\"\"\n----------导入模块中的所有函数----------\"\"\")\nmake_pizza(16, 'pepperoni')\nmake_pizza(12, 'mushrooms', 'green peppers', 'extra cheese')\n",
"step-3": "from e19_pizza import *\npr... | [
0,
1,
2,
3
] |
import serial
import time
def main():
# '/dev/tty****' is your port ID
con=serial.Serial('/dev/tty****', 9600)
print('connected.')
while 1:
str=con.readline() # byte code
print (str.strip().decode('utf-8')) # decoded string
if __name__ == '__main__':
main()
| normal | {
"blob_id": "108c8bbb4d3dbc6b7f32e084b13009296b3c5a80",
"index": 8016,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n con = serial.Serial('/dev/tty****', 9600)\n print('connected.')\n while 1:\n str = con.readline()\n print(str.strip().decode('utf-8'))\n\n\n<mask ... | [
0,
1,
2,
3,
4
] |
def bfs(graph, start):
queue = [start]
queued = list()
path = list()
while queue:
print('Queue is: %s' % queue)
vertex = queue.pop(0)
print('Processing %s' % vertex)
for candidate in graph[vertex]:
if candidate not in queued:
queued.append(cand... | normal | {
"blob_id": "7bb49712c4ef482c64f3c2a457a766de691ba7c3",
"index": 9427,
"step-1": "<mask token>\n",
"step-2": "def bfs(graph, start):\n queue = [start]\n queued = list()\n path = list()\n while queue:\n print('Queue is: %s' % queue)\n vertex = queue.pop(0)\n print('Processing %s... | [
0,
1
] |
from QnA_processor.question_analysis.google_question_classifier import GoogleQuestionClassifier
def classify_question(query):
try:
"""
Get answer-type from google autoML classifier
(by making POST requests with authorization key)
"""
question_c... | normal | {
"blob_id": "db231ea92319414dd10ca8dfbc14e5a70ed2fe44",
"index": 7343,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef classify_question(query):\n try:\n \"\"\"\n Get answer-type from google autoML classifier \n (by making POST requests with authorization key)\n \"\"... | [
0,
1,
2,
3
] |
## This file is the celeryconfig for the Task Worker (scanworker).
from scanworker.commonconfig import *
import sys
sys.path.append('.')
BROKER_CONF = {
'uid' : '{{ mq_user }}',
'pass' : '{{ mq_password }}',
'host' : '{{ mq_host }}',
'port' : '5672',
'vhost' : '{{ mq_vhost }}',
}
BROKER_URL = 'amqp://... | normal | {
"blob_id": "1a569b88c350124968212cb910bef7b09b166152",
"index": 8990,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsys.path.append('.')\n<mask token>\n",
"step-3": "<mask token>\nsys.path.append('.')\nBROKER_CONF = {'uid': '{{ mq_user }}', 'pass': '{{ mq_password }}', 'host':\n '{{ mq_host }}', '... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import TestCase
from django.utils import timezone
from core import models
class ChildTestCase(TestCase):
def setUp(self):
call_command('migrate', verbosity=0)
def test... | normal | {
"blob_id": "135401ea495b80fc1d09d6919ccec8640cb328ce",
"index": 3901,
"step-1": "<mask token>\n\n\nclass TimerTestCase(TestCase):\n\n def setUp(self):\n call_command('migrate', verbosity=0)\n child = models.Child.objects.create(first_name='First', last_name=\n 'Last', birth_date=time... | [
10,
17,
25,
26,
34
] |
import webbrowser
import time
x=10
while x > 0:
print (x), time.sleep(1)
x=x-1
while x==0:
print ("MEOW")
webbrowser.open("https://www.youtube.com/watch?v=IuysY1BekOE")
| normal | {
"blob_id": "4d31357936ce53b2be5f9a952b99df58baffe7ea",
"index": 4937,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile x > 0:\n print(x), time.sleep(1)\n x = x - 1\nwhile x == 0:\n print('MEOW')\n webbrowser.open('https://www.youtube.com/watch?v=IuysY1BekOE')\n",
"step-3": "<mask token... | [
0,
1,
2,
3,
4
] |
import re
def match_regex(filename, regex):
with open(filename) as file:
lines = file.readlines()
for line in reversed(lines):
match = re.match(regex, line)
if match:
regex = yield match.groups()[0]
def get_serials(filename):
ERROR_RE = 'XFS ERROR (\[sd[a-z]\])'
#... | normal | {
"blob_id": "a36a553342cfe605a97ddc0f636bbb73b683f6a6",
"index": 1239,
"step-1": "<mask token>\n\n\ndef match_regex(filename, regex):\n with open(filename) as file:\n lines = file.readlines()\n for line in reversed(lines):\n match = re.match(regex, line)\n if match:\n regex ... | [
1,
3,
4,
5,
6
] |
# ""
# "deb_char_cont_x9875"
# # def watch_edit_text(self): # execute when test edited
# # logging.info("TQ : " + str(len(self.te_sql_cmd.toPlainText())))
# # logging.info("TE : " + str(len(self.cmd_last_text)))
# # logging.info("LEN : " + str(self.cmd_len))
# # if len(self.te_sql_cmd.toPlainText()) < ... | normal | {
"blob_id": "f70f4f093aa64b8cd60acbb846855ca3fed13c63",
"index": 4837,
"step-1": "# \"\"\n# \"deb_char_cont_x9875\"\n# # def watch_edit_text(self): # execute when test edited\n# # logging.info(\"TQ : \" + str(len(self.te_sql_cmd.toPlainText())))\n# # logging.info(\"TE : \" + str(len(self.cmd_last_text))... | [
1
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib import request,parse
# req = request.Request('https://api.douban.com/v2/book/2129650')
# req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36')
# with request.urlopen(req) as f:... | normal | {
"blob_id": "9bd63181de024c2f4517defa9ed51bdbc8d610d2",
"index": 6025,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Login to weibo.com')\n<mask token>\nreq.add_header('Host', 'chenshuaijun.com')\nreq.add_header('User-Agent',\n 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like G... | [
0,
1,
2,
3,
4
] |
import requests
from multiprocessing import Process
from atomic_counter import AtomicCounter
class Downloader:
def __init__(self, src_url, num_threads):
try:
header = requests.head(src_url).headers
self.url = src_url
self.file_size = int(header.get('content-length'))
... | normal | {
"blob_id": "3dc3bbd00f9c2d00093bf8669963d96f5019b2da",
"index": 4648,
"step-1": "<mask token>\n\n\nclass Downloader:\n <mask token>\n\n def _worker(self, download_range: tuple, counter: AtomicCounter):\n start, end = download_range\n header = {'Range': 'bytes=' + str(start) + '-' + str(end)}... | [
3,
4,
5,
6,
7
] |
# file = open('suifeng.txt')
# # text = file.read()
# # print(text)
# # file.close()
# with open('suifeng.txt') as f:
# print(f.read())
newList=[]
for i in range(11):
newList.append(i*2)
print(newList)
newList2=[i*2 for i in range(11)]
print(newList2)
list = ["小米","王银龙","王思"]
emptyList=[]
for name in list... | normal | {
"blob_id": "3752b68e151379c57e1494715a45172607f4aead",
"index": 8090,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(11):\n newList.append(i * 2)\nprint(newList)\n<mask token>\nprint(newList2)\n<mask token>\nfor name in list:\n if name.startswith('王'):\n emptyList.append(name... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-17 14:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('votes', '0003_choice_votes'),
]
operations = [
migrations.CreateModel(
... | normal | {
"blob_id": "781cb59fb9b6d22547fd4acf895457868342e125",
"index": 8290,
"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 = [('votes', '00... | [
0,
1,
2,
3,
4
] |
config_info = {'n_input': 1, 'num_layers': 1, 'features': 20,
'sequence_length': 1344, 'num_steps': None, 'lstm_size': None,
'batch_size': None, 'init_learning_rate': None, 'learning_rate_decay':
None, 'init_epoch': None, 'max_epoch': None, 'dropout_rate': None}
| normal | {
"blob_id": "8ede786526f4b730173777d9d3b9c7e4554fc887",
"index": 2443,
"step-1": "<mask token>\n",
"step-2": "config_info = {'n_input': 1, 'num_layers': 1, 'features': 20,\n 'sequence_length': 1344, 'num_steps': None, 'lstm_size': None,\n 'batch_size': None, 'init_learning_rate': None, 'learning_rate_dec... | [
0,
1
] |
from django.db import models
# Create your models here.
class GeneralInformation(models.Model):
name = models.CharField(max_length=100)
address = models.TextField()
city = models.CharField(max_length=20)
class Meta:
ordering = ['name']
def __str__(self):
return "{} {} {}".format... | normal | {
"blob_id": "d0f83e3b7eb5e1bc81a56e46043f394757437af8",
"index": 5504,
"step-1": "<mask token>\n\n\nclass GeneralInformation(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = ['name']\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass GeneralInf... | [
1,
2,
3,
4,
5
] |
import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import extract_tables_columns
def test_get_tables():
sql_str = "SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;"
assert(extract_tables_columns.get_tables(sql_str)) == [('TA... | normal | {
"blob_id": "72286078841c7fe5b297767576741dbbd0a80411",
"index": 3457,
"step-1": "<mask token>\n\n\ndef test_get_tables():\n sql_str = (\n 'SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;')\n assert extract_tables_columns.get_tables(sql_str) == [('TABLE1',\n 'TABLE1'), ('T... | [
3,
4,
6,
7,
8
] |
#!/usr/bin/python
# coding: utf-8
# # import re
# # import urllib
# #
# #
# # def getHtml(url):
# # page = urllib.urlopen(url)
# # html = page.read()
# # return html
# #
# #
# # def getMp4(html):
# # r = r"href='(http.*\.mp4)'"
# # re_mp4 = re.compile(r)
# # mp4List = re.findall(re_mp4, html)
... | normal | {
"blob_id": "ad94118b43e130aec5df3976fd0460164de17511",
"index": 8361,
"step-1": "<mask token>\n\n\ndef _not_divisible(n):\n return lambda x: x % n > 0\n\n\ndef primes():\n yield 2\n it = _odd_iter()\n while True:\n n = next(it)\n yield n\n it = filter(_not_divisible(n), it)\n\n\... | [
6,
9,
10,
11,
13
] |
import unittest
import achemkit.properties_wnx
class TestDummy(unittest.TestCase):
pass
| normal | {
"blob_id": "5f0e6f6dc645996b486f1292fe05229a7fae9b17",
"index": 2342,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestDummy(unittest.TestCase):\n pass\n",
"step-3": "import unittest\nimport achemkit.properties_wnx\n\n\nclass TestDummy(unittest.TestCase):\n pass\n",
"step-4": null,... | [
0,
1,
2
] |
offset = input()
cal = 1030 + int(offset) * 100
if 0 < cal < 2400:
print('Tuesday')
elif cal < 0:
print('Monday')
else:
print('Wednesday')
| normal | {
"blob_id": "aefb49410e077180a660d17c4c646265a75969a7",
"index": 7509,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif 0 < cal < 2400:\n print('Tuesday')\nelif cal < 0:\n print('Monday')\nelse:\n print('Wednesday')\n",
"step-3": "offset = input()\ncal = 1030 + int(offset) * 100\nif 0 < cal <... | [
0,
1,
2
] |
from PyQt5.QtWidgets import QApplication, QWidget
import sys
class Calculator(QWidget):
def __init__(self):
self.number_str = ""
self.version = "小树计算器 V1.0"
super().__init__()
self.resize(400,400)
from PyQt5.uic import loadUi # 需要导入的模块
#loadUi("record.ui", self) ... | normal | {
"blob_id": "4df9af863a857c3bbc3c266d745a49b6ef78ba9b",
"index": 1994,
"step-1": "<mask token>\n\n\nclass Calculator(QWidget):\n <mask token>\n\n def accept_button_value(self, number):\n if number == 'Clean':\n self.number_str = ''\n elif number == 'Backspace':\n self.nu... | [
3,
4,
5,
6,
7
] |
import pymysql
conn = None
cur = None
try:
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='test')
cur = conn.cursor()
cur.execute("SELECT user_id, user_name FROM cap_user")
row_count = cur.rowcount
# row_number = cur.rownumber
for r in cur.fetchall():
... | normal | {
"blob_id": "e5b5874f060bdf93ac4fadaf556aa4182619d077",
"index": 2033,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd\n ='root', db='test')\n cur = conn.cursor()\n cur.execute('SELECT user_id, user_name FROM ca... | [
0,
1,
2,
3,
4
] |
# Copyright 2017-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License MIT (https://opensource.org/licenses/MIT).
from datetime import datetime, timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestCase(TransactionCase):
def setUp(self):
super(Test... | normal | {
"blob_id": "29ec576d1fe04108eeb03a5d1b167671d3004570",
"index": 4403,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestCase(TransactionCase):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass TestCase(TransactionCase):\n\n def setUp(self):\n super(TestCase, self).setUp()\n... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import calendar as cal
import random
import pytz
from datetime import datetime, timedelta, time
from dateutil import rrule
from dateutil.relativedelta import relativedelta
from babel.dates import format_datetime
from od... | normal | {
"blob_id": "e03dfa0e02313c5478d4e97dcaf3bc27915bd878",
"index": 1421,
"step-1": "<mask token>\n\n\nclass CalendarAppointmentSlot(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @api.constrains('hour')\n def ch... | [
7,
10,
12,
18,
19
] |
from os import read
from cryptography.fernet import Fernet
#create a key
# key = Fernet.generate_key()
#When every we run this code we will create a new key
# with open('mykey.key','wb') as mykey:
# mykey.write(key)
#To avoid create a new key and reuse the same key
with open('mykey.key','rb') as myk... | normal | {
"blob_id": "df828344b81a40b7101adcc6759780ea84f2c6b4",
"index": 4698,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('mykey.key', 'rb') as mykey:\n key = mykey.read()\n<mask token>\nwith open('encryptedpassword.txt', 'rb') as encrypted_password_file:\n encrypte_file = encrypted_password_... | [
0,
1,
2,
3,
4
] |
"""These are views that are used for viewing and editing characters."""
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin,\
LoginRequiredMixin, PermissionRequiredMixin
from django.db import transaction
from django.db.models import F
from django.http import HttpResponseR... | normal | {
"blob_id": "55ea522b096b189ff67b0da0058af777b0a910e3",
"index": 4970,
"step-1": "<mask token>\n\n\nclass CharacterDropHeaderView(APIView):\n \"\"\"\n Set of AJAX views for a Characters\n\n This handles different API calls for character actions.\n \"\"\"\n authentication_classes = [SessionAuthenti... | [
33,
48,
59,
68,
81
] |
def flat_list(array):
result = []
for element in array:
if type(element) == list:
result += flat_list(element)
else:
result.append(element)
return result
print flat_list([1, [2, 2, 2], 4])
print flat_list([-1, [1, [-2], 1], -1]) | normal | {
"blob_id": "0d321193d68b463e3dd04b21ee611afdc212a22b",
"index": 4682,
"step-1": "def flat_list(array):\n result = []\n for element in array:\n if type(element) == list:\n result += flat_list(element)\n else:\n result.append(element)\n return result\n\n\nprint flat_li... | [
0
] |
"""This module defines simple utilities for making toy datasets to be used in testing/examples"""
##################################################
# Import Miscellaneous Assets
##################################################
import pandas as pd
###############################################
# Import Learning Ass... | normal | {
"blob_id": "285ca945696b32160175f15c4e89b3938f41ebf4",
"index": 2172,
"step-1": "<mask token>\n\n\ndef get_diabetes_data(target='progression'):\n \"\"\"Get the SKLearn Diabetes regression dataset, formatted as a DataFrame\n\n Parameters\n ----------\n target: String, default='progression'\n W... | [
1,
2,
3,
4,
5
] |
class TimeEntry:
def __init__(self, date, duration, togglproject='default toggl',
tdproject='default td', togglID='NULL', tdID='Null'):
self.duration = duration
self.date = date
self.togglProject = togglproject
self.tdProject = tdproject
self.togglID = togglID
... | normal | {
"blob_id": "bdf2c35c12820dd31bd242ce1b6dae7271ceb2b7",
"index": 8433,
"step-1": "<mask token>\n",
"step-2": "class TimeEntry:\n <mask token>\n",
"step-3": "class TimeEntry:\n\n def __init__(self, date, duration, togglproject='default toggl',\n tdproject='default td', togglID='NULL', tdID='Null'... | [
0,
1,
2
] |
import dtw
import stats
import glob
import argparse
import matplotlib.pyplot as plt
GRAPH = False
PERCENTAGE = False
VERBOSE = False
def buildExpectations(queryPath, searchPatternPath):
"""
Based on SpeechCommand_v0.02 directory structure.
"""
expectations = []
currentDirectory = ""
queryFile... | normal | {
"blob_id": "03fb1cf0aac0c37858dd8163562a7139ed4e1179",
"index": 776,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef buildExpectations(queryPath, searchPatternPath):\n \"\"\"\n Based on SpeechCommand_v0.02 directory structure.\n \"\"\"\n expectations = []\n currentDirectory = ''\n ... | [
0,
2,
3,
4,
5
] |
from collections import defaultdict
# The order of the steps doesn't matter, so the distance
# function is very simple
def dist(counts):
n = abs(counts["n"] - counts["s"])
nw = abs(counts["nw"] - counts["se"])
ne = abs(counts["ne"] - counts["sw"])
return n + max(ne,nw)
if __name__ == "__main__":
c... | normal | {
"blob_id": "ac2e9145e3345e5448683d684b69d2356e3214ce",
"index": 9999,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef dist(counts):\n n = abs(counts['n'] - counts['s'])\n nw = abs(counts['nw'] - counts['se'])\n ne = abs(counts['ne'] - counts['sw'])\n return n + max(ne, nw)\n\n\n<mask ... | [
0,
1,
2,
3,
4
] |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from collections import OrderedDict
from functools import reduce
class ArcTan(nn.Module):
def __init__(self):
super(ArcTan,self).__init__()
def forward(self, x):
return torch.arctan(x) / 1.5708
class Pa... | normal | {
"blob_id": "1c1673b5e54bafef9f36a2583115f8135c112ab4",
"index": 1922,
"step-1": "<mask token>\n\n\nclass GraphNN(nn.Module):\n\n def __init__(self, dim_in=7, dim_act=6, dim_h=8, dropout=0.0):\n super(GraphNN, self).__init__()\n self.ligand_dim = dim_in\n self.dim_h = dim_h\n self.... | [
26,
31,
34,
35,
39
] |
import os, re
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.sessions',
'django.contrib.contenttypes',
'django.contrib.sites',
'maintenancemode'... | normal | {
"blob_id": "34ecf2bd9bc72a98aba4584880a198dd24899dbe",
"index": 6218,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':\n ':memory:'}}\nINSTALLED_APPS = ('django.contrib.auth', 'django.contrib.admin',\n 'django.contrib.sessions'... | [
0,
1,
2,
3
] |
import os
my_home = os.popen("echo $MYWORK_DIR").readlines()[0][:-1]
import numpy
from sys import path, argv
path.append("D:/Github/astrophy-research/mylib")
path.append("D:/Github/astrophy-research/multi_shear_detect")
path.append('%s/work/mylib' % my_home)
from Fourier_Quad import Fourier_Quad
# import h5py
# from pl... | normal | {
"blob_id": "1ffdc2845bc503c0a30407de444a152f8cc68d57",
"index": 1370,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npath.append('D:/Github/astrophy-research/mylib')\npath.append('D:/Github/astrophy-research/multi_shear_detect')\npath.append('%s/work/mylib' % my_home)\n<mask token>\nif rank == 0:\n n... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python2.7
#
# Assignment2 Interface
#
import psycopg2
import os
import sys
import Assignment1 as a
# Donot close the connection inside this file i.e. do not perform openconnection.close()
#range__metadata = RangeRatingsMetadata
#roundR_metadata = RoundRobinRatingsMetadata
#rangetablepartition = rangeratings... | normal | {
"blob_id": "0c736bb5c88a8d7ee359e05fe12f0b77d83146c8",
"index": 3439,
"step-1": "#!/usr/bin/python2.7\n#\n# Assignment2 Interface\n#\n\nimport psycopg2\nimport os\nimport sys\nimport Assignment1 as a\n# Donot close the connection inside this file i.e. do not perform openconnection.close()\n#range__metadata = Ra... | [
0
] |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 18:50:46 2019
@author: kanfar
"""
import numpy as np
import timeit
import matplotlib.pyplot as plt
from numpy import expand_dims, zeros, ones
from numpy.random import randn, randint
from keras.models import load_model
from keras.optimizers import Adam
from keras.model... | normal | {
"blob_id": "fc6c220f8a3a0e9dd1d6e6e1ca131136db8f8a58",
"index": 9155,
"step-1": "<mask token>\n\n\nclass cGAN:\n\n def __init__(self, input_dim1, input_dim2, input_dim3, latent_size):\n self.input_dim1 = input_dim1\n self.input_dim2 = input_dim2\n self.input_dim3 = input_dim3\n se... | [
10,
11,
12,
13,
14
] |
import datetime
from django.views.generic import DetailView, ListView
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import get_list_or_404, render_to_response, get_object_or_404
from django.template import RequestContext
from django.co... | normal | {
"blob_id": "3ecc9ce82d9c902958a4da51ce7ee3c39b064b2b",
"index": 3591,
"step-1": "<mask token>\n\n\nclass MilkingListView(ListView):\n <mask token>\n\n def get_queryset(self, *args, **kwargs):\n try:\n animal = Animal.objects.get(self.kwargs.get('slug', None))\n qs = Milking.ob... | [
7,
10,
13,
15,
16
] |
#!/usr/bin/env python
import sys, re
window = 2
for line in sys.stdin:
line = line.strip()
twits = line.split()
i = 0
while i <len(twits):
j = 0
while j <len(twits):
if i!= j:
print("%s%s\t%d" % (twits[i]+' ', twits[j], 1))
j+=1
i+=1 | normal | {
"blob_id": "e884825325ceb401142cab0618d9d4e70e475cf5",
"index": 893,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in sys.stdin:\n line = line.strip()\n twits = line.split()\n i = 0\n while i < len(twits):\n j = 0\n while j < len(twits):\n if i != j:\n ... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qtGSD_DESIGN.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(... | normal | {
"blob_id": "9dde8e5fd0e83860ee86cf5402ab6eeb5b07ab2c",
"index": 7761,
"step-1": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n\n def setupUi(self, MainWindow):\n MainWindow.setObjectName(_fromUtf8('M... | [
1,
3,
4,
5,
6
] |
# RSA key
modulus_size = 2048
(n, e) = (0, 0) # Not being initialize here
# modulus size in bytes
k = modulus_size // 8
# keep track of the oracle calls
queries = 0
print_queries_every = 1
number_of_time_to_confirm_conforming = 10
# Choose to use OpenSSL encrypt function or our own implementations
encrypt_openssl =... | normal | {
"blob_id": "415d58e502e8a33f7a37c4fb2da34e838246ea9c",
"index": 2057,
"step-1": "<mask token>\n",
"step-2": "modulus_size = 2048\nn, e = 0, 0\nk = modulus_size // 8\nqueries = 0\nprint_queries_every = 1\nnumber_of_time_to_confirm_conforming = 10\nencrypt_openssl = True\nt_start = 0\ncwd = ''\nhost = '10.0.0.1... | [
0,
1,
2
] |
"""
A module for constants.
"""
# fin adding notes for keys and uncomment
KEYS = [
"CM",
"GM"
# ,
# "DM",
# "AM",
# "EM",
# "BM",
# "FSM",
# "CSM",
# "Am",
# "Em",
# "Bm",
# "FSm",
# "CSm",
# "GSm",
# "DSm",
# "ASm",
]
NOTES_FOR_KEY = {
"CM": [... | normal | {
"blob_id": "dd7ade05ef912f7c094883507768cc21f95f31f6",
"index": 533,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nKEYS = ['CM', 'GM']\nNOTES_FOR_KEY = {'CM': [21, 23, 24, 26, 28, 29, 31, 33, 35, 36, 38, 40, 41,\n 43, 45, 47, 48, 50, 52, 53, 55, 57, 59, 60, 62, 64, 65, 67, 69, 71, 72,\n 74, 76, 7... | [
0,
1,
2
] |
from django.shortcuts import render,redirect
from django.http import HttpResponseRedirect
from . import forms,models
from django.contrib.auth.models import Group
from django.contrib import auth
from django.contrib.auth.decorators import login_required,user_passes_test
from datetime import datetime,timedelta,date
from d... | normal | {
"blob_id": "ce9e1ac0f1596ba4db904289f91f5ab95c2de4b8",
"index": 7642,
"step-1": "<mask token>\n\n\ndef home_view(request):\n if request.user.is_authenticated:\n return HttpResponseRedirect('afterlogin')\n return render(request, 'library/index.html')\n\n\n<mask token>\n\n\ndef studentsignup_view(req... | [
8,
11,
15,
18,
19
] |
from brie.config import ldap_config
from brie.model.ldap import *
from brie.lib.log_helper import BrieLogging
import datetime
import smtplib
class Residences:
@staticmethod
def get_dn_by_name(user_session, name):
result = user_session.ldap_bind.search_first(ldap_config.liste_residence_dn, "(cn=" +... | normal | {
"blob_id": "d726e468a9df26f1bcb8a016812b87fad7b41aa8",
"index": 8089,
"step-1": "<mask token>\n\n\nclass CotisationComputes:\n\n @staticmethod\n def current_year():\n now = datetime.datetime.now()\n if now.month > 8:\n return now.year + 1\n return now.year\n\n @staticmet... | [
11,
12,
16,
17,
23
] |
import markovify
import argparse
import sqlite3
import time
modelFile = './data/model.json'
corpusFile = './data/corpus.txt'
dbFile = './data/tweets.sqlite3'
def generate():
generate_count = 168
model_json = open(modelFile, 'r').read()
model = markovify.Text.from_json(model_json)
conn = sqlite3.conne... | normal | {
"blob_id": "cc71c0cc1ec21dc465486fb5894c4d389c39bd62",
"index": 8164,
"step-1": "<mask token>\n\n\ndef make_model():\n corpus = open(corpusFile).read()\n text_model = markovify.Text(corpus, state_size=4)\n model_json = text_model.to_json()\n f = open(modelFile, mode='w')\n f.write(model_json)\n ... | [
1,
4,
5,
6,
7
] |
import json
from pets.pet import Pet
from store_requests.store import Store
from user_requests.user import User
SUCCESS = 200
NotFound = 404
url_site = 'https://petstore.swagger.io/v2'
new_username = "Khrystyna"
new_id = 12345
invalid_new_id = 1234
error_message = "oops we have a problem!"
store_inventory = {
"1": ... | normal | {
"blob_id": "54ed0683d0f8d907c27e2f3809f9533556593392",
"index": 5546,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nSUCCESS = 200\nNotFound = 404\nurl_site = 'https://petstore.swagger.io/v2'\nnew_username = 'Khrystyna'\nnew_id = 12345\ninvalid_new_id = 1234\nerror_message = 'oops we have a problem!'\ns... | [
0,
1,
2,
3
] |
#part-handler
# vi: syntax=python ts=4
#
# Copyright (C) 2012 Silpion IT-Solutions GmbH
#
# Author: Malte Stretz <stretz@silpion.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Softwa... | normal | {
"blob_id": "98b27c268fe1f47a899269e988ddf798faf827df",
"index": 8401,
"step-1": "<mask token>\n\n\ndef list_types():\n return ['application/tar']\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef list_types():\n return ['application/tar']\n\n\ndef handle_part(data, ctype, filename, payload):\n i... | [
1,
2,
3,
4,
5
] |
#Credits To @maxprogrammer007 (for editing)
# Ported for Ultroid < https://github.com/TeamUltroid/Ultroid >
import os
import sys
import logging
from telethon import events
import asyncio
from userbot.utils import admin_cmd
from userbot import ALIVE_NAME
import random, re
from userbot import CMD_HELP
from collectio... | normal | {
"blob_id": "51cff2f7dd1fd10c6f447d62db3e98075caebe51",
"index": 1708,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@borg.on(admin_cmd(pattern='stupid$'))\nasync def _(event):\n if event.fwd_from:\n return\n animation_interval = 1\n animation_ttl = range(0, 14)\n await event.edit... | [
0,
1,
2,
3,
4
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.