content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Block:
def __init__(self):
self.statements = []
def add_statement(self, statement):
self.statements.append(statement)
| class Block:
def __init__(self):
self.statements = []
def add_statement(self, statement):
self.statements.append(statement) |
# TODO: Just change this to CSS
colors = {
"text" : "#aaaaaa",
"background" : "#222221",
"plot_background" : "#222221",
"plot_gridlines" : "#777776",
"page_background" : "#222221"
} | colors = {'text': '#aaaaaa', 'background': '#222221', 'plot_background': '#222221', 'plot_gridlines': '#777776', 'page_background': '#222221'} |
clang_env = {
"ASAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"CC": "/usr/local/bin/clang",
"GCOV": "/dev/null",
"LD_LIBRARY_PATH": "/usr/local/lib",
"MSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"TSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
"UBSAN_SYMBOLIZER_PATH": "/usr/local/bin/llvm-symbolizer",
}
| clang_env = {'ASAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'CC': '/usr/local/bin/clang', 'GCOV': '/dev/null', 'LD_LIBRARY_PATH': '/usr/local/lib', 'MSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'TSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer', 'UBSAN_SYMBOLIZER_PATH': '/usr/local/bin/llvm-symbolizer'} |
# Task 03. Special Numbers
num = int(input())
digits = [x for x in range(1,num+1)]
is_special = False
for digit in digits:
digit_iter = [int(x) for x in str(digit)]
if sum(digit_iter) == 5 or sum(digit_iter) == 7 or sum(digit_iter) == 11:
is_special = True
else:
is_special = False
print(f'{digit} -> {is_special}')
| num = int(input())
digits = [x for x in range(1, num + 1)]
is_special = False
for digit in digits:
digit_iter = [int(x) for x in str(digit)]
if sum(digit_iter) == 5 or sum(digit_iter) == 7 or sum(digit_iter) == 11:
is_special = True
else:
is_special = False
print(f'{digit} -> {is_special}') |
__version__ = '0.11.2'
# import importlib
# import logging
# from pathlib import Path
# importlib.reload(logging)
# logpath = Path.home() / 'p4reduction.log'
# logging.basicConfig(filename=str(logpath), filemode='w',
# format='%(asctime)s %(levelname)s: %(message)s',
# datefmt='%Y-%m-%d %H:%M:%S')
| __version__ = '0.11.2' |
def binario(n):
num = []
while(n>1):
if(n==2 or n==3):
resto = n % 2
n //= 2
num.append(resto)
num.append(n)
else:
resto = n % 2
n //= 2
num.append(resto)
return num
n = int(input('digite um numero: '))
num = []
bin = 0
if(n > 1):
num = binario(n)
i = len(num)-1
while(i>-1):
bin+= num[i]*10**i
i-=1
else:
bin = n
print('numero: {} em binario = {}'.format(n,bin)) | def binario(n):
num = []
while n > 1:
if n == 2 or n == 3:
resto = n % 2
n //= 2
num.append(resto)
num.append(n)
else:
resto = n % 2
n //= 2
num.append(resto)
return num
n = int(input('digite um numero: '))
num = []
bin = 0
if n > 1:
num = binario(n)
i = len(num) - 1
while i > -1:
bin += num[i] * 10 ** i
i -= 1
else:
bin = n
print('numero: {} em binario = {}'.format(n, bin)) |
#
#
# Package libApp in directory source
#
#
print("Loaded libApp")
#
# This file can be left empty, but its presence informs the import mechanism
#
| print('Loaded libApp') |
EXPECTED_DAILY_WEBSITE_GENERATE_SAMPLES_QUERIES_SIZE = """delimiter //
DROP PROCEDURE IF EXISTS get_daily_samples_size_websites;
CREATE PROCEDURE get_daily_samples_size_websites (
IN id INT,
OUT entry0 FLOAT,
OUT entry1 FLOAT,
OUT entry2 FLOAT,
OUT entry3 FLOAT,
OUT entry4 FLOAT,
OUT entry5 FLOAT,
OUT entry6 FLOAT,
OUT entry7 FLOAT,
OUT entry8 FLOAT,
OUT entry9 FLOAT,
OUT entry10 FLOAT,
OUT entry11 FLOAT,
OUT entry12 FLOAT,
OUT entry13 FLOAT,
OUT entry14 FLOAT,
OUT entry15 FLOAT,
OUT entry16 FLOAT,
OUT entry17 FLOAT,
OUT entry18 FLOAT,
OUT entry19 FLOAT,
OUT entry20 FLOAT,
OUT entry21 FLOAT,
OUT entry22 FLOAT,
OUT entry23 FLOAT,
OUT start_hour FLOAT
)
BEGIN
select HOUR(now()) INTO start_hour;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1);
else SET entry0 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1);
else SET entry1 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1);
else SET entry2 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1);
else SET entry3 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1);
else SET entry4 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1);
else SET entry5 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1);
else SET entry6 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1);
else SET entry7 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1);
else SET entry8 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1);
else SET entry9 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1);
else SET entry10 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1);
else SET entry11 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1);
else SET entry12 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1);
else SET entry13 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1);
else SET entry14 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1);
else SET entry15 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1);
else SET entry16 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1);
else SET entry17 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1);
else SET entry18 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1);
else SET entry19 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1);
else SET entry20 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1);
else SET entry21 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1);
else SET entry22 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1);
else SET entry23 := 0;
end if;
END//
delimiter ;
"""
EXPECTED_WEEKLY_WEBSITE_GENERATE_SAMPLES_QUERIES_SIZE = """delimiter //
DROP PROCEDURE IF EXISTS get_weekly_samples_size_websites;
CREATE PROCEDURE get_weekly_samples_size_websites (
IN id INT,
OUT entry0 FLOAT,
OUT entry1 FLOAT,
OUT entry2 FLOAT,
OUT entry3 FLOAT,
OUT entry4 FLOAT,
OUT entry5 FLOAT,
OUT entry6 FLOAT,
OUT entry7 FLOAT,
OUT entry8 FLOAT,
OUT entry9 FLOAT,
OUT entry10 FLOAT,
OUT entry11 FLOAT,
OUT entry12 FLOAT,
OUT entry13 FLOAT,
OUT entry14 FLOAT,
OUT entry15 FLOAT,
OUT entry16 FLOAT,
OUT entry17 FLOAT,
OUT entry18 FLOAT,
OUT entry19 FLOAT,
OUT entry20 FLOAT,
OUT entry21 FLOAT,
OUT entry22 FLOAT,
OUT entry23 FLOAT,
OUT entry24 FLOAT,
OUT entry25 FLOAT,
OUT entry26 FLOAT,
OUT entry27 FLOAT,
OUT start_hour FLOAT
)
BEGIN
select HOUR(now()) INTO start_hour;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 168 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 168 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND Websiteid = id limit 1);
else SET entry0 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND Websiteid = id limit 1);
else SET entry1 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND Websiteid = id limit 1);
else SET entry2 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND Websiteid = id limit 1);
else SET entry3 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND Websiteid = id limit 1);
else SET entry4 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND Websiteid = id limit 1);
else SET entry5 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND Websiteid = id limit 1);
else SET entry6 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND Websiteid = id limit 1);
else SET entry7 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND Websiteid = id limit 1);
else SET entry8 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND Websiteid = id limit 1);
else SET entry9 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND Websiteid = id limit 1);
else SET entry10 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND Websiteid = id limit 1);
else SET entry11 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND Websiteid = id limit 1);
else SET entry12 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND Websiteid = id limit 1);
else SET entry13 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND Websiteid = id limit 1);
else SET entry14 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND Websiteid = id limit 1);
else SET entry15 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND Websiteid = id limit 1);
else SET entry16 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND Websiteid = id limit 1);
else SET entry17 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND Websiteid = id limit 1);
else SET entry18 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND Websiteid = id limit 1);
else SET entry19 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND Websiteid = id limit 1);
else SET entry20 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND Websiteid = id limit 1);
else SET entry21 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND Websiteid = id limit 1);
else SET entry22 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND Websiteid = id limit 1);
else SET entry23 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry24 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1);
else SET entry24 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry25 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1);
else SET entry25 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry26 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1);
else SET entry26 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry27 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1);
else SET entry27 := 0;
end if;
END//
delimiter ;
"""
EXPECTED_MONTHLY_WEBSITE_GENERATE_SAMPLES_QUERIES_SIZE = """delimiter //
DROP PROCEDURE IF EXISTS get_monthly_samples_size_websites;
CREATE PROCEDURE get_monthly_samples_size_websites (
IN id INT,
OUT entry0 FLOAT,
OUT entry1 FLOAT,
OUT entry2 FLOAT,
OUT entry3 FLOAT,
OUT entry4 FLOAT,
OUT entry5 FLOAT,
OUT entry6 FLOAT,
OUT entry7 FLOAT,
OUT entry8 FLOAT,
OUT entry9 FLOAT,
OUT entry10 FLOAT,
OUT entry11 FLOAT,
OUT entry12 FLOAT,
OUT entry13 FLOAT,
OUT entry14 FLOAT,
OUT entry15 FLOAT,
OUT entry16 FLOAT,
OUT entry17 FLOAT,
OUT entry18 FLOAT,
OUT entry19 FLOAT,
OUT entry20 FLOAT,
OUT entry21 FLOAT,
OUT entry22 FLOAT,
OUT entry23 FLOAT,
OUT entry24 FLOAT,
OUT entry25 FLOAT,
OUT entry26 FLOAT,
OUT entry27 FLOAT,
OUT entry28 FLOAT,
OUT entry29 FLOAT,
OUT entry30 FLOAT,
OUT start_hour FLOAT
)
BEGIN
select DAY(now()) INTO start_hour;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 31 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 31 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 DAY) AND Websiteid = id limit 1);
else SET entry0 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 29 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 29 DAY) AND Websiteid = id limit 1);
else SET entry1 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 29 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 28 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 29 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 28 DAY) AND Websiteid = id limit 1);
else SET entry2 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 28 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 27 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 28 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 27 DAY) AND Websiteid = id limit 1);
else SET entry3 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 27 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 26 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 27 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 26 DAY) AND Websiteid = id limit 1);
else SET entry4 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 26 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 25 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 26 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 25 DAY) AND Websiteid = id limit 1);
else SET entry5 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 25 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 25 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 DAY) AND Websiteid = id limit 1);
else SET entry6 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 DAY) AND Websiteid = id limit 1);
else SET entry7 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 DAY) AND Websiteid = id limit 1);
else SET entry8 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 DAY) AND Websiteid = id limit 1);
else SET entry9 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 DAY) AND Websiteid = id limit 1);
else SET entry10 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 DAY) AND Websiteid = id limit 1);
else SET entry11 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 DAY) AND Websiteid = id limit 1);
else SET entry12 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 DAY) AND Websiteid = id limit 1);
else SET entry13 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 DAY) AND Websiteid = id limit 1);
else SET entry14 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 DAY) AND Websiteid = id limit 1);
else SET entry15 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 DAY) AND Websiteid = id limit 1);
else SET entry16 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 DAY) AND Websiteid = id limit 1);
else SET entry17 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 DAY) AND Websiteid = id limit 1);
else SET entry18 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 DAY) AND Websiteid = id limit 1);
else SET entry19 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 DAY) AND Websiteid = id limit 1);
else SET entry20 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 DAY) AND Websiteid = id limit 1);
else SET entry21 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 DAY) AND Websiteid = id limit 1);
else SET entry22 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 DAY) AND Websiteid = id limit 1);
else SET entry23 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry24 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 DAY) AND Websiteid = id limit 1);
else SET entry24 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry25 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 DAY) AND Websiteid = id limit 1);
else SET entry25 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry26 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 DAY) AND Websiteid = id limit 1);
else SET entry26 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry27 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 DAY) AND Websiteid = id limit 1);
else SET entry27 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry28 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 DAY) AND Websiteid = id limit 1);
else SET entry28 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry29 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND Websiteid = id limit 1);
else SET entry29 := 0;
end if;
if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 DAY) AND Websiteid = id limit 1))
then SELECT SUM(bodySize) INTO entry30 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 DAY) AND Websiteid = id limit 1);
else SET entry30 := 0;
end if;
END//
delimiter ;
"""
| expected_daily_website_generate_samples_queries_size = 'delimiter //\nDROP PROCEDURE IF EXISTS get_daily_samples_size_websites;\nCREATE PROCEDURE get_daily_samples_size_websites (\n IN id INT,\n OUT entry0 FLOAT,\n OUT entry1 FLOAT,\n OUT entry2 FLOAT,\n OUT entry3 FLOAT,\n OUT entry4 FLOAT,\n OUT entry5 FLOAT,\n OUT entry6 FLOAT,\n OUT entry7 FLOAT,\n OUT entry8 FLOAT,\n OUT entry9 FLOAT,\n OUT entry10 FLOAT,\n OUT entry11 FLOAT,\n OUT entry12 FLOAT,\n OUT entry13 FLOAT,\n OUT entry14 FLOAT,\n OUT entry15 FLOAT,\n OUT entry16 FLOAT,\n OUT entry17 FLOAT,\n OUT entry18 FLOAT,\n OUT entry19 FLOAT,\n OUT entry20 FLOAT,\n OUT entry21 FLOAT,\n OUT entry22 FLOAT,\n OUT entry23 FLOAT,\n OUT start_hour FLOAT\n )\nBEGIN\n select HOUR(now()) INTO start_hour;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1);\n else SET entry0 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1);\n else SET entry1 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1);\n else SET entry2 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1);\n else SET entry3 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1);\n else SET entry4 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1);\n else SET entry5 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1);\n else SET entry6 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1);\n else SET entry7 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1);\n else SET entry8 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1);\n else SET entry9 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1);\n else SET entry10 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1);\n else SET entry11 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1);\n else SET entry12 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1);\n else SET entry13 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1);\n else SET entry14 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1);\n else SET entry15 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1);\n else SET entry16 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1);\n else SET entry17 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1);\n else SET entry18 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1);\n else SET entry19 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1);\n else SET entry20 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1);\n else SET entry21 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1);\n else SET entry22 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1);\n else SET entry23 := 0;\n end if;\nEND//\ndelimiter ;\n'
expected_weekly_website_generate_samples_queries_size = 'delimiter //\nDROP PROCEDURE IF EXISTS get_weekly_samples_size_websites;\nCREATE PROCEDURE get_weekly_samples_size_websites (\n IN id INT,\n OUT entry0 FLOAT,\n OUT entry1 FLOAT,\n OUT entry2 FLOAT,\n OUT entry3 FLOAT,\n OUT entry4 FLOAT,\n OUT entry5 FLOAT,\n OUT entry6 FLOAT,\n OUT entry7 FLOAT,\n OUT entry8 FLOAT,\n OUT entry9 FLOAT,\n OUT entry10 FLOAT,\n OUT entry11 FLOAT,\n OUT entry12 FLOAT,\n OUT entry13 FLOAT,\n OUT entry14 FLOAT,\n OUT entry15 FLOAT,\n OUT entry16 FLOAT,\n OUT entry17 FLOAT,\n OUT entry18 FLOAT,\n OUT entry19 FLOAT,\n OUT entry20 FLOAT,\n OUT entry21 FLOAT,\n OUT entry22 FLOAT,\n OUT entry23 FLOAT,\n OUT entry24 FLOAT,\n OUT entry25 FLOAT,\n OUT entry26 FLOAT,\n OUT entry27 FLOAT,\n OUT start_hour FLOAT\n )\nBEGIN\n select HOUR(now()) INTO start_hour;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 168 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 168 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND Websiteid = id limit 1);\n else SET entry0 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 162 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND Websiteid = id limit 1);\n else SET entry1 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 156 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND Websiteid = id limit 1);\n else SET entry2 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 150 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND Websiteid = id limit 1);\n else SET entry3 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 144 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND Websiteid = id limit 1);\n else SET entry4 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 138 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND Websiteid = id limit 1);\n else SET entry5 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 132 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND Websiteid = id limit 1);\n else SET entry6 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 126 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND Websiteid = id limit 1);\n else SET entry7 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 120 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND Websiteid = id limit 1);\n else SET entry8 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 114 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND Websiteid = id limit 1);\n else SET entry9 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 108 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND Websiteid = id limit 1);\n else SET entry10 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 102 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND Websiteid = id limit 1);\n else SET entry11 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 96 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND Websiteid = id limit 1);\n else SET entry12 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 90 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND Websiteid = id limit 1);\n else SET entry13 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 84 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND Websiteid = id limit 1);\n else SET entry14 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 78 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND Websiteid = id limit 1);\n else SET entry15 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 72 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND Websiteid = id limit 1);\n else SET entry16 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 66 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND Websiteid = id limit 1);\n else SET entry17 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 60 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND Websiteid = id limit 1);\n else SET entry18 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 54 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND Websiteid = id limit 1);\n else SET entry19 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 48 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND Websiteid = id limit 1);\n else SET entry20 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 42 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND Websiteid = id limit 1);\n else SET entry21 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 36 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND Websiteid = id limit 1);\n else SET entry22 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND Websiteid = id limit 1);\n else SET entry23 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry24 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1);\n else SET entry24 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry25 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1);\n else SET entry25 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry26 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1);\n else SET entry26 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry27 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1);\n else SET entry27 := 0;\n end if;\nEND//\ndelimiter ;\n'
expected_monthly_website_generate_samples_queries_size = 'delimiter //\nDROP PROCEDURE IF EXISTS get_monthly_samples_size_websites;\nCREATE PROCEDURE get_monthly_samples_size_websites (\n IN id INT,\n OUT entry0 FLOAT,\n OUT entry1 FLOAT,\n OUT entry2 FLOAT,\n OUT entry3 FLOAT,\n OUT entry4 FLOAT,\n OUT entry5 FLOAT,\n OUT entry6 FLOAT,\n OUT entry7 FLOAT,\n OUT entry8 FLOAT,\n OUT entry9 FLOAT,\n OUT entry10 FLOAT,\n OUT entry11 FLOAT,\n OUT entry12 FLOAT,\n OUT entry13 FLOAT,\n OUT entry14 FLOAT,\n OUT entry15 FLOAT,\n OUT entry16 FLOAT,\n OUT entry17 FLOAT,\n OUT entry18 FLOAT,\n OUT entry19 FLOAT,\n OUT entry20 FLOAT,\n OUT entry21 FLOAT,\n OUT entry22 FLOAT,\n OUT entry23 FLOAT,\n OUT entry24 FLOAT,\n OUT entry25 FLOAT,\n OUT entry26 FLOAT,\n OUT entry27 FLOAT,\n OUT entry28 FLOAT,\n OUT entry29 FLOAT,\n OUT entry30 FLOAT,\n OUT start_hour FLOAT\n )\nBEGIN\n select DAY(now()) INTO start_hour;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 31 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 31 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 30 DAY) AND Websiteid = id limit 1);\n else SET entry0 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 29 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 30 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 29 DAY) AND Websiteid = id limit 1);\n else SET entry1 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 29 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 28 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 29 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 28 DAY) AND Websiteid = id limit 1);\n else SET entry2 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 28 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 27 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 28 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 27 DAY) AND Websiteid = id limit 1);\n else SET entry3 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 27 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 26 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 27 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 26 DAY) AND Websiteid = id limit 1);\n else SET entry4 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 26 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 25 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 26 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 25 DAY) AND Websiteid = id limit 1);\n else SET entry5 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 25 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 25 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 24 DAY) AND Websiteid = id limit 1);\n else SET entry6 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 DAY) AND Websiteid = id limit 1);\n else SET entry7 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 DAY) AND Websiteid = id limit 1);\n else SET entry8 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 DAY) AND Websiteid = id limit 1);\n else SET entry9 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 DAY) AND Websiteid = id limit 1);\n else SET entry10 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 DAY) AND Websiteid = id limit 1);\n else SET entry11 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 DAY) AND Websiteid = id limit 1);\n else SET entry12 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 DAY) AND Websiteid = id limit 1);\n else SET entry13 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 DAY) AND Websiteid = id limit 1);\n else SET entry14 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 DAY) AND Websiteid = id limit 1);\n else SET entry15 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 DAY) AND Websiteid = id limit 1);\n else SET entry16 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 DAY) AND Websiteid = id limit 1);\n else SET entry17 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 DAY) AND Websiteid = id limit 1);\n else SET entry18 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 DAY) AND Websiteid = id limit 1);\n else SET entry19 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 DAY) AND Websiteid = id limit 1);\n else SET entry20 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 DAY) AND Websiteid = id limit 1);\n else SET entry21 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 DAY) AND Websiteid = id limit 1);\n else SET entry22 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 DAY) AND Websiteid = id limit 1);\n else SET entry23 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry24 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 DAY) AND Websiteid = id limit 1);\n else SET entry24 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry25 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 DAY) AND Websiteid = id limit 1);\n else SET entry25 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry26 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 DAY) AND Websiteid = id limit 1);\n else SET entry26 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry27 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 DAY) AND Websiteid = id limit 1);\n else SET entry27 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry28 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 DAY) AND Websiteid = id limit 1);\n else SET entry28 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry29 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND Websiteid = id limit 1);\n else SET entry29 := 0;\n end if;\n if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 DAY) AND Websiteid = id limit 1))\n then SELECT SUM(bodySize) INTO entry30 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 DAY) AND Websiteid = id limit 1);\n else SET entry30 := 0;\n end if;\nEND//\ndelimiter ;\n' |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Corwin Brown <corwin@corwinbrown.com>
# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_uri
version_added: '2.1'
short_description: Interacts with webservices
description:
- Interacts with FTP, HTTP and HTTPS web services.
- Supports Digest, Basic and WSSE HTTP authentication mechanisms.
- For non-Windows targets, use the M(uri) module instead.
options:
url:
description:
- Supports FTP, HTTP or HTTPS URLs in the form of (ftp|http|https)://host.domain:port/path.
type: str
required: yes
method:
description:
- The HTTP Method of the request or response.
type: str
default: GET
content_type:
description:
- Sets the "Content-Type" header.
type: str
body:
description:
- The body of the HTTP request/response to the web service.
type: raw
dest:
description:
- Output the response body to a file.
type: path
version_added: '2.3'
creates:
description:
- A filename, when it already exists, this step will be skipped.
type: path
version_added: '2.4'
removes:
description:
- A filename, when it does not exist, this step will be skipped.
type: path
version_added: '2.4'
return_content:
description:
- Whether or not to return the body of the response as a "content" key in
the dictionary result. If the reported Content-type is
"application/json", then the JSON is additionally loaded into a key
called C(json) in the dictionary results.
type: bool
default: no
version_added: '2.4'
status_code:
description:
- A valid, numeric, HTTP status code that signifies success of the request.
- Can also be comma separated list of status codes.
type: list
default: [ 200 ]
version_added: '2.4'
url_username:
description:
- The username to use for authentication.
- Was originally called I(user) but was changed to I(url_username) in
Ansible 2.9.
version_added: "2.4"
url_password:
description:
- The password for I(url_username).
- Was originally called I(password) but was changed to I(url_password) in
Ansible 2.9.
version_added: "2.4"
follow_redirects:
version_added: "2.4"
maximum_redirection:
version_added: "2.4"
client_cert:
version_added: "2.4"
client_cert_password:
version_added: "2.5"
use_proxy:
version_added: "2.9"
proxy_url:
version_added: "2.9"
proxy_username:
version_added: "2.9"
proxy_password:
version_added: "2.9"
extends_documentation_fragment:
- url_windows
seealso:
- module: uri
- module: win_get_url
author:
- Corwin Brown (@blakfeld)
- Dag Wieers (@dagwieers)
'''
EXAMPLES = r'''
- name: Perform a GET and Store Output
win_uri:
url: http://example.com/endpoint
register: http_output
# Set a HOST header to hit an internal webserver:
- name: Hit a Specific Host on the Server
win_uri:
url: http://example.com/
method: GET
headers:
host: www.somesite.com
- name: Perform a HEAD on an Endpoint
win_uri:
url: http://www.example.com/
method: HEAD
- name: POST a Body to an Endpoint
win_uri:
url: http://www.somesite.com/
method: POST
body: "{ 'some': 'json' }"
'''
RETURN = r'''
elapsed:
description: The number of seconds that elapsed while performing the download.
returned: always
type: float
sample: 23.2
url:
description: The Target URL.
returned: always
type: str
sample: https://www.ansible.com
status_code:
description: The HTTP Status Code of the response.
returned: success
type: int
sample: 200
status_description:
description: A summary of the status.
returned: success
type: str
sample: OK
content:
description: The raw content of the HTTP response.
returned: success and return_content is True
type: str
sample: '{"foo": "bar"}'
content_length:
description: The byte size of the response.
returned: success
type: int
sample: 54447
json:
description: The json structure returned under content as a dictionary.
returned: success and Content-Type is "application/json" or "application/javascript" and return_content is True
type: dict
sample: {"this-is-dependent": "on the actual return content"}
'''
| ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = '\n---\nmodule: win_uri\nversion_added: \'2.1\'\nshort_description: Interacts with webservices\ndescription:\n- Interacts with FTP, HTTP and HTTPS web services.\n- Supports Digest, Basic and WSSE HTTP authentication mechanisms.\n- For non-Windows targets, use the M(uri) module instead.\noptions:\n url:\n description:\n - Supports FTP, HTTP or HTTPS URLs in the form of (ftp|http|https)://host.domain:port/path.\n type: str\n required: yes\n method:\n description:\n - The HTTP Method of the request or response.\n type: str\n default: GET\n content_type:\n description:\n - Sets the "Content-Type" header.\n type: str\n body:\n description:\n - The body of the HTTP request/response to the web service.\n type: raw\n dest:\n description:\n - Output the response body to a file.\n type: path\n version_added: \'2.3\'\n creates:\n description:\n - A filename, when it already exists, this step will be skipped.\n type: path\n version_added: \'2.4\'\n removes:\n description:\n - A filename, when it does not exist, this step will be skipped.\n type: path\n version_added: \'2.4\'\n return_content:\n description:\n - Whether or not to return the body of the response as a "content" key in\n the dictionary result. If the reported Content-type is\n "application/json", then the JSON is additionally loaded into a key\n called C(json) in the dictionary results.\n type: bool\n default: no\n version_added: \'2.4\'\n status_code:\n description:\n - A valid, numeric, HTTP status code that signifies success of the request.\n - Can also be comma separated list of status codes.\n type: list\n default: [ 200 ]\n version_added: \'2.4\'\n url_username:\n description:\n - The username to use for authentication.\n - Was originally called I(user) but was changed to I(url_username) in\n Ansible 2.9.\n version_added: "2.4"\n url_password:\n description:\n - The password for I(url_username).\n - Was originally called I(password) but was changed to I(url_password) in\n Ansible 2.9.\n version_added: "2.4"\n follow_redirects:\n version_added: "2.4"\n maximum_redirection:\n version_added: "2.4"\n client_cert:\n version_added: "2.4"\n client_cert_password:\n version_added: "2.5"\n use_proxy:\n version_added: "2.9"\n proxy_url:\n version_added: "2.9"\n proxy_username:\n version_added: "2.9"\n proxy_password:\n version_added: "2.9"\nextends_documentation_fragment:\n- url_windows\nseealso:\n- module: uri\n- module: win_get_url\nauthor:\n- Corwin Brown (@blakfeld)\n- Dag Wieers (@dagwieers)\n'
examples = '\n- name: Perform a GET and Store Output\n win_uri:\n url: http://example.com/endpoint\n register: http_output\n\n# Set a HOST header to hit an internal webserver:\n- name: Hit a Specific Host on the Server\n win_uri:\n url: http://example.com/\n method: GET\n headers:\n host: www.somesite.com\n\n- name: Perform a HEAD on an Endpoint\n win_uri:\n url: http://www.example.com/\n method: HEAD\n\n- name: POST a Body to an Endpoint\n win_uri:\n url: http://www.somesite.com/\n method: POST\n body: "{ \'some\': \'json\' }"\n'
return = '\nelapsed:\n description: The number of seconds that elapsed while performing the download.\n returned: always\n type: float\n sample: 23.2\nurl:\n description: The Target URL.\n returned: always\n type: str\n sample: https://www.ansible.com\nstatus_code:\n description: The HTTP Status Code of the response.\n returned: success\n type: int\n sample: 200\nstatus_description:\n description: A summary of the status.\n returned: success\n type: str\n sample: OK\ncontent:\n description: The raw content of the HTTP response.\n returned: success and return_content is True\n type: str\n sample: \'{"foo": "bar"}\'\ncontent_length:\n description: The byte size of the response.\n returned: success\n type: int\n sample: 54447\njson:\n description: The json structure returned under content as a dictionary.\n returned: success and Content-Type is "application/json" or "application/javascript" and return_content is True\n type: dict\n sample: {"this-is-dependent": "on the actual return content"}\n' |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Detroit'
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 't76+zh&*@(p*l3y50$f^el8q79o7gytx)64@uwt280hf=+)x1('
| debug = True
template_debug = DEBUG
admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}
time_zone = 'America/Detroit'
media_root = ''
media_url = ''
static_root = ''
static_url = '/static/'
secret_key = 't76+zh&*@(p*l3y50$f^el8q79o7gytx)64@uwt280hf=+)x1(' |
VERSION = "3.6.dev1"
SERIES = '.'.join(VERSION.split('.')[:2])
| version = '3.6.dev1'
series = '.'.join(VERSION.split('.')[:2]) |
cookie = {
'ipb_member_id': '',
'ipb_pass_hash': '',
'igneous': '',
} | cookie = {'ipb_member_id': '', 'ipb_pass_hash': '', 'igneous': ''} |
"""
TASK: Find the edit distance between two given strings.
The edit distance between two strings refers to the minimum number of character insertions,
deletions, and substitutions required to change one string to the other
"""
def edit_distance(str1: str, str2: str) -> int:
print("->edit_distance: str1={}, str2={}".format(str1, str2))
difference = 0
if len(str1) > len(str2):
difference = len(str1) - len(str2)
str1 = str1[:difference]
print("updated str1="+str1)
if len(str2) > len(str1):
difference = len(str2) - len(str1)
str2 = str2[:difference]
print("updated str2=" + str2)
len1 = len(str1)
len2 = len(str2)
print("len1="+str(len1))
print("len2=" + str(len2))
max_len = max(len1, len2)
print("max_len="+str(max_len))
for i in range(max_len):
if str1[i] != str2[i]:
difference += 1
return difference
def test_edit_distance_1():
print("->test_edit_distance_1: start")
result = edit_distance("kitten", "sitting")
expected = 3 # substitute the "k" for "s", substitute the "e" for "i", and append a "g"
print("result={}, expected={}".format(result, expected))
assert result == expected
print("->test_edit_distance_1: end\n")
def test():
test_edit_distance_1()
print("======================")
print("ALL TEST CASES FINISHED")
test() | """
TASK: Find the edit distance between two given strings.
The edit distance between two strings refers to the minimum number of character insertions,
deletions, and substitutions required to change one string to the other
"""
def edit_distance(str1: str, str2: str) -> int:
print('->edit_distance: str1={}, str2={}'.format(str1, str2))
difference = 0
if len(str1) > len(str2):
difference = len(str1) - len(str2)
str1 = str1[:difference]
print('updated str1=' + str1)
if len(str2) > len(str1):
difference = len(str2) - len(str1)
str2 = str2[:difference]
print('updated str2=' + str2)
len1 = len(str1)
len2 = len(str2)
print('len1=' + str(len1))
print('len2=' + str(len2))
max_len = max(len1, len2)
print('max_len=' + str(max_len))
for i in range(max_len):
if str1[i] != str2[i]:
difference += 1
return difference
def test_edit_distance_1():
print('->test_edit_distance_1: start')
result = edit_distance('kitten', 'sitting')
expected = 3
print('result={}, expected={}'.format(result, expected))
assert result == expected
print('->test_edit_distance_1: end\n')
def test():
test_edit_distance_1()
print('======================')
print('ALL TEST CASES FINISHED')
test() |
class UserTarget:
@staticmethod
def get_response():
return "Response by UserTarget"
| class Usertarget:
@staticmethod
def get_response():
return 'Response by UserTarget' |
class ATM:
def __init__(self, balance, bank_name):
self.balance = balance
self.bank_name = bank_name
self.withdrawals_list = []
def calcul(self,request):
self.withdrawals_list.append(request)
self.balance -= request
notes =[100,50,10,5]
for note in notes :
while request >= note :
request-=note
print("give ", str(note))
if request < 5:
print("give " + str(request))
request = 0
return self.balance
def withdraw(self, request):
print("the name of bank is :",self.bank_name)
print("the balance is",self.balance)
if request > self.balance:
print("Can't give you all this money !!")
elif request < 0:
print("More than zero plz!")
else:
self.calcul(request)
def show_withdrawals(self):
for withdrawal in self.withdrawals_list:
print(withdrawal)
balance1=500
balance2=1000
atm1=ATM(balance1,"smart_bank")
atm2=ATM(balance2,"baraka_bank")
atm1.withdraw(700)
atm1.withdraw(300)
print("the rest of balance for smart bank are",atm1.balance)
atm2.withdraw(500)
print("the rest of balance for baraka bank are",atm2.balance)
atm2.withdraw(257)
print("the rest of balance for baraka bank are",atm2.balance)
atm2.show_withdrawals()
| class Atm:
def __init__(self, balance, bank_name):
self.balance = balance
self.bank_name = bank_name
self.withdrawals_list = []
def calcul(self, request):
self.withdrawals_list.append(request)
self.balance -= request
notes = [100, 50, 10, 5]
for note in notes:
while request >= note:
request -= note
print('give ', str(note))
if request < 5:
print('give ' + str(request))
request = 0
return self.balance
def withdraw(self, request):
print('the name of bank is :', self.bank_name)
print('the balance is', self.balance)
if request > self.balance:
print("Can't give you all this money !!")
elif request < 0:
print('More than zero plz!')
else:
self.calcul(request)
def show_withdrawals(self):
for withdrawal in self.withdrawals_list:
print(withdrawal)
balance1 = 500
balance2 = 1000
atm1 = atm(balance1, 'smart_bank')
atm2 = atm(balance2, 'baraka_bank')
atm1.withdraw(700)
atm1.withdraw(300)
print('the rest of balance for smart bank are', atm1.balance)
atm2.withdraw(500)
print('the rest of balance for baraka bank are', atm2.balance)
atm2.withdraw(257)
print('the rest of balance for baraka bank are', atm2.balance)
atm2.show_withdrawals() |
#
# @lc app=leetcode id=53 lang=python3
#
# [53] Maximum Subarray
#
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
if all([x < 0 for x in nums]):
return max(nums)
running_sum = 0
ans = 0
for x in nums:
running_sum += x
if running_sum < 0:
running_sum = 0
continue
if ans < running_sum:
ans = running_sum
return ans
| class Solution:
def max_sub_array(self, nums: List[int]) -> int:
if all([x < 0 for x in nums]):
return max(nums)
running_sum = 0
ans = 0
for x in nums:
running_sum += x
if running_sum < 0:
running_sum = 0
continue
if ans < running_sum:
ans = running_sum
return ans |
#include inc/node.py
class Example(Node):
def __init__(self, selector):
self.dom_bind_to_node_by_selector(selector)
print(self._node)
self.dom_set_classes(['blue'])
# some raw js...
# RawJS("""/* foo */""")
| class Example(Node):
def __init__(self, selector):
self.dom_bind_to_node_by_selector(selector)
print(self._node)
self.dom_set_classes(['blue']) |
# flake8: NOQA: E501
# This proves that the given key (which is an account) exists on the trie rooted at this state
# root. It was obtained by querying geth via the LES protocol
state_root = b'Gu\xd8\x85\xf5/\x83:e\xf5\x9e0\x0b\xce\x86J\xcc\xe4.0\xc8#\xdaW\xb3\xbd\xd0).\x91\x17\xe8'
key = b'\x9b\xbf\xc3\x08Z\xd0\xd47\x84\xe6\xe4S4ndG|\xac\xa3\x0f^7\xd5nv\x14\x9e\x98\x84\xe7\xc2\x97'
proof = ([b'\x01\xb2\xcf/\xa7&\xef{\xec9c%\xed\xeb\x9b)\xe9n\xb5\xd5\x0e\x8c\xa9A\xc1:-{<2$)', b'\xa2\xbab\xe5J\x88\xa1\x8b\x90y\xa5yW\xd7G\x13\x16\xec\xb3\xb6\x87S9okV\xa3\rlC\xbfU', b'\xd6\x06\x92\x9e\x0b\xd310|\xbeV\x9d\xb4r\xdf0\xa5Q\xfb\xec\xb9I\x8c\x96r\x81\xeb\xefX7_l', b'\xa8\x88\xed@\x04\x7f\xa6\xbe&\x89&\x89T\t+\xac\xb8w\x8a\xebn\x16\x0c\xe1n\xb4?\xad\x14\xfdF\xff', b'\xc9\t\xd0\xaa\xb0:P\xdc\xea\xedX%\x04\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06rz\xe5m', b''], [b"\xb3\x03\xa9\xc11\x87mQ\xa1I2D4jg\xfe\xd0%k\xf2\r]\xb0\x0e\xeb'\x17\xedx\xc9Uj", b'L/\r$7-\xa5\xdf x\x9c\xbc\xc4\x99\x1e\xc5\xd8\xb5\xaf\xd1\xd1\xae\xe6L\xeco\xc4\xe2RUe\r', b'\xbeSp\xf5\xef\x02\xcd\x83\xb2\x0b\xa06\xfd\xca\xbb\xed_\xf2}\xf7\xea\xb3\x84\x17\xed\xcc\x19mF\x13(\xf3', b"\xfb$IYR\x9f\x04p\x01\x1d}\x88\x0b\xed'\x8e%\x9b\xc9\xeaN_\xab\xf9\xc9\x9d\xac\xa9\xb3\t\x1eq", b'\xaab\xeb\x14\xc2\xf6}%\xaa+0\xb5\xc1\x0f< \xc5ma\xb1c\xeb\xdd\xca\xc0\x90\xe2L\x8b\xe9\xfe/', b'\x91l\x9d\xa2\x84\xbf\xc1\x05\xe2S\x0e\xc9`\xc0^}Q!\xc4ml-\xec\xf4R$\xf6\x8a\xd3\xc6\xf1j', b'\xf3\x13\xde\xe0L\xdb\x96E`Q\xdf\xa1\x13\x01b5\xe4k\xde\xde\xbf\xb10\xaf\xe61Z\xdbZ\xd47\xf4', b'\t\x81\xb0\xea*\xec\xd0\xc3\x16\xee\xed~\xdc\x98e\x90\xf2~p\xbbSY\x19\xcfl\xc4)\x01\xc2\xd9\xc91', b'-\xda%\x8a\xc5jA-\xe5 lIp\xbe\xb3h\x98\x0f\x80q\xed\xab\x89KN\xdd\xa6\xcb;\x98\xb08', b'\x13\x97\x12f\xa31\xfa}\xf1\xfe\x19\xfa\x0b\xe6\x89\x9a\xcb\xf5\xed\xf3Q\x98O=\xa3\xb0e/\xd9\x9fy\x08', b'f\xba%\xfb\xbfE\x1d]\xb3\x05\xe4$\xa5\xd2G\xecc\xe5#\x0f,\x91\x8bN9a\x8a\xd1L\x16l\xa5', b'#p\x15\x8bU\x04\x88/K|4a\xfc\x0e.Zm^{\x15uk\x8d\xe4_\xfe\xee\xae\xb99\xd1\x8e', b'C \x9f\xb3y\xf3d.\x8b\t\x1cF\x9eL\x08\x07y\x08\xb9\xe1\xffM\x87\xfd\xd6\xfd\xdb\x8f\x94\x9e\x88\xc2', b'\x17X\x1f/\x8b\x82\xf5\xe4\x02\x84}\xbe\x9bz` \x94\'"_\x9c\xff\x06\t>\x8a\xd7oK\xf9\xf5w', b'6Q\x8db\xd8\\\x84_Rin\x18\x1f\x17\x89\x7f@\xd6\xbb%>\xafa\'\x80A\xa7\xd8}d\x07"', b'\xccgm\xf7\x05\xc8\xe4G\xf4\xb3\x18\xc7\\.\x0b\xa25]\xdc\x80w\xda\xc9;\xde\x9b\x03\xa0LS\xce\x8c', b''], [b'\xe4\xd3\x15\xe0\xaa\x0f\xf9\xd0\xa6\xc2\xc8B_\xaf"0\x8c\xea;\x91\xe4E\x04\xec\x901yZ\xd6>\xadc', b'wM\xce\x16JS:\xe96\x98\x12|\xa0\xc9~G\xbb\xc7u8\xc8\x93\x9b\x05\x92yh\xaa\xda\x94NK', b'\x89\xc7\xa2\xbd\xe1\xda\x06$|\xde\x03\xd9RS\x90\x84\xe7\x05\x0cc\xdfy\xb0\xfb@\x065\xdb8\xa9\xef\x1f', b'@\x11>\xe8\xb8\x19\xb7\xc7@\x92m$\x93 \x08\xc5\x15\xbd\x97\xb0;\xf5\x05q;\xb5\xc69\xd3E\xc4\x0e', b'\xd5_ol\x05o\x8e\xf0V\xd2\xa0n\xe7CxR\xc9\x92HTQhkc\x10K\xad\xfdU\xe9\x97\x8f', b'v\x7f\xc5KB\xdaYS\xa1\xbf \xda\xe2\x99\x84\xef,\x92\xdd\xc9\xb8\x9eo\xfcv(\x95\xff\x94t\xbc5', b"\xcbQ\x962!$\x1f\xdc\xdb\xfe\xef'\xc8\xc8O\xec\xa2\xae\xd3P\x88\xbf\xbd!\xea\x0e\xb0\x89\xe9\xdd\xf3w", b'H\xb8\x1b\xc3&\x86|!o\x003/\xc7K\xc9+,K\xe1y\xf2\x86\xa9*H\x05W\xcd\xf8\x8b\xb5\n', b'\x06\xc5\xa1\x83\xe4\xb4\xdc\xbf\xc0\x8c4Q\x93\x14W\xaf\xbb\xe9f\x82\xa2\x8d\xa3m\xda\xed\xc0W\x88UA\xd9', b'\x9czV\x7f$\xa8\xb9\xf3\xc1W0\x19\xac\xc5\xaap\x03?*\xe6\xd6\xee<\x0b\xafr\xf6ji\xd9\x87\xed', b'\xc7\x1d\xca\x95\xab~\xd3|\xa6\x9f\xba\x9e\xd5KxI\x95Y\xadx\xb8\xda\xa7!\xba\x93\xbbB,\x97n\xe4', b'\xd7"\x13\xca=\xa9|e\x11\x8f%\xb2^\x1b\xa6\xff\x93Z\x8b(\xca\xab\x12\xed\x8b3\x0f\xe0\xa7U\xa9\xe1', b'\xc2\xb4\x98\xb7\x08\x18#i7\x81\x85\xfd\xc3\xc6k\x12\x86\x99\xa55\x0c8\xd3\xbc\x9d\xc8\xe0\xd3\xcd=\xc6x', b'\xad\xf0\xea&\xf4\x8f=5\xe1\xb5b\xc1}\xba\xa1\n \xa4\xb7J2\x1f\xd7\xc9\x1d\xa4\xc2\xaf\xb7O\xb2\x12', b'\xd5~\x94\x99~Vy,4\xedMJ\x1a\xda3\xe7\x90\x91\xd4\xafw\xba\xbf\x89`\x0e\x99s\x93E\xdf%', b'\x82\xd2O\x16\xca{\x15\x87\xef-\x8a\xea\xb9\xcd\xfc\x82\x84\x99\xdco\xc1\x1eg\xf3-\x07\xf8\xa3\xed\xffx\x85', b''], [b"\xc5\xa5\xd38zu\xfc\xe9\xe2j\x97\xf0\x81T$\xee5\x94AC\xb1\x85\x0c\xef\x10\xcb`Z\xfcT'\xcb", b'ZU\xe4?lj\x05\xf8\xbc\xa7\xf1\xe4\xdb\x08M\x06\xad\xbf\xb3s\xfa\xcaS\xb9{U\xd2n\x981+|', b'l\x0cL\xfb\\(g\xb47\xc2<\xcb\x14\xf3\xa9l\x01#\xdb"|\xdc\xfd\xa0#\xa2\x89\xcfx\x97\xb4\x8e', b'\x0b\xe7$\x1d\xa2\x1c\\\xa5)t\xd6\x82\xec\xed\x02]\xdd\xefz\xa3C`\x1b\xda\x81\t\xb3\x14\xdf5\xbb\xcb', b'\xe7%b2\xd4\xc6\x98\x90\xd8:B\xa4\x9e\n\xc6\xa1\x01\xac\x94\xbdr\xca\xdd\x8a\xa8\xe8\xc6F\xed\x04\xe9\x14', b'\xa7\xac\xc0S\xcbo\x98\xebJ)\xb1\x8b{\xda,\x98\xf2M\xca,\xcd\xc4%\x94\xe4\xdc<\xf5o}\x90\x1d', b'[\xd9}F\xe2\n\x84\xbc\xa0\x81\x0f\xb9\x0b]\x0c\x10%\x9d\r\x00RZgbV*2b\xd1z\xb5\xd3', b'\xac\xcag\xdb\xc3y\x91\x82\xddu\xad\x85%g\x82\xa0\r\xf4\x99^=\x14h\xee\xac\x81/o\xe6\xe4\xec\x0c', b'8\xeb\xed\x80}2\xd9.\x0e\xeb\x92\xa7\xae\xeb\x8d\x9b>8<\x9d\xc4\x05\xf2W;F\xce!\t\x15\xb2\xe3', b'*\xed\xbfJ\x80\x9f7\xd1\xcd\xeft\x89.e\x02M\r\x85D-\x9bL\x8d\xac*3h\xf3\x9f\xde\xe0F', b'd\xf9\xdf\xfb\xfa`\x97:\x11\xc4\x89u_\xe9&\xd0LX;r\x12\x86\\,}\x7f:\xbc\xf9\x9a\xd2\xe9', b'\x94\x80\xd4\xb8\xe4\xa6\xd4\x9cS\xcc\xc7*xo]2y~\xd6\x18a\xfb\xafP\x19\x87\xe7:\xb1r\x96\xdc', b'\x1c\xdar\xc1\x18\x1f\x0b\xf3\xe2\xf0\xf1<\x05\x88\xa4\x01J,\xc2\xa1\xbd`L\x8b\x95\xa6\xbdze4&\xc1', b'>0\x01SdF=\x8c\xa7\x1d4\x1elOt\xcd;,|\xf0l\xe9O\x83\xf3\xc0rm\xb6\x82\xaa\x08', b'\xd0\xef\x12\xc5<\\\x00\x82$\x98\x8d\xb6\xa7l\xd6w\xa3\x00<D\x15\xf7\xd6\xc9\xd0\xfb\xd3\x9f\xed,\x9e\xf7', b'\xa6->\xb1\x80jz\xc3\x8a,5\xb8\xf8\xbf\xb4^\x880\x824A\xfa\xbf\x0e\x1f\x9b /\x02\xadhx', b''], [b"\xc1\x17\xa1{\x135'>\xce\x8a\xe8;\x84V\x8c\xfer\xdaZS\xc7v\xd7\x18\xfb\xe3\xbf\xff\x92\x87@D", b'\x06\xb9c\xad\x8d2\xc0WU\xaf"w\xe5>\x1a\xfd\x02\xf1\xdd\x91$h/\x02)\xc6\xd3\xbc\x17\xc42\xe8', b'\xc4\xa2\xb3*k\xa8\xc8\x124\x86\xa0\x9b\xad\xfa\xb9$5?\xc6\x0c]\x98Kb\xd13\xdb:\x85\xed\xe1[', b'%\xa4>aM\x08\xbet\x1b\xc8\xb5\xf2c.9o!\x03G\x99_\n\xef\x93OA^\xabC\x91\xce\x97', b'\xc9T\xc1\xf6\xc8\xbe\xd8h\x86\xfey\x82Evg\xe1zP\x9ct\x98(\x01\xf5\xfc\xf8\xbe\xf6\x1d\xc0\x15\x8e', b'\xd3\xf1\xe6T\xd7"\xba\xdeipC\xe5\xe1\x04\x0e?o\x84\xcb\x1aE\x18\xd0\xa36\x0eC\xc7D>\x12 ', b'\xe0\x06\x0c\xaf\xec\xe3op*j\xcd\x84\xef\x9b\x82a{,\x1c\x98\xba-\x10\xf9\x7f+\xb6\x8a/q,\xeb', b"\x8a'\xeb\x1a\xe8i\x91S\xf3;\xa8[f-\xb02\x01?\xac\xe4Ds\xd8E\xa0\x87\x8a\xec]\x9b?\x9e", b'\xcf\x0cM\xbd\x92\xbbaS\x9d\xd0:\x7f\xfe\xd5\x08\xac\xe4\xb5\x81ga\xc2>\\\x89\x95\x08\xd6C\xf9\xe6\xb7', b'\x9bh\xd3\xb0x\xf0\xfa5\xa6vV\x96_\x16\x9dx\x95B2\xa9\xcem\xc8\xb9\xaf\xb9\xff\n\xae\xc7\x14\x13', b'H\x03\x82\xd6\xbd\x00Z\r\xa03YQ\xa4\xfa\xcdl\xea8g{L\x16\x18\xca\xdb\xb75~\xff\x1b]&', b'A?l1\xbf\x04\xc3Qs\x9b\x08c\xc3|\xf5D6\xa2\x82\xf8\xd3\xf4@\xab\xa0oDx\xc4\xffY*', b'\x0c\xd7U\x880\xa0\xd3\xad\xdd\xda\xdb\x01\xac\x99ya:\xeb\xab8K%\xaf\xc4\xf1G\xd3*\xb7\xae\x01*', b'\xb8s\xab\x0e\xf4\x90\xdb\xce\x0b)l\xb3\x7f\xf1p\xc6&\x0eh\xfb\xc8\xd7\x88`\xcd\xdc\x97-l\xb6L\x82', b'x\xf2\x15\x85\xe9\x01\xd8\xdc\xc5\xbc\xb7\xda\xcd$\xf0\xae\xc9\x01\xcdHZ\xb8)\x97\x11\xff\xcc7\xa5\x98\xb4\xb6', b'\xf3\xb6\xdd\xe9\xb1\x93\x08A\xda\xa39\xfe$\x8dO\n$ Mn"-\'\xa5$F5\xae\xcd>\xa2\x0c', b''], [b'\x82\x8b\x9d\x85\x0b/\x83\xacmb\x07\x89h\xa5\x86R\x8e\xf4\xd9_\x00\t\xeb\xb3>\\@\x11\xecOp\x7f', b'', b'', b'"\xee\xd9\x89<\xc3_\xca\xe9\xed\xc2v\r,\x9e\x10\x1c\x07\xe8E\xbd\x10\x9a\x16_:hk\xb9Om\xf2', b'', b'', b'\x11]i\xb3t6\xabKF\xc0\xa9\x81z&\xdf\x02\xcaRQ\x82\x92\xac\xf1\xf9~\x94\x94tM9\xbe\x1a', b'\xd0dY\xbc\xbe\xe5\xa8\x93\xc8e\xbd\x15\xf8\xb6b\x9a+\xbeh\xeb\x9d\x85\x1f(\xee\xd5\xb2 \xf2\xea\xa1\xf2', b'', b'`\xa8\xcd0:I\xdd\xd7\xa1\xc9W\r\x00\xa6\x1b\x0cM\xbb8\xb0Z\x8b\xe2\x87\x16\x0f\x99U\xf7\xdf\xc4U', b'', b'\xbcR\x17x\x12Y\xf1r\xb9c\xf5\x17#\xcd\xdb\xd5\x1c0\xd2\xda~\x99a\x96\xd5k\xef\x94\x0f\xd0$\xcb', b'!\x16\xaee\xb5H7X\xd5\tA\xb5{\x98\x8f\x12\x0bX\x85K\x184\x04\xcf\x80\x17\xf81V\xbc\xed\x9c', b'\x00\x08C^\xb5\xcfb\xb3\x13\xf0\x95S\x8eyQ\xe8\xdf\x9bI\xfe\xa2\x9c\x91@_\x16\x9d\x82w,u\x86', b'6&\x99Z\xae\xe6r\xab\xec\xb3X\x87\\\x02\x99>\xfa\xebP:\xd5\xd2t\xe2p\xc7\xe2\xe0\x0e\x95\xf9D', b'\xcf\x7f\x99\x9a\x1c\x18\xa6\x9av\xe6\xa2\xd5\xb3E\x8aJ\x18\xa7\x8c\xc0\x07\xda\xe9\x0bi\r\t\x0f\x9b\x06\xf8S', b''], [b'\x07\x83C\xd1X\xdf\xddJ\xd4\xf2\x7f3+\n\x95\xb2\x89\xd2"\x9d\xc5S\xfb\xfc\x9ed\x8d\xd2\xd2\xe5\x99B', b'', b'', b'', b'', b'-m2\x00\xef\x95\xcd\xfe\xf8\x9e\x0b\xbf\xae\xd8\xb4\xd2\xa1*\xfde\xaa\xb1\x8a\xdd\x1d\x07\x03\xc7,<\xe8\xe7', b'', b'', b'', b'', b'', b'', b'', b'', b'', b'', b''], [b'8Z\xd0\xd47\x84\xe6\xe4S4ndG|\xac\xa3\x0f^7\xd5nv\x14\x9e\x98\x84\xe7\xc2\x97', b'\xf8D\x01\x80\xa0U\xbd\x1daQ\x97{bg,!\xc2uK\xbe\xeb;\x82x\xb2\xe0\xc3\x8e\xdc\xd9I\x84n\xe3b\x8b\xf1\xa0\x1e\x0b*\xd9p\xb3e\xa2\x17\xc4\x0b\xcf5\x82\xcb\xb4\xfc\xc1d-z]\xd7\xa8*\xe1\xe2x\xe0\x10\x12>'])
| state_root = b'Gu\xd8\x85\xf5/\x83:e\xf5\x9e0\x0b\xce\x86J\xcc\xe4.0\xc8#\xdaW\xb3\xbd\xd0).\x91\x17\xe8'
key = b'\x9b\xbf\xc3\x08Z\xd0\xd47\x84\xe6\xe4S4ndG|\xac\xa3\x0f^7\xd5nv\x14\x9e\x98\x84\xe7\xc2\x97'
proof = ([b'\x01\xb2\xcf/\xa7&\xef{\xec9c%\xed\xeb\x9b)\xe9n\xb5\xd5\x0e\x8c\xa9A\xc1:-{<2$)', b'\xa2\xbab\xe5J\x88\xa1\x8b\x90y\xa5yW\xd7G\x13\x16\xec\xb3\xb6\x87S9okV\xa3\rlC\xbfU', b'\xd6\x06\x92\x9e\x0b\xd310|\xbeV\x9d\xb4r\xdf0\xa5Q\xfb\xec\xb9I\x8c\x96r\x81\xeb\xefX7_l', b'\xa8\x88\xed@\x04\x7f\xa6\xbe&\x89&\x89T\t+\xac\xb8w\x8a\xebn\x16\x0c\xe1n\xb4?\xad\x14\xfdF\xff', b'\xc9\t\xd0\xaa\xb0:P\xdc\xea\xedX%\x04\x9a\xbe\x1f\x16\x0cf\xbc\x04P#@\xfd\xd60\xad\xecK\x8b\x08', b'x\xff\xb2\x9ajO\xbc\x1bjR\x80$I\xe6\x95\xf6Tow\x82\xf9\x01\xa8V\xa9\xaa4\xa6`\x88\xf9\x10', b'I\x1cQc\x8a\xeda\xf8\xd1D\x01GT)\xc9\x02O\xef\x8d\xcc\\\xf9\xe6}\x8a~\xcc\x98~\xd5\xd6\xb6', b"U'\xa2\xa0 \xe4\xb1\xb6\xc3\xcd4C_\x9c]\xb3P\xa8w\xef\x8c\xde\xc2\x02^v\xcd\x12\xed%\x89\xa5", b'(\xa6x\xfa\xbe\xc3\x9a\xae\xaa\xe9\xbcv#u\\\xdfo\x14\x9a3\xbc\x89c\xc1\xfe\xdf[{|\x02P\x03', b'\xcf5\x07\x8f3\xa9\x1f\x19Q\xbb\x11\x8a\xb0\x97\xbe\x93\xb2\xd5~\xe2\xe06\x07\xc37\x08vg\x80 BD', b'U\x8e/\x95&\n\xc5\xf1\xd4\xc3\xb9\xa84Rd\xaa\x80\xfe8\xf1\xcf G\xcc\xe3\x99\x01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`Q\xdf\xa1\x13\x01b5\xe4k\xde\xde\xbf\xb10\xaf\xe61Z\xdbZ\xd47\xf4', b'\t\x81\xb0\xea*\xec\xd0\xc3\x16\xee\xed~\xdc\x98e\x90\xf2~p\xbbSY\x19\xcfl\xc4)\x01\xc2\xd9\xc91', b'-\xda%\x8a\xc5jA-\xe5 lIp\xbe\xb3h\x98\x0f\x80q\xed\xab\x89KN\xdd\xa6\xcb;\x98\xb08', b'\x13\x97\x12f\xa31\xfa}\xf1\xfe\x19\xfa\x0b\xe6\x89\x9a\xcb\xf5\xed\xf3Q\x98O=\xa3\xb0e/\xd9\x9fy\x08', b'f\xba%\xfb\xbfE\x1d]\xb3\x05\xe4$\xa5\xd2G\xecc\xe5#\x0f,\x91\x8bN9a\x8a\xd1L\x16l\xa5', b'#p\x15\x8bU\x04\x88/K|4a\xfc\x0e.Zm^{\x15uk\x8d\xe4_\xfe\xee\xae\xb99\xd1\x8e', b'C \x9f\xb3y\xf3d.\x8b\t\x1cF\x9eL\x08\x07y\x08\xb9\xe1\xffM\x87\xfd\xd6\xfd\xdb\x8f\x94\x9e\x88\xc2', b'\x17X\x1f/\x8b\x82\xf5\xe4\x02\x84}\xbe\x9bz` \x94\'"_\x9c\xff\x06\t>\x8a\xd7oK\xf9\xf5w', b'6Q\x8db\xd8\\\x84_Rin\x18\x1f\x17\x89\x7f@\xd6\xbb%>\xafa\'\x80A\xa7\xd8}d\x07"', b'\xccgm\xf7\x05\xc8\xe4G\xf4\xb3\x18\xc7\\.\x0b\xa25]\xdc\x80w\xda\xc9;\xde\x9b\x03\xa0LS\xce\x8c', b''], [b'\xe4\xd3\x15\xe0\xaa\x0f\xf9\xd0\xa6\xc2\xc8B_\xaf"0\x8c\xea;\x91\xe4E\x04\xec\x901yZ\xd6>\xadc', b'wM\xce\x16JS:\xe96\x98\x12|\xa0\xc9~G\xbb\xc7u8\xc8\x93\x9b\x05\x92yh\xaa\xda\x94NK', b'\x89\xc7\xa2\xbd\xe1\xda\x06$|\xde\x03\xd9RS\x90\x84\xe7\x05\x0cc\xdfy\xb0\xfb@\x065\xdb8\xa9\xef\x1f', b'@\x11>\xe8\xb8\x19\xb7\xc7@\x92m$\x93 \x08\xc5\x15\xbd\x97\xb0;\xf5\x05q;\xb5\xc69\xd3E\xc4\x0e', b'\xd5_ol\x05o\x8e\xf0V\xd2\xa0n\xe7CxR\xc9\x92HTQhkc\x10K\xad\xfdU\xe9\x97\x8f', b'v\x7f\xc5KB\xdaYS\xa1\xbf \xda\xe2\x99\x84\xef,\x92\xdd\xc9\xb8\x9eo\xfcv(\x95\xff\x94t\xbc5', b"\xcbQ\x962!$\x1f\xdc\xdb\xfe\xef'\xc8\xc8O\xec\xa2\xae\xd3P\x88\xbf\xbd!\xea\x0e\xb0\x89\xe9\xdd\xf3w", b'H\xb8\x1b\xc3&\x86|!o\x003/\xc7K\xc9+,K\xe1y\xf2\x86\xa9*H\x05W\xcd\xf8\x8b\xb5\n', b'\x06\xc5\xa1\x83\xe4\xb4\xdc\xbf\xc0\x8c4Q\x93\x14W\xaf\xbb\xe9f\x82\xa2\x8d\xa3m\xda\xed\xc0W\x88UA\xd9', b'\x9czV\x7f$\xa8\xb9\xf3\xc1W0\x19\xac\xc5\xaap\x03?*\xe6\xd6\xee<\x0b\xafr\xf6ji\xd9\x87\xed', b'\xc7\x1d\xca\x95\xab~\xd3|\xa6\x9f\xba\x9e\xd5KxI\x95Y\xadx\xb8\xda\xa7!\xba\x93\xbbB,\x97n\xe4', b'\xd7"\x13\xca=\xa9|e\x11\x8f%\xb2^\x1b\xa6\xff\x93Z\x8b(\xca\xab\x12\xed\x8b3\x0f\xe0\xa7U\xa9\xe1', b'\xc2\xb4\x98\xb7\x08\x18#i7\x81\x85\xfd\xc3\xc6k\x12\x86\x99\xa55\x0c8\xd3\xbc\x9d\xc8\xe0\xd3\xcd=\xc6x', b'\xad\xf0\xea&\xf4\x8f=5\xe1\xb5b\xc1}\xba\xa1\n \xa4\xb7J2\x1f\xd7\xc9\x1d\xa4\xc2\xaf\xb7O\xb2\x12', b'\xd5~\x94\x99~Vy,4\xedMJ\x1a\xda3\xe7\x90\x91\xd4\xafw\xba\xbf\x89`\x0e\x99s\x93E\xdf%', b'\x82\xd2O\x16\xca{\x15\x87\xef-\x8a\xea\xb9\xcd\xfc\x82\x84\x99\xdco\xc1\x1eg\xf3-\x07\xf8\xa3\xed\xffx\x85', b''], [b"\xc5\xa5\xd38zu\xfc\xe9\xe2j\x97\xf0\x81T$\xee5\x94AC\xb1\x85\x0c\xef\x10\xcb`Z\xfcT'\xcb", b'ZU\xe4?lj\x05\xf8\xbc\xa7\xf1\xe4\xdb\x08M\x06\xad\xbf\xb3s\xfa\xcaS\xb9{U\xd2n\x981+|', b'l\x0cL\xfb\\(g\xb47\xc2<\xcb\x14\xf3\xa9l\x01#\xdb"|\xdc\xfd\xa0#\xa2\x89\xcfx\x97\xb4\x8e', b'\x0b\xe7$\x1d\xa2\x1c\\\xa5)t\xd6\x82\xec\xed\x02]\xdd\xefz\xa3C`\x1b\xda\x81\t\xb3\x14\xdf5\xbb\xcb', b'\xe7%b2\xd4\xc6\x98\x90\xd8:B\xa4\x9e\n\xc6\xa1\x01\xac\x94\xbdr\xca\xdd\x8a\xa8\xe8\xc6F\xed\x04\xe9\x14', b'\xa7\xac\xc0S\xcbo\x98\xebJ)\xb1\x8b{\xda,\x98\xf2M\xca,\xcd\xc4%\x94\xe4\xdc<\xf5o}\x90\x1d', b'[\xd9}F\xe2\n\x84\xbc\xa0\x81\x0f\xb9\x0b]\x0c\x10%\x9d\r\x00RZgbV*2b\xd1z\xb5\xd3', b'\xac\xcag\xdb\xc3y\x91\x82\xddu\xad\x85%g\x82\xa0\r\xf4\x99^=\x14h\xee\xac\x81/o\xe6\xe4\xec\x0c', b'8\xeb\xed\x80}2\xd9.\x0e\xeb\x92\xa7\xae\xeb\x8d\x9b>8<\x9d\xc4\x05\xf2W;F\xce!\t\x15\xb2\xe3', b'*\xed\xbfJ\x80\x9f7\xd1\xcd\xeft\x89.e\x02M\r\x85D-\x9bL\x8d\xac*3h\xf3\x9f\xde\xe0F', b'd\xf9\xdf\xfb\xfa`\x97:\x11\xc4\x89u_\xe9&\xd0LX;r\x12\x86\\,}\x7f:\xbc\xf9\x9a\xd2\xe9', b'\x94\x80\xd4\xb8\xe4\xa6\xd4\x9cS\xcc\xc7*xo]2y~\xd6\x18a\xfb\xafP\x19\x87\xe7:\xb1r\x96\xdc', b'\x1c\xdar\xc1\x18\x1f\x0b\xf3\xe2\xf0\xf1<\x05\x88\xa4\x01J,\xc2\xa1\xbd`L\x8b\x95\xa6\xbdze4&\xc1', b'>0\x01SdF=\x8c\xa7\x1d4\x1elOt\xcd;,|\xf0l\xe9O\x83\xf3\xc0rm\xb6\x82\xaa\x08', b'\xd0\xef\x12\xc5<\\\x00\x82$\x98\x8d\xb6\xa7l\xd6w\xa3\x00<D\x15\xf7\xd6\xc9\xd0\xfb\xd3\x9f\xed,\x9e\xf7', b'\xa6->\xb1\x80jz\xc3\x8a,5\xb8\xf8\xbf\xb4^\x880\x824A\xfa\xbf\x0e\x1f\x9b /\x02\xadhx', b''], [b"\xc1\x17\xa1{\x135'>\xce\x8a\xe8;\x84V\x8c\xfer\xdaZS\xc7v\xd7\x18\xfb\xe3\xbf\xff\x92\x87@D", b'\x06\xb9c\xad\x8d2\xc0WU\xaf"w\xe5>\x1a\xfd\x02\xf1\xdd\x91$h/\x02)\xc6\xd3\xbc\x17\xc42\xe8', b'\xc4\xa2\xb3*k\xa8\xc8\x124\x86\xa0\x9b\xad\xfa\xb9$5?\xc6\x0c]\x98Kb\xd13\xdb:\x85\xed\xe1[', b'%\xa4>aM\x08\xbet\x1b\xc8\xb5\xf2c.9o!\x03G\x99_\n\xef\x93OA^\xabC\x91\xce\x97', b'\xc9T\xc1\xf6\xc8\xbe\xd8h\x86\xfey\x82Evg\xe1zP\x9ct\x98(\x01\xf5\xfc\xf8\xbe\xf6\x1d\xc0\x15\x8e', b'\xd3\xf1\xe6T\xd7"\xba\xdeipC\xe5\xe1\x04\x0e?o\x84\xcb\x1aE\x18\xd0\xa36\x0eC\xc7D>\x12 ', b'\xe0\x06\x0c\xaf\xec\xe3op*j\xcd\x84\xef\x9b\x82a{,\x1c\x98\xba-\x10\xf9\x7f+\xb6\x8a/q,\xeb', b"\x8a'\xeb\x1a\xe8i\x91S\xf3;\xa8[f-\xb02\x01?\xac\xe4Ds\xd8E\xa0\x87\x8a\xec]\x9b?\x9e", b'\xcf\x0cM\xbd\x92\xbbaS\x9d\xd0:\x7f\xfe\xd5\x08\xac\xe4\xb5\x81ga\xc2>\\\x89\x95\x08\xd6C\xf9\xe6\xb7', b'\x9bh\xd3\xb0x\xf0\xfa5\xa6vV\x96_\x16\x9dx\x95B2\xa9\xcem\xc8\xb9\xaf\xb9\xff\n\xae\xc7\x14\x13', b'H\x03\x82\xd6\xbd\x00Z\r\xa03YQ\xa4\xfa\xcdl\xea8g{L\x16\x18\xca\xdb\xb75~\xff\x1b]&', b'A?l1\xbf\x04\xc3Qs\x9b\x08c\xc3|\xf5D6\xa2\x82\xf8\xd3\xf4@\xab\xa0oDx\xc4\xffY*', b'\x0c\xd7U\x880\xa0\xd3\xad\xdd\xda\xdb\x01\xac\x99ya:\xeb\xab8K%\xaf\xc4\xf1G\xd3*\xb7\xae\x01*', b'\xb8s\xab\x0e\xf4\x90\xdb\xce\x0b)l\xb3\x7f\xf1p\xc6&\x0eh\xfb\xc8\xd7\x88`\xcd\xdc\x97-l\xb6L\x82', b'x\xf2\x15\x85\xe9\x01\xd8\xdc\xc5\xbc\xb7\xda\xcd$\xf0\xae\xc9\x01\xcdHZ\xb8)\x97\x11\xff\xcc7\xa5\x98\xb4\xb6', b'\xf3\xb6\xdd\xe9\xb1\x93\x08A\xda\xa39\xfe$\x8dO\n$ Mn"-\'\xa5$F5\xae\xcd>\xa2\x0c', b''], [b'\x82\x8b\x9d\x85\x0b/\x83\xacmb\x07\x89h\xa5\x86R\x8e\xf4\xd9_\x00\t\xeb\xb3>\\@\x11\xecOp\x7f', b'', b'', b'"\xee\xd9\x89<\xc3_\xca\xe9\xed\xc2v\r,\x9e\x10\x1c\x07\xe8E\xbd\x10\x9a\x16_:hk\xb9Om\xf2', b'', b'', b'\x11]i\xb3t6\xabKF\xc0\xa9\x81z&\xdf\x02\xcaRQ\x82\x92\xac\xf1\xf9~\x94\x94tM9\xbe\x1a', b'\xd0dY\xbc\xbe\xe5\xa8\x93\xc8e\xbd\x15\xf8\xb6b\x9a+\xbeh\xeb\x9d\x85\x1f(\xee\xd5\xb2 \xf2\xea\xa1\xf2', b'', b'`\xa8\xcd0:I\xdd\xd7\xa1\xc9W\r\x00\xa6\x1b\x0cM\xbb8\xb0Z\x8b\xe2\x87\x16\x0f\x99U\xf7\xdf\xc4U', b'', b'\xbcR\x17x\x12Y\xf1r\xb9c\xf5\x17#\xcd\xdb\xd5\x1c0\xd2\xda~\x99a\x96\xd5k\xef\x94\x0f\xd0$\xcb', b'!\x16\xaee\xb5H7X\xd5\tA\xb5{\x98\x8f\x12\x0bX\x85K\x184\x04\xcf\x80\x17\xf81V\xbc\xed\x9c', b'\x00\x08C^\xb5\xcfb\xb3\x13\xf0\x95S\x8eyQ\xe8\xdf\x9bI\xfe\xa2\x9c\x91@_\x16\x9d\x82w,u\x86', b'6&\x99Z\xae\xe6r\xab\xec\xb3X\x87\\\x02\x99>\xfa\xebP:\xd5\xd2t\xe2p\xc7\xe2\xe0\x0e\x95\xf9D', b'\xcf\x7f\x99\x9a\x1c\x18\xa6\x9av\xe6\xa2\xd5\xb3E\x8aJ\x18\xa7\x8c\xc0\x07\xda\xe9\x0bi\r\t\x0f\x9b\x06\xf8S', b''], [b'\x07\x83C\xd1X\xdf\xddJ\xd4\xf2\x7f3+\n\x95\xb2\x89\xd2"\x9d\xc5S\xfb\xfc\x9ed\x8d\xd2\xd2\xe5\x99B', b'', b'', b'', b'', b'-m2\x00\xef\x95\xcd\xfe\xf8\x9e\x0b\xbf\xae\xd8\xb4\xd2\xa1*\xfde\xaa\xb1\x8a\xdd\x1d\x07\x03\xc7,<\xe8\xe7', b'', b'', b'', b'', b'', b'', b'', b'', b'', b'', b''], [b'8Z\xd0\xd47\x84\xe6\xe4S4ndG|\xac\xa3\x0f^7\xd5nv\x14\x9e\x98\x84\xe7\xc2\x97', b'\xf8D\x01\x80\xa0U\xbd\x1daQ\x97{bg,!\xc2uK\xbe\xeb;\x82x\xb2\xe0\xc3\x8e\xdc\xd9I\x84n\xe3b\x8b\xf1\xa0\x1e\x0b*\xd9p\xb3e\xa2\x17\xc4\x0b\xcf5\x82\xcb\xb4\xfc\xc1d-z]\xd7\xa8*\xe1\xe2x\xe0\x10\x12>']) |
#!/usr/bin/python
#
# This file is part of PyRQA.
# Copyright 2015 Tobias Rawald, Mike Sips.
"""
Custom exceptions.
"""
class UnsupportedNeighbourhoodException(Exception):
""" Neighbourhood chosen is not supported. """
def __init__(self, message):
super(UnsupportedNeighbourhoodException, self).__init__(message)
class NoOpenCLPlatformDetectedException(Exception):
""" No OpenCL platform could be detected. """
def __init__(self, message):
super(NoOpenCLPlatformDetectedException, self).__init__(message)
class NoOpenCLDeviceDetectedException(Exception):
""" No OpenCL device could be detected. """
def __init__(self, message):
super(NoOpenCLDeviceDetectedException, self).__init__(message)
class OpenCLPlatformIndexOutOfBoundsException(Exception):
""" OpenCL Platform index is out of bounds. """
def __init__(self, message):
super(OpenCLPlatformIndexOutOfBoundsException, self).__init__(message)
class OpenCLDeviceIndexOutOfBoundsException(Exception):
""" OpenCL Device index is out of bounds. """
def __init__(self, message):
super(OpenCLDeviceIndexOutOfBoundsException, self).__init__(message)
class NoOpenCLKernelsFoundException(Exception):
""" No OpenCL kernels have been found. """
def __init__(self, message):
super(NoOpenCLKernelsFoundException, self).__init__(message)
| """
Custom exceptions.
"""
class Unsupportedneighbourhoodexception(Exception):
""" Neighbourhood chosen is not supported. """
def __init__(self, message):
super(UnsupportedNeighbourhoodException, self).__init__(message)
class Noopenclplatformdetectedexception(Exception):
""" No OpenCL platform could be detected. """
def __init__(self, message):
super(NoOpenCLPlatformDetectedException, self).__init__(message)
class Noopencldevicedetectedexception(Exception):
""" No OpenCL device could be detected. """
def __init__(self, message):
super(NoOpenCLDeviceDetectedException, self).__init__(message)
class Openclplatformindexoutofboundsexception(Exception):
""" OpenCL Platform index is out of bounds. """
def __init__(self, message):
super(OpenCLPlatformIndexOutOfBoundsException, self).__init__(message)
class Opencldeviceindexoutofboundsexception(Exception):
""" OpenCL Device index is out of bounds. """
def __init__(self, message):
super(OpenCLDeviceIndexOutOfBoundsException, self).__init__(message)
class Noopenclkernelsfoundexception(Exception):
""" No OpenCL kernels have been found. """
def __init__(self, message):
super(NoOpenCLKernelsFoundException, self).__init__(message) |
# Minizip library
unz = StaticLibrary( 'unz', sources = ['ioapi.c', 'mztools.c', 'unzip.c', 'zip.c'] )
# minizip
minizip = Executable( 'minizip', libs = [ unz, 'z' ], sources = ['minizip.c'] )
# miniunz
miniunz = Executable( 'miniunz', libs = [ unz, 'z' ], sources = ['miniunz.c'] )
# Platform specific settings
if platform == 'MacOS':
project.define( 'unix' )
elif platform == 'iOS':
project.define( 'unix' )
elif platform == 'Windows':
unz.files( 'iowin32.c' ) | unz = static_library('unz', sources=['ioapi.c', 'mztools.c', 'unzip.c', 'zip.c'])
minizip = executable('minizip', libs=[unz, 'z'], sources=['minizip.c'])
miniunz = executable('miniunz', libs=[unz, 'z'], sources=['miniunz.c'])
if platform == 'MacOS':
project.define('unix')
elif platform == 'iOS':
project.define('unix')
elif platform == 'Windows':
unz.files('iowin32.c') |
_base_ = [
'./coco_resize.py'
]
data = dict(
train=dict(classes=('person',)),
val=dict(classes=('person',)),
test=dict(classes=('person',))
)
| _base_ = ['./coco_resize.py']
data = dict(train=dict(classes=('person',)), val=dict(classes=('person',)), test=dict(classes=('person',))) |
class DFS:
def __init__(self):
self.visited_node_counter = 0
def visitor(self):
self.visited_node_counter += 1
def visit(self, node):
node.accept_visitor(self.visitor)
for child in node.children: self.visit(child)
class Node:
def __init__(self):
self.children = []
def add_child(self, node):
self.children.append(node)
def accept_visitor(self, visitor):
visitor()
root = Node()
for i in xrange(0, firstLevelNodes):
root.add_child(Node())
for child in root.children:
for i in xrange(0, secondLevelNodes): child.add_child(Node())
dfs = DFS()
dfs.visit(root)
result = dfs.visited_node_counter
| class Dfs:
def __init__(self):
self.visited_node_counter = 0
def visitor(self):
self.visited_node_counter += 1
def visit(self, node):
node.accept_visitor(self.visitor)
for child in node.children:
self.visit(child)
class Node:
def __init__(self):
self.children = []
def add_child(self, node):
self.children.append(node)
def accept_visitor(self, visitor):
visitor()
root = node()
for i in xrange(0, firstLevelNodes):
root.add_child(node())
for child in root.children:
for i in xrange(0, secondLevelNodes):
child.add_child(node())
dfs = dfs()
dfs.visit(root)
result = dfs.visited_node_counter |
n=int(input())
l=[1 for i in range(n)]
for i in range(1,n):
for x in range(n):
if x==0:
continue
else:
l[x]=l[x]+l[x-1]
print(l[-1])
| n = int(input())
l = [1 for i in range(n)]
for i in range(1, n):
for x in range(n):
if x == 0:
continue
else:
l[x] = l[x] + l[x - 1]
print(l[-1]) |
android = 70 # percents of people using nova poshta on android
ios = 30 # percents of people using nova poshta on ios
people_count = 5000000
ios_people = people_count/ 100 * ios
print (ios_people, " people using nova poshta on ios.") | android = 70
ios = 30
people_count = 5000000
ios_people = people_count / 100 * ios
print(ios_people, ' people using nova poshta on ios.') |
class Profile:
'''
Example
my = Profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading','Sleeping','Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_hobby()
'''
def __init__(self,name):
self.name = name
self.company = ''
self.hobby = []
self.art = '''
|\ _,,,---,,_
ZZZzz /,`.-'`' -. ;-;;,_
|,4- ) )-,_. ,\ ( `'-'
'---''(_/--' `-'\_)
CAT'''
self.art2 = '''
~~~~
~~
_||____
/\ /\ /\ /\\\\\\\\
//\\/\\/\\ __ /__\\\\\\\\ _,
//\\/\\/\\ __/ \_ |__|_|_|__| \__,
|| || || '-o---o-' | |/|\| /| /\ \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
def show_email(self):
if self.company != '':
print('{}@{}.com'.format(self.name.lower(),self.company))
else:
print('{}@gmail.com'.format(self.name.lower()))
def show_myart(self):
print(self.art)
def show_myart2(self):
print(self.art2)
def show_hobby(self):
if len(self.hobby) != 0:
print('------my hobby-------')
for i,h in enumerate(self.hobby,start = 1):
print(i,h)
print('---------------------')
else:
print('No hobby')
if __name__ == '__main__':
my = Profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading','Sleeping','Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_myart2()
my.show_hobby()
#help(my)
| class Profile:
"""
Example
my = Profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading','Sleeping','Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_hobby()
"""
def __init__(self, name):
self.name = name
self.company = ''
self.hobby = []
self.art = "\n\t\t |\\ _,,,---,,_\n\tZZZzz /,`.-'`' -. ;-;;,_\n\t |,4- ) )-,_. ,\\ ( `'-'\n\t '---''(_/--' `-'\\_)\n\n\t\tCAT"
self.art2 = "\n\t\t ~~~~\n ~~\n _||____\n /\\ /\\ /\\ /\\\\\\\\\n//\\/\\/\\ __ /__\\\\\\\\ _,\n//\\/\\/\\ __/ \\_ |__|_|_|__| \\__,\n || || || '-o---o-' | |/|\\| /| /\\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n "
def show_email(self):
if self.company != '':
print('{}@{}.com'.format(self.name.lower(), self.company))
else:
print('{}@gmail.com'.format(self.name.lower()))
def show_myart(self):
print(self.art)
def show_myart2(self):
print(self.art2)
def show_hobby(self):
if len(self.hobby) != 0:
print('------my hobby-------')
for (i, h) in enumerate(self.hobby, start=1):
print(i, h)
print('---------------------')
else:
print('No hobby')
if __name__ == '__main__':
my = profile('Rob')
my.company = 'CPF'
my.hobby = ['Reading', 'Sleeping', 'Eating']
print(my.name)
my.show_email()
my.show_myart()
my.show_myart2()
my.show_hobby() |
def format_duration(seconds):
years = int(seconds/(365*24*60*60))
days = int((seconds-(years*365*24*60*60))/(24*60*60))
hours = int((seconds-(years*365*24*60*60)-(days*24*60*60)) / (60*60))
mins = int((seconds-(years*365*24*60*60)-(days*24*60*60) - hours*60*60)/60)
sec = (seconds -(years*365*24*60*60)-(days*24*60*60)- hours*60*60 - mins*60)
total = [years, days, hours, mins, sec]
x = ""
if years == 1:
x += "1 year, "
elif years > 1:
x += str(years) + " years, "
if days == 1:
x += "1 day, "
elif days >1:
x += str(days) + " days, "
if hours == 1:
x += "1 hour, "
elif hours >1:
x += str(hours) + " hours, "
if sec == 0 and mins > 0:
x = x[:-2]
x += " and "
if mins == 1:
x += "1 minute, "
elif mins >1:
x += str(mins) + " minutes, "
if sec == 1:
x = x[:-2]
x += " and 1 second"
elif sec > 1:
x = x[:-2]
x += " and " + str(sec) + " seconds"
if seconds == 0:
x = "now"
if x[0] == ",":
x = x[1:]
if x[0] == " ":
x = x[1:]
if x[-1] == " ":
x = x[:-1]
if x[-1] == ",":
x = x[:-1]
if x[0] == "a":
x = x[4:]
return x
print(format_duration(100000))
| def format_duration(seconds):
years = int(seconds / (365 * 24 * 60 * 60))
days = int((seconds - years * 365 * 24 * 60 * 60) / (24 * 60 * 60))
hours = int((seconds - years * 365 * 24 * 60 * 60 - days * 24 * 60 * 60) / (60 * 60))
mins = int((seconds - years * 365 * 24 * 60 * 60 - days * 24 * 60 * 60 - hours * 60 * 60) / 60)
sec = seconds - years * 365 * 24 * 60 * 60 - days * 24 * 60 * 60 - hours * 60 * 60 - mins * 60
total = [years, days, hours, mins, sec]
x = ''
if years == 1:
x += '1 year, '
elif years > 1:
x += str(years) + ' years, '
if days == 1:
x += '1 day, '
elif days > 1:
x += str(days) + ' days, '
if hours == 1:
x += '1 hour, '
elif hours > 1:
x += str(hours) + ' hours, '
if sec == 0 and mins > 0:
x = x[:-2]
x += ' and '
if mins == 1:
x += '1 minute, '
elif mins > 1:
x += str(mins) + ' minutes, '
if sec == 1:
x = x[:-2]
x += ' and 1 second'
elif sec > 1:
x = x[:-2]
x += ' and ' + str(sec) + ' seconds'
if seconds == 0:
x = 'now'
if x[0] == ',':
x = x[1:]
if x[0] == ' ':
x = x[1:]
if x[-1] == ' ':
x = x[:-1]
if x[-1] == ',':
x = x[:-1]
if x[0] == 'a':
x = x[4:]
return x
print(format_duration(100000)) |
# "range(1,11)" just provides us a list of numbers 1-10 (the last number isn't included).
# The list in this case would look like this: [1,2,3,4,5,6,7,8,9,10].
# For loop
## This takes each number inside "range", and saves it as a variable "i". It does whatever is in the loop with that variable, then moves to the next number.
## In this case, the first time it goes through the loop, i is 1 (the first item in the list provided by range).
## Then it will print it, since that's the only thing inside the loop. When it's done with that, it will move to the next number: 2 and do the same thing.
## And so on and so on until it reaches 10. It will print 10 and exit the loop.
for i in range(1,11):
print(i)
# While loop
## While loops will go on forever until whatever condition you provide turns false.
## If the condition is false at the start, the loop is never entered.
do_loop = True
while do_loop:
user_input = input("Should I do the loop again? ")
if user_input == 'no':
do_loop = False
print("Ok, exiting loop")
| for i in range(1, 11):
print(i)
do_loop = True
while do_loop:
user_input = input('Should I do the loop again? ')
if user_input == 'no':
do_loop = False
print('Ok, exiting loop') |
def merge_sort(sorted_l1, sorted_l2):
""" Merge sorting two sorted array """
result = []
i = 0
j = 0
while i < len(sorted_l1) and j < len(sorted_l2):
if sorted_l1[i] < sorted_l2[j]:
result.append(sorted_l1[i])
i += 1
else:
result.append(sorted_l2[j])
j += 1
while i < len(sorted_l1):
result.append(sorted_l1[i])
i += 1
while j < len(sorted_l2):
result.append(sorted_l2[j])
j += 1
return result
print(f'Merge Sort : {merge_sort([1,3,5], [2,4,6, 100, 1001])}')
# Big O notation O(n)
| def merge_sort(sorted_l1, sorted_l2):
""" Merge sorting two sorted array """
result = []
i = 0
j = 0
while i < len(sorted_l1) and j < len(sorted_l2):
if sorted_l1[i] < sorted_l2[j]:
result.append(sorted_l1[i])
i += 1
else:
result.append(sorted_l2[j])
j += 1
while i < len(sorted_l1):
result.append(sorted_l1[i])
i += 1
while j < len(sorted_l2):
result.append(sorted_l2[j])
j += 1
return result
print(f'Merge Sort : {merge_sort([1, 3, 5], [2, 4, 6, 100, 1001])}') |
math_str = input("please input a number: ")
math = int(math_str)
math6 = 6
if math == math6:
print("Yes, it is 6!")
elif math < math6:
print("That's less than 6!")
else:
print("That's more than 6!")
| math_str = input('please input a number: ')
math = int(math_str)
math6 = 6
if math == math6:
print('Yes, it is 6!')
elif math < math6:
print("That's less than 6!")
else:
print("That's more than 6!") |
a = arr = [[False for i in range(100)] for j in range(100)]
ans = 0
sl = 0
block= []
def findLargestRectangle(blockNumber):
global sl
global block
block = blockNumber
for i in block: sl += i
for i in range(1,9):
find(i, 1)
return ans
def find(r,n):
global ans
global a
# calc result
if (((n - 1) * 4) % r == 0):
l = (n - 1) * 4 // r
check = True
for i in range(l):
for j in range(r):
if (not a[i][j]):
check = False
break
if (not check): break
if (check and ans < (n-1)*4):
ans = (n-1)*4
# condition end
if (n > sl): return
#fill - backtracking
for i in range(80):
for j in range(r):
if (not a[i][j]):
if (block[0] > 0):
if (not a[i + 1][j] and not a[i + 2][j] and not a[i + 3][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 3][j] = True
block[0]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 3][j] = False
block[0]+=1
if (j + 3 < r and not a[i][j + 1] and not a[i][j + 2] and not a[i][j + 3]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i][j + 3] = True
block[0]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i][j + 3] = False
block[0]+=1
if (block[1] > 0):
if (j + 1 < r and not a[i][j + 1] and not a[i + 1][j] and not a[i + 1][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
block[1]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
block[1]+=1
if (block[2] > 0):
if (j + 2 < r and not a[i][j + 1] and not a[i][j + 2] and not a[i + 1][j + 2]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j + 2] = True
block[2]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j + 2] = False
block[2]+=1
if (j + 1 < r and not a[i][j + 1] and not a[i + 1][j] and not a[i + 2][j]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 2][j] = True
block[2]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 2][j] = False
block[2]+=1
if (j + 2 < r and not a[i + 1][j] and not a[i + 1][j + 1] and not a[i + 1][j + 2]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 1][j + 2] = True
block[2]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 1][j + 2] = False
block[2]+=1
if (j > 0):
if (not a[i + 1][j] and not a[i + 2][j] and not a[i + 2][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 2][j - 1] = True
block[2]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 2][j - 1] = False
block[2]+=1
if (block[3] > 0):
if (j + 2 < r and not a[i][j + 1] and not a[i + 1][j + 1] and not a[i + 1][j + 2]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j + 1] = True
a[i + 1][j + 2] = True
block[3]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j + 1] = False
a[i + 1][j + 2] = False
block[3]+=1
if (j > 0):
if (not a[i + 1][j] and not a[i + 1][j - 1] and not a[i + 2][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 2][j - 1] = True
block[3]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 2][j - 1] = False
block[3]+=1
if (block[4] > 0):
if (j + 1 < r and j > 0):
if(not a[i][j + 1] and not a[i + 1][j] and not a[i + 1][j - 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
block[4]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
block[4]+=1
if (j + 1 < r):
if (not a[i + 1][j] and not a[i + 1][j + 1] and not a[i + 2][j + 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 2][j + 1] = True
block[4]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 2][j + 1] = False
block[4]+=1
if (block[5] > 0):
if (j + 2 < r and not a[i][j + 1] and not a[i][j + 2] and not a[i + 1][j]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j] = True
block[5]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j] = False
block[5]+=1
if (j + 1 < r and not a[i][j + 1] and not a[i + 1][j + 1] and not a[i + 2][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j + 1] = True
a[i + 2][j + 1] = True
block[5]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j + 1] = False
a[i + 2][j + 1] = False
block[5]+=1
if (j > 1):
if(not a[i + 1][j] and not a[i + 1][j - 1] and not a[i + 1][j - 2]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 1][j - 2] = True
block[5]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 1][j - 2] = False
block[5]+=1
if (j + 1 < r):
if (not a[i + 1][j] and not a[i + 2][j] and not a[i + 2][j + 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 2][j + 1] = True
block[5]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 2][j + 1] = False
block[5]+=1
if (block[6] > 0):
if (j + 2 < r and not a[i][j + 1] and not a[i][j + 2] and not a[i + 1][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j + 1] = True
block[6]-=1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j + 1] = False
block[6]+=1
if (j + 1 < r and not a[i + 1][j] and not a[i + 1][j + 1] and not a[i + 2][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 2][j] = True
block[6]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 2][j] = False
block[6]+=1
if (j > 0):
if (not a[i + 1][j] and not a[i + 1][j - 1] and not a[i + 2][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 2][j] = True
block[6]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 2][j] = False
block[6]+=1
if (j + 1 < r and j > 0):
if(not a[i + 1][j] and not a[i + 1][j + 1] and not a[i + 1][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 1][j + 1] = True
block[6]-=1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 1][j + 1] = False
block[6]+=1
return
print(findLargestRectangle([0,0,1,1,0,1,0]))
| a = arr = [[False for i in range(100)] for j in range(100)]
ans = 0
sl = 0
block = []
def find_largest_rectangle(blockNumber):
global sl
global block
block = blockNumber
for i in block:
sl += i
for i in range(1, 9):
find(i, 1)
return ans
def find(r, n):
global ans
global a
if (n - 1) * 4 % r == 0:
l = (n - 1) * 4 // r
check = True
for i in range(l):
for j in range(r):
if not a[i][j]:
check = False
break
if not check:
break
if check and ans < (n - 1) * 4:
ans = (n - 1) * 4
if n > sl:
return
for i in range(80):
for j in range(r):
if not a[i][j]:
if block[0] > 0:
if not a[i + 1][j] and (not a[i + 2][j]) and (not a[i + 3][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 3][j] = True
block[0] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 3][j] = False
block[0] += 1
if j + 3 < r and (not a[i][j + 1]) and (not a[i][j + 2]) and (not a[i][j + 3]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i][j + 3] = True
block[0] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i][j + 3] = False
block[0] += 1
if block[1] > 0:
if j + 1 < r and (not a[i][j + 1]) and (not a[i + 1][j]) and (not a[i + 1][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
block[1] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
block[1] += 1
if block[2] > 0:
if j + 2 < r and (not a[i][j + 1]) and (not a[i][j + 2]) and (not a[i + 1][j + 2]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j + 2] = True
block[2] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j + 2] = False
block[2] += 1
if j + 1 < r and (not a[i][j + 1]) and (not a[i + 1][j]) and (not a[i + 2][j]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 2][j] = True
block[2] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 2][j] = False
block[2] += 1
if j + 2 < r and (not a[i + 1][j]) and (not a[i + 1][j + 1]) and (not a[i + 1][j + 2]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 1][j + 2] = True
block[2] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 1][j + 2] = False
block[2] += 1
if j > 0:
if not a[i + 1][j] and (not a[i + 2][j]) and (not a[i + 2][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 2][j - 1] = True
block[2] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 2][j - 1] = False
block[2] += 1
if block[3] > 0:
if j + 2 < r and (not a[i][j + 1]) and (not a[i + 1][j + 1]) and (not a[i + 1][j + 2]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j + 1] = True
a[i + 1][j + 2] = True
block[3] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j + 1] = False
a[i + 1][j + 2] = False
block[3] += 1
if j > 0:
if not a[i + 1][j] and (not a[i + 1][j - 1]) and (not a[i + 2][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 2][j - 1] = True
block[3] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 2][j - 1] = False
block[3] += 1
if block[4] > 0:
if j + 1 < r and j > 0:
if not a[i][j + 1] and (not a[i + 1][j]) and (not a[i + 1][j - 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
block[4] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
block[4] += 1
if j + 1 < r:
if not a[i + 1][j] and (not a[i + 1][j + 1]) and (not a[i + 2][j + 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 2][j + 1] = True
block[4] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 2][j + 1] = False
block[4] += 1
if block[5] > 0:
if j + 2 < r and (not a[i][j + 1]) and (not a[i][j + 2]) and (not a[i + 1][j]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j] = True
block[5] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j] = False
block[5] += 1
if j + 1 < r and (not a[i][j + 1]) and (not a[i + 1][j + 1]) and (not a[i + 2][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i + 1][j + 1] = True
a[i + 2][j + 1] = True
block[5] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i + 1][j + 1] = False
a[i + 2][j + 1] = False
block[5] += 1
if j > 1:
if not a[i + 1][j] and (not a[i + 1][j - 1]) and (not a[i + 1][j - 2]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 1][j - 2] = True
block[5] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 1][j - 2] = False
block[5] += 1
if j + 1 < r:
if not a[i + 1][j] and (not a[i + 2][j]) and (not a[i + 2][j + 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 2][j] = True
a[i + 2][j + 1] = True
block[5] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 2][j] = False
a[i + 2][j + 1] = False
block[5] += 1
if block[6] > 0:
if j + 2 < r and (not a[i][j + 1]) and (not a[i][j + 2]) and (not a[i + 1][j + 1]):
a[i][j] = True
a[i][j + 1] = True
a[i][j + 2] = True
a[i + 1][j + 1] = True
block[6] -= 1
find(r, n + 1)
a[i][j] = False
a[i][j + 1] = False
a[i][j + 2] = False
a[i + 1][j + 1] = False
block[6] += 1
if j + 1 < r and (not a[i + 1][j]) and (not a[i + 1][j + 1]) and (not a[i + 2][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j + 1] = True
a[i + 2][j] = True
block[6] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j + 1] = False
a[i + 2][j] = False
block[6] += 1
if j > 0:
if not a[i + 1][j] and (not a[i + 1][j - 1]) and (not a[i + 2][j]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 2][j] = True
block[6] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 2][j] = False
block[6] += 1
if j + 1 < r and j > 0:
if not a[i + 1][j] and (not a[i + 1][j + 1]) and (not a[i + 1][j - 1]):
a[i][j] = True
a[i + 1][j] = True
a[i + 1][j - 1] = True
a[i + 1][j + 1] = True
block[6] -= 1
find(r, n + 1)
a[i][j] = False
a[i + 1][j] = False
a[i + 1][j - 1] = False
a[i + 1][j + 1] = False
block[6] += 1
return
print(find_largest_rectangle([0, 0, 1, 1, 0, 1, 0])) |
def rook_cells_under_attack(p, width=8, height=8):
cells = []
for i in range(height):
cells.append((p[0], i))
for i in range(width):
cells.append((i, p[1]))
return cells
# TODO: add width and height parameters
def bishop_cells_under_attack(p, width=8, height=8):
cells = []
for k in range(max(width, height)):
if p[0] + k <= width and p[1] + k <= height:
cells.append((p[0] + k, p[1] + k))
if p[0] + k <= width and p[1] - k >= 0:
cells.append((p[0] + k, p[1] - k))
if p[0] - k >= 0 and p[1] - k >= 0:
cells.append((p[0] - k, p[1] - k))
if p[0] - k >= 0 and p[1] + k <= height:
cells.append((p[0] - k, p[1] + k))
return cells
def queen_cells_under_attack(p, width=8, height=8):
return rook_cells_under_attack(p, width, height) + bishop_cells_under_attack(p, width, height)
| def rook_cells_under_attack(p, width=8, height=8):
cells = []
for i in range(height):
cells.append((p[0], i))
for i in range(width):
cells.append((i, p[1]))
return cells
def bishop_cells_under_attack(p, width=8, height=8):
cells = []
for k in range(max(width, height)):
if p[0] + k <= width and p[1] + k <= height:
cells.append((p[0] + k, p[1] + k))
if p[0] + k <= width and p[1] - k >= 0:
cells.append((p[0] + k, p[1] - k))
if p[0] - k >= 0 and p[1] - k >= 0:
cells.append((p[0] - k, p[1] - k))
if p[0] - k >= 0 and p[1] + k <= height:
cells.append((p[0] - k, p[1] + k))
return cells
def queen_cells_under_attack(p, width=8, height=8):
return rook_cells_under_attack(p, width, height) + bishop_cells_under_attack(p, width, height) |
nome = str(input("Digite seu nome completo: ")).strip()
nome = nome.lower()
#verifica = nome.find('silva') > 0
print("Seu nome tem Silva? ")
#print("{}".format(verifica))
print("{}".format("silva" in nome))
| nome = str(input('Digite seu nome completo: ')).strip()
nome = nome.lower()
print('Seu nome tem Silva? ')
print('{}'.format('silva' in nome)) |
# Solution
# O(n*l) time / O(c) space
# n - number of words
# l - length of the longest word
# c - number of unique characters across all words
def minimumCharactersForWords(words):
maximumCharacterFrequencies = {}
for word in words:
characterFrequencies = countCharacterFrequencies(word)
updateMaximumFrequencies(characterFrequencies, maximumCharacterFrequencies)
return makeArrayFromCharacterFrequencies(maximumCharacterFrequencies)
def countCharacterFrequencies(string):
characterFrequencies = {}
for character in string:
if character not in characterFrequencies:
characterFrequencies[character] = 0
characterFrequencies[character] += 1
return characterFrequencies
def updateMaximumFrequencies(frequencies, maximumFrequencies):
for character in frequencies:
frequency = frequencies[character]
if character in maximumFrequencies:
maximumFrequencies[character] = max(frequency, maximumFrequencies[character])
else:
maximumFrequencies[character] = frequency
def makeArrayFromCharacterFrequencies(characterFrequencies):
characters = []
for character in characterFrequencies:
frequency = characterFrequencies[character]
for _ in range(frequency):
characters.append(character)
return characters
| def minimum_characters_for_words(words):
maximum_character_frequencies = {}
for word in words:
character_frequencies = count_character_frequencies(word)
update_maximum_frequencies(characterFrequencies, maximumCharacterFrequencies)
return make_array_from_character_frequencies(maximumCharacterFrequencies)
def count_character_frequencies(string):
character_frequencies = {}
for character in string:
if character not in characterFrequencies:
characterFrequencies[character] = 0
characterFrequencies[character] += 1
return characterFrequencies
def update_maximum_frequencies(frequencies, maximumFrequencies):
for character in frequencies:
frequency = frequencies[character]
if character in maximumFrequencies:
maximumFrequencies[character] = max(frequency, maximumFrequencies[character])
else:
maximumFrequencies[character] = frequency
def make_array_from_character_frequencies(characterFrequencies):
characters = []
for character in characterFrequencies:
frequency = characterFrequencies[character]
for _ in range(frequency):
characters.append(character)
return characters |
a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())
d = map(int, input().split())
e = map(int, input().split())
_a, _b, _c, _d, _e = sum(a), sum(b), sum(c), sum(d), sum(e)
m = max(_a, _b, _c, _d, _e)
if m == _a:
print(1, _a)
elif m == _b:
print(2, _b)
elif m == _c:
print(3, _c)
elif m == _d:
print(4, _d)
elif m == _e:
print(5, _e)
| a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())
d = map(int, input().split())
e = map(int, input().split())
(_a, _b, _c, _d, _e) = (sum(a), sum(b), sum(c), sum(d), sum(e))
m = max(_a, _b, _c, _d, _e)
if m == _a:
print(1, _a)
elif m == _b:
print(2, _b)
elif m == _c:
print(3, _c)
elif m == _d:
print(4, _d)
elif m == _e:
print(5, _e) |
L=[23,45,88,23,56,78,96]
Temp=L[0]
L[0]=L[-1]
L[-1]=Temp
print(L)
| l = [23, 45, 88, 23, 56, 78, 96]
temp = L[0]
L[0] = L[-1]
L[-1] = Temp
print(L) |
# Time: O(n)
# Space: O(1)
class Solution(object):
# @param {integer} s
# @param {integer[]} nums
# @return {integer}
def minSubArrayLen(self, s, nums):
start = 0
sum = 0
min_size = float("inf")
for i in xrange(len(nums)):
sum += nums[i]
while sum >= s:
min_size = min(min_size, i - start + 1)
sum -= nums[start]
start += 1
return min_size if min_size != float("inf") else 0
# Time: O(nlogn)
# Space: O(n)
# Binary search solution.
class Solution2(object):
# @param {integer} s
# @param {integer[]} nums
# @return {integer}
def minSubArrayLen(self, s, nums):
min_size = float("inf")
sum_from_start = [n for n in nums]
for i in xrange(len(sum_from_start) - 1):
sum_from_start[i + 1] += sum_from_start[i]
for i in xrange(len(sum_from_start)):
end = self.binarySearch(lambda x, y: x <= y, sum_from_start, \
i, len(sum_from_start), \
sum_from_start[i] - nums[i] + s)
if end < len(sum_from_start):
min_size = min(min_size, end - i + 1)
return min_size if min_size != float("inf") else 0
def binarySearch(self, compare, A, start, end, target):
while start < end:
mid = start + (end - start) / 2
if compare(target, A[mid]):
end = mid
else:
start = mid + 1
return start
| class Solution(object):
def min_sub_array_len(self, s, nums):
start = 0
sum = 0
min_size = float('inf')
for i in xrange(len(nums)):
sum += nums[i]
while sum >= s:
min_size = min(min_size, i - start + 1)
sum -= nums[start]
start += 1
return min_size if min_size != float('inf') else 0
class Solution2(object):
def min_sub_array_len(self, s, nums):
min_size = float('inf')
sum_from_start = [n for n in nums]
for i in xrange(len(sum_from_start) - 1):
sum_from_start[i + 1] += sum_from_start[i]
for i in xrange(len(sum_from_start)):
end = self.binarySearch(lambda x, y: x <= y, sum_from_start, i, len(sum_from_start), sum_from_start[i] - nums[i] + s)
if end < len(sum_from_start):
min_size = min(min_size, end - i + 1)
return min_size if min_size != float('inf') else 0
def binary_search(self, compare, A, start, end, target):
while start < end:
mid = start + (end - start) / 2
if compare(target, A[mid]):
end = mid
else:
start = mid + 1
return start |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
'TEST_NAME': 'test1.db',
}
}
ROOT_URLCONF='testapp.urls'
SITE_ID = 1
SECRET_KEY = "not very secret in tests"
ALLOWED_HOSTS = (
'testserver',
'*'
)
INSTALLED_APPS = (
"rest_framework",
"testapp"
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
)
| databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.db', 'TEST_NAME': 'test1.db'}}
root_urlconf = 'testapp.urls'
site_id = 1
secret_key = 'not very secret in tests'
allowed_hosts = ('testserver', '*')
installed_apps = ('rest_framework', 'testapp')
middleware_classes = ('django.middleware.common.CommonMiddleware',) |
#Write a Python program that reads your height in cms and converts your height to feet and inches.
heightCM = float(input('Enter the height in CM: '))
totalInch = heightCM * 0.393701
heightInch = (totalInch % 12)
heightFeet = (totalInch - heightInch)*0.0833333
print('The height is : ',heightFeet,' feet AND 163',heightInch,' inch') | height_cm = float(input('Enter the height in CM: '))
total_inch = heightCM * 0.393701
height_inch = totalInch % 12
height_feet = (totalInch - heightInch) * 0.0833333
print('The height is : ', heightFeet, ' feet AND 163', heightInch, ' inch') |
"""Given a string, determine if a permutation of the string could form a palindrome.
For example,
"code" -> False, "aab" -> True, "carerac" -> True."""
class Solution:
def canPermutePalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
check = set()
for c in s:
if c in check:
check.remove(c)
else:
check.add(c)
return len(check) <= 1
| """Given a string, determine if a permutation of the string could form a palindrome.
For example,
"code" -> False, "aab" -> True, "carerac" -> True."""
class Solution:
def can_permute_palindrome(self, s):
"""
:type s: str
:rtype: bool
"""
check = set()
for c in s:
if c in check:
check.remove(c)
else:
check.add(c)
return len(check) <= 1 |
#!/usr/bin/env python3.7
rules = {}
with open('input.txt') as fd:
for line in fd:
words = line[:-1].split()
this_bag = words[0]+ " " + words[1]
rules[this_bag] = []
b = line[:-1].split('contain')
bags = b[1].split(',')
for bag in bags:
words = bag.split()
count = 0
try:
count = int(words[0])
except:
break
new_bag = [count,words[1]+" "+words[2]]
rules[this_bag].append(new_bag)
def contains(rules, find):
res = []
for f in find:
for rule in rules:
for bag in rules[rule]:
if f in bag:
res.append(rule)
return res
search_for = ['shiny gold']
final = {}
while True:
res = contains(rules,search_for)
if res == []:
break
for bag in res:
final[bag] = 1
search_for = res
print(final.keys())
print(len(final))
| rules = {}
with open('input.txt') as fd:
for line in fd:
words = line[:-1].split()
this_bag = words[0] + ' ' + words[1]
rules[this_bag] = []
b = line[:-1].split('contain')
bags = b[1].split(',')
for bag in bags:
words = bag.split()
count = 0
try:
count = int(words[0])
except:
break
new_bag = [count, words[1] + ' ' + words[2]]
rules[this_bag].append(new_bag)
def contains(rules, find):
res = []
for f in find:
for rule in rules:
for bag in rules[rule]:
if f in bag:
res.append(rule)
return res
search_for = ['shiny gold']
final = {}
while True:
res = contains(rules, search_for)
if res == []:
break
for bag in res:
final[bag] = 1
search_for = res
print(final.keys())
print(len(final)) |
ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p']
n_vars = 2
def model(y, t, yout, p):
#---------------------------------------------------------#
#Parameters#
#---------------------------------------------------------#
vmax = p[0]
km = p[1]
k_synt_s = p[2]
k_deg_s = p[3]
k_deg_p = p[4]
#---------------------------------------------------------#
#Variables#
#---------------------------------------------------------#
_s = y[0]
_p = y[1]
#---------------------------------------------------------#
#Differential Equations#
#---------------------------------------------------------#
yout[0] = ((-_s * vmax + (_s + km) * (-_s * k_deg_s + k_synt_s)) / (_s + km))
yout[1] = ((-_p * k_deg_p * (_s + km) + _s * vmax) / (_s + km))
| ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p']
n_vars = 2
def model(y, t, yout, p):
vmax = p[0]
km = p[1]
k_synt_s = p[2]
k_deg_s = p[3]
k_deg_p = p[4]
_s = y[0]
_p = y[1]
yout[0] = (-_s * vmax + (_s + km) * (-_s * k_deg_s + k_synt_s)) / (_s + km)
yout[1] = (-_p * k_deg_p * (_s + km) + _s * vmax) / (_s + km) |
"""
Purpose: Stakoverflow question finding first and last coordinates for values in matrix
Date created: 2019-12-28
URI: https://stackoverflow.com/questions/59511521/how-to-get-start-and-end-of-subsection-of-2d-array-where-a-condition-holds/59511652#59511652
Contributor(s):
Mark M.
"""
a = [[0, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]
results_list= list()
while True:
for i, v in enumerate(a):
if 1 in v:
results_list.append([i, v.index(1)])
first_pair = results_list[0]
last_pair = results_list[-1]
break
results_list[0]
results_list[-1] | """
Purpose: Stakoverflow question finding first and last coordinates for values in matrix
Date created: 2019-12-28
URI: https://stackoverflow.com/questions/59511521/how-to-get-start-and-end-of-subsection-of-2d-array-where-a-condition-holds/59511652#59511652
Contributor(s):
Mark M.
"""
a = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
results_list = list()
while True:
for (i, v) in enumerate(a):
if 1 in v:
results_list.append([i, v.index(1)])
first_pair = results_list[0]
last_pair = results_list[-1]
break
results_list[0]
results_list[-1] |
def max_num_in_list( list ):
max = list[ 0 ]
for a in list:
if a > max:
max = a
return max
ls=[]
n=int(input("Enter number of elements:"))
for i in range(1,n+1):
b=int(input("Enter element:"))
ls.append(b)
print("Max number in the list is:",max_num_in_list(ls))
| def max_num_in_list(list):
max = list[0]
for a in list:
if a > max:
max = a
return max
ls = []
n = int(input('Enter number of elements:'))
for i in range(1, n + 1):
b = int(input('Enter element:'))
ls.append(b)
print('Max number in the list is:', max_num_in_list(ls)) |
iter_num = 0
def fib(num):
global iter_num
iter_num += 1
print("Iteration number {0}. num = {1}".format(iter_num, num))
# Base class for fibonnaci series
if num==0 or num==1:
return 1
# Recursive call
else:
return fib(num-1)+fib(num-2)
if __name__ == '__main__':
num = int(input("Enter a number: "))
ans = fib(num)
print("Fibonnaci sum of the number is ", ans)
| iter_num = 0
def fib(num):
global iter_num
iter_num += 1
print('Iteration number {0}. num = {1}'.format(iter_num, num))
if num == 0 or num == 1:
return 1
else:
return fib(num - 1) + fib(num - 2)
if __name__ == '__main__':
num = int(input('Enter a number: '))
ans = fib(num)
print('Fibonnaci sum of the number is ', ans) |
class Solution:
@staticmethod
def _encode(word):
enc = []
idx = 0
repeat = 0
prev = None
while idx < len(word):
if word[idx] == prev:
idx += 1
repeat += 1
else:
if prev:
enc.append((prev, repeat))
prev = word[idx]
repeat = 1
idx += 1
if prev:
enc.append((prev, repeat))
return enc
@staticmethod
def _is_expressive(enc_s, enc_w):
if len(enc_s) != len(enc_w):
return False
else:
for i in range(len(enc_s)):
ch_s = enc_s[i]
ch_w = enc_w[i]
if ch_s[0] == ch_w[0] and \
(ch_s[1] == ch_w[1] or (ch_s[1] >= ch_w[1] and ch_s[1] >= 3)):
continue
else:
return False
return True
def expressiveWords(self, S: str, words: list) -> int:
"""
helllooo
hello, hellllo
"""
enc_s = self._encode(S)
cnt = 0
print(enc_s)
for w in words:
enc_w = self._encode(w)
print(enc_w)
cnt += self._is_expressive(enc_s, enc_w)
return cnt | class Solution:
@staticmethod
def _encode(word):
enc = []
idx = 0
repeat = 0
prev = None
while idx < len(word):
if word[idx] == prev:
idx += 1
repeat += 1
else:
if prev:
enc.append((prev, repeat))
prev = word[idx]
repeat = 1
idx += 1
if prev:
enc.append((prev, repeat))
return enc
@staticmethod
def _is_expressive(enc_s, enc_w):
if len(enc_s) != len(enc_w):
return False
else:
for i in range(len(enc_s)):
ch_s = enc_s[i]
ch_w = enc_w[i]
if ch_s[0] == ch_w[0] and (ch_s[1] == ch_w[1] or (ch_s[1] >= ch_w[1] and ch_s[1] >= 3)):
continue
else:
return False
return True
def expressive_words(self, S: str, words: list) -> int:
"""
helllooo
hello, hellllo
"""
enc_s = self._encode(S)
cnt = 0
print(enc_s)
for w in words:
enc_w = self._encode(w)
print(enc_w)
cnt += self._is_expressive(enc_s, enc_w)
return cnt |
def getNext(instr):
count=0
curch=instr[0]
outstr=[]
for ch in instr:
if ch != curch:
outstr.append(str(count)+curch)
curch=ch
count=1
else:
count+=1
outstr.append(str(count)+curch)
return ''.join(outstr)
a=['1']
for i in range(31):
a.append(getNext(a[i]))
print(len(a[30])) | def get_next(instr):
count = 0
curch = instr[0]
outstr = []
for ch in instr:
if ch != curch:
outstr.append(str(count) + curch)
curch = ch
count = 1
else:
count += 1
outstr.append(str(count) + curch)
return ''.join(outstr)
a = ['1']
for i in range(31):
a.append(get_next(a[i]))
print(len(a[30])) |
# coding=utf-8
__author__ = 'Gareth Coles'
class BaseAlgorithm(object):
def hash(self, value, salt):
pass
def check(self, hash, value, salt):
return hash == self.hash(value, salt)
def gen_salt(self):
pass
| __author__ = 'Gareth Coles'
class Basealgorithm(object):
def hash(self, value, salt):
pass
def check(self, hash, value, salt):
return hash == self.hash(value, salt)
def gen_salt(self):
pass |
description = ''
pages = ['header',
'my_account']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_is_not_selected(my_account.remember_me)
capture('Remember me is not selected')
def teardown(data):
pass
| description = ''
pages = ['header', 'my_account']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_is_not_selected(my_account.remember_me)
capture('Remember me is not selected')
def teardown(data):
pass |
# Vamos a convertir un numero entero en una lista de sus digitos
numero = int(input('Dime tu numero\n'))
digitos =[]
while numero !=0:
digitos.insert(0,numero%10)
numero //= 10
print('Los digitos de su numero son',digitos)
| numero = int(input('Dime tu numero\n'))
digitos = []
while numero != 0:
digitos.insert(0, numero % 10)
numero //= 10
print('Los digitos de su numero son', digitos) |
def main():
input = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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(len(nums) == 0):
return 0
for n in nums:
if n == 1:
count = count +n
if(count > globalMax):
globalMax = count
elif n==0:
count = 0
return globalMax
if __name__ == '__main__':
main()
| def main():
input = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
output = find_max_consecutive_ones(input)
print(output)
def find_max_consecutive_ones(nums):
global_max = 0
count = 0
if len(nums) == 0:
return 0
for n in nums:
if n == 1:
count = count + n
if count > globalMax:
global_max = count
elif n == 0:
count = 0
return globalMax
if __name__ == '__main__':
main() |
n=int(input().strip())
b=input().strip()
step=0
for i in range(0,n-2):
if(b[i]+b[i+1]+b[i+2]=='010'):
step+=1
print(step)
| n = int(input().strip())
b = input().strip()
step = 0
for i in range(0, n - 2):
if b[i] + b[i + 1] + b[i + 2] == '010':
step += 1
print(step) |
# -*- coding: utf-8 -*-
"""
View and Model base classes used to control access permissions for CRUD requests.
"""
__version__ = '0.1' | """
View and Model base classes used to control access permissions for CRUD requests.
"""
__version__ = '0.1' |
"""Dummy technologies
"""
def insert_dummy_technologies(technologies, tech_p_by, all_specified_tech_enduse_by):
"""Define dummy technologies
Where no specific technologies are assigned for an enduse
and a fueltype, dummy technologies are generated. This is
necessary because the model needs a technology for every
fueltype in an enduse. Technologies are however defined
with no efficiency changes, so that the energy demand
for an enduse per fueltype can be treated not related
to technologies (e.g. definieng definin overall
eficiency change)
Parameters
----------
tech_p_by : dict
Fuel assignement of technologies in base year
all_specified_tech_enduse_by : dict
Technologies per enduse
Returns
-------
tech_p_by : dict
all_specified_tech_enduse_by : dict
dummy_techs : dict
TODO
"""
for end_use in tech_p_by:
for fuel_type in tech_p_by[end_use]:
# TODO write explicit in assumptions: Test if any fueltype is specified with a technology.
# If yes, do not insert dummy technologies
# because in the fuel definition all technologies of all endueses need to be defined
crit_tech_defined_in_enduse = False
all_defined_tech_in_fueltype = tech_p_by[end_use].values()
for definition in all_defined_tech_in_fueltype:
if definition == {}:
pass
else:
crit_tech_defined_in_enduse = True
continue
# If an enduse has no defined technologies across all fueltypes
if crit_tech_defined_in_enduse is False:
if tech_p_by[end_use][fuel_type] == {}:
all_specified_tech_enduse_by[end_use].append("dummy_tech")
# Assign total fuel demand to dummy technology
tech_p_by[end_use][fuel_type] = {"dummy_tech": 1.0}
# Insert dummy tech
technologies['dummy_tech'] = {}
return tech_p_by, all_specified_tech_enduse_by, technologies
def get_enduses_with_dummy_tech(enduse_tech_p_by):
"""Find all enduses with defined dummy technologies
Parameters
----------
enduse_tech_p_by : dict
Fuel share definition of technologies
Return
------
dummy_enduses : list
List with all endueses with dummy technologies
"""
dummy_enduses = set([])
for enduse in enduse_tech_p_by:
for fueltype in enduse_tech_p_by[enduse]:
for tech in enduse_tech_p_by[enduse][fueltype]:
if tech == 'dummy_tech':
dummy_enduses.add(enduse)
continue
return list(dummy_enduses)
| """Dummy technologies
"""
def insert_dummy_technologies(technologies, tech_p_by, all_specified_tech_enduse_by):
"""Define dummy technologies
Where no specific technologies are assigned for an enduse
and a fueltype, dummy technologies are generated. This is
necessary because the model needs a technology for every
fueltype in an enduse. Technologies are however defined
with no efficiency changes, so that the energy demand
for an enduse per fueltype can be treated not related
to technologies (e.g. definieng definin overall
eficiency change)
Parameters
----------
tech_p_by : dict
Fuel assignement of technologies in base year
all_specified_tech_enduse_by : dict
Technologies per enduse
Returns
-------
tech_p_by : dict
all_specified_tech_enduse_by : dict
dummy_techs : dict
TODO
"""
for end_use in tech_p_by:
for fuel_type in tech_p_by[end_use]:
crit_tech_defined_in_enduse = False
all_defined_tech_in_fueltype = tech_p_by[end_use].values()
for definition in all_defined_tech_in_fueltype:
if definition == {}:
pass
else:
crit_tech_defined_in_enduse = True
continue
if crit_tech_defined_in_enduse is False:
if tech_p_by[end_use][fuel_type] == {}:
all_specified_tech_enduse_by[end_use].append('dummy_tech')
tech_p_by[end_use][fuel_type] = {'dummy_tech': 1.0}
technologies['dummy_tech'] = {}
return (tech_p_by, all_specified_tech_enduse_by, technologies)
def get_enduses_with_dummy_tech(enduse_tech_p_by):
"""Find all enduses with defined dummy technologies
Parameters
----------
enduse_tech_p_by : dict
Fuel share definition of technologies
Return
------
dummy_enduses : list
List with all endueses with dummy technologies
"""
dummy_enduses = set([])
for enduse in enduse_tech_p_by:
for fueltype in enduse_tech_p_by[enduse]:
for tech in enduse_tech_p_by[enduse][fueltype]:
if tech == 'dummy_tech':
dummy_enduses.add(enduse)
continue
return list(dummy_enduses) |
SHOWNAMES = [
"ap1/product-id",
"ap1/adc0",
"ap1/adc1",
"ap1/adc2",
"ap1/din0",
"ap1/din1",
"ap1/din2",
"ap1/din3",
"ap1/led1",
"ap1/led2",
"ap1/device-id",
"ap1/vendor-id",
"ap1/dout0",
"ap1/dout1",
"ap1/dout2",
"ap1/dout3",
"ap1/reset",
"ap1/dout-enable",
"ap1/hw-version",
"capability/adc",
"capability/din",
"capability/gps",
"capability/dout",
"capability/lora",
"capability/wifi",
"capability/bluetooth",
"device-id",
"eth-reset",
"gpiob/product-id",
"gpiob/adc0",
"gpiob/adc1",
"gpiob/adc2",
"gpiob/din0",
"gpiob/din1",
"gpiob/din2",
"gpiob/din3",
"gpiob/led1",
"gpiob/led2",
"gpiob/device-id",
"gpiob/vendor-id",
"gpiob/dout0",
"gpiob/dout1",
"gpiob/dout2",
"gpiob/dout3",
"gpiob/reset",
"gpiob/dout-enable",
"gpiob/hw-version",
"has-radio",
"hw-version",
"imei",
"led-a",
"led-b",
"led-c",
"led-cd",
"led-d",
"led-sig1",
"led-sig2",
"led-sig3",
"led-status",
"mac-eth",
"product-id",
"reset",
"reset-monitor",
"reset-monitor-intervals",
"uuid",
"vendor-id",
]
| shownames = ['ap1/product-id', 'ap1/adc0', 'ap1/adc1', 'ap1/adc2', 'ap1/din0', 'ap1/din1', 'ap1/din2', 'ap1/din3', 'ap1/led1', 'ap1/led2', 'ap1/device-id', 'ap1/vendor-id', 'ap1/dout0', 'ap1/dout1', 'ap1/dout2', 'ap1/dout3', 'ap1/reset', 'ap1/dout-enable', 'ap1/hw-version', 'capability/adc', 'capability/din', 'capability/gps', 'capability/dout', 'capability/lora', 'capability/wifi', 'capability/bluetooth', 'device-id', 'eth-reset', 'gpiob/product-id', 'gpiob/adc0', 'gpiob/adc1', 'gpiob/adc2', 'gpiob/din0', 'gpiob/din1', 'gpiob/din2', 'gpiob/din3', 'gpiob/led1', 'gpiob/led2', 'gpiob/device-id', 'gpiob/vendor-id', 'gpiob/dout0', 'gpiob/dout1', 'gpiob/dout2', 'gpiob/dout3', 'gpiob/reset', 'gpiob/dout-enable', 'gpiob/hw-version', 'has-radio', 'hw-version', 'imei', 'led-a', 'led-b', 'led-c', 'led-cd', 'led-d', 'led-sig1', 'led-sig2', 'led-sig3', 'led-status', 'mac-eth', 'product-id', 'reset', 'reset-monitor', 'reset-monitor-intervals', 'uuid', 'vendor-id'] |
def merge(left, right, sorted_lst):
i, j, k = 0, 0, 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
sorted_lst[k] = left[i]
i += 1
else:
sorted_lst[k] = right[j]
j += 1
k += 1
while i < len(left):
sorted_lst[k] = left[i]
i += 1
k += 1
while j < len(right):
sorted_lst[k] = right[j]
j += 1
k += 1
return sorted_lst
def mergesort(arr: list):
if len(arr) > 1:
mid = len(arr) // 2
left, right = mergesort(arr[:mid]), mergesort(arr[mid:])
return merge(left, right, arr)
return arr
def min_pair_arr(arr):
arr = mergesort(arr)
min_pair = abs(arr[1] - arr[0]), arr[1], arr[0]
for i in range(1, len(arr)):
dist = abs(arr[i] - arr[i - 1])
if dist < min_pair[0]:
min_pair = dist, arr[i - 1], arr[i]
return min_pair[1:]
if __name__ == "__main__":
arr = [6,2, 1,9, 3, 0, 5, 23 , 73, 123, 4]
print(mergesort(arr))
print(min_pair_arr(arr)) | def merge(left, right, sorted_lst):
(i, j, k) = (0, 0, 0)
while i < len(left) and j < len(right):
if left[i] <= right[j]:
sorted_lst[k] = left[i]
i += 1
else:
sorted_lst[k] = right[j]
j += 1
k += 1
while i < len(left):
sorted_lst[k] = left[i]
i += 1
k += 1
while j < len(right):
sorted_lst[k] = right[j]
j += 1
k += 1
return sorted_lst
def mergesort(arr: list):
if len(arr) > 1:
mid = len(arr) // 2
(left, right) = (mergesort(arr[:mid]), mergesort(arr[mid:]))
return merge(left, right, arr)
return arr
def min_pair_arr(arr):
arr = mergesort(arr)
min_pair = (abs(arr[1] - arr[0]), arr[1], arr[0])
for i in range(1, len(arr)):
dist = abs(arr[i] - arr[i - 1])
if dist < min_pair[0]:
min_pair = (dist, arr[i - 1], arr[i])
return min_pair[1:]
if __name__ == '__main__':
arr = [6, 2, 1, 9, 3, 0, 5, 23, 73, 123, 4]
print(mergesort(arr))
print(min_pair_arr(arr)) |
# vestlus:admin:actions
def make_read(model, request, queryset):
queryset.update(read=True)
make_read.short_description = "Mark as read"
def make_unread(model, request, queryset):
queryset.update(read=False)
make_unread.short_description = "Mark as unread"
def make_private(model, request, queryset):
queryset.update(is_private=True)
make_private.short_description = "Make private"
def make_public(model, request, queryset):
queryset.update(is_private=False)
make_public.short_description = "Make public"
| def make_read(model, request, queryset):
queryset.update(read=True)
make_read.short_description = 'Mark as read'
def make_unread(model, request, queryset):
queryset.update(read=False)
make_unread.short_description = 'Mark as unread'
def make_private(model, request, queryset):
queryset.update(is_private=True)
make_private.short_description = 'Make private'
def make_public(model, request, queryset):
queryset.update(is_private=False)
make_public.short_description = 'Make public' |
def find(key, dictionary):
"""
Generator to extract items from complex nested data structures
source: https://stackoverflow.com/questions/9807634/find-all-occurrences-of-a-key-in-nested-python-dictionaries-and-lists
:param key: Key to look for
:param dictionary: Object with nested dicts and lists
:return: generator with all values matching the desired key
"""
for k, v in dictionary.items():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
for d in v:
if isinstance(d, dict) or isinstance(d, list):
for result in find(key, d):
yield result
| def find(key, dictionary):
"""
Generator to extract items from complex nested data structures
source: https://stackoverflow.com/questions/9807634/find-all-occurrences-of-a-key-in-nested-python-dictionaries-and-lists
:param key: Key to look for
:param dictionary: Object with nested dicts and lists
:return: generator with all values matching the desired key
"""
for (k, v) in dictionary.items():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
for d in v:
if isinstance(d, dict) or isinstance(d, list):
for result in find(key, d):
yield result |
class FeedMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
if self.is_atom_feed(environ['PATH_INFO']):
def _start_response(status, headers, exc_info=None):
return start_response(status, self.set_charset(headers), exc_info)
else:
_start_response = start_response
return self.app(environ, _start_response)
@staticmethod
def set_charset(headers, charset='utf-8'):
for header in headers:
attr, value = header
if attr.lower() == 'content-type':
if '; ' not in value:
value += '; charset={}'.format(charset)
yield (attr, value)
@staticmethod
def is_atom_feed(path_info):
return path_info.startswith('/feeds/') and path_info.endswith('.atom')
| class Feedmiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
if self.is_atom_feed(environ['PATH_INFO']):
def _start_response(status, headers, exc_info=None):
return start_response(status, self.set_charset(headers), exc_info)
else:
_start_response = start_response
return self.app(environ, _start_response)
@staticmethod
def set_charset(headers, charset='utf-8'):
for header in headers:
(attr, value) = header
if attr.lower() == 'content-type':
if '; ' not in value:
value += '; charset={}'.format(charset)
yield (attr, value)
@staticmethod
def is_atom_feed(path_info):
return path_info.startswith('/feeds/') and path_info.endswith('.atom') |
var = 0
print("Hello!")
while var < 10:
print(10 - var, end="\n")
var += 2 | var = 0
print('Hello!')
while var < 10:
print(10 - var, end='\n')
var += 2 |
def main():
# input
ABCs = [*map(int, input().split())]
# compute
# output
print(2 * sum([ABCs[i-1]*ABCs[i] for i in range(3)]))
if __name__ == '__main__':
main()
| def main():
ab_cs = [*map(int, input().split())]
print(2 * sum([ABCs[i - 1] * ABCs[i] for i in range(3)]))
if __name__ == '__main__':
main() |
async def async_value(value):
"""
Gives an object which can be used in .thenReturn for methods that are coroutines
:param value: what should be returned after coroutine is awaited
:return: coroutine that can be awaited
"""
return value
# noinspection PyPep8Naming
class async_iter:
"""
Object that can be used in async for. Specify it in .thenReturn as needed.
"""
def __init__(self, *items: any) -> None:
self.not_done = list(items)
self.done = list()
async def __aiter__(self):
return self
async def __anext__(self):
if self.not_done:
self.done.append(self.not_done.pop())
if not self.done:
assert not self.not_done
raise StopAsyncIteration()
return self.done.pop() | async def async_value(value):
"""
Gives an object which can be used in .thenReturn for methods that are coroutines
:param value: what should be returned after coroutine is awaited
:return: coroutine that can be awaited
"""
return value
class Async_Iter:
"""
Object that can be used in async for. Specify it in .thenReturn as needed.
"""
def __init__(self, *items: any) -> None:
self.not_done = list(items)
self.done = list()
async def __aiter__(self):
return self
async def __anext__(self):
if self.not_done:
self.done.append(self.not_done.pop())
if not self.done:
assert not self.not_done
raise stop_async_iteration()
return self.done.pop() |
def get_larger(x, y):
if x > y:
return x
else:
return y
larger_value = get_larger(23, 32)
print(larger_value)
def add_numbers(x, y):
total = x + y
return total
print("This won't be printed")
print(add_numbers(4, 5))
#Comment and doc string
# few variables below
x = 10
y = 5
# make sum of the above two variables
# and store the result in z
z = x + y
print(z) # print the result
# print (x // y)
# another comment
def greet(word):
"""
Print a word with an
exclamation mark following it.
"""
print(word + "!")
def greet(word):
"""
Print a word with an
exclamation mark following it.
"""
print(word + "!")
# What the fucntion does?
print(greet.__doc__)
# Make sense, now lets use it
greet("Hello World")
def square_root(n):
"""Calculate the square root of a number.
Args:
n: the number to get the square root of.
Returns:
the square root of n.
Raises:
TypeError: if n is not a number.
ValueError: if n is negative.
"""
pass
| def get_larger(x, y):
if x > y:
return x
else:
return y
larger_value = get_larger(23, 32)
print(larger_value)
def add_numbers(x, y):
total = x + y
return total
print("This won't be printed")
print(add_numbers(4, 5))
x = 10
y = 5
z = x + y
print(z)
def greet(word):
"""
Print a word with an
exclamation mark following it.
"""
print(word + '!')
def greet(word):
"""
Print a word with an
exclamation mark following it.
"""
print(word + '!')
print(greet.__doc__)
greet('Hello World')
def square_root(n):
"""Calculate the square root of a number.
Args:
n: the number to get the square root of.
Returns:
the square root of n.
Raises:
TypeError: if n is not a number.
ValueError: if n is negative.
"""
pass |
class Worker:
""" An abstraction of a worker. """
def __init__(self, worker_id: str):
""" Create a worker instance.
Args:
worker_id: the id that uniquely identifies the user.
"""
self._worker_id = worker_id
def worker_id(self) -> str:
""" Get the id of this worker.
Returns:
worker_id (str) : the id of this worker.
"""
return self._worker_id
| class Worker:
""" An abstraction of a worker. """
def __init__(self, worker_id: str):
""" Create a worker instance.
Args:
worker_id: the id that uniquely identifies the user.
"""
self._worker_id = worker_id
def worker_id(self) -> str:
""" Get the id of this worker.
Returns:
worker_id (str) : the id of this worker.
"""
return self._worker_id |
"""
imutils/ml/aug/image/__init__.py
"""
| """
imutils/ml/aug/image/__init__.py
""" |
#Q.1 Convert tuples to list.
tup=(5,4,2,'a',16,'ram') #this is a tuples.
l=[] #this is empty list.
lenght=len(tup)
for i in (tup):
l.append(i)
print("list converted form tuples is :",l)
| tup = (5, 4, 2, 'a', 16, 'ram')
l = []
lenght = len(tup)
for i in tup:
l.append(i)
print('list converted form tuples is :', l) |
#A particularly hard problem to solve
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
#Suppose we have two arrays that are sorted
#l1 = [1,2,3]
#l2 = [4,5,6]
#L1 + L2 = [1,2,3,4,5,6]
#The median 3.5.
#Notice that the index where 3,4 are located is basically the maximum of the left split. And the right split of the union of the 2 arryas
#Well this implies a good algorithm too use
#We basically split the indexes of both arrays 2 parts each. First assume that 3 and 4 is where we can split off
#Then the left partitions [1,2,4] and right partition is [3,5,6]
#Then basically the the left partitions can be broken again on the median [1,2] and [2,4]
#The right partition is again brokn on the median [3,5] and [5,6]
#Notice that 2 and 5 were the medians on their respected parition we use discard them but then maximum(1,3) is used. And then minimum [4,6] is used.
#So averaging out (3,4) is 3.5
#The same idea applies when we add 2 sets and get odd numbers
#Get the lenghts of the two arrays
x = len(nums1)
y = len(nums2)
#Since we always want the median of the smaller array. We will want to swap them. If they are equal then this doesnt matter
#Since python is extremely anal about calling methods on itself in a clas. We have to say self
if y < x:
return self.findMedianSortedArrays(nums2,nums1)
start = 0
end = x
#If start becomes greater than the end then we cant partitition arrays in ascending order
while(start <= end):
#Create a partition based on the (start + (min(x,y))/2)
pivotx = int((start + end)/2)
pivoty = int((x + y + 1)/2) - pivotx
#These cases occur if find that a partition is the length of the entire array
#Particularly the mininums edge case occurs if the pivot winds up taking up the arrya
#The maximum edge cases occurs if the pivot gets completely reduced to zero
maxLeftX = -(sys.maxsize-1 ) if pivotx == 0 else nums1[pivotx-1]
minRightX = sys.maxsize if pivotx == x else nums1[pivotx]
maxLeftY = -(sys.maxsize-1) if pivoty == 0 else nums2[pivoty-1]
minRightY = sys.maxsize if pivoty == y else nums2[pivoty]
#We care about these specific integers to get the conclusion we so desired.
#Which is the maximum of the Left partitions of each array and the minimum of each partition in the Right partition of each arryas
#It is up the reader to understand why we can get the medium through these four numbers
if(maxLeftX <= minRightY and maxLeftY <= minRightX):
#We found the correct partition
#return their specific cases
#In the case of even. The median the average of the maximum(maxLeftx,maxLefty) and min(minRightX,minRightY)
if (x+y) % 2 == 0:
maximum = max(maxLeftX,maxLeftY)
minimum = min(minRightX,minRightY)
return float((maximum + minimum)/2 )
#Otherwise its the maximum between the maximum of the left partition of X and Y
else:
return float(max(maxLeftX,maxLeftY))
#We gone too far in the array. We need to move the pivot back
elif maxLeftX > minRightY:
end = pivotx -1
else:
#We gone too far back in the array. We need to the move the pivote forward
start = pivotx + 1
| class Solution:
def find_median_sorted_arrays(self, nums1: List[int], nums2: List[int]) -> float:
x = len(nums1)
y = len(nums2)
if y < x:
return self.findMedianSortedArrays(nums2, nums1)
start = 0
end = x
while start <= end:
pivotx = int((start + end) / 2)
pivoty = int((x + y + 1) / 2) - pivotx
max_left_x = -(sys.maxsize - 1) if pivotx == 0 else nums1[pivotx - 1]
min_right_x = sys.maxsize if pivotx == x else nums1[pivotx]
max_left_y = -(sys.maxsize - 1) if pivoty == 0 else nums2[pivoty - 1]
min_right_y = sys.maxsize if pivoty == y else nums2[pivoty]
if maxLeftX <= minRightY and maxLeftY <= minRightX:
if (x + y) % 2 == 0:
maximum = max(maxLeftX, maxLeftY)
minimum = min(minRightX, minRightY)
return float((maximum + minimum) / 2)
else:
return float(max(maxLeftX, maxLeftY))
elif maxLeftX > minRightY:
end = pivotx - 1
else:
start = pivotx + 1 |
epsilon = 0.001
def sqr_root(low,high,n,const_value):
mid = (low+high)/2.0
mid_2 = mid
for _i in range(n-1):
mid_2*=mid
dif = mid_2 - const_value
if abs(dif) <= epsilon:
return mid
elif mid_2 > const_value:
return sqr_root(low,mid,n,const_value)
elif mid_2 < const_value:
return sqr_root(mid,high,n,const_value)
def find_nth_root(value, n):
low = 0
high = value
return sqr_root(low,high,n,value)
def main():
print(find_nth_root(12345,3))
if __name__ == "__main__":
main()
| epsilon = 0.001
def sqr_root(low, high, n, const_value):
mid = (low + high) / 2.0
mid_2 = mid
for _i in range(n - 1):
mid_2 *= mid
dif = mid_2 - const_value
if abs(dif) <= epsilon:
return mid
elif mid_2 > const_value:
return sqr_root(low, mid, n, const_value)
elif mid_2 < const_value:
return sqr_root(mid, high, n, const_value)
def find_nth_root(value, n):
low = 0
high = value
return sqr_root(low, high, n, value)
def main():
print(find_nth_root(12345, 3))
if __name__ == '__main__':
main() |
#! /usr/bin/python3
# seesway.py -- This script counts from -10 to 10 and then back from 10 to -10
# Author -- Prince Oppong Boamah<regioths@gmail.com>
# Date -- 27th August 2015
for i in range(-10, 11): print(i)
for i in range(9, -1, -1): print(i)
for i in range(-10, 0): print(i)
| for i in range(-10, 11):
print(i)
for i in range(9, -1, -1):
print(i)
for i in range(-10, 0):
print(i) |
#WAP to input marks of 5 subject and find average and assign grade
sub1=int(input("Enter marks of the first subject: "))
sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
sub5=int(input("Enter marks of the fifth subject: "))
total=(sub1+sub2+sub3+sub4+sub4)
avg=total/5
if(avg>=90):
print("Grade: O")
elif(avg>=80 and avg<=89):
print("Grade: E")
elif(avg>=70 and avg<=79):
print("Grade: A")
elif(avg<70):
print("Grade: B") | sub1 = int(input('Enter marks of the first subject: '))
sub2 = int(input('Enter marks of the second subject: '))
sub3 = int(input('Enter marks of the third subject: '))
sub4 = int(input('Enter marks of the fourth subject: '))
sub5 = int(input('Enter marks of the fifth subject: '))
total = sub1 + sub2 + sub3 + sub4 + sub4
avg = total / 5
if avg >= 90:
print('Grade: O')
elif avg >= 80 and avg <= 89:
print('Grade: E')
elif avg >= 70 and avg <= 79:
print('Grade: A')
elif avg < 70:
print('Grade: B') |
"""Kata url: https://www.codewars.com/kata/5803c0c6ab6c20a06f000026."""
def swap_vowel_case(st: str) -> str:
return ''.join(
x.swapcase() if x.lower() in 'aeoui' else x for x in st
)
| """Kata url: https://www.codewars.com/kata/5803c0c6ab6c20a06f000026."""
def swap_vowel_case(st: str) -> str:
return ''.join((x.swapcase() if x.lower() in 'aeoui' else x for x in st)) |
class Solution:
def thirdMax(self, nums: List[int]) -> int:
maxs = [-float('inf'),-float('inf'),-float('inf')]
m = 0
for i in range(len(nums)):
if nums[i] not in maxs:
if m < 3 :
maxs[m] = nums[i]
m += 1
if m == 3:
maxs = sorted(maxs)
else:
if nums[i] > maxs[0]:
j = len(maxs) - 1
while j >= 0:
if nums[i] > maxs[j]:
for k in range(j):
maxs[k] = maxs[k+1]
maxs[j] = nums[i]
break
j -= 1
if m > 2:
return maxs[0]
else:
if maxs[0] > maxs[1]:
return maxs[0]
else:
return maxs[1] | class Solution:
def third_max(self, nums: List[int]) -> int:
maxs = [-float('inf'), -float('inf'), -float('inf')]
m = 0
for i in range(len(nums)):
if nums[i] not in maxs:
if m < 3:
maxs[m] = nums[i]
m += 1
if m == 3:
maxs = sorted(maxs)
elif nums[i] > maxs[0]:
j = len(maxs) - 1
while j >= 0:
if nums[i] > maxs[j]:
for k in range(j):
maxs[k] = maxs[k + 1]
maxs[j] = nums[i]
break
j -= 1
if m > 2:
return maxs[0]
elif maxs[0] > maxs[1]:
return maxs[0]
else:
return maxs[1] |
VERSION = '0.2'
TYPE = 'type'
LIBRML = 'libRML'
ITEM = 'item'
ID = 'id'
ACTIONS = 'actions'
RESTRICTIONS = 'restrictions'
PERMISSION = 'permission'
TENANT = 'tenant'
MENTION = 'mention'
SHARE = 'sharealike'
USAGEGUIDE = 'usageguide'
TEMPLATE = 'template'
#XML
XRESTRICTION = 'restriction'
XACTION = 'action'
XPART = 'part'
XGROUP = 'group'
XSUBNET = 'subnet'
XMACHINE = 'machine'
# Fieldnames
SUBNET = 'subnet'
GROUPS = 'groups'
PARTS = 'parts'
MINAGE = 'minage'
INSIDE = 'inside'
OUTSIDE = 'outside'
MACHINES = 'machines'
FROMDATE = 'fromdate'
TODATE = 'todate'
DURATION = 'duration'
COUNT = 'count'
SESSIONS = 'sessions'
WATERMARK = 'watermarkvalue'
COMMERCIAL = 'commercialuse'
NONCOMMERCIAL = 'noncommercialuse'
MAXRES = 'maxresolution'
MAXBIT = 'maxbitrate'
| version = '0.2'
type = 'type'
librml = 'libRML'
item = 'item'
id = 'id'
actions = 'actions'
restrictions = 'restrictions'
permission = 'permission'
tenant = 'tenant'
mention = 'mention'
share = 'sharealike'
usageguide = 'usageguide'
template = 'template'
xrestriction = 'restriction'
xaction = 'action'
xpart = 'part'
xgroup = 'group'
xsubnet = 'subnet'
xmachine = 'machine'
subnet = 'subnet'
groups = 'groups'
parts = 'parts'
minage = 'minage'
inside = 'inside'
outside = 'outside'
machines = 'machines'
fromdate = 'fromdate'
todate = 'todate'
duration = 'duration'
count = 'count'
sessions = 'sessions'
watermark = 'watermarkvalue'
commercial = 'commercialuse'
noncommercial = 'noncommercialuse'
maxres = 'maxresolution'
maxbit = 'maxbitrate' |
def factorial(n):
if(n == 0):
return 1
else:
return n*factorial(n-1)
if __name__ == "__main__":
number = int(input("Enter number:"))
print(f'Factorial of {number} is {factorial(number)}')
| def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
if __name__ == '__main__':
number = int(input('Enter number:'))
print(f'Factorial of {number} is {factorial(number)}') |
A = True
B = False
C = A and B
D = A or B
if C == True:
print("A and B is True.")
else:
print("A and B is False.")
if D == True:
print("A or B is True.")
else:
print("A or B is False.")
| a = True
b = False
c = A and B
d = A or B
if C == True:
print('A and B is True.')
else:
print('A and B is False.')
if D == True:
print('A or B is True.')
else:
print('A or B is False.') |
instr = [
"""Digit-symbol coding, part 1 (practice)
At the top of the screen you will see a row of symbols and
a row of numbers. Each symbol is paired with the number below
it.
You will also see one symbol and one number in the middle of
the screen. Your task is to decide whether they make a
correct pair. Respond 'Yes' (using the LEFT arrow key) if
they do and 'No' (using the RIGHT arrow key) if they
don't.
Press the SPACE BAR to begin.""",
"""Digit-symbol coding, part 2 (real test)
Now you will perform the real test. It is the same as the
practice, except there are more trials, and there is no
feedback. Try to complete as many trials as you can within
90 seconds without making mistakes.
Press the SPACE BAR to begin.""",
"""Digit-symbol coding, part 3 (real test)
Now you will perform the test again. It is exactly the same
as the last time. Try to complete as many trials as you can
within 90 seconds without making mistakes.
Press the SPACE BAR to begin.""",
"Correct! :)",
"Incorrect! :(",
]
| instr = ["Digit-symbol coding, part 1 (practice)\n\nAt the top of the screen you will see a row of symbols and\na row of numbers. Each symbol is paired with the number below\nit.\n\nYou will also see one symbol and one number in the middle of\nthe screen. Your task is to decide whether they make a\ncorrect pair. Respond 'Yes' (using the LEFT arrow key) if\nthey do and 'No' (using the RIGHT arrow key) if they\ndon't.\n\nPress the SPACE BAR to begin.", 'Digit-symbol coding, part 2 (real test)\n\nNow you will perform the real test. It is the same as the\npractice, except there are more trials, and there is no\nfeedback. Try to complete as many trials as you can within\n90 seconds without making mistakes.\n\nPress the SPACE BAR to begin.', 'Digit-symbol coding, part 3 (real test)\n\nNow you will perform the test again. It is exactly the same\nas the last time. Try to complete as many trials as you can\nwithin 90 seconds without making mistakes.\n\nPress the SPACE BAR to begin.', 'Correct! :)', 'Incorrect! :('] |
class Tile():
def __init__(self,bomb=False):
self.bomb = False
self.revealed = False
self.nearBombs = 0
def isBomb(self):
return self.bomb
def isRevealed(self):
return self.revealed
def setBomb(self):
self.bomb=True
def setNearBombs(self,near = 0):
self.nearBombs = near
def getNearBombs(self):
return self.nearBombs
def revealTile(self):
self.revealed = True
def printer(self):
if self.revealed:
if(self.bomb):
return "x"
if self.nearBombs == 0:
return " "
else:
return str(self.nearBombs)
else:
return "#"
def debugPrinter(self):
if self.bomb:
return "x"
if self.nearBombs == 0:
return " "
else:
return str(self.nearBombs)
| class Tile:
def __init__(self, bomb=False):
self.bomb = False
self.revealed = False
self.nearBombs = 0
def is_bomb(self):
return self.bomb
def is_revealed(self):
return self.revealed
def set_bomb(self):
self.bomb = True
def set_near_bombs(self, near=0):
self.nearBombs = near
def get_near_bombs(self):
return self.nearBombs
def reveal_tile(self):
self.revealed = True
def printer(self):
if self.revealed:
if self.bomb:
return 'x'
if self.nearBombs == 0:
return ' '
else:
return str(self.nearBombs)
else:
return '#'
def debug_printer(self):
if self.bomb:
return 'x'
if self.nearBombs == 0:
return ' '
else:
return str(self.nearBombs) |
OCTICON_FILE = """
<svg class="octicon octicon-file" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg>
"""
| octicon_file = '\n<svg class="octicon octicon-file" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg>\n' |
### CONFIGS ###
dataset = 'cora'
model = 'VGAE'
input_dim = 10
hidden1_dim = 32
hidden2_dim = 16
use_feature = True
num_epoch = 2000
learning_rate = 0.01 | dataset = 'cora'
model = 'VGAE'
input_dim = 10
hidden1_dim = 32
hidden2_dim = 16
use_feature = True
num_epoch = 2000
learning_rate = 0.01 |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a=[*open(0)][1].split()
a,b=[a.count('100'),a.count('200')]
print('YNEOS'[(a+2*b)%2 or b%2 and a<2::2]) | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a = [*open(0)][1].split()
(a, b) = [a.count('100'), a.count('200')]
print('YNEOS'[(a + 2 * b) % 2 or (b % 2 and a < 2)::2]) |
# clut.py.
#
# clut.py Teletext colour lookup table
# Maintains colour lookups
#
# Copyright (c) 2020 Peter Kwan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# This holds the colour lookup tables read in by packet 28 etc.
# I think we have four CLUTs 0 to 3. Here is what the standard says:
## 8 background full intensity colours:
## Magenta, Cyan, White. Black, Red, Green, Yellow, Blue,
## 7 foreground full intensity colours:
## Cyan, White. Red, Green, Yellow, Blue, Magenta,
## Invoked as spacing attributes via codes in packets X/0 to X/25.
## Black foreground: Invoked as a spacing attribute via codes in packets X/0
## to X/25.
## 32 colours per page. The Colour Map contains four CLUTs
## (numbered 0 - 3), each of 8 entries. Each entry has a four bit resolution for
## the RGB components, subclause 12.4.
## Presentation
## Level
## 1 1.5 2.5 3.5
## { { ~ ~
## ~ ~ ~ ~
## { { ~ ~
## { { ~ ~
## Colour Definition
## CLUT 0 defaults to the full intensity colours used as spacing colour
## attributes at Levels 1 and 1.5.
## CLUT 1, entry 0 is defined to be transparent. CLUT 1, entries 1 to 7 default
## to half intensity versions of CLUT 0, entries 1 to 7.
## CLUTs 2 and 3 have the default values specified in subclause 12.4. CLUTs
## 2 and 3 can be defined for a particular page by packet X/28/0 Format 1, or
## for all pages in magazine M by packet M/29/0.
## Colour Selection
## CLUT 0, entries 1 to 7 are selectable directly by the Level 1 data as
## spacing attributes. CLUTs 0 to 3 are selectable via packets 26 or objects
## as non-spacing attributes.
## The foreground and background colour codes on the Level 1 page may be
## used to select colours from other parts of the Colour Map. Different CLUTs
## may be selected for both foreground and background colours.
## This mapping information is transmitted in packet X/28/0 Format 1 for the
## associated page and in packet M/29/0 for all pages in magazine M.
## With the exception of entry 0 in CLUT 1 (transparent), CLUTs 0 and 1 can
## be redefined for a particular page by packet X/28/4, or
##
class Clut:
def __init__(self):
print ("Clut loaded")
self.clut0 = [0] * 8 # Default full intensity colours
self.clut1 = [0] * 8 # default half intensity colours
self.clut2 = [0] * 8
self.clut3 = [0] * 8
# set defaults
self.reset()
# Used by X26/0 to swap entire cluts
# @param colour - Colour index 0..7
# @param remap - Remap 0..7
# @param foreground - True for foreground coilour, or False for background
# @return - Colour string for tkinter. eg. 'black' or '#000'
def RemapColourTable(self, colourIndex, remap, foreground):
if type(colourIndex) != int:
print('[RemapColourTable] colourIndex is not an integer' + colourIndex + ". foreground = " +str(foreground))
clutIndex = 0
if foreground:
if remap>4:
clutIndex = 2
elif remap<3:
clutIndex = 0
else:
clutIndex = 1
else: # background
if remap < 3:
clutIndex = remap
elif remap == 3 or remap == 5:
clutIndex = 1
elif remap == 4 or remap == 6:
clutIndex = 2
else:
clutIndex = 3
return self.get_value(clutIndex, colourIndex)
def reset(self): # To values from table 12.4
# CLUT 0 full intensity
self.clut0[0] = '#000' # black
self.clut0[1] = '#f00' # red
self.clut0[2] = '#0f0' # green
self.clut0[3] = '#ff0' # yellow
self.clut0[4] = '#00f' # blue
self.clut0[5] = '#f0f' # magenta
self.clut0[6] = '#0ff' # cyan
self.clut0[7] = '#fff' # white
# CLUT 1 half intensity
self.clut1[0] = '#000' # transparent
self.clut1[1] = '#700' # half red
self.clut1[2] = '#070' # half green
self.clut1[3] = '#770' # half yellow
self.clut1[4] = '#007' # half blue
self.clut1[5] = '#707' # half magenta
self.clut1[6] = '#077' # half cyan
self.clut1[7] = '#777' # half white
# CLUT 2 lovely colours
self.clut2[0] = '#f05' # crimsonish
self.clut2[1] = '#f70' # orangish
self.clut2[2] = '#0f7' # blueish green
self.clut2[3] = '#ffb' # pale yellow
self.clut2[4] = '#0ca' # cyanish
self.clut2[5] = '#500' # dark red
self.clut2[6] = '#652' # hint of a tint of runny poo
self.clut2[7] = '#c77' # gammon
# CLUT 3 more lovely colours
self.clut3[0] = '#333' # pastel black
self.clut3[1] = '#f77' # pastel red
self.clut3[2] = '#7f7' # pastel green
self.clut3[3] = '#ff7' # pastel yellow
self.clut3[4] = '#77f' # pastel blue
self.clut3[5] = '#f7f' # pastel magenta
self.clut3[6] = '#7ff' # pastel cyan
self.clut3[7] = '#ddd' # pastel white
# set a value in a particular clut
# Get the colour from a particular clut
# Probably want to record which cluts are selected
# Lots of stuff
# @param colour - 12 bit web colour string eg. '#1ab'
# @param clut_index CLUT index 0 to 3
# @param clr_index - 0..7 colour index
def set_value(self, colour, clut_index, clr_index):
clr_index = clr_index % 8 # need to trap this a bit better. This is masking a problem
clut_index = clut_index % 4
if clut_index==0:
self.clut0[clr_index] = colour;
if clut_index==1:
self.clut1[clr_index] = colour;
if clut_index==2:
self.clut2[clr_index] = colour;
if clut_index==3:
self.clut3[clr_index] = colour;
print("clut value: clut" + str(clut_index) + " set[" + str(clr_index) + '] = ' + colour)
# @return colour - 12 bit web colour string eg. '#1ab'
# @param clut_index CLUT index 0 to 3
# @param clr_index - 0..7 colour index
def get_value(self, clut_index, clr_index):
clut_index = clut_index % 4
clr_index = clr_index % 8
if clut_index == 0:
return self.clut0[clr_index]
if clut_index == 1:
return self.clut1[clr_index]
if clut_index == 2:
return self.clut2[clr_index]
if clut_index == 3:
return self.clut3[clr_index]
return 0 # just in case!
# debug dump the clut contents
def dump(self):
print("[Dump] CLUT values")
for i in range(8):
print(self.clut0[i] + ', ', end='')
print()
for i in range(8):
print(self.clut1[i] + ', ', end='')
print()
for i in range(8):
print(self.clut2[i] + ', ', end='')
print()
for i in range(8):
print(self.clut3[i] + ', ', end='')
print()
clut = Clut()
| class Clut:
def __init__(self):
print('Clut loaded')
self.clut0 = [0] * 8
self.clut1 = [0] * 8
self.clut2 = [0] * 8
self.clut3 = [0] * 8
self.reset()
def remap_colour_table(self, colourIndex, remap, foreground):
if type(colourIndex) != int:
print('[RemapColourTable] colourIndex is not an integer' + colourIndex + '. foreground = ' + str(foreground))
clut_index = 0
if foreground:
if remap > 4:
clut_index = 2
elif remap < 3:
clut_index = 0
else:
clut_index = 1
elif remap < 3:
clut_index = remap
elif remap == 3 or remap == 5:
clut_index = 1
elif remap == 4 or remap == 6:
clut_index = 2
else:
clut_index = 3
return self.get_value(clutIndex, colourIndex)
def reset(self):
self.clut0[0] = '#000'
self.clut0[1] = '#f00'
self.clut0[2] = '#0f0'
self.clut0[3] = '#ff0'
self.clut0[4] = '#00f'
self.clut0[5] = '#f0f'
self.clut0[6] = '#0ff'
self.clut0[7] = '#fff'
self.clut1[0] = '#000'
self.clut1[1] = '#700'
self.clut1[2] = '#070'
self.clut1[3] = '#770'
self.clut1[4] = '#007'
self.clut1[5] = '#707'
self.clut1[6] = '#077'
self.clut1[7] = '#777'
self.clut2[0] = '#f05'
self.clut2[1] = '#f70'
self.clut2[2] = '#0f7'
self.clut2[3] = '#ffb'
self.clut2[4] = '#0ca'
self.clut2[5] = '#500'
self.clut2[6] = '#652'
self.clut2[7] = '#c77'
self.clut3[0] = '#333'
self.clut3[1] = '#f77'
self.clut3[2] = '#7f7'
self.clut3[3] = '#ff7'
self.clut3[4] = '#77f'
self.clut3[5] = '#f7f'
self.clut3[6] = '#7ff'
self.clut3[7] = '#ddd'
def set_value(self, colour, clut_index, clr_index):
clr_index = clr_index % 8
clut_index = clut_index % 4
if clut_index == 0:
self.clut0[clr_index] = colour
if clut_index == 1:
self.clut1[clr_index] = colour
if clut_index == 2:
self.clut2[clr_index] = colour
if clut_index == 3:
self.clut3[clr_index] = colour
print('clut value: clut' + str(clut_index) + ' set[' + str(clr_index) + '] = ' + colour)
def get_value(self, clut_index, clr_index):
clut_index = clut_index % 4
clr_index = clr_index % 8
if clut_index == 0:
return self.clut0[clr_index]
if clut_index == 1:
return self.clut1[clr_index]
if clut_index == 2:
return self.clut2[clr_index]
if clut_index == 3:
return self.clut3[clr_index]
return 0
def dump(self):
print('[Dump] CLUT values')
for i in range(8):
print(self.clut0[i] + ', ', end='')
print()
for i in range(8):
print(self.clut1[i] + ', ', end='')
print()
for i in range(8):
print(self.clut2[i] + ', ', end='')
print()
for i in range(8):
print(self.clut3[i] + ', ', end='')
print()
clut = clut() |
# record all kinds of type
# pm type
LINKEDIN_TYPE = 1
PM_LANG_ITEM_TYPE = 0
PM_CITY_ITEM_TYPE = 1
PM_SERVICE_ITEM_TYPE = 2
REALTOR_MESSAGE_TYPE = 3
#quiz type
PM_QUIZ_TYPE = 0
#pm inspection report note type
PM_INSPECTION_REPORT_TYPE = 3
PM_EXPENSE_TYPE = 4
#user progress bar
USER_PROGRESS_BAR_TYPE = 0
HOME_PROGRESS_BAR_TYPE = 1
#pm bill incomes type
PM_INCOME_TYPE = 0
#picture type
PIC_AVATAR_TYPE = 0
PIC_URL_TYPE = 1
#file type
FILE_S3_TYPE = 0
#status log type
STATUS_LOG_USER_TYPE = 0
#extra file type
EXTRA_USER_INSPECTION_REPORT_TYPE = 0
EXTRA_USER_CONTRACT_TYEP = 1
#submit type
EXPENSE_SUBMIT_TYPE = 0
# census report type
CENSUS_REPORT_TYPE_STATE = 0
CENSUS_REPORT_TYPE_MSA = 1
CENSUS_REPORT_TYPE_COUNTY = 2
CENSUS_REPORT_TYPE_CITY = 3
CENSUS_REPORT_TYPE_TOWN = 4
CENSUS_REPORT_TYPE_NEIGHBORHOOD = 5
CENSUS_REPORT_TYPE_ZIPCODE = 6
| linkedin_type = 1
pm_lang_item_type = 0
pm_city_item_type = 1
pm_service_item_type = 2
realtor_message_type = 3
pm_quiz_type = 0
pm_inspection_report_type = 3
pm_expense_type = 4
user_progress_bar_type = 0
home_progress_bar_type = 1
pm_income_type = 0
pic_avatar_type = 0
pic_url_type = 1
file_s3_type = 0
status_log_user_type = 0
extra_user_inspection_report_type = 0
extra_user_contract_tyep = 1
expense_submit_type = 0
census_report_type_state = 0
census_report_type_msa = 1
census_report_type_county = 2
census_report_type_city = 3
census_report_type_town = 4
census_report_type_neighborhood = 5
census_report_type_zipcode = 6 |
if request.isInit:
lastVal = 0
else:
if lastVal == 0:
lastVal = 1
else:
lastVal = (lastVal << 1) & 0xFFFFFFFF
request.value = lastVal
| if request.isInit:
last_val = 0
else:
if lastVal == 0:
last_val = 1
else:
last_val = lastVal << 1 & 4294967295
request.value = lastVal |
# Copyright 2009, UCAR/Unidata
# Enumerate the kinds of Sax Events received by the SaxEventHandler
STARTDOCUMENT = 1
ENDDOCUMENT = 2
STARTELEMENT = 3
ENDELEMENT = 4
ATTRIBUTE = 5
CHARACTERS = 6
# Define printable output
_MAP = {
STARTDOCUMENT: "STARTDOCUMENT",
ENDDOCUMENT: "ENDDOCUMENT",
STARTELEMENT: "STARTELEMENT",
ENDELEMENT: "ENDELEMENT",
ATTRIBUTE: "ATTRIBUTE",
CHARACTERS: "CHARACTERS"
}
def tostring(t) :
return _MAP[t]
| startdocument = 1
enddocument = 2
startelement = 3
endelement = 4
attribute = 5
characters = 6
_map = {STARTDOCUMENT: 'STARTDOCUMENT', ENDDOCUMENT: 'ENDDOCUMENT', STARTELEMENT: 'STARTELEMENT', ENDELEMENT: 'ENDELEMENT', ATTRIBUTE: 'ATTRIBUTE', CHARACTERS: 'CHARACTERS'}
def tostring(t):
return _MAP[t] |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""
Defines some constants used in chemical calculations.
"""
# multiplicative conversions
N_A = 6.02214129e23 # particles per mol
KCAL_PER_MOL_TO_J_PER_MOLECULE = 6.947695e-21
HARTREE_TO_KCAL_PER_MOL = 627.509474
HARTREE_TO_J_PER_MOL = 2625499.63922
HARTREE_TO_KJ_PER_MOL = 2625.49963922
HARTREE_TO_PER_CM = 219474.63
J_PER_MOL_TO_PER_CM = 0.08359347178
CAL_TO_J = 4.184
HARTREE_TO_J = 4.3597443380807824e-18 # HARTREE_TO_J_PER_MOL / N_A
J_TO_HARTREE = 2.293712480489655e17 # 1.0 / HARTREE_TO_J
M_TO_ANGSTROM = 1e10
ANGSTROM_TO_M = 1e-10
# physical constants
C_CM_PER_S = 2.9979245800e10
C_M_PER_S = 2.9979245800e8
HBAR_J_S = 1.054571800e-34 # note this is h/2Pi
H_J_S = 6.62607015e-34
KB_J_PER_K = 1.3806488e-23
| """
Defines some constants used in chemical calculations.
"""
n_a = 6.02214129e+23
kcal_per_mol_to_j_per_molecule = 6.947695e-21
hartree_to_kcal_per_mol = 627.509474
hartree_to_j_per_mol = 2625499.63922
hartree_to_kj_per_mol = 2625.49963922
hartree_to_per_cm = 219474.63
j_per_mol_to_per_cm = 0.08359347178
cal_to_j = 4.184
hartree_to_j = 4.3597443380807824e-18
j_to_hartree = 2.293712480489655e+17
m_to_angstrom = 10000000000.0
angstrom_to_m = 1e-10
c_cm_per_s = 29979245800.0
c_m_per_s = 299792458.0
hbar_j_s = 1.0545718e-34
h_j_s = 6.62607015e-34
kb_j_per_k = 1.3806488e-23 |
def select_k_items(stream, n, k):
reservoir = []
for i in range(k):
reservoir.append(stream[i])
if __name__ == '__main__':
stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
n = len(stream)
k = 5
select_k_items(stream, n, k) | def select_k_items(stream, n, k):
reservoir = []
for i in range(k):
reservoir.append(stream[i])
if __name__ == '__main__':
stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
n = len(stream)
k = 5
select_k_items(stream, n, k) |
#! python3
"""A printing shop runs 16 batches (jobs) every week and each batch requires a
sheet of special colour-proofing paper of size A5.
Every Monday morning, the foreman opens a new envelope, containing a large
sheet of the special paper with size A1.
He proceeds to cut it in half, thus getting two sheets of size A2.
Then he cuts one of them in half to get two sheets of size A3 and so on until
he obtains the A5-size sheet needed for the first batch of the week.
All the unused sheets are placed back in the envelope.
At the beginning of each subsequent batch, he takes from the envelope one sheet
of paper at random. If it is of size A5, he uses it. If it is larger,
he repeats the 'cut-in-half' procedure until he has what he needs and any
remaining sheets are always placed back in the envelope.
Excluding the first and last batch of the week, find the expected number of
times (during each week) that the foreman finds a single sheet of paper
in the envelope."""
def choose(sheets, chosen):
new = sheets[:]
new.remove(chosen)
if chosen != 5:
new.extend(range(chosen + 1, 6))
return new
def f(sheets):
if sheets == [5]:
return 0
total = len(sheets)
out = total == 1
for i in set(sheets):
out += (sheets.count(i) / total) * f(choose(sheets, i))
return out
value = f([2, 3, 4, 5])
print(round(value, 6))
| """A printing shop runs 16 batches (jobs) every week and each batch requires a
sheet of special colour-proofing paper of size A5.
Every Monday morning, the foreman opens a new envelope, containing a large
sheet of the special paper with size A1.
He proceeds to cut it in half, thus getting two sheets of size A2.
Then he cuts one of them in half to get two sheets of size A3 and so on until
he obtains the A5-size sheet needed for the first batch of the week.
All the unused sheets are placed back in the envelope.
At the beginning of each subsequent batch, he takes from the envelope one sheet
of paper at random. If it is of size A5, he uses it. If it is larger,
he repeats the 'cut-in-half' procedure until he has what he needs and any
remaining sheets are always placed back in the envelope.
Excluding the first and last batch of the week, find the expected number of
times (during each week) that the foreman finds a single sheet of paper
in the envelope."""
def choose(sheets, chosen):
new = sheets[:]
new.remove(chosen)
if chosen != 5:
new.extend(range(chosen + 1, 6))
return new
def f(sheets):
if sheets == [5]:
return 0
total = len(sheets)
out = total == 1
for i in set(sheets):
out += sheets.count(i) / total * f(choose(sheets, i))
return out
value = f([2, 3, 4, 5])
print(round(value, 6)) |
class Solution:
def majorityElement(self, nums: list[int]) -> list[int]:
candidate1, candidate2 = 0, 0
count1, count2 = 0, 0
for num in nums:
if candidate1 == num:
count1 += 1
continue
if candidate2 == num:
count2 += 1
continue
# NOTE: count checks must come AFTER candidate == num checks
# to ensure we're not adding the count of an already existing
# candidate to the a new number instead.
if count1 == 0:
candidate1 = num
count1 += 1
continue
if count2 == 0:
candidate2 = num
count2 += 1
continue
# If we have reached this point,
# we have found 3 different items, which we can count out.
count1 -= 1
count2 -= 1
result = set()
for candidate in (candidate1, candidate2):
if nums.count(candidate) > len(nums) // 3:
result.add(candidate)
return list(result)
tests = [
(
([3, 2, 3],),
[3],
),
(
([1],),
[1],
),
(
([1, 2],),
[1, 2],
),
(
([2, 2],),
[2],
),
(
([2, 1, 1, 3, 1, 4, 5, 6],),
[1],
),
]
| class Solution:
def majority_element(self, nums: list[int]) -> list[int]:
(candidate1, candidate2) = (0, 0)
(count1, count2) = (0, 0)
for num in nums:
if candidate1 == num:
count1 += 1
continue
if candidate2 == num:
count2 += 1
continue
if count1 == 0:
candidate1 = num
count1 += 1
continue
if count2 == 0:
candidate2 = num
count2 += 1
continue
count1 -= 1
count2 -= 1
result = set()
for candidate in (candidate1, candidate2):
if nums.count(candidate) > len(nums) // 3:
result.add(candidate)
return list(result)
tests = [(([3, 2, 3],), [3]), (([1],), [1]), (([1, 2],), [1, 2]), (([2, 2],), [2]), (([2, 1, 1, 3, 1, 4, 5, 6],), [1])] |
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def GetNumSuffixes(start_state):
"""Compute number of minimal suffixes automaton accepts from each state.
For each state reachable from given state, compute number of paths in the
automaton that start from that state, end in the accepting state and do not
pass through accepting states in between.
It is assumed that there are no cyclic paths going entirely through
non-accepting states.
Args:
start_state: start state (as defined in dfa_parser.py).
Returns:
Dictionary from reachable states to numbers of suffixes.
"""
num_suffixes = {}
def ComputeNumSuffixes(state):
if state in num_suffixes:
return
if state.is_accepting:
num_suffixes[state] = 1
# Even though the state itself is accepting, there may be more reachable
# states behind it.
for t in state.forward_transitions.values():
ComputeNumSuffixes(t.to_state)
return
if state.any_byte:
next_state = state.forward_transitions[0].to_state
ComputeNumSuffixes(next_state)
num_suffixes[state] = num_suffixes[next_state]
return
count = 0
for t in state.forward_transitions.values():
ComputeNumSuffixes(t.to_state)
count += num_suffixes[t.to_state]
num_suffixes[state] = count
ComputeNumSuffixes(start_state)
return num_suffixes
def TraverseTree(state, final_callback, prefix, anyfield=0x01):
if state.is_accepting:
final_callback(prefix)
return
if state.any_byte:
assert anyfield < 256
TraverseTree(
state.forward_transitions[0].to_state,
final_callback,
prefix + [anyfield],
anyfield=0 if anyfield == 0 else anyfield + 0x11)
# We add 0x11 each time to get sequence 01 12 23 etc.
# TODO(shcherbina): change it to much nicer 0x22 once
# http://code.google.com/p/nativeclient/issues/detail?id=3164 is fixed
# (right now we want to keep immediates small to avoid problem with sign
# extension).
else:
for byte, t in state.forward_transitions.iteritems():
TraverseTree(
t.to_state,
final_callback,
prefix + [byte],
anyfield)
def CreateTraversalTasks(states, initial_state):
"""Create list of DFA traversal subtasks (handy for parallelization).
Note that unlike TraverseTree function, which stops on accepting states,
here we go past initial state even when it's accepted.
Args:
initial_state: initial state of the automaton.
Returns:
List of (prefix, state_index) pairs, where prefix is list of bytes.
"""
assert not initial_state.any_byte
num_suffixes = GetNumSuffixes(initial_state)
# Split by first three bytes.
tasks = []
for byte1, t1 in sorted(initial_state.forward_transitions.items()):
state1 = t1.to_state
if state1.any_byte or state1.is_accepting or num_suffixes[state1] < 10**4:
tasks.append(([byte1], states.index(state1)))
continue
for byte2, t2 in sorted(state1.forward_transitions.items()):
state2 = t2.to_state
if state2.any_byte or state2.is_accepting or num_suffixes[state2] < 10**4:
tasks.append(([byte1, byte2], states.index(state2)))
continue
for byte3, t3 in sorted(state2.forward_transitions.items()):
state3 = t3.to_state
tasks.append(([byte1, byte2, byte3], states.index(state3)))
return tasks
| def get_num_suffixes(start_state):
"""Compute number of minimal suffixes automaton accepts from each state.
For each state reachable from given state, compute number of paths in the
automaton that start from that state, end in the accepting state and do not
pass through accepting states in between.
It is assumed that there are no cyclic paths going entirely through
non-accepting states.
Args:
start_state: start state (as defined in dfa_parser.py).
Returns:
Dictionary from reachable states to numbers of suffixes.
"""
num_suffixes = {}
def compute_num_suffixes(state):
if state in num_suffixes:
return
if state.is_accepting:
num_suffixes[state] = 1
for t in state.forward_transitions.values():
compute_num_suffixes(t.to_state)
return
if state.any_byte:
next_state = state.forward_transitions[0].to_state
compute_num_suffixes(next_state)
num_suffixes[state] = num_suffixes[next_state]
return
count = 0
for t in state.forward_transitions.values():
compute_num_suffixes(t.to_state)
count += num_suffixes[t.to_state]
num_suffixes[state] = count
compute_num_suffixes(start_state)
return num_suffixes
def traverse_tree(state, final_callback, prefix, anyfield=1):
if state.is_accepting:
final_callback(prefix)
return
if state.any_byte:
assert anyfield < 256
traverse_tree(state.forward_transitions[0].to_state, final_callback, prefix + [anyfield], anyfield=0 if anyfield == 0 else anyfield + 17)
else:
for (byte, t) in state.forward_transitions.iteritems():
traverse_tree(t.to_state, final_callback, prefix + [byte], anyfield)
def create_traversal_tasks(states, initial_state):
"""Create list of DFA traversal subtasks (handy for parallelization).
Note that unlike TraverseTree function, which stops on accepting states,
here we go past initial state even when it's accepted.
Args:
initial_state: initial state of the automaton.
Returns:
List of (prefix, state_index) pairs, where prefix is list of bytes.
"""
assert not initial_state.any_byte
num_suffixes = get_num_suffixes(initial_state)
tasks = []
for (byte1, t1) in sorted(initial_state.forward_transitions.items()):
state1 = t1.to_state
if state1.any_byte or state1.is_accepting or num_suffixes[state1] < 10 ** 4:
tasks.append(([byte1], states.index(state1)))
continue
for (byte2, t2) in sorted(state1.forward_transitions.items()):
state2 = t2.to_state
if state2.any_byte or state2.is_accepting or num_suffixes[state2] < 10 ** 4:
tasks.append(([byte1, byte2], states.index(state2)))
continue
for (byte3, t3) in sorted(state2.forward_transitions.items()):
state3 = t3.to_state
tasks.append(([byte1, byte2, byte3], states.index(state3)))
return tasks |
memo=[0, 1]
def fib_digits(n):
if len(memo)==2:
for i in range(2, 100001):
memo.append(memo[i-1]+memo[i-2])
num=str(memo[n])
res=[]
for i in range(0,10):
check=num.count(str(i))
if check:
res.append((check, i))
return sorted(res, reverse=True) | memo = [0, 1]
def fib_digits(n):
if len(memo) == 2:
for i in range(2, 100001):
memo.append(memo[i - 1] + memo[i - 2])
num = str(memo[n])
res = []
for i in range(0, 10):
check = num.count(str(i))
if check:
res.append((check, i))
return sorted(res, reverse=True) |
# Question 1: Write a program that asks the user to enter a string. The program should then print the following:
# a) The total number of characters in the string
# b) The string repeated 10 times
# c) The first character of the string
# d) The first three characters of the string
# e) The last three characters of the string
# f) The string backwards
# g) The seventh character of the string if the string is long enough and a message otherwise
# h) The string with its first and last characters removed
# i) The string in all caps
# j) The string with every a replaced with an e
# k) The string with every character replaced by an *
string=input("enter a string")
print(len(string))
print(string*10)
print(string[0])
print(string[0:3])
print(string[-3:])
print(string[: :-1])
if len(string) >= 7:
print(string[7])
else:
print("the string is shorter than 7 charecters")
print(string[1:-1])
print(string.upper())
print(string.replace('a', 'e'))
print('*'*len(string)) | string = input('enter a string')
print(len(string))
print(string * 10)
print(string[0])
print(string[0:3])
print(string[-3:])
print(string[::-1])
if len(string) >= 7:
print(string[7])
else:
print('the string is shorter than 7 charecters')
print(string[1:-1])
print(string.upper())
print(string.replace('a', 'e'))
print('*' * len(string)) |
_base_ = [
'../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py'
]
model = dict(
backbone=dict(
type='CBSwinTransformer',
),
neck=dict(
type='CBFPN',
),
test_cfg = dict(
rcnn=dict(
score_thr=0.001,
nms=dict(type='soft_nms'),
)
)
)
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
albu_train_transforms = [
dict(
type='ShiftScaleRotate',
shift_limit=0.0,
scale_limit=0.0,
rotate_limit=20,
interpolation=1,
p=0.2),
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='AutoAugment',
policies=[
[
dict(type='Resize',
img_scale=[(320, 320), (384, 384), (448, 448),
(512, 512), (576, 576)],
multiscale_mode='value',
keep_ratio=True)
],
[
dict(type='Resize',
img_scale=[(320, 320), (576, 576)],
multiscale_mode='value',
keep_ratio=True),
dict(type='RandomCrop',
crop_type='absolute_range',
crop_size=(320, 320),
allow_negative_crop=True),
dict(type='Resize',
img_scale=[(320, 320), (384, 384), (448, 448),
(512, 512), (576, 576)],
multiscale_mode='value',
override=True,
keep_ratio=True)
]
]),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=[(320, 320), (576, 576)],
flip=True,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
samples_per_gpu=2
data = dict(samples_per_gpu=samples_per_gpu,
train=dict(pipeline=train_pipeline),
val=dict(pipeline=test_pipeline),
test=dict(pipeline=test_pipeline))
optimizer = dict(lr=0.0001*(samples_per_gpu/2))
| _base_ = ['../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py']
model = dict(backbone=dict(type='CBSwinTransformer'), neck=dict(type='CBFPN'), test_cfg=dict(rcnn=dict(score_thr=0.001, nms=dict(type='soft_nms'))))
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
albu_train_transforms = [dict(type='ShiftScaleRotate', shift_limit=0.0, scale_limit=0.0, rotate_limit=20, interpolation=1, p=0.2)]
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='AutoAugment', policies=[[dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', keep_ratio=True)], [dict(type='Resize', img_scale=[(320, 320), (576, 576)], multiscale_mode='value', keep_ratio=True), dict(type='RandomCrop', crop_type='absolute_range', crop_size=(320, 320), allow_negative_crop=True), dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', override=True, keep_ratio=True)]]), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])]
test_pipeline = [dict(type='LoadImageFromFile'), dict(type='MultiScaleFlipAug', img_scale=[(320, 320), (576, 576)], flip=True, transforms=[dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])])]
samples_per_gpu = 2
data = dict(samples_per_gpu=samples_per_gpu, train=dict(pipeline=train_pipeline), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline))
optimizer = dict(lr=0.0001 * (samples_per_gpu / 2)) |
def test_index(man):
errors = []
G = man.writeTest()
G.addIndex("Person", "name")
G.addVertex("1", "Person", {"name": "marko", "age": "29"})
G.addVertex("2", "Person", {"name": "vadas", "age": "27"})
G.addVertex("3", "Software", {"name": "lop", "lang": "java"})
G.addVertex("4", "Person", {"name": "josh", "age": "32"})
G.addVertex("5", "Software", {"name": "ripple", "lang": "java"})
G.addVertex("6", "Person", {"name": "peter", "age": "35"})
G.addVertex("7", "Person", {"name": "marko", "age": "35"})
G.addEdge("1", "3", "created", {"weight": 0.4})
G.addEdge("1", "2", "knows", {"weight": 0.5})
G.addEdge("1", "4", "knows", {"weight": 1.0})
G.addEdge("4", "3", "created", {"weight": 0.4})
G.addEdge("6", "3", "created", {"weight": 0.2})
G.addEdge("4", "5", "created", {"weight": 1.0})
resp = G.listIndices()
found = False
for i in resp:
if i["field"] == "name" and i["label"] == "Person":
found = True
if not found:
errors.append("Expected index not found")
return errors
| def test_index(man):
errors = []
g = man.writeTest()
G.addIndex('Person', 'name')
G.addVertex('1', 'Person', {'name': 'marko', 'age': '29'})
G.addVertex('2', 'Person', {'name': 'vadas', 'age': '27'})
G.addVertex('3', 'Software', {'name': 'lop', 'lang': 'java'})
G.addVertex('4', 'Person', {'name': 'josh', 'age': '32'})
G.addVertex('5', 'Software', {'name': 'ripple', 'lang': 'java'})
G.addVertex('6', 'Person', {'name': 'peter', 'age': '35'})
G.addVertex('7', 'Person', {'name': 'marko', 'age': '35'})
G.addEdge('1', '3', 'created', {'weight': 0.4})
G.addEdge('1', '2', 'knows', {'weight': 0.5})
G.addEdge('1', '4', 'knows', {'weight': 1.0})
G.addEdge('4', '3', 'created', {'weight': 0.4})
G.addEdge('6', '3', 'created', {'weight': 0.2})
G.addEdge('4', '5', 'created', {'weight': 1.0})
resp = G.listIndices()
found = False
for i in resp:
if i['field'] == 'name' and i['label'] == 'Person':
found = True
if not found:
errors.append('Expected index not found')
return errors |
DEFAULT_CHUNK_SIZE = 1000
def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE):
qs = qs._clone()
qs.query.clear_ordering(force_empty=True)
qs.query.add_ordering('pk')
last_pk = None
empty = False
while not empty:
sub_qs = qs
if last_pk:
sub_qs = sub_qs.filter(pk__gt=last_pk)
sub_qs = sub_qs[:size]
empty = True
for o in sub_qs:
last_pk = o.pk
empty = False
yield o
| default_chunk_size = 1000
def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE):
qs = qs._clone()
qs.query.clear_ordering(force_empty=True)
qs.query.add_ordering('pk')
last_pk = None
empty = False
while not empty:
sub_qs = qs
if last_pk:
sub_qs = sub_qs.filter(pk__gt=last_pk)
sub_qs = sub_qs[:size]
empty = True
for o in sub_qs:
last_pk = o.pk
empty = False
yield o |
indent = 3
key = "foo"
print('\n%s%*s' % (indent, len(key)+3, 'Hello')) # ok: variable length
print("%.*f" % (indent, 1.2345))
def myprint(x, *args):
print("%.3f %.4f %10.3f %1.*f" % (x, x, x, 3, x))
myprint(3)
| indent = 3
key = 'foo'
print('\n%s%*s' % (indent, len(key) + 3, 'Hello'))
print('%.*f' % (indent, 1.2345))
def myprint(x, *args):
print('%.3f %.4f %10.3f %1.*f' % (x, x, x, 3, x))
myprint(3) |
class Admin_string_literal:
def __init__(self):
Admin_string_literal.admin_menu_string = """
Select the operation to perfrom:
1. Create a Topic
2. Remove a Topic
3. Restrict a Topic
4. Purge a Topic
5. Edit a Message
6. Delete a Message
7. See last 10 subscriber
8. See last 10 publishers
Enter your option:
"""
Admin_string_literal()
| class Admin_String_Literal:
def __init__(self):
Admin_string_literal.admin_menu_string = '\n Select the operation to perfrom:\n 1. Create a Topic\n 2. Remove a Topic\n 3. Restrict a Topic\n 4. Purge a Topic\n 5. Edit a Message\n 6. Delete a Message\n 7. See last 10 subscriber\n 8. See last 10 publishers\n\n Enter your option:\n '
admin_string_literal() |
def max_sum_of_increasing_subseq(seq: list[int]) -> int:
"""
O(n^2) time, O(n) extra space
"""
if not seq:
return 0
max_sum = [0 for _ in seq] # the answer to the question if you have end on index i
# max sum ending on index i is seq[i] + prev biggest sum, corresponding to some j < i
for i in range(len(seq)):
for j in range(i):
if seq[j] <= seq[i]:
max_sum[i] = max(max_sum[i], max_sum[j])
max_sum[i] += seq[i]
return max(max_sum)
class IntsAndSum:
def __init__(self, ints: list[int], precomputed_sum: int = None):
self.ints: list[int] = ints
self.sum: int = precomputed_sum if precomputed_sum is not None else sum(ints)
def __repr__(self):
return f'{self.__class__.__name__}({self.ints}, sum={self.sum})'
@staticmethod
def max(*args):
return max(args, key=lambda x: x.sum)
def append(self, i: int) -> None:
self.ints.append(i)
self.sum += i
def copy(self):
return IntsAndSum(ints=self.ints.copy(), precomputed_sum=self.sum)
def max_sum_of_increasing_subseq_with_elements(seq: list[int]) -> IntsAndSum:
"""
O(n^2) time, O(n^2) extra space
"""
if not seq:
return IntsAndSum(ints=[])
max_sum = [IntsAndSum(ints=[]) for _ in seq] # the answer to the question if you have end on index i
# max sum ending on index i is seq[i] + prev biggest sum, corresponding to some j < i
for i in range(len(seq)): # loop invariant: max_sum[i] is fully computed/ constant after ith iteration
for j in range(i):
if seq[j] <= seq[i]:
max_sum[i] = IntsAndSum.max(max_sum[i], max_sum[j])
max_sum[i] = max_sum[i].copy()
max_sum[i].append(seq[i])
return IntsAndSum.max(*max_sum)
def main():
s0 = max_sum_of_increasing_subseq([]) # should be 0
s1 = max_sum_of_increasing_subseq([6, 5, 7, 2, 3, 200, 4, 5]) # should be 6+7+200 = 213
s2 = max_sum_of_increasing_subseq([3, 4, 5, 6, 20]) # should be 3+4+5+6+20 = 38
print(s0, s1, s2)
s0 = max_sum_of_increasing_subseq_with_elements([]) # should be 0
s1 = max_sum_of_increasing_subseq_with_elements([6, 5, 7, 2, 3, 200, 4, 5]) # should be 6+7+200 = 213
s2 = max_sum_of_increasing_subseq_with_elements([3, 4, 5, 6, 20]) # should be 3+4+5+6+20 = 38
print(s0)
print(s1)
print(s2)
s3 = max_sum_of_increasing_subseq([8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11]) # should be 8+12+14 = 34
l3 = max_sum_of_increasing_subseq_with_elements([8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11])
print(s3)
print(l3)
if __name__ == '__main__':
main()
| def max_sum_of_increasing_subseq(seq: list[int]) -> int:
"""
O(n^2) time, O(n) extra space
"""
if not seq:
return 0
max_sum = [0 for _ in seq]
for i in range(len(seq)):
for j in range(i):
if seq[j] <= seq[i]:
max_sum[i] = max(max_sum[i], max_sum[j])
max_sum[i] += seq[i]
return max(max_sum)
class Intsandsum:
def __init__(self, ints: list[int], precomputed_sum: int=None):
self.ints: list[int] = ints
self.sum: int = precomputed_sum if precomputed_sum is not None else sum(ints)
def __repr__(self):
return f'{self.__class__.__name__}({self.ints}, sum={self.sum})'
@staticmethod
def max(*args):
return max(args, key=lambda x: x.sum)
def append(self, i: int) -> None:
self.ints.append(i)
self.sum += i
def copy(self):
return ints_and_sum(ints=self.ints.copy(), precomputed_sum=self.sum)
def max_sum_of_increasing_subseq_with_elements(seq: list[int]) -> IntsAndSum:
"""
O(n^2) time, O(n^2) extra space
"""
if not seq:
return ints_and_sum(ints=[])
max_sum = [ints_and_sum(ints=[]) for _ in seq]
for i in range(len(seq)):
for j in range(i):
if seq[j] <= seq[i]:
max_sum[i] = IntsAndSum.max(max_sum[i], max_sum[j])
max_sum[i] = max_sum[i].copy()
max_sum[i].append(seq[i])
return IntsAndSum.max(*max_sum)
def main():
s0 = max_sum_of_increasing_subseq([])
s1 = max_sum_of_increasing_subseq([6, 5, 7, 2, 3, 200, 4, 5])
s2 = max_sum_of_increasing_subseq([3, 4, 5, 6, 20])
print(s0, s1, s2)
s0 = max_sum_of_increasing_subseq_with_elements([])
s1 = max_sum_of_increasing_subseq_with_elements([6, 5, 7, 2, 3, 200, 4, 5])
s2 = max_sum_of_increasing_subseq_with_elements([3, 4, 5, 6, 20])
print(s0)
print(s1)
print(s2)
s3 = max_sum_of_increasing_subseq([8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11])
l3 = max_sum_of_increasing_subseq_with_elements([8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11])
print(s3)
print(l3)
if __name__ == '__main__':
main() |
class TextXLSError(Exception):
"""Indicates a generic textX-LS-core error."""
pass
class GenerateExtensionError(TextXLSError):
"""Indicates an error while generating an extension."""
def __init__(self, target, cmd_args):
super().__init__(
"Failed to generate the extension for '{}' with following arguments: '{}'.".format(
target, cmd_args
)
)
self.target = target
self.cmd_args = cmd_args
class GenerateSyntaxHighlightError(TextXLSError):
"""Indicates an error while generating a syntax highlighting data."""
def __init__(self, project_name, target):
super().__init__(
"Failed to generate syntax highlighting for project '{}' and target '{}'.".format(
project_name, target
)
)
self.project_name = project_name
self.target = target
class InstallTextXProjectError(TextXLSError):
"""Indicates an error while installing a textX project."""
def __init__(self, project_name, dist_location, detailed_err_msg):
super().__init__(
"Failed to install project: {} ({}).".format(project_name, dist_location)
)
self.project_name = project_name
self.dist_location = dist_location
self.detailed_err_msg = detailed_err_msg
class UninstallTextXProjectError(TextXLSError):
"""Indicates an error while uninstalling a textX project."""
def __init__(self, project_name, detailed_err_msg):
super().__init__("Failed to uninstall project: {}".format(project_name))
self.project_name = project_name
self.detailed_err_msg = detailed_err_msg
class LanguageNotRegistered(TextXLSError):
"""Indicates an error if language can't be parsed with any of registered metamodels.
"""
def __init__(self, file_name):
super().__init__(
"There are no metamodels that can parse '{}'.".format(file_name)
)
class MultipleLanguagesError(TextXLSError):
"""Indicates an error if language can be parsed with multiple registered metamodels.
"""
def __init__(self, file_name):
super().__init__(
"Multiple languages can parse '{}'. Install appropriate extension and select language id.".format(
file_name
)
)
| class Textxlserror(Exception):
"""Indicates a generic textX-LS-core error."""
pass
class Generateextensionerror(TextXLSError):
"""Indicates an error while generating an extension."""
def __init__(self, target, cmd_args):
super().__init__("Failed to generate the extension for '{}' with following arguments: '{}'.".format(target, cmd_args))
self.target = target
self.cmd_args = cmd_args
class Generatesyntaxhighlighterror(TextXLSError):
"""Indicates an error while generating a syntax highlighting data."""
def __init__(self, project_name, target):
super().__init__("Failed to generate syntax highlighting for project '{}' and target '{}'.".format(project_name, target))
self.project_name = project_name
self.target = target
class Installtextxprojecterror(TextXLSError):
"""Indicates an error while installing a textX project."""
def __init__(self, project_name, dist_location, detailed_err_msg):
super().__init__('Failed to install project: {} ({}).'.format(project_name, dist_location))
self.project_name = project_name
self.dist_location = dist_location
self.detailed_err_msg = detailed_err_msg
class Uninstalltextxprojecterror(TextXLSError):
"""Indicates an error while uninstalling a textX project."""
def __init__(self, project_name, detailed_err_msg):
super().__init__('Failed to uninstall project: {}'.format(project_name))
self.project_name = project_name
self.detailed_err_msg = detailed_err_msg
class Languagenotregistered(TextXLSError):
"""Indicates an error if language can't be parsed with any of registered metamodels.
"""
def __init__(self, file_name):
super().__init__("There are no metamodels that can parse '{}'.".format(file_name))
class Multiplelanguageserror(TextXLSError):
"""Indicates an error if language can be parsed with multiple registered metamodels.
"""
def __init__(self, file_name):
super().__init__("Multiple languages can parse '{}'. Install appropriate extension and select language id.".format(file_name)) |
class Floodfill:
"""abstract floodfill class, must specify _is_in_region() condition and
_fill() operation"""
def __init__(self):
pass
def floodfill(self, x, y):
Q = []
if not self._is_in_region(x,y):
return
Q.append([x,y])
while Q != []:
w,z = Q.pop(0)
e = w
while self._is_in_region(w-1,z):
w-=1
while self._is_in_region(e+1,z):
e+=1
for n in range(w, e+1):
self._fill(n,z)
if self._is_in_region(n,z+1):
Q.append([n,z+1])
if self._is_in_region(n,z-1):
Q.append([n,z-1])
def _is_in_region(self, x, y):
pass
def _fill(self, x, y):
pass
| class Floodfill:
"""abstract floodfill class, must specify _is_in_region() condition and
_fill() operation"""
def __init__(self):
pass
def floodfill(self, x, y):
q = []
if not self._is_in_region(x, y):
return
Q.append([x, y])
while Q != []:
(w, z) = Q.pop(0)
e = w
while self._is_in_region(w - 1, z):
w -= 1
while self._is_in_region(e + 1, z):
e += 1
for n in range(w, e + 1):
self._fill(n, z)
if self._is_in_region(n, z + 1):
Q.append([n, z + 1])
if self._is_in_region(n, z - 1):
Q.append([n, z - 1])
def _is_in_region(self, x, y):
pass
def _fill(self, x, y):
pass |
PAGES_FOLDER = 'pages'
PUBLIC_FOLDER = 'public'
STATIC_FOLDER = 'static'
TEMPLATE_NAME = 'template.mustache'
| pages_folder = 'pages'
public_folder = 'public'
static_folder = 'static'
template_name = 'template.mustache' |
teisuu = 1
suuji_kous = 3
aru = 2
zenn = 0
for ai in range(suuji_kous):
zenn += teisuu*aru**ai
print(zenn)
| teisuu = 1
suuji_kous = 3
aru = 2
zenn = 0
for ai in range(suuji_kous):
zenn += teisuu * aru ** ai
print(zenn) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.