hexsha
string | size
int64 | ext
string | lang
string | max_stars_repo_path
string | max_stars_repo_name
string | max_stars_repo_head_hexsha
string | max_stars_repo_licenses
list | max_stars_count
int64 | max_stars_repo_stars_event_min_datetime
string | max_stars_repo_stars_event_max_datetime
string | max_issues_repo_path
string | max_issues_repo_name
string | max_issues_repo_head_hexsha
string | max_issues_repo_licenses
list | max_issues_count
int64 | max_issues_repo_issues_event_min_datetime
string | max_issues_repo_issues_event_max_datetime
string | max_forks_repo_path
string | max_forks_repo_name
string | max_forks_repo_head_hexsha
string | max_forks_repo_licenses
list | max_forks_count
int64 | max_forks_repo_forks_event_min_datetime
string | max_forks_repo_forks_event_max_datetime
string | content
string | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | qsc_code_num_words_quality_signal
int64 | qsc_code_num_chars_quality_signal
float64 | qsc_code_mean_word_length_quality_signal
float64 | qsc_code_frac_words_unique_quality_signal
float64 | qsc_code_frac_chars_top_2grams_quality_signal
float64 | qsc_code_frac_chars_top_3grams_quality_signal
float64 | qsc_code_frac_chars_top_4grams_quality_signal
float64 | qsc_code_frac_chars_dupe_5grams_quality_signal
float64 | qsc_code_frac_chars_dupe_6grams_quality_signal
float64 | qsc_code_frac_chars_dupe_7grams_quality_signal
float64 | qsc_code_frac_chars_dupe_8grams_quality_signal
float64 | qsc_code_frac_chars_dupe_9grams_quality_signal
float64 | qsc_code_frac_chars_dupe_10grams_quality_signal
float64 | qsc_code_frac_chars_replacement_symbols_quality_signal
float64 | qsc_code_frac_chars_digital_quality_signal
float64 | qsc_code_frac_chars_whitespace_quality_signal
float64 | qsc_code_size_file_byte_quality_signal
float64 | qsc_code_num_lines_quality_signal
float64 | qsc_code_num_chars_line_max_quality_signal
float64 | qsc_code_num_chars_line_mean_quality_signal
float64 | qsc_code_frac_chars_alphabet_quality_signal
float64 | qsc_code_frac_chars_comments_quality_signal
float64 | qsc_code_cate_xml_start_quality_signal
float64 | qsc_code_frac_lines_dupe_lines_quality_signal
float64 | qsc_code_cate_autogen_quality_signal
float64 | qsc_code_frac_lines_long_string_quality_signal
float64 | qsc_code_frac_chars_string_length_quality_signal
float64 | qsc_code_frac_chars_long_word_length_quality_signal
float64 | qsc_code_frac_lines_string_concat_quality_signal
float64 | qsc_code_cate_encoded_data_quality_signal
float64 | qsc_code_frac_chars_hex_words_quality_signal
float64 | qsc_code_frac_lines_prompt_comments_quality_signal
float64 | qsc_code_frac_lines_assert_quality_signal
float64 | qsc_codepython_cate_ast_quality_signal
float64 | qsc_codepython_frac_lines_func_ratio_quality_signal
float64 | qsc_codepython_cate_var_zero_quality_signal
bool | qsc_codepython_frac_lines_pass_quality_signal
float64 | qsc_codepython_frac_lines_import_quality_signal
float64 | qsc_codepython_frac_lines_simplefunc_quality_signal
float64 | qsc_codepython_score_lines_no_logic_quality_signal
float64 | qsc_codepython_frac_lines_print_quality_signal
float64 | qsc_code_num_words
int64 | qsc_code_num_chars
int64 | qsc_code_mean_word_length
int64 | qsc_code_frac_words_unique
null | qsc_code_frac_chars_top_2grams
int64 | qsc_code_frac_chars_top_3grams
int64 | qsc_code_frac_chars_top_4grams
int64 | qsc_code_frac_chars_dupe_5grams
int64 | qsc_code_frac_chars_dupe_6grams
int64 | qsc_code_frac_chars_dupe_7grams
int64 | qsc_code_frac_chars_dupe_8grams
int64 | qsc_code_frac_chars_dupe_9grams
int64 | qsc_code_frac_chars_dupe_10grams
int64 | qsc_code_frac_chars_replacement_symbols
int64 | qsc_code_frac_chars_digital
int64 | qsc_code_frac_chars_whitespace
int64 | qsc_code_size_file_byte
int64 | qsc_code_num_lines
int64 | qsc_code_num_chars_line_max
int64 | qsc_code_num_chars_line_mean
int64 | qsc_code_frac_chars_alphabet
int64 | qsc_code_frac_chars_comments
int64 | qsc_code_cate_xml_start
int64 | qsc_code_frac_lines_dupe_lines
int64 | qsc_code_cate_autogen
int64 | qsc_code_frac_lines_long_string
int64 | qsc_code_frac_chars_string_length
int64 | qsc_code_frac_chars_long_word_length
int64 | qsc_code_frac_lines_string_concat
null | qsc_code_cate_encoded_data
int64 | qsc_code_frac_chars_hex_words
int64 | qsc_code_frac_lines_prompt_comments
int64 | qsc_code_frac_lines_assert
int64 | qsc_codepython_cate_ast
int64 | qsc_codepython_frac_lines_func_ratio
int64 | qsc_codepython_cate_var_zero
int64 | qsc_codepython_frac_lines_pass
int64 | qsc_codepython_frac_lines_import
int64 | qsc_codepython_frac_lines_simplefunc
int64 | qsc_codepython_score_lines_no_logic
int64 | qsc_codepython_frac_lines_print
int64 | effective
string | hits
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9298357a4dc62d29858ed4860ad34b7ba0fc46df
| 201
|
py
|
Python
|
Week 6/Exercises/exceptions.py
|
diegoamato/CS50x-Harvard
|
68088df4b8e28660c3db2217053fb9bc0ec1b0e6
|
[
"MIT"
] | 1
|
2022-03-02T21:08:05.000Z
|
2022-03-02T21:08:05.000Z
|
Week 6/Exercises/exceptions.py
|
diegoamato/CS50x-Harvard
|
68088df4b8e28660c3db2217053fb9bc0ec1b0e6
|
[
"MIT"
] | null | null | null |
Week 6/Exercises/exceptions.py
|
diegoamato/CS50x-Harvard
|
68088df4b8e28660c3db2217053fb9bc0ec1b0e6
|
[
"MIT"
] | null | null | null |
try:
x = int(input("X: "))
except ValueError:
print("That is not an int!")
exit()
try:
y = int(input("Y: "))
except ValueError:
print("That is not an int!")
exit()
print (x + y)
| 18.272727
| 32
| 0.552239
| 31
| 201
| 3.580645
| 0.419355
| 0.144144
| 0.378378
| 0.45045
| 0.702703
| 0.702703
| 0.702703
| 0.702703
| 0.702703
| 0
| 0
| 0
| 0.263682
| 201
| 11
| 33
| 18.272727
| 0.75
| 0
| 0
| 0.727273
| 0
| 0
| 0.217822
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.272727
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
2b8bd28ce04b5fd4acf0cc41262eab11cebbc67a
| 100
|
py
|
Python
|
soccer_geometry/src/soccer_geometry/__init__.py
|
utra-robosoccer/soccerbot
|
f5e95b00356e42cdd143ab26f67f23c9cd8afd5a
|
[
"BSD-3-Clause"
] | 56
|
2016-12-25T22:29:00.000Z
|
2022-01-06T04:42:00.000Z
|
soccer_geometry/src/soccer_geometry/__init__.py
|
utra-robosoccer/soccerbot
|
f5e95b00356e42cdd143ab26f67f23c9cd8afd5a
|
[
"BSD-3-Clause"
] | 244
|
2021-04-05T03:22:25.000Z
|
2022-03-31T16:47:36.000Z
|
soccer_geometry/src/soccer_geometry/__init__.py
|
utra-robosoccer/soccerbot
|
f5e95b00356e42cdd143ab26f67f23c9cd8afd5a
|
[
"BSD-3-Clause"
] | 7
|
2017-01-24T23:38:07.000Z
|
2022-01-19T16:58:08.000Z
|
from soccer_geometry.transformation import Transformation
from soccer_geometry.camera import Camera
| 33.333333
| 57
| 0.9
| 12
| 100
| 7.333333
| 0.5
| 0.227273
| 0.409091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.08
| 100
| 2
| 58
| 50
| 0.956522
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
920225d0654e6ffe227c0453cac77689989d81bd
| 5,897
|
py
|
Python
|
pyda/utilities/AssimilationVis.py
|
hickmank/pyda
|
7a2f04bd752e9c75bc8dcd2a45b21ff549736fa6
|
[
"Apache-2.0"
] | 7
|
2015-03-04T02:33:21.000Z
|
2020-11-30T22:10:40.000Z
|
pyda/utilities/AssimilationVis.py
|
lastproxy/pyda
|
7a2f04bd752e9c75bc8dcd2a45b21ff549736fa6
|
[
"Apache-2.0"
] | 10
|
2015-04-06T08:01:37.000Z
|
2017-04-25T03:12:35.000Z
|
pyda/utilities/AssimilationVis.py
|
lastproxy/pyda
|
7a2f04bd752e9c75bc8dcd2a45b21ff549736fa6
|
[
"Apache-2.0"
] | 4
|
2017-10-31T10:29:06.000Z
|
2021-11-09T21:02:54.000Z
|
# Module of functions for different visualizations of a data
# assimilation process.
import numpy as np
import matplotlib.pyplot as plt
# NOTE: This visualization assumes that the data being assimilated is
# a scalar. Uses percentile (100.0*Quantile) cone visualization as
# opposed to trajectory visualization. This will provide a decent
# starting point for designing application specific visualizations for
# data assimilation with ODE systems.
def ode_DA_vis1(SimDim,DataFileName,EnsembleFileName,AnalysisFileName):
# First load respective files into NumPy arrays and set ensemble size
DataArray = np.loadtxt(DataFileName,delimiter='\t',skiprows=1)
Ndata_pts = DataArray.shape[0]
# Pull out data time
datatime = DataArray[:,0]
# Pull out data timeseries
DataSeries = DataArray[:,1]
# Define percentiles
pLev = [5.0, 25.0, 50.0, 75.0, 95.0]
# Import analysis ensemble data
AnalysisArray = np.loadtxt(AnalysisFileName)
# Grab analysis time
analysistime = AnalysisArray[:,0]
# Pull array of last simulation dimension of runs
# NOTE: This should be fixed to either specify which simulation
# dimension to graph or cycle through each simulation dimension
# and create many subplots/plots.
AnalysisSeries = AnalysisArray[:,SimDim::SimDim]
# Import ensemble data
EnsembleArray = np.loadtxt(EnsembleFileName)
# Grab analysis time
ensembletime = EnsembleArray[:,0]
# Pull array of last simulation dimension of runs
# NOTE: This should be fixed to either specify which simulation
# dimension to graph or cycle through each simulation dimension
# and create many subplots/plots.
EnsembleSeries = EnsembleArray[:,SimDim::SimDim]
# Calculate ensemble percentile curves
EnPcnt = np.percentile(EnsembleSeries,pLev,axis=1)
# Calculate analysis quantile curves
AnPcnt = np.percentile(AnalysisSeries,pLev,axis=1)
# Only plot one group of analysis ensemble runs
plt.figure(1)
# Plot 90% cone
plt.subplot(1,2,1)
plt.fill_between(ensembletime,EnPcnt[0],EnPcnt[4],
color=(158./255.,202./255.,225./255.),alpha=0.5)
# Plot 50% cone
plt.subplot(1,2,1)
plt.fill_between(ensembletime,EnPcnt[1],EnPcnt[3],
color=(49./255.,130./255.,189./255.),alpha=0.5)
# Plot median forecast
plt.subplot(1,2,1)
plt.plot(ensembletime,EnPcnt[2],'r-',linewidth=2, label='Median Forecast')
# Plot data over ensemble plot
plt.subplot(1,2,1)
plt.plot(datatime, DataSeries, 'yD', label='Data')
# Label the plot
plt.title('ODE Data Assimilation (Ensemble)')
plt.ylabel('Simulation')
plt.xlabel('Time')
plt.xlim([0.0,datatime[-1]])
plt.legend()
# Plot 90% cone
plt.subplot(1,2,2)
plt.fill_between(analysistime,AnPcnt[0],AnPcnt[4],
color=(158./255.,202./255.,225./255.),alpha=0.5)
# Plot 50% cone
plt.subplot(1,2,2)
plt.fill_between(analysistime,AnPcnt[1],AnPcnt[3],
color=(49./255.,130./255.,189./255.),alpha=0.5)
# Plot median forecast
plt.subplot(1,2,2)
plt.plot(analysistime,AnPcnt[2],'r-',linewidth=2, label='Median Forecast')
# Plot data over ensemble plot
plt.subplot(1,2,2)
plt.plot(datatime, DataSeries, 'yD', label='Data')
# Label the plot
plt.title('ODE Data Assimilation (Analysis)')
plt.ylabel('Simulation')
plt.xlabel('Time')
plt.xlim([0.0,datatime[-1]])
plt.legend()
# Display image
plt.show()
######################################################################
######################################################################
# NOTE: This visualization assumes that the data being assimilated is
# a scalar. Uses trajectory visualization. This will provide a decent
# starting point for designing application specific visualizations for
# data assimilation with ODE systems.
def ode_DA_vis2(SimDim,DataFileName,EnsembleFileName,AnalysisFileName):
# First load respective files into NumPy arrays and set ensemble size
DataArray = np.loadtxt(DataFileName,delimiter='\t',skiprows=1)
Ndata_pts = DataArray.shape[0]
# Pull out data time
datatime = DataArray[:,0]
# Pull out data timeseries
DataSeries = DataArray[:,1]
# Import analysis ensemble data
AnalysisArray = np.loadtxt(AnalysisFileName)
# Grab analysis time
analysistime = AnalysisArray[:,0]
# Pull array of last simulation dimension of runs
# NOTE: This should be fixed to either specify which simulation
# dimension to graph or cycle through each simulation dimension
# and create many subplots/plots.
AnalysisSeries = AnalysisArray[:,SimDim::SimDim]
# Import ensemble data
EnsembleArray = np.loadtxt(EnsembleFileName)
# Grab analysis time
ensembletime = EnsembleArray[:,0]
# Pull array of last simulation dimension of runs
# NOTE: This should be fixed to either specify which simulation
# dimension to graph or cycle through each simulation dimension
# and create many subplots/plots.
EnsembleSeries = EnsembleArray[:,SimDim::SimDim]
EnSize = EnsembleSeries.shape[1]
plt.figure(1)
for i in range(EnSize):
# Light Blue: color=(36./255.,164./255.,239./255.)
plt.plot(ensembletime,EnsembleSeries[:,i],color=(161./255.,218./255.,180./255.),linewidth=.2)
plt.plot(analysistime,AnalysisSeries[:,i],color=(37./255.,52./255.,148./255.),linewidth=.2)
plt.plot(datatime, DataSeries, 'yD', label='Data')
# Label the plot
plt.title('ODE Data Assimilation')
plt.ylabel('Simulation')
plt.xlabel('Time')
plt.xlim([0.0,datatime[-1]])
# Display image
plt.show()
######################################################################
######################################################################
| 35.957317
| 101
| 0.655079
| 737
| 5,897
| 5.227951
| 0.233379
| 0.059175
| 0.022839
| 0.024916
| 0.818583
| 0.810278
| 0.810278
| 0.802751
| 0.802751
| 0.802751
| 0
| 0.046351
| 0.191453
| 5,897
| 163
| 102
| 36.177914
| 0.761745
| 0.383585
| 0
| 0.714286
| 0
| 0
| 0.055539
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028571
| false
| 0
| 0.028571
| 0
| 0.057143
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a6179f4603c9a826fe1c415a8c702ef5146911ea
| 5,325
|
py
|
Python
|
make_dataset_list.py
|
rajahaseeb147/Alzheimers_final
|
dd9b8607ec47b4317cb139e8c78c3c0b3c8ca1b8
|
[
"MIT"
] | null | null | null |
make_dataset_list.py
|
rajahaseeb147/Alzheimers_final
|
dd9b8607ec47b4317cb139e8c78c3c0b3c8ca1b8
|
[
"MIT"
] | null | null | null |
make_dataset_list.py
|
rajahaseeb147/Alzheimers_final
|
dd9b8607ec47b4317cb139e8c78c3c0b3c8ca1b8
|
[
"MIT"
] | null | null | null |
import os, argparse
def make_list(path):
f = open(os.path.join(path, 'images.txt'), 'w')
ff = open(os.path.join(path, 'image_class_labels.txt'), 'w')
i = 0
for dirlist in os.listdir(path):
if dirlist != '.DS_Store' and dirlist != 'images_AD_CN.txt' and dirlist != 'image_class_labels_AD_CN.txt' \
and dirlist != 'images.txt' and dirlist != 'image_class_labels.txt' and dirlist != 'images_MCI_CN.txt' \
and dirlist != 'image_class_labels_MCI_CN.txt' and dirlist != 'images_AD_MCI.txt' and dirlist != 'image_class_labels_AD_MCI.txt':
for imagelist in os.listdir(os.path.join(path, dirlist)):
if dirlist == 'AD':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 0\n'
f.write(name)
ff.write(name2)
i += 1
elif dirlist == 'MCI':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 1\n'
f.write(name)
ff.write(name2)
i += 1
else:
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 2\n'
f.write(name)
ff.write(name2)
i += 1
f.close()
ff.close()
f = open(os.path.join(path, 'images_AD_CN.txt'), 'w')
ff = open(os.path.join(path, 'image_class_labels_AD_CN.txt'), 'w')
i = 0
for dirlist in os.listdir(path):
if dirlist != '.DS_Store' and dirlist != 'images_AD_CN.txt' and dirlist != 'image_class_labels_AD_CN.txt' \
and dirlist != 'images.txt' and dirlist != 'image_class_labels.txt' and dirlist != 'images_MCI_CN.txt' \
and dirlist != 'image_class_labels_MCI_CN.txt' and dirlist != 'images_AD_MCI.txt' and dirlist != 'image_class_labels_AD_MCI.txt':
for imagelist in os.listdir(os.path.join(path, dirlist)):
if dirlist == 'AD':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 0\n'
f.write(name)
ff.write(name2)
i += 1
elif dirlist == 'CN':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 1\n'
f.write(name)
ff.write(name2)
i += 1
f.close()
ff.close()
f = open(os.path.join(path, 'images_AD_MCI.txt'), 'w')
ff = open(os.path.join(path, 'image_class_labels_AD_MCI.txt'), 'w')
i = 0
for dirlist in os.listdir(path):
if dirlist != '.DS_Store' and dirlist != 'images_AD_CN.txt' and dirlist != 'image_class_labels_AD_CN.txt' \
and dirlist != 'images.txt' and dirlist != 'image_class_labels.txt' and dirlist != 'images_MCI_CN.txt' \
and dirlist != 'image_class_labels_MCI_CN.txt' and dirlist != 'images_AD_MCI.txt' and dirlist != 'image_class_labels_AD_MCI.txt':
for imagelist in os.listdir(os.path.join(path, dirlist)):
if dirlist == 'AD':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 0\n'
f.write(name)
ff.write(name2)
i += 1
elif dirlist == 'MCI':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 1\n'
f.write(name)
ff.write(name2)
i += 1
f.close()
ff.close()
f = open(os.path.join(path, 'images_MCI_CN.txt'), 'w')
ff = open(os.path.join(path, 'image_class_labels_MCI_CN.txt'), 'w')
i = 0
for dirlist in os.listdir(path):
if dirlist != '.DS_Store' and dirlist != 'images_AD_CN.txt' and dirlist != 'image_class_labels_AD_CN.txt' \
and dirlist != 'images.txt' and dirlist != 'image_class_labels.txt' and dirlist != 'images_MCI_CN.txt' \
and dirlist != 'image_class_labels_MCI_CN.txt' and dirlist != 'images_AD_MCI.txt' and dirlist != 'image_class_labels_AD_MCI.txt':
for imagelist in os.listdir(os.path.join(path, dirlist)):
if dirlist == 'MCI':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 0\n'
f.write(name)
ff.write(name2)
i += 1
elif dirlist == 'CN':
name = str(i) + ' ' + os.path.join(dirlist, imagelist) + '\n'
name2 = str(i) + ' 1\n'
f.write(name)
ff.write(name2)
i += 1
f.close()
ff.close()
if __name__ == '__main__':
parser = argparse.ArgumentParser('argument for training')
parser.add_argument('--dataset_path', type=str, default='/data/tm/alzh/SSIM_PGGAN_data')
opt = parser.parse_args()
make_list(os.path.join(opt.dataset_path, 'train'))
make_list(os.path.join(opt.dataset_path, 'validation'))
| 49.305556
| 145
| 0.504977
| 679
| 5,325
| 3.78056
| 0.088365
| 0.124659
| 0.1418
| 0.093494
| 0.923257
| 0.923257
| 0.920919
| 0.91118
| 0.886249
| 0.886249
| 0
| 0.011598
| 0.3523
| 5,325
| 108
| 146
| 49.305556
| 0.732676
| 0
| 0
| 0.813725
| 0
| 0
| 0.197709
| 0.106834
| 0
| 0
| 0
| 0
| 0
| 1
| 0.009804
| false
| 0
| 0.009804
| 0
| 0.019608
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a6b8e8dd3dce2838c263288c2fa3e58405e5915a
| 812
|
py
|
Python
|
pyNastran/dev/bdf_vectorized/test/all_tests.py
|
ACea15/pyNastran
|
5ffc37d784b52c882ea207f832bceb6b5eb0e6d4
|
[
"BSD-3-Clause"
] | 293
|
2015-03-22T20:22:01.000Z
|
2022-03-14T20:28:24.000Z
|
pyNastran/dev/bdf_vectorized/test/all_tests.py
|
ACea15/pyNastran
|
5ffc37d784b52c882ea207f832bceb6b5eb0e6d4
|
[
"BSD-3-Clause"
] | 512
|
2015-03-14T18:39:27.000Z
|
2022-03-31T16:15:43.000Z
|
pyNastran/dev/bdf_vectorized/test/all_tests.py
|
ACea15/pyNastran
|
5ffc37d784b52c882ea207f832bceb6b5eb0e6d4
|
[
"BSD-3-Clause"
] | 136
|
2015-03-19T03:26:06.000Z
|
2022-03-25T22:14:54.000Z
|
from pyNastran.dev.bdf_vectorized.test.test_coords import *
from pyNastran.dev.bdf_vectorized.test.test_mass import *
from pyNastran.dev.bdf_vectorized.cards.elements.solid.test_solids import *
from pyNastran.dev.bdf_vectorized.cards.elements.shell.test_shell import *
from pyNastran.dev.bdf_vectorized.cards.elements.rod.test_rods import *
#from pyNastran.dev.bdf_vectorized.cards.elements.bar.test_bars import *
#from pyNastran.dev.bdf_vectorized.cards.elements.beam.test_beams import *
#from pyNastran.dev.bdf_vectorized.cards.elements.spring.test_spring import *
#from pyNastran.dev.bdf_vectorized.cards.elements.shear.test_shear import *
#from pyNastran.dev.bdf_vectorized.cards.elements.damper.test_dampers import *
if __name__ == "__main__": # pragma: no cover
import unittest
unittest.main()
| 47.764706
| 78
| 0.82266
| 116
| 812
| 5.517241
| 0.267241
| 0.203125
| 0.25
| 0.296875
| 0.725
| 0.725
| 0.715625
| 0.6
| 0
| 0
| 0
| 0
| 0.077586
| 812
| 16
| 79
| 50.75
| 0.854473
| 0.477833
| 0
| 0
| 0
| 0
| 0.019139
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.75
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
a6f00d43676b038d565442cb30978b08a0848924
| 91,968
|
py
|
Python
|
src/core/util.py
|
MathieuRita/Dialog
|
f53afbc019103131417d775676061a7060c5fdf2
|
[
"MIT"
] | null | null | null |
src/core/util.py
|
MathieuRita/Dialog
|
f53afbc019103131417d775676061a7060c5fdf2
|
[
"MIT"
] | null | null | null |
src/core/util.py
|
MathieuRita/Dialog
|
f53afbc019103131417d775676061a7060c5fdf2
|
[
"MIT"
] | null | null | null |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Union, Iterable, List, Optional, Any
import sys
import random
import argparse
import torch
import numpy as np
from collections import defaultdict
common_opts = None
optimizer = None
summary_writer = None
def _populate_cl_params(arg_parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
arg_parser.add_argument('--random_seed', type=int, default=None,
help='Set random seed')
# trainer params
arg_parser.add_argument('--checkpoint_dir', type=str, default=None,
help='Where the checkpoints are stored')
arg_parser.add_argument('--preemptable', default=False,
action='store_true',
help='If the flag is set, Trainer would always try to initialise itself from a checkpoint')
arg_parser.add_argument('--checkpoint_freq', type=int, default=0,
help='How often the checkpoints are saved')
arg_parser.add_argument('--validation_freq', type=int, default=1,
help='The validation would be run every `validation_freq` epochs')
arg_parser.add_argument('--n_epochs', type=int, default=10,
help='Number of epochs to train (default: 10)')
arg_parser.add_argument('--load_from_checkpoint', type=str, default=None,
help='If the parameter is set, model, trainer, and optimizer states are loaded from the '
'checkpoint (default: None)')
# cuda setup
arg_parser.add_argument('--no_cuda', default=False, help='disable cuda',
action='store_true')
# dataset
arg_parser.add_argument('--batch_size', type=int, default=32,
help='Input batch size for training (default: 32)')
# optimizer
arg_parser.add_argument('--optimizer', type=str, default='adam',
help='Optimizer to use [adam, sgd, adagrad] (default: adam)')
arg_parser.add_argument('--lr', type=float, default=1e-2,
help='Learning rate (default: 1e-2)')
# Channel parameters
arg_parser.add_argument('--vocab_size', type=int, default=10,
help='Number of symbols (terms) in the vocabulary (default: 10)')
arg_parser.add_argument('--max_len', type=int, default=1,
help='Max length of the sequence (default: 1)')
# Setting up tensorboard
arg_parser.add_argument('--tensorboard', default=False, help='enable tensorboard',
action='store_true')
arg_parser.add_argument('--tensorboard_dir', type=str, default='runs/',
help='Path for tensorboard log')
return arg_parser
def _get_params(arg_parser: argparse.ArgumentParser, params: List[str]) -> argparse.Namespace:
args = arg_parser.parse_args(params)
args.cuda = not args.no_cuda and torch.cuda.is_available()
# just to avoid confusion and be consistent
args.no_cuda = not args.cuda
args.device = "cuda" if args.cuda else "cpu"
return args
def init(arg_parser:Optional[argparse.ArgumentParser] = None, params:Optional[List[str]] = None) -> argparse.Namespace:
"""
Should be called before any code using egg; initializes the common components, such as
seeding logic etc.
:param arg_parser: An instance of argparse.ArgumentParser that is pre-populated if game-specific arguments.
`init` would add the commonly used arguments and parse the CL parameters. This allows us to easily obtain
commonly used parameters and have a full list of parameters obtained by a `--help` argument.
:param params: An optional list of parameters to be parsed against pre-defined frequently used parameters.
If set to None (default), command line parameters from sys.argv[1:] are used; setting to an empty list forces
to use default parameters.
"""
global common_opts
global optimizer
global summary_writer
if arg_parser is None:
arg_parser = argparse.ArgumentParser()
arg_parser = _populate_cl_params(arg_parser)
if params is None:
params = sys.argv[1:]
common_opts = _get_params(arg_parser, params)
if common_opts.random_seed is None:
common_opts.random_seed = random.randint(0, 2**31)
_set_seed(common_opts.random_seed)
optimizers = {'adam': torch.optim.Adam,
'sgd': torch.optim.SGD,
'adagrad': torch.optim.Adagrad}
if common_opts.optimizer in optimizers:
optimizer = optimizers[common_opts.optimizer]
else:
raise NotImplementedError(f'Unknown optimizer name {common_opts.optimizer}!')
if summary_writer is None and common_opts.tensorboard:
try:
from torch.utils.tensorboard import SummaryWriter
summary_writer = SummaryWriter(log_dir=common_opts.tensorboard_dir)
except ModuleNotFoundError:
print('Cannot load tensorboard module; makes sure you installed everything required')
return common_opts
def close() -> None:
"""
Should be called at the end of the program - however, not required unless Tensorboard is used
"""
global summary_writer
if summary_writer: summary_writer.close()
def get_opts() -> argparse.Namespace:
"""
:return: command line options
"""
global common_opts
return common_opts
def build_optimizer(params: Iterable, lr=None) -> torch.optim.Optimizer:
if lr is None:
return optimizer(params, lr=get_opts().lr)
else:
return optimizer(params, lr=lr)
def get_summary_writer() -> 'torch.utils.SummaryWriter':
"""
:return: Returns an initialized instance of torch.util.SummaryWriter
"""
global summary_writer
return summary_writer
def _set_seed(seed) -> None:
"""
Seeds the RNG in python.random, torch {cpu/cuda}, numpy.
:param seed: Random seed to be used
>>> _set_seed(10)
>>> random.randint(0, 100), torch.randint(0, 100, (1,)).item(), np.random.randint(0, 100)
(73, 37, 9)
>>> _set_seed(10)
>>> random.randint(0, 100), torch.randint(0, 100, (1,)).item(), np.random.randint(0, 100)
(73, 37, 9)
"""
random.seed(seed)
torch.manual_seed(seed)
np.random.seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
def dump_sender_receiver(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
#if impatient:
# output=output[:,0,:]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_sender_receiver_test(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
pos_min=0,
pos_max=10):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# ETUDE DES POSITIONS
if pos_min>-1 and pos_max>-1:
for j in range(message[0].size()[0]):
for k in range(pos_min,pos_max):
message[0][j,k]=np.random.randint(20)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_impose_message(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# Test vocab
conv=np.random.choice(10,size=10,replace=False)
not_found=True
k=0
while not_found:
if conv[k]==0:
conv=np.concatenate((conv[:k],conv[k+1:]),axis=0)
not_found=False
k+=1
# Test replacement with reference message
mes=message[0][77]
N=1 # N-gram
np.random.seed(43)
for j in range(30):
for i in range(30):
message[0][j,i]=mes[i]
for i in range(N-1,30):
if i==j:
for k in range(N):
message[0][j,i-k]=np.random.randint(1,10)
# Test changer le milieu
for j in range(200):
longueur=0
not_found=True
while not_found:
longueur+=1
if message[0][j,longueur-1]==0 or longueur==30:
not_found=False
for i in range(3,longueur-5):
message[0][j,i]=1
for i in range(message[0].size()[0]):
for j in range(message[0].size()[1]):
if message[0][i,j]!=0:
message[0][i,j]=int(conv[int(message[0][i,j]-1)])
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def move_to(x: Any, device: torch.device) \
-> Any:
"""
Simple utility function that moves a tensor or a dict/list/tuple of (dict/list/tuples of ...) tensors to a specified device, recursively.
:param x: tensor, list, tuple, or dict with values that are lists, tuples or dicts with values of ...
:param device: device to be moved to
:return: Same as input, but with all tensors placed on device. Non-tensors are not affected. For dicts, the changes are done in-place!
"""
if hasattr(x, 'to'):
return x.to(device)
if isinstance(x, list) or isinstance(x, tuple):
return [move_to(i, device) for i in x]
if isinstance(x, dict) or isinstance(x, defaultdict):
for k, v in x.items():
x[k] = move_to(v, device)
return x
return x
def find_lengths(messages: torch.Tensor) -> torch.Tensor:
"""
:param messages: A tensor of term ids, encoded as Long values, of size (batch size, max sequence length).
:returns A tensor with lengths of the sequences, including the end-of-sequence symbol <eos> (in EGG, it is 0).
If no <eos> is found, the full length is returned (i.e. messages.size(1)).
>>> messages = torch.tensor([[1, 1, 0, 0, 0, 1], [1, 1, 1, 10, 100500, 5]])
>>> lengths = find_lengths(messages)
>>> lengths
tensor([3, 6])
"""
max_k = messages.size(1)
zero_mask = messages == 0
# a bit involved logic, but it seems to be faster for large batches than slicing batch dimension and
# querying torch.nonzero()
# zero_mask contains ones on positions where 0 occur in the outputs, and 1 otherwise
# zero_mask.cumsum(dim=1) would contain non-zeros on all positions after 0 occurred
# zero_mask.cumsum(dim=1) > 0 would contain ones on all positions after 0 occurred
# (zero_mask.cumsum(dim=1) > 0).sum(dim=1) equates to the number of steps that happened after 0 occured (including it)
# max_k - (zero_mask.cumsum(dim=1) > 0).sum(dim=1) is the number of steps before 0 took place
lengths = max_k - (zero_mask.cumsum(dim=1) > 0).sum(dim=1)
lengths.add_(1).clamp_(max=max_k)
return lengths
def levenshtein(s1, s2):
"""Compute the Levenshtein Edit distance between two strings.
Parameters
----------
s1 : str
s2 : str
"""
#s1 = s1.lower()
#s2 = s2.lower()
m = np.zeros((len(s1)+1, len(s2)+1))
m[:, 0] = np.arange(len(s1)+1)
m[0, :] = np.arange(len(s2)+1)
for i in range(1, len(s1)+1):
for j in range(1, len(s2)+1):
if s1[i-1] == s2[j-1]:
m[i, j] = min(m[i-1, j]+1, m[i, j-1]+1, m[i-1, j-1])
else:
m[i, j] = min(m[i-1, j]+1, m[i, j-1]+1, m[i-1, j-1]+1)
return m[len(s1), len(s2)]
def input_distance(i1: list, i2:list):
dist=len(i1)
for k in range(len(i1)):
if i1[k]==i2[k]:
dist-=1
return dist
def convert_messages_to_numpy(messages):
all_messages=[]
for x in messages:
x = x.cpu().numpy()
all_messages.append(x)
all_messages = np.asarray(all_messages)
return all_messages
def dump_test_position(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
position: int,
voc_size: int,
gs: bool, variable_length: bool,
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
for i in range(message[0].size()[0]):
message[0][i,position]=np.random.randint(1,voc_size)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_sender_receiver_impatient(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False,
test_mode=False,
save_dir=""):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
# AJOUT
preds=output[:,:,:].argmax(2)
if test_mode:
np.save(save_dir+"predictions.npy",preds.cpu().numpy())
message_lengths = find_lengths(message)
outputs=[]
for i in range(output.size(0)):
outputs.append(output[i,message_lengths[i]-1,:])
output=torch.stack(outputs,0)
sc=0.
for i in range(preds.size(0)):
sc+=(preds[i,:]==i).sum()
print("Impatient score="+str(int(sc)),flush=True)
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_test_position_impatient(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
position: int,
voc_size: int,
gs: bool, variable_length: bool,
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
for i in range(message[0].size()[0]):
message[0][i,position]=np.random.randint(1,voc_size)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
### AJOUT CHANGEMENT###
#output=output[:,-1,:]
message_lengths = find_lengths(message)
outputs=[]
for i in range(output.size(0)):
outputs.append(output[i,message_lengths[i]-1,:])
output=torch.stack(outputs,0)
####
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_sender_receiver_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
# AJOUT
preds_by_att=[]
for i in range(output.size(1)):
preds_by_att.append(output[:,i,:].argmax(1))
message_lengths = find_lengths(message)
output=[]
for j in range(preds_by_att[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att)):
output_sing.append(int(preds_by_att[attribute][j]))
output.append(output_sing)
receiver_outputs=output
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
#receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
#if gs:
# receiver_outputs.append(output[i, message_end, ...])
#else:
#receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_sender_receiver_impatient_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
# AJOUT
preds_by_att=[]
for i in range(output.size(2)):
preds_by_att.append(output[:,:,i,:].argmax(2))
message_lengths = find_lengths(message)
output=[]
for j in range(preds_by_att[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att)):
output_sing.append(int(preds_by_att[attribute][j,message_lengths[j]-1]))
output.append(output_sing)
receiver_outputs=output
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
#receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
#if gs:
# receiver_outputs.append(output[i, message_end, ...])
#else:
#receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_test_position_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
position: int,
voc_size: int,
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
for i in range(message[0].size()[0]):
message[0][i,position]=np.random.randint(1,voc_size)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
# AJOUT
preds_by_att=[]
for i in range(output.size(1)):
preds_by_att.append(output[:,i,:].argmax(1))
message_lengths = find_lengths(message)
output=[]
for j in range(preds_by_att[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att)):
output_sing.append(int(preds_by_att[attribute][j]))
output.append(output_sing)
receiver_outputs=output
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
#receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
#if gs:
# receiver_outputs.append(output[i, message_end, ...])
#else:
#receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_test_position_impatient_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
position: int,
voc_size: int,
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.sender(sender_input)
for i in range(message[0].size()[0]):
message[0][i,position]=np.random.randint(1,voc_size)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
output = game.receiver(message, receiver_input)
if not gs: output = output[0]
# AJOUT
preds_by_att=[]
for i in range(output.size(2)):
preds_by_att.append(output[:,:,i,:].argmax(2))
message_lengths = find_lengths(message)
output=[]
for j in range(preds_by_att[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att)):
output_sing.append(int(preds_by_att[attribute][j,message_lengths[j]-1]))
output.append(output_sing)
receiver_outputs=output
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
#receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
#if gs:
# receiver_outputs.append(output[i, message_end, ...])
#else:
#receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
"""NEW ! : for dialog """
def dump_sender_receiver_dialog(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_1 = [], [], [], []
sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_2 = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message_1 = game.agent_1.sender(sender_input)
message_2 = game.agent_2.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message_1 = message_1[0]
if not gs: message_2 = message_2[0]
output_1 = game.agent_2.receiver(message_1, receiver_input)
output_2 = game.agent_1.receiver(message_2, receiver_input)
if not gs: output_1 = output_1[0]
if not gs: output_2 = output_2[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs_1.extend(zip(*sender_input))
sender_inputs_2.extend(zip(*sender_input))
else:
sender_inputs_1.extend(sender_input)
sender_inputs_2.extend(sender_input)
if receiver_input is not None:
receiver_inputs_1.extend(receiver_input)
receiver_inputs_2.extend(receiver_input)
if gs: message_1 = message_1.argmax(dim=-1) # actual symbols instead of one-hot encoded
if gs: message_2 = message_2.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages_1.extend(message_2)
receiver_outputs_1.extend(output_1)
messages_2.extend(message_2)
receiver_outputs_2.extend(output_2)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message_1.size(0)):
eos_positions_1 = (message_1[i, :] == 0).nonzero()
message_end_1 = eos_positions_1[0].item() if eos_positions_1.size(0) > 0 else -1
assert message_end_1 == -1 or message_1[i, message_end_1] == 0
if message_end_1 < 0:
messages_1.append(message_1[i, :])
else:
messages_1.append(message_1[i, :message_end_1 + 1])
if gs:
receiver_outputs_1.append(output[i, message_end_1, ...])
else:
receiver_outputs_1.append(output_1[i, ...])
for i in range(message_2.size(0)):
eos_positions_2 = (message_2[i, :] == 0).nonzero()
message_end_2 = eos_positions_2[0].item() if eos_positions_2.size(0) > 0 else -1
assert message_end_2 == -1 or message_2[i, message_end_2] == 0
if message_end_2 < 0:
messages_2.append(message_2[i, :])
else:
messages_2.append(message_2[i, :message_end_2 + 1])
if gs:
receiver_outputs_2.append(output_2[i, message_end_2, ...])
else:
receiver_outputs_2.append(output_2[i, ...])
game.train(mode=train_state)
return sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_1, sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_2, labels
def dump_sender_receiver_dialog_model_1(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11, receiver_outputs_12 = [], [], [], [], []
sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22 = [], [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message_1 = game.agent_1.sender(sender_input)
message_2 = game.agent_2.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message_1 = message_1[0]
if not gs: message_2 = message_2[0]
output_12 = game.agent_2.receiver(message_1, receiver_input)
output_11 = game.agent_1.receiver(message_1, receiver_input)
output_21 = game.agent_1.receiver(message_2, receiver_input)
output_22 = game.agent_2.receiver(message_2, receiver_input)
if not gs: output_11 = output_11[0]
if not gs: output_12 = output_12[0]
if not gs: output_21 = output_21[0]
if not gs: output_22 = output_22[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs_1.extend(zip(*sender_input))
sender_inputs_2.extend(zip(*sender_input))
else:
sender_inputs_1.extend(sender_input)
sender_inputs_2.extend(sender_input)
if receiver_input is not None:
receiver_inputs_1.extend(receiver_input)
receiver_inputs_2.extend(receiver_input)
if gs: message_1 = message_1.argmax(dim=-1) # actual symbols instead of one-hot encoded
if gs: message_2 = message_2.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages_1.extend(message_2)
receiver_outputs_11.extend(output_11)
receiver_outputs_12.extend(output_12)
messages_2.extend(message_2)
receiver_outputs_21.extend(output_22)
receiver_outputs_22.extend(output_22)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message_1.size(0)):
eos_positions_1 = (message_1[i, :] == 0).nonzero()
message_end_1 = eos_positions_1[0].item() if eos_positions_1.size(0) > 0 else -1
assert message_end_1 == -1 or message_1[i, message_end_1] == 0
if message_end_1 < 0:
messages_1.append(message_1[i, :])
else:
messages_1.append(message_1[i, :message_end_1 + 1])
if gs:
receiver_outputs_11.append(output_11[i, message_end_1, ...])
receiver_outputs_12.append(output_12[i, message_end_1, ...])
else:
receiver_outputs_11.append(output_11[i, ...])
receiver_outputs_12.append(output_12[i, ...])
for i in range(message_2.size(0)):
eos_positions_2 = (message_2[i, :] == 0).nonzero()
message_end_2 = eos_positions_2[0].item() if eos_positions_2.size(0) > 0 else -1
assert message_end_2 == -1 or message_2[i, message_end_2] == 0
if message_end_2 < 0:
messages_2.append(message_2[i, :])
else:
messages_2.append(message_2[i, :message_end_2 + 1])
if gs:
receiver_outputs_21.append(output_21[i, message_end_2, ...])
receiver_outputs_22.append(output_22[i, message_end_2, ...])
else:
receiver_outputs_21.append(output_21[i, ...])
receiver_outputs_22.append(output_22[i, ...])
game.train(mode=train_state)
return sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11,receiver_outputs_12, sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22, labels
def dump_sender_receiver_dialog_model_2(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_1 = [], [], [], []
sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_2 = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message_1 = game.agent_1.sender(sender_input)
message_2 = game.agent_2.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message_1 = message_1[0]
if not gs: message_2 = message_2[0]
output_1 = game.agent_2.receiver(message_1, receiver_input)
output_2 = game.agent_1.receiver(message_2, receiver_input)
if not gs: output_1 = output_1[0]
if not gs: output_2 = output_2[0]
output_1=output_1[:,-1,:]
output_2=output_2[:,-1,:]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs_1.extend(zip(*sender_input))
sender_inputs_2.extend(zip(*sender_input))
else:
sender_inputs_1.extend(sender_input)
sender_inputs_2.extend(sender_input)
if receiver_input is not None:
receiver_inputs_1.extend(receiver_input)
receiver_inputs_2.extend(receiver_input)
if gs: message_1 = message_1.argmax(dim=-1) # actual symbols instead of one-hot encoded
if gs: message_2 = message_2.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages_1.extend(message_2)
receiver_outputs_1.extend(output_1)
messages_2.extend(message_2)
receiver_outputs_2.extend(output_2)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message_1.size(0)):
eos_positions_1 = (message_1[i, :] == 0).nonzero()
message_end_1 = eos_positions_1[0].item() if eos_positions_1.size(0) > 0 else -1
assert message_end_1 == -1 or message_1[i, message_end_1] == 0
if message_end_1 < 0:
messages_1.append(message_1[i, :])
else:
messages_1.append(message_1[i, :message_end_1 + 1])
if gs:
receiver_outputs_1.append(output[i, message_end_1, ...])
else:
receiver_outputs_1.append(output_1[i, ...])
for i in range(message_2.size(0)):
eos_positions_2 = (message_2[i, :] == 0).nonzero()
message_end_2 = eos_positions_2[0].item() if eos_positions_2.size(0) > 0 else -1
assert message_end_2 == -1 or message_2[i, message_end_2] == 0
if message_end_2 < 0:
messages_2.append(message_2[i, :])
else:
messages_2.append(message_2[i, :message_end_2 + 1])
if gs:
receiver_outputs_2.append(output_2[i, message_end_2, ...])
else:
receiver_outputs_2.append(output_2[i, ...])
game.train(mode=train_state)
return sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_1, sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_2, labels
def dump_pretraining_u(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = game.agent_1.sender(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
#if impatient:
# output=output[:,0,:]
output = game.agent_1.receiver(message, receiver_input)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end, ...])
else:
receiver_outputs.append(output[i, ...])
game.train(mode=train_state)
return sender_inputs, messages, receiver_inputs, receiver_outputs, labels
def dump_sender_receiver_dialog_model_6(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11, receiver_outputs_12 = [], [], [], [], []
sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22 = [], [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message_1 = game.agent_1.send(sender_input)
message_2 = game.agent_2.send(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message_1 = message_1[0]
if not gs: message_2 = message_2[0]
output_12 = game.agent_2.receive_2(message_1, receiver_input, None)
output_11 = game.agent_1.receive_2(message_1, receiver_input, None)
output_21 = game.agent_1.receive_2(message_2, receiver_input, None)
output_22 = game.agent_2.receive_2(message_2, receiver_input, None)
if not gs: output_11 = output_11[0]
if not gs: output_12 = output_12[0]
if not gs: output_21 = output_21[0]
if not gs: output_22 = output_22[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs_1.extend(zip(*sender_input))
sender_inputs_2.extend(zip(*sender_input))
else:
sender_inputs_1.extend(sender_input)
sender_inputs_2.extend(sender_input)
if receiver_input is not None:
receiver_inputs_1.extend(receiver_input)
receiver_inputs_2.extend(receiver_input)
if gs: message_1 = message_1.argmax(dim=-1) # actual symbols instead of one-hot encoded
if gs: message_2 = message_2.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages_1.extend(message_1)
receiver_outputs_11.extend(output_11)
receiver_outputs_12.extend(output_12)
messages_2.extend(message_2)
receiver_outputs_21.extend(output_22)
receiver_outputs_22.extend(output_22)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message_1.size(0)):
eos_positions_1 = (message_1[i, :] == 0).nonzero()
message_end_1 = eos_positions_1[0].item() if eos_positions_1.size(0) > 0 else -1
assert message_end_1 == -1 or message_1[i, message_end_1] == 0
if message_end_1 < 0:
messages_1.append(message_1[i, :])
else:
messages_1.append(message_1[i, :message_end_1 + 1])
if gs:
receiver_outputs_11.append(output_11[i, message_end_1, ...])
receiver_outputs_12.append(output_12[i, message_end_1, ...])
else:
receiver_outputs_11.append(output_11[i, ...])
receiver_outputs_12.append(output_12[i, ...])
for i in range(message_2.size(0)):
eos_positions_2 = (message_2[i, :] == 0).nonzero()
message_end_2 = eos_positions_2[0].item() if eos_positions_2.size(0) > 0 else -1
assert message_end_2 == -1 or message_2[i, message_end_2] == 0
if message_end_2 < 0:
messages_2.append(message_2[i, :])
else:
messages_2.append(message_2[i, :message_end_2 + 1])
if gs:
receiver_outputs_21.append(output_21[i, message_end_2, ...])
receiver_outputs_22.append(output_22[i, message_end_2, ...])
else:
receiver_outputs_21.append(output_21[i, ...])
receiver_outputs_22.append(output_22[i, ...])
game.train(mode=train_state)
return sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11,receiver_outputs_12, sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22, labels
def test_receiver_evolution_core(game: torch.nn.Module,
messages:torch.tensor,
device: Optional[torch.device] = None,
gs: bool = False,variable_length : bool = True,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
receiver_outputs_1 = []
receiver_outputs_2 = []
with torch.no_grad():
message = move_to(messages, device) # size=[nb_messages,max_len]
output_1 = game.agent_1.receive_2(message, None, None)
output_2 = game.agent_2.receive_2(message, None, None)
if not gs: output_1 = output_1[0]
if not gs: output_2 = output_2[0]
if not variable_length:
messages.extend(message)
receiver_outputs_1.extend(output_1)
receiver_outputs_2.extend(output_2)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
messages=[]
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs_1.append(output_1[i, message_end_1, ...])
receiver_outputs_2.append(output_2[i, message_end_1, ...])
else:
receiver_outputs_1.append(output_1[i, ...])
receiver_outputs_2.append(output_2[i, ...])
game.train(mode=train_state)
return receiver_outputs_1,receiver_outputs_2
def dump_dialog_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
gs: bool, variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11, receiver_outputs_12 = [], [], [], [], []
sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22 = [], [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message_1 = game.agent_1.send(sender_input)
message_2 = game.agent_2.send(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message_1 = message_1[0]
if not gs: message_2 = message_2[0]
output_12 = game.agent_2.receive(message_1, receiver_input, None)
output_11 = game.agent_1.receive(message_1, receiver_input, None)
output_21 = game.agent_1.receive(message_2, receiver_input, None)
output_22 = game.agent_2.receive(message_2, receiver_input, None)
output_11 = output_11[0]
output_12 = output_12[0]
output_21 = output_21[0]
output_22 = output_22[0]
# AJOUT
preds_by_att_11=[]
for i in range(output_11.size(1)):
preds_by_att_11.append(output_11[:,i,:].argmax(1))
preds_by_att_12=[]
for i in range(output_12.size(1)):
preds_by_att_12.append(output_12[:,i,:].argmax(1))
preds_by_att_22=[]
for i in range(output_22.size(1)):
preds_by_att_22.append(output_22[:,i,:].argmax(1))
preds_by_att_21=[]
for i in range(output_21.size(1)):
preds_by_att_21.append(output_21[:,i,:].argmax(1))
receiver_outputs_11=[]
receiver_outputs_12=[]
receiver_outputs_22=[]
receiver_outputs_21=[]
for j in range(preds_by_att_11[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att_11)):
output_sing.append(int(preds_by_att_11[attribute][j]))
receiver_outputs_11.append(output_sing)
for j in range(preds_by_att_12[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att_12)):
output_sing.append(int(preds_by_att_12[attribute][j]))
receiver_outputs_12.append(output_sing)
for j in range(preds_by_att_22[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att_22)):
output_sing.append(int(preds_by_att_22[attribute][j]))
receiver_outputs_22.append(output_sing)
for j in range(preds_by_att_21[i].size(0)):
output_sing=[]
for attribute in range(len(preds_by_att_21)):
output_sing.append(int(preds_by_att_21[attribute][j]))
receiver_outputs_21.append(output_sing)
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs_1.extend(zip(*sender_input))
sender_inputs_2.extend(zip(*sender_input))
else:
sender_inputs_1.extend(sender_input)
sender_inputs_2.extend(sender_input)
if receiver_input is not None:
receiver_inputs_1.extend(receiver_input)
receiver_inputs_2.extend(receiver_input)
if gs: message_1 = message_1.argmax(dim=-1) # actual symbols instead of one-hot encoded
if gs: message_2 = message_2.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages_1.extend(message_1)
#receiver_outputs_11.extend(output_11)
#receiver_outputs_12.extend(output_12)
messages_2.extend(message_2)
#receiver_outputs_21.extend(output_22)
#receiver_outputs_22.extend(output_22)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message_1.size(0)):
eos_positions_1 = (message_1[i, :] == 0).nonzero()
message_end_1 = eos_positions_1[0].item() if eos_positions_1.size(0) > 0 else -1
assert message_end_1 == -1 or message_1[i, message_end_1] == 0
if message_end_1 < 0:
messages_1.append(message_1[i, :])
else:
messages_1.append(message_1[i, :message_end_1 + 1])
#if gs:
# receiver_outputs_11.append(output_11[i, message_end_1, ...])
# receiver_outputs_12.append(output_12[i, message_end_1, ...])
#else:
# receiver_outputs_11.append(output_11[i, ...])
# receiver_outputs_12.append(output_12[i, ...])
for i in range(message_2.size(0)):
eos_positions_2 = (message_2[i, :] == 0).nonzero()
message_end_2 = eos_positions_2[0].item() if eos_positions_2.size(0) > 0 else -1
assert message_end_2 == -1 or message_2[i, message_end_2] == 0
if message_end_2 < 0:
messages_2.append(message_2[i, :])
else:
messages_2.append(message_2[i, :message_end_2 + 1])
#if gs:
# receiver_outputs_21.append(output_21[i, message_end_2, ...])
# receiver_outputs_22.append(output_22[i, message_end_2, ...])
#else:
# receiver_outputs_21.append(output_21[i, ...])
# receiver_outputs_22.append(output_22[i, ...])
game.train(mode=train_state)
return sender_inputs_1, messages_1, receiver_inputs_1, receiver_outputs_11,receiver_outputs_12, sender_inputs_2, messages_2, receiver_inputs_2, receiver_outputs_21,receiver_outputs_22, labels
def sample_messages(agent: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
device = device if device is not None else common_opts.device
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = agent.send(sender_input,eval=False)
message = message[0]
return message
def estimate_listener_policy(speaker: torch.nn.Module,
listener: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
device = device if device is not None else common_opts.device
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = speaker.send(sender_input,eval=False)
message = message[0]
message_lengths = find_lengths(message)
_, _,logits, _ = listener.receive(message,None, message_lengths,return_policies=True)
return message
def dump_multiagent_compositionality(game: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
list_speakers : list,
list_listeners : list,
variable_length: bool,
device: Optional[torch.device] = None,
impatient = False):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
train_state = game.training # persist so we restore it back
game.eval()
device = device if device is not None else common_opts.device
sender_inputs, receiver_inputs = [], []
messages_agents, receiver_outputs_agents = {}, {}
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
outputs={}
for i in list_speakers:
message = game.agents["agent_{}".format(i)].send(sender_input)
message = message[0]
receiver_outputs_agents["agent_{}".format(i)]={}
for list in list_listeners:
output = game.agents["agent_{}".format(list)].receive(message, receiver_input, None)
output=output[0]
# Compositionality
preds_by_att=[]
for j in range(output.size(1)):
preds_by_att.append(output[:,j,:].argmax(1))
# Receiver outputs
receiver_outputs = []
for k in range(preds_by_att[j].size(0)): # i ???? print here
output_sing=[]
for attribute in range(len(preds_by_att)):
output_sing.append(int(preds_by_att[attribute][k]))
receiver_outputs.append(output_sing)
receiver_outputs_agents["agent_{}".format(i)]["agent_{}".format(list)] = receiver_outputs
# Messages post processing
if not variable_length:
messages.extend(message)
else:
messages=[]
for k in range(message.size(0)):
eos_positions = (message[k, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[k, message_end] == 0
if message_end < 0:
messages.append(message[k, :])
else:
messages.append(message[k, :message_end + 1])
messages_agents["agent_{}".format(i)]=messages
# Post process labels, sender_inputs and receiver_inputs
if batch[1] is not None:
labels.extend(batch[1])
#if isinstance(sender_input, list) or isinstance(sender_input, tuple):
# sender_inputs.extend(zip(*sender_input))
#else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
game.train(mode=train_state)
return sender_inputs, messages_agents, receiver_inputs, receiver_outputs_agents, labels
def dump_sender_receiver_with_noise(agent_1: torch.nn.Module,
agent_2: torch.nn.Module,
dataset: 'torch.utils.data.DataLoader',
noise_prob: float,
max_len:int,
gs:bool,variable_length: bool,
device: Optional[torch.device] = None):
"""
A tool to dump the interaction between Sender and Receiver
:param game: A Game instance
:param dataset: Dataset of inputs to be used when analyzing the communication
:param gs: whether Gumbel-Softmax relaxation was used during training
:param variable_length: whether variable-length communication is used
:param device: device (e.g. 'cuda') to be used
:return:
"""
device = device if device is not None else common_opts.device
sender_inputs, messages, receiver_inputs, receiver_outputs = [], [], [], []
labels = []
with torch.no_grad():
for batch in dataset:
# by agreement, each batch is (sender_input, labels) plus optional (receiver_input)
sender_input = move_to(batch[0], device)
receiver_input = None if len(batch) == 2 else move_to(batch[2], device)
message = agent_1.send(sender_input)
# Under GS, the only output is a message; under Reinforce, two additional tensors are returned.
# We don't need them.
if not gs: message = message[0]
for i in range(message.size(0)):
for j in range(message.size(1)):
if message[i,j]!=0:
if np.random.rand()<noise_prob:
message[i,j]=np.random.randint(1,max_len)
output = agent_2.receive_2(message, receiver_input, None)
if not gs: output = output[0]
if batch[1] is not None:
labels.extend(batch[1])
if isinstance(sender_input, list) or isinstance(sender_input, tuple):
sender_inputs.extend(zip(*sender_input))
else:
sender_inputs.extend(sender_input)
if receiver_input is not None:
receiver_inputs.extend(receiver_input)
if gs: message = message.argmax(dim=-1) # actual symbols instead of one-hot encoded
if not variable_length:
messages.extend(message)
receiver_outputs.extend(output)
else:
# A trickier part is to handle EOS in the messages. It also might happen that not every message has EOS.
# We cut messages at EOS if it is present or return the entire message otherwise. Note, EOS id is always
# set to 0.
for i in range(message.size(0)):
eos_positions = (message[i, :] == 0).nonzero()
message_end = eos_positions[0].item() if eos_positions.size(0) > 0 else -1
assert message_end == -1 or message[i, message_end] == 0
if message_end < 0:
messages.append(message[i, :])
else:
messages.append(message[i, :message_end + 1])
if gs:
receiver_outputs.append(output[i, message_end_1, ...])
else:
receiver_outputs.append(output[i, ...])
return sender_inputs, messages, receiver_inputs, receiver_outputs
| 42.245292
| 195
| 0.580767
| 11,461
| 91,968
| 4.485472
| 0.042056
| 0.049603
| 0.016262
| 0.009415
| 0.857162
| 0.83843
| 0.830649
| 0.821351
| 0.815204
| 0.810885
| 0
| 0.024407
| 0.328636
| 91,968
| 2,176
| 196
| 42.264706
| 0.808192
| 0.231287
| 0
| 0.775701
| 0
| 0
| 0.024052
| 0.008805
| 0
| 0
| 0
| 0
| 0.018692
| 1
| 0.02648
| false
| 0
| 0.006231
| 0
| 0.060748
| 0.001558
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
471afa24e010cbe32646c5ae740fefa47969e2eb
| 8,656
|
py
|
Python
|
tests/hadoop-etl/test/compression_types.py
|
mace84/script-languages
|
d586cbe212bbb4efbfb39e095183729c65489360
|
[
"MIT"
] | 6
|
2019-01-09T11:55:15.000Z
|
2021-06-25T19:52:42.000Z
|
tests/hadoop-etl/test/compression_types.py
|
mace84/script-languages
|
d586cbe212bbb4efbfb39e095183729c65489360
|
[
"MIT"
] | 65
|
2018-12-12T08:40:38.000Z
|
2022-02-28T09:19:45.000Z
|
tests/hadoop-etl/test/compression_types.py
|
mace84/script-languages
|
d586cbe212bbb4efbfb39e095183729c65489360
|
[
"MIT"
] | 9
|
2018-11-23T08:59:09.000Z
|
2020-02-04T12:56:35.000Z
|
#!/usr/bin/env python2.7
# encoding: utf8
import os
import sys
sys.path.append(os.path.realpath(__file__ + '/../../../lib'))
sys.path.append(os.path.realpath(__file__ + '/../../lib'))
import udf
import utils
import datagen
import hadoopenv
class TestDeflate(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=org.apache.hadoop.io.compress.DefaultCodec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
class TestGzip(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
class TestBzip2(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=org.apache.hadoop.io.compress.BZip2Codec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
class TestLzo(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=com.hadoop.compression.lzo.LzoCodec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
class TestLzop(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=com.hadoop.compression.lzo.LzopCodec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
'''
# Requires native libraries
class TestLz4(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=org.apache.hadoop.io.compress.Lz4Codec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
'''
'''
# Requires native libraries
class TestSnappy(utils.HiveTestCase):
hive_file_format = 'textfile'
hive_table = '{file_format}_%s'.format(file_format = hive_file_format)
hive_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'string', 'char(20)', 'varchar(50)', 'boolean', 'binary', \
'array<timestamp>', 'map<int, string>', 'struct<s1:int, s2:smallint, s3:date>', \
'uniontype<bigint, timestamp, boolean, varchar(100)>']
exa_col_types = ['decimal(36,0)', 'tinyint', 'smallint', 'int', 'bigint', 'decimal(18,5)', 'float', 'double', \
'date', 'timestamp', 'varchar(5000)', 'char(20)', 'varchar(50)', 'boolean', 'varchar(5000) ASCII', \
'varchar(5000)', 'varchar(5000)', 'varchar(5000)', \
'varchar(5000)']
hive_config_props = ['hive.exec.compress.output=true', \
'mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec']
num_rows = 1000
has_id_col = True
def test(self):
utils.test_import(self)
utils.validate_import_odbc(self)
'''
if __name__ == '__main__':
udf.main()
| 50.619883
| 120
| 0.582255
| 975
| 8,656
| 5.009231
| 0.106667
| 0.094595
| 0.077396
| 0.094595
| 0.950246
| 0.950246
| 0.950246
| 0.950246
| 0.936323
| 0.936323
| 0
| 0.057617
| 0.22805
| 8,656
| 170
| 121
| 50.917647
| 0.673301
| 0.00439
| 0
| 0.8
| 0
| 0
| 0.441567
| 0.081256
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05
| false
| 0
| 0.16
| 0
| 0.61
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 8
|
5b34f922a63445dbd5f1ef8add2511a25d56ca22
| 75
|
py
|
Python
|
gpscript/__init__.py
|
OBITORASU/gpscript
|
43da61b383bbc686c5b50efb8cadbd3a75c8c93f
|
[
"MIT"
] | null | null | null |
gpscript/__init__.py
|
OBITORASU/gpscript
|
43da61b383bbc686c5b50efb8cadbd3a75c8c93f
|
[
"MIT"
] | null | null | null |
gpscript/__init__.py
|
OBITORASU/gpscript
|
43da61b383bbc686c5b50efb8cadbd3a75c8c93f
|
[
"MIT"
] | 1
|
2021-11-11T13:28:39.000Z
|
2021-11-11T13:28:39.000Z
|
from gpscript.gpscript import install
from gpscript.gpscript import lists
| 18.75
| 37
| 0.853333
| 10
| 75
| 6.4
| 0.5
| 0.375
| 0.625
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12
| 75
| 3
| 38
| 25
| 0.969697
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
5b39d2e3010510a13e3c28522a7d4c40528ea650
| 7,649
|
py
|
Python
|
dfirtrack_main/tests/system/test_system_views.py
|
blackhatethicalhacking/dfirtrack
|
9c2e13015291f2981d14d63c9683e7c447e91f3a
|
[
"MIT"
] | 4
|
2020-03-06T17:37:09.000Z
|
2020-03-17T07:50:55.000Z
|
dfirtrack_main/tests/system/test_system_views.py
|
blackhatethicalhacking/dfirtrack
|
9c2e13015291f2981d14d63c9683e7c447e91f3a
|
[
"MIT"
] | null | null | null |
dfirtrack_main/tests/system/test_system_views.py
|
blackhatethicalhacking/dfirtrack
|
9c2e13015291f2981d14d63c9683e7c447e91f3a
|
[
"MIT"
] | 1
|
2020-03-06T20:54:52.000Z
|
2020-03-06T20:54:52.000Z
|
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from dfirtrack_main.models import System, Systemstatus
import urllib.parse
class SystemViewTestCase(TestCase):
""" system view tests """
@classmethod
def setUpTestData(cls):
# create user
test_user = User.objects.create_user(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# create object
systemstatus_1 = Systemstatus.objects.create(systemstatus_name='systemstatus_1')
# create object
System.objects.create(
system_name = 'system_1',
systemstatus = systemstatus_1,
system_modify_time = timezone.now(),
system_created_by_user_id = test_user,
system_modified_by_user_id = test_user,
)
def test_systems_list_not_logged_in(self):
""" test list view """
# create url
destination = '/login/?next=' + urllib.parse.quote('/systems/', safe='')
# get response
response = self.client.get('/systems/', follow=True)
# compare
self.assertRedirects(response, destination, status_code=302, target_status_code=200)
def test_systems_list_logged_in(self):
""" test list view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/')
# compare
self.assertEqual(response.status_code, 200)
def test_systems_list_template(self):
""" test list view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/')
# compare
self.assertTemplateUsed(response, 'dfirtrack_main/system/systems_list.html')
def test_systems_list_get_user_context(self):
""" test list view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/')
# compare
self.assertEqual(str(response.context['user']), 'testuser_system')
def test_systems_detail_not_logged_in(self):
""" test detail view """
# get object
system_1 = System.objects.get(system_name='system_1')
# create url
destination = '/login/?next=' + urllib.parse.quote('/systems/' + str(system_1.system_id), safe='')
# get response
response = self.client.get('/systems/' + str(system_1.system_id), follow=True)
# compare
self.assertRedirects(response, destination, status_code=302, target_status_code=200)
def test_systems_detail_logged_in(self):
""" test detail view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id))
# compare
self.assertEqual(response.status_code, 200)
def test_systems_detail_template(self):
""" test detail view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id))
# compare
self.assertTemplateUsed(response, 'dfirtrack_main/system/systems_detail.html')
def test_systems_detail_get_user_context(self):
""" test detail view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id))
# compare
self.assertEqual(str(response.context['user']), 'testuser_system')
def test_systems_add_not_logged_in(self):
""" test add view """
# create url
destination = '/login/?next=' + urllib.parse.quote('/systems/add/', safe='')
# get response
response = self.client.get('/systems/add/', follow=True)
# compare
self.assertRedirects(response, destination, status_code=302, target_status_code=200)
def test_systems_add_logged_in(self):
""" test add view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/add/')
# compare
self.assertEqual(response.status_code, 200)
def test_systems_add_template(self):
""" test add view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/add/')
# compare
self.assertTemplateUsed(response, 'dfirtrack_main/system/systems_add.html')
def test_systems_add_get_user_context(self):
""" test add view """
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/add/')
# compare
self.assertEqual(str(response.context['user']), 'testuser_system')
def test_systems_edit_not_logged_in(self):
""" test edit view """
# get object
system_1 = System.objects.get(system_name='system_1')
# create url
destination = '/login/?next=' + urllib.parse.quote('/systems/' + str(system_1.system_id) + '/edit/', safe='')
# get response
response = self.client.get('/systems/' + str(system_1.system_id) + '/edit/', follow=True)
# compare
self.assertRedirects(response, destination, status_code=302, target_status_code=200)
def test_systems_edit_logged_in(self):
""" test edit view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id) + '/edit/')
# compare
self.assertEqual(response.status_code, 200)
def test_systems_edit_template(self):
""" test edit view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id) + '/edit/')
# compare
self.assertTemplateUsed(response, 'dfirtrack_main/system/systems_edit.html')
def test_systems_edit_get_user_context(self):
""" test edit view """
# get object
system_1 = System.objects.get(system_name='system_1')
# login testuser
login = self.client.login(username='testuser_system', password='LqShcoecDud6JLRxhfKV')
# get response
response = self.client.get('/systems/' + str(system_1.system_id) + '/edit/')
# compare
self.assertEqual(str(response.context['user']), 'testuser_system')
| 37.679803
| 117
| 0.645705
| 848
| 7,649
| 5.619104
| 0.087264
| 0.058762
| 0.049108
| 0.07723
| 0.863379
| 0.831899
| 0.820357
| 0.812382
| 0.750052
| 0.742497
| 0
| 0.0135
| 0.234933
| 7,649
| 202
| 118
| 37.866337
| 0.800752
| 0.126422
| 0
| 0.494382
| 0
| 0
| 0.161938
| 0.024076
| 0
| 0
| 0
| 0
| 0.179775
| 1
| 0.191011
| false
| 0.146067
| 0.05618
| 0
| 0.258427
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
5b4572868f52eea5f1a594a5924fd167df7d487c
| 12,911
|
py
|
Python
|
murano_tempest_tests/tests/api/application_catalog/test_services_negative.py
|
zhur0ng/murano-tempest-plugin
|
c70cda4dc7b8208252e9741a96acba9fb6a5c6e9
|
[
"Apache-2.0"
] | 6
|
2017-10-31T10:37:17.000Z
|
2019-01-28T22:05:05.000Z
|
murano_tempest_tests/tests/api/application_catalog/test_services_negative.py
|
zhur0ng/murano-tempest-plugin
|
c70cda4dc7b8208252e9741a96acba9fb6a5c6e9
|
[
"Apache-2.0"
] | 1
|
2018-08-20T07:39:23.000Z
|
2018-08-20T07:39:23.000Z
|
murano_tempest_tests/tests/api/application_catalog/test_services_negative.py
|
zhur0ng/murano-tempest-plugin
|
c70cda4dc7b8208252e9741a96acba9fb6a5c6e9
|
[
"Apache-2.0"
] | 2
|
2018-01-11T05:08:35.000Z
|
2018-08-20T07:32:33.000Z
|
# Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib import decorators
from tempest.lib import exceptions
from murano_tempest_tests.tests.api.application_catalog import base
from murano_tempest_tests import utils
class TestServicesNegative(base.BaseApplicationCatalogTest):
@classmethod
def resource_setup(cls):
super(TestServicesNegative, cls).resource_setup()
name = utils.generate_name(cls.__name__)
cls.environment = cls.application_catalog_client.\
create_environment(name)
@classmethod
def resource_cleanup(cls):
cls.application_catalog_client.\
delete_environment(cls.environment['id'])
super(TestServicesNegative, cls).resource_cleanup()
@decorators.attr(type='negative')
@decorators.idempotent_id('5f1dd3f4-170f-4020-bbf6-3d7c277957a8')
def test_get_services_list_without_env_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.get_services_list,
None,
session['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('e17972e2-4c5c-4b25-a6cd-82eb2d64897a')
def test_get_services_list_after_delete_env(self):
name = utils.generate_name("get_services_list_after_delete_env")
environment = self.application_catalog_client.create_environment(name)
session = self.application_catalog_client.\
create_session(environment['id'])
self.application_catalog_client.delete_environment(environment['id'])
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.get_services_list,
environment['id'],
session['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('e4ffe0b1-deb0-4f33-9790-6e6dc8bcdecb')
def test_get_services_list_after_delete_session(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.application_catalog_client.\
delete_session(self.environment['id'], session['id'])
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.get_services_list,
self.environment['id'],
session['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('d88880e2-63de-47a0-b29b-a3810b5715e6')
def test_create_service_without_env_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.create_service,
None,
session['id'],
post_body)
@decorators.attr(type='negative')
@decorators.idempotent_id('1d9311af-917a-4a29-b42f-62377369d346')
def test_create_service_without_sess_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
self.assertRaises(exceptions.BadRequest,
self.application_catalog_client.create_service,
self.environment['id'],
"",
post_body)
@decorators.attr(type='negative')
@decorators.idempotent_id('b22f2232-a6d3-4770-b26e-a1e0ccf62d60')
def test_delete_service_without_env_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.delete_service,
"",
session['id'],
service['?']['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('04b4a8b7-3cf6-494a-8741-151305909893')
def test_delete_service_without_session_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.assertRaises(exceptions.BadRequest,
self.application_catalog_client.delete_service,
self.environment['id'],
"",
service['?']['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('2d040e59-3af3-47a2-8d87-eef70920cd65')
def test_double_delete_service(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.application_catalog_client.\
delete_service(self.environment['id'],
session['id'],
service['?']['id'])
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.delete_service,
self.environment['id'],
session['id'],
service['?']['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('a742e411-e572-4aed-ba91-dba8db694039')
def test_get_service_without_env_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.get_service,
None,
session['id'],
service['?']['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('ded0b813-c36e-4108-8be2-c4b1e061f4e9')
def test_put_services_without_env_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
put_body = [self._get_demo_app()]
self.assertRaises(exceptions.NotFound,
self.application_catalog_client.update_services,
None,
session['id'],
put_body)
@decorators.attr(type='negative')
@decorators.idempotent_id('4ab7a7ac-1939-404a-8cb7-feaadc06ae3f')
def test_put_services_without_sess_id(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
put_body = [self._get_demo_app()]
self.assertRaises(exceptions.BadRequest,
self.application_catalog_client.update_services,
self.environment['id'],
"",
put_body)
class TestServicesNegativeTenantIsolation(base.BaseApplicationCatalogTest):
@classmethod
def resource_setup(cls):
super(TestServicesNegativeTenantIsolation, cls).resource_setup()
name = utils.generate_name(cls.__name__)
cls.environment = cls.application_catalog_client.\
create_environment(name)
cls.alt_client = cls.get_client_with_isolated_creds(
type_of_creds='alt')
@classmethod
def resource_cleanup(cls):
cls.application_catalog_client.\
delete_environment(cls.environment['id'])
super(TestServicesNegativeTenantIsolation, cls).resource_cleanup()
@decorators.attr(type='negative')
@decorators.idempotent_id('014050a1-4f8d-4a9b-8332-3eb03d10ba64')
def test_get_list_services_in_env_from_another_tenant(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
self.assertRaises(exceptions.Forbidden,
self.alt_client.get_services_list,
self.environment['id'],
session['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('b2c70134-0537-4912-a6c7-23d477f62764')
def test_create_service_in_env_from_another_tenant(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
self.assertRaises(exceptions.Forbidden,
self.alt_client.create_service,
self.environment['id'],
session['id'],
post_body)
@decorators.attr(type='negative')
@decorators.idempotent_id('264f5854-5fce-4186-987a-98d4fbb67093')
def test_delete_service_in_env_from_another_tenant(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.assertRaises(exceptions.Forbidden,
self.alt_client.delete_service,
self.environment['id'],
session['id'],
service['?']['id'])
@decorators.attr(type='negative')
@decorators.idempotent_id('ff557e1f-a775-4a10-9265-2fa653179c4c')
def test_get_service_in_env_from_another_tenant(self):
session = self.application_catalog_client.\
create_session(self.environment['id'])
self.addCleanup(self.application_catalog_client.delete_session,
self.environment['id'], session['id'])
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service(self.environment['id'], session['id'], post_body)
self.assertRaises(exceptions.Forbidden,
self.alt_client.get_service,
self.environment['id'],
session['id'],
service['?']['id'])
| 47.29304
| 78
| 0.625048
| 1,283
| 12,911
| 6.007794
| 0.157443
| 0.126103
| 0.165023
| 0.177997
| 0.803321
| 0.78438
| 0.769071
| 0.746108
| 0.713285
| 0.694603
| 0
| 0.034248
| 0.271784
| 12,911
| 272
| 79
| 47.466912
| 0.785578
| 0.045155
| 0
| 0.769231
| 0
| 0
| 0.071643
| 0.046625
| 0
| 0
| 0
| 0
| 0.064103
| 1
| 0.081197
| false
| 0
| 0.017094
| 0
| 0.106838
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
5b6c945080277d68fdf3c3dfd2f48138d6aff03f
| 33
|
py
|
Python
|
matchzoo/datasets/wiki_qa/__init__.py
|
ChrisRBXiong/MatchZoo-py
|
8883d0933a62610d71fec0215dce643630e03b1c
|
[
"Apache-2.0"
] | 2,209
|
2018-10-15T08:31:35.000Z
|
2022-03-31T14:29:11.000Z
|
matchzoo/datasets/wiki_qa/__init__.py
|
ChrisRBXiong/MatchZoo-py
|
8883d0933a62610d71fec0215dce643630e03b1c
|
[
"Apache-2.0"
] | 398
|
2018-10-15T07:35:01.000Z
|
2022-03-13T21:31:26.000Z
|
matchzoo/datasets/wiki_qa/__init__.py
|
ChrisRBXiong/MatchZoo-py
|
8883d0933a62610d71fec0215dce643630e03b1c
|
[
"Apache-2.0"
] | 535
|
2018-10-16T09:29:02.000Z
|
2022-03-31T02:12:52.000Z
|
from .load_data import load_data
| 16.5
| 32
| 0.848485
| 6
| 33
| 4.333333
| 0.666667
| 0.615385
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 33
| 1
| 33
| 33
| 0.896552
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
5b6d0aa043c59ddc7b4dddce065901f23e072d6a
| 57,772
|
py
|
Python
|
sfof/python/euclid/dm/_sgs.py
|
sfarrens/sfof
|
f887abc0dbd1587fd7fbc7148b4704d1b5f4cdac
|
[
"MIT"
] | 13
|
2017-06-15T16:56:29.000Z
|
2021-12-08T20:44:39.000Z
|
sfof/python/euclid/dm/_sgs.py
|
umikanero/sfof
|
9aa7b09ccb12311a68373e4e516dee82fa5c428e
|
[
"MIT"
] | 6
|
2020-05-30T07:40:59.000Z
|
2020-11-30T12:25:14.000Z
|
sfof/python/euclid/dm/_sgs.py
|
umikanero/sfof
|
9aa7b09ccb12311a68373e4e516dee82fa5c428e
|
[
"MIT"
] | 4
|
2018-02-24T02:12:24.000Z
|
2021-06-03T07:22:15.000Z
|
# /home/sartor/pymodule/euclid/dm/_sgs.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:77d3da8c9c0b8eec64b9957d9ec227ca99caec32
# Generated 2014-07-24 16:26:39.933073 by PyXB version 1.2.3
# Namespace http://euclid.esa.org/schema/sys/sgs [xmlns:sgs]
import pyxb
import pyxb.binding
import pyxb.binding.saxer
import io
import pyxb.utils.utility
import pyxb.utils.domutils
import sys
# Unique identifier for bindings created at the same time
_GenerationUID = pyxb.utils.utility.UniqueIdentifier('urn:uuid:869ae486-133e-11e4-88d8-90b11c83965f')
# Version of PyXB used to generate the bindings
_PyXBVersion = '1.2.3'
# Generated bindings are not compatible across PyXB versions
if pyxb.__version__ != _PyXBVersion:
raise pyxb.PyXBVersionError(_PyXBVersion)
# Import bindings for namespaces imported into schema
import pyxb.binding.datatypes
import euclid.dm._sys as _ImportedBinding_euclid_dm__sys
import euclid.dm._dss as _ImportedBinding_euclid_dm__dss
# NOTE: All namespace declarations are reserved within the binding
Namespace = pyxb.namespace.NamespaceForURI(u'http://euclid.esa.org/schema/sys/sgs', create_if_missing=True)
Namespace.configureCategories(['typeBinding', 'elementBinding'])
def CreateFromDocument (xml_text, default_namespace=None, location_base=None):
"""Parse the given XML and use the document element to create a
Python instance.
@param xml_text An XML document. This should be data (Python 2
str or Python 3 bytes), or a text (Python 2 unicode or Python 3
str) in the L{pyxb._InputEncoding} encoding.
@keyword default_namespace The L{pyxb.Namespace} instance to use as the
default namespace where there is no default namespace in scope.
If unspecified or C{None}, the namespace of the module containing
this function will be used.
@keyword location_base: An object to be recorded as the base of all
L{pyxb.utils.utility.Location} instances associated with events and
objects handled by the parser. You might pass the URI from which
the document was obtained.
"""
if pyxb.XMLStyle_saxer != pyxb._XMLStyle:
dom = pyxb.utils.domutils.StringToDOM(xml_text)
return CreateFromDOM(dom.documentElement)
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
saxer = pyxb.binding.saxer.make_parser(fallback_namespace=default_namespace, location_base=location_base)
handler = saxer.getContentHandler()
xmld = xml_text
if isinstance(xmld, unicode):
xmld = xmld.encode(pyxb._InputEncoding)
saxer.parse(io.BytesIO(xmld))
instance = handler.rootObject()
return instance
def CreateFromDOM (node, default_namespace=None):
"""Create a Python instance from the given DOM node.
The node tag must correspond to an element declaration in this module.
@deprecated: Forcing use of DOM interface is unnecessary; use L{CreateFromDocument}."""
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace)
# Atomic simple type: {http://euclid.esa.org/schema/sys/sgs}emailAddress
class emailAddress (pyxb.binding.datatypes.string):
"""An atomic simple type."""
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'emailAddress')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 10, 1)
_Documentation = None
emailAddress._CF_pattern = pyxb.binding.facets.CF_pattern()
emailAddress._CF_pattern.addPattern(pattern=u'[^@]+@[^\\.]+\\..+')
emailAddress._InitializeFacetMap(emailAddress._CF_pattern)
Namespace.addCategoryObject('typeBinding', u'emailAddress', emailAddress)
# Complex type {http://euclid.esa.org/schema/sys/sgs}ivoaUCDParam with content type ELEMENT_ONLY
class ivoaUCDParam (pyxb.binding.basis.complexTypeDefinition):
"""This complex type agregates the two ivoa parameters : name and ucd. The definition of the UCD is on ivoa site : http://www.ivoa.net/Documents/REC/UCD/UCDlist-20070402.html#_Toc163276342."""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'ivoaUCDParam')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 15, 1)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Name uses Python identifier Name
__Name = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Name'), 'Name', '__httpeuclid_esa_orgschemasyssgs_ivoaUCDParam_Name', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 21, 3), )
Name = property(__Name.value, __Name.set, None, None)
# Element UCD uses Python identifier UCD
__UCD = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'UCD'), 'UCD', '__httpeuclid_esa_orgschemasyssgs_ivoaUCDParam_UCD', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 22, 3), )
UCD = property(__UCD.value, __UCD.set, None, None)
_ElementMap.update({
__Name.name() : __Name,
__UCD.name() : __UCD
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'ivoaUCDParam', ivoaUCDParam)
# Complex type {http://euclid.esa.org/schema/sys/sgs}curation with content type ELEMENT_ONLY
class curation (pyxb.binding.basis.complexTypeDefinition):
"""This type defines the different characterisitics of the curator of the corresponding set of data."""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'curation')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 25, 1)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Publisher uses Python identifier Publisher
__Publisher = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Publisher'), 'Publisher', '__httpeuclid_esa_orgschemasyssgs_curation_Publisher', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 31, 3), )
Publisher = property(__Publisher.value, __Publisher.set, None, None)
# Element PublisherID uses Python identifier PublisherID
__PublisherID = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'PublisherID'), 'PublisherID', '__httpeuclid_esa_orgschemasyssgs_curation_PublisherID', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 32, 3), )
PublisherID = property(__PublisherID.value, __PublisherID.set, None, None)
# Element Reference uses Python identifier Reference
__Reference = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Reference'), 'Reference', '__httpeuclid_esa_orgschemasyssgs_curation_Reference', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 33, 3), )
Reference = property(__Reference.value, __Reference.set, None, None)
# Element Version uses Python identifier Version
__Version = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Version'), 'Version', '__httpeuclid_esa_orgschemasyssgs_curation_Version', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 34, 3), )
Version = property(__Version.value, __Version.set, None, None)
# Element Contact uses Python identifier Contact
__Contact = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Contact'), 'Contact', '__httpeuclid_esa_orgschemasyssgs_curation_Contact', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 35, 3), )
Contact = property(__Contact.value, __Contact.set, None, None)
# Element Rights uses Python identifier Rights
__Rights = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Rights'), 'Rights', '__httpeuclid_esa_orgschemasyssgs_curation_Rights', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 36, 3), )
Rights = property(__Rights.value, __Rights.set, None, None)
# Element Date uses Python identifier Date
__Date = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Date'), 'Date', '__httpeuclid_esa_orgschemasyssgs_curation_Date', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 37, 3), )
Date = property(__Date.value, __Date.set, None, None)
# Element PublisherDID uses Python identifier PublisherDID
__PublisherDID = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'PublisherDID'), 'PublisherDID', '__httpeuclid_esa_orgschemasyssgs_curation_PublisherDID', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 38, 3), )
PublisherDID = property(__PublisherDID.value, __PublisherDID.set, None, None)
_ElementMap.update({
__Publisher.name() : __Publisher,
__PublisherID.name() : __PublisherID,
__Reference.name() : __Reference,
__Version.name() : __Version,
__Contact.name() : __Contact,
__Rights.name() : __Rights,
__Date.name() : __Date,
__PublisherDID.name() : __PublisherDID
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'curation', curation)
# Complex type {http://euclid.esa.org/schema/sys/sgs}contact with content type ELEMENT_ONLY
class contact (pyxb.binding.basis.complexTypeDefinition):
"""This type defines the coordinates of the organism/people in charge of the curation of the corresponding data."""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'contact')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 41, 1)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Name uses Python identifier Name
__Name = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Name'), 'Name', '__httpeuclid_esa_orgschemasyssgs_contact_Name', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 47, 3), )
Name = property(__Name.value, __Name.set, None, None)
# Element Email uses Python identifier Email
__Email = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Email'), 'Email', '__httpeuclid_esa_orgschemasyssgs_contact_Email', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 48, 3), )
Email = property(__Email.value, __Email.set, None, None)
_ElementMap.update({
__Name.name() : __Name,
__Email.name() : __Email
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'contact', contact)
# Complex type {http://euclid.esa.org/schema/sys/sgs}product with content type ELEMENT_ONLY
class product (pyxb.binding.basis.complexTypeDefinition):
"""Descriptor for product."""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'product')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 53, 1)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Name uses Python identifier Name
__Name = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Name'), 'Name', '__httpeuclid_esa_orgschemasyssgs_product_Name', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 58, 3), )
Name = property(__Name.value, __Name.set, None, None)
# Element Description uses Python identifier Description
__Description = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Description'), 'Description', '__httpeuclid_esa_orgschemasyssgs_product_Description', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 59, 3), )
Description = property(__Description.value, __Description.set, None, None)
# Element Type uses Python identifier Type
__Type = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Type'), 'Type', '__httpeuclid_esa_orgschemasyssgs_product_Type', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 60, 3), )
Type = property(__Type.value, __Type.set, None, None)
# Element ProductionDate uses Python identifier ProductionDate
__ProductionDate = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'ProductionDate'), 'ProductionDate', '__httpeuclid_esa_orgschemasyssgs_product_ProductionDate', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 61, 3), )
ProductionDate = property(__ProductionDate.value, __ProductionDate.set, None, None)
# Element Producer uses Python identifier Producer
__Producer = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Producer'), 'Producer', '__httpeuclid_esa_orgschemasyssgs_product_Producer', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 62, 3), )
Producer = property(__Producer.value, __Producer.set, None, u'Creator of the data.')
# Element Source uses Python identifier Source
__Source = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Source'), 'Source', '__httpeuclid_esa_orgschemasyssgs_product_Source', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 68, 4), )
Source = property(__Source.value, __Source.set, None, None)
_ElementMap.update({
__Name.name() : __Name,
__Description.name() : __Description,
__Type.name() : __Type,
__ProductionDate.name() : __ProductionDate,
__Producer.name() : __Producer,
__Source.name() : __Source
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'product', product)
# Complex type {http://euclid.esa.org/schema/sys/sgs}fileDescriptor with content type ELEMENT_ONLY
class fileDescriptor (pyxb.binding.basis.complexTypeDefinition):
"""
Descriptor of a file used to store transient data such as data managed by the IAL
until moved to the workspace as input for the pipeline processing tasks.
"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'fileDescriptor')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 73, 1)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Id uses Python identifier Id
__Id = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Id'), 'Id', '__httpeuclid_esa_orgschemasyssgs_fileDescriptor_Id', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 81, 3), )
Id = property(__Id.value, __Id.set, None, None)
# Element Filename uses Python identifier Filename
__Filename = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Filename'), 'Filename', '__httpeuclid_esa_orgschemasyssgs_fileDescriptor_Filename', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 82, 3), )
Filename = property(__Filename.value, __Filename.set, None, None)
# Element Path uses Python identifier Path
__Path = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Path'), 'Path', '__httpeuclid_esa_orgschemasyssgs_fileDescriptor_Path', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 83, 3), )
Path = property(__Path.value, __Path.set, None, None)
# Element StorageId uses Python identifier StorageId
__StorageId = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'StorageId'), 'StorageId', '__httpeuclid_esa_orgschemasyssgs_fileDescriptor_StorageId', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 84, 3), )
StorageId = property(__StorageId.value, __StorageId.set, None, None)
_ElementMap.update({
__Id.name() : __Id,
__Filename.name() : __Filename,
__Path.name() : __Path,
__StorageId.name() : __StorageId
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'fileDescriptor', fileDescriptor)
# Complex type {http://euclid.esa.org/schema/sys/sgs}taskProduct with content type ELEMENT_ONLY
class taskProduct (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://euclid.esa.org/schema/sys/sgs}taskProduct with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'taskProduct')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 89, 4)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Id uses Python identifier Id
__Id = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Id'), 'Id', '__httpeuclid_esa_orgschemasyssgs_taskProduct_Id', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 91, 12), )
Id = property(__Id.value, __Id.set, None, None)
# Element PortName uses Python identifier PortName
__PortName = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'PortName'), 'PortName', '__httpeuclid_esa_orgschemasyssgs_taskProduct_PortName', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 92, 12), )
PortName = property(__PortName.value, __PortName.set, None, None)
# Element ProductType uses Python identifier ProductType
__ProductType = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'ProductType'), 'ProductType', '__httpeuclid_esa_orgschemasyssgs_taskProduct_ProductType', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 93, 12), )
ProductType = property(__ProductType.value, __ProductType.set, None, None)
# Element ProductId uses Python identifier ProductId
__ProductId = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'ProductId'), 'ProductId', '__httpeuclid_esa_orgschemasyssgs_taskProduct_ProductId', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 94, 12), )
ProductId = property(__ProductId.value, __ProductId.set, None, None)
# Element LocalFile uses Python identifier LocalFile
__LocalFile = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'LocalFile'), 'LocalFile', '__httpeuclid_esa_orgschemasyssgs_taskProduct_LocalFile', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 95, 12), )
LocalFile = property(__LocalFile.value, __LocalFile.set, None, None)
_ElementMap.update({
__Id.name() : __Id,
__PortName.name() : __PortName,
__ProductType.name() : __ProductType,
__ProductId.name() : __ProductId,
__LocalFile.name() : __LocalFile
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'taskProduct', taskProduct)
# Complex type {http://euclid.esa.org/schema/sys/sgs}dataFileNameList with content type ELEMENT_ONLY
class dataFileNameList (pyxb.binding.basis.complexTypeDefinition):
"""Complex type {http://euclid.esa.org/schema/sys/sgs}dataFileNameList with content type ELEMENT_ONLY"""
_TypeDefinition = None
_ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_ELEMENT_ONLY
_Abstract = False
_ExpandedName = pyxb.namespace.ExpandedName(Namespace, u'dataFileNameList')
_XSDLocation = pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 100, 4)
_ElementMap = {}
_AttributeMap = {}
# Base type is pyxb.binding.datatypes.anyType
# Element Id uses Python identifier Id
__Id = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'Id'), 'Id', '__httpeuclid_esa_orgschemasyssgs_dataFileNameList_Id', False, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 102, 12), )
Id = property(__Id.value, __Id.set, None, None)
# Element FileName uses Python identifier FileName
__FileName = pyxb.binding.content.ElementDeclaration(pyxb.namespace.ExpandedName(None, u'FileName'), 'FileName', '__httpeuclid_esa_orgschemasyssgs_dataFileNameList_FileName', True, pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 103, 12), )
FileName = property(__FileName.value, __FileName.set, None, None)
_ElementMap.update({
__Id.name() : __Id,
__FileName.name() : __FileName
})
_AttributeMap.update({
})
Namespace.addCategoryObject('typeBinding', u'dataFileNameList', dataFileNameList)
ivoaUCDParam._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Name'), pyxb.binding.datatypes.string, scope=ivoaUCDParam, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 21, 3)))
ivoaUCDParam._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'UCD'), pyxb.binding.datatypes.string, scope=ivoaUCDParam, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 22, 3)))
def _BuildAutomaton ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton
del _BuildAutomaton
import pyxb.utils.fac as fac
counters = set()
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(ivoaUCDParam._UseForTag(pyxb.namespace.ExpandedName(None, u'Name')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 21, 3))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
symbol = pyxb.binding.content.ElementUse(ivoaUCDParam._UseForTag(pyxb.namespace.ExpandedName(None, u'UCD')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 22, 3))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
st_1._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
ivoaUCDParam._Automaton = _BuildAutomaton()
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Publisher'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 31, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'PublisherID'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 32, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Reference'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 33, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Version'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 34, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Contact'), contact, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 35, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Rights'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 36, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Date'), pyxb.binding.datatypes.dateTime, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 37, 3)))
curation._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'PublisherDID'), ivoaUCDParam, scope=curation, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 38, 3)))
def _BuildAutomaton_ ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_
del _BuildAutomaton_
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 31, 3))
counters.add(cc_0)
cc_1 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 32, 3))
counters.add(cc_1)
cc_2 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 33, 3))
counters.add(cc_2)
cc_3 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 34, 3))
counters.add(cc_3)
cc_4 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 35, 3))
counters.add(cc_4)
cc_5 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 36, 3))
counters.add(cc_5)
cc_6 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 37, 3))
counters.add(cc_6)
cc_7 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 38, 3))
counters.add(cc_7)
states = []
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Publisher')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 31, 3))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_1, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'PublisherID')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 32, 3))
st_1 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_2, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Reference')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 33, 3))
st_2 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_3, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Version')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 34, 3))
st_3 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_3)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_4, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Contact')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 35, 3))
st_4 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_4)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_5, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Rights')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 36, 3))
st_5 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_5)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_6, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'Date')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 37, 3))
st_6 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_6)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_7, False))
symbol = pyxb.binding.content.ElementUse(curation._UseForTag(pyxb.namespace.ExpandedName(None, u'PublisherDID')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 38, 3))
st_7 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_7)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_0, False) ]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_1, True) ]))
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_1, False) ]))
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_1, False) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_1, False) ]))
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_1, False) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_1, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_1, False) ]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_2, True) ]))
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_2, False) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_2, False) ]))
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_2, False) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_2, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_2, False) ]))
st_2._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_3, True) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_3, False) ]))
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_3, False) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_3, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_3, False) ]))
st_3._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_4, True) ]))
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_4, False) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_4, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_4, False) ]))
st_4._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_5, [
fac.UpdateInstruction(cc_5, True) ]))
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_5, False) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_5, False) ]))
st_5._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_6, [
fac.UpdateInstruction(cc_6, True) ]))
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_6, False) ]))
st_6._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_7, [
fac.UpdateInstruction(cc_7, True) ]))
st_7._set_transitionSet(transitions)
return fac.Automaton(states, counters, True, containing_state=None)
curation._Automaton = _BuildAutomaton_()
contact._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Name'), pyxb.binding.datatypes.string, scope=contact, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 47, 3)))
contact._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Email'), emailAddress, scope=contact, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 48, 3)))
def _BuildAutomaton_2 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_2
del _BuildAutomaton_2
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 47, 3))
counters.add(cc_0)
cc_1 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 48, 3))
counters.add(cc_1)
states = []
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.ElementUse(contact._UseForTag(pyxb.namespace.ExpandedName(None, u'Name')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 47, 3))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_1, False))
symbol = pyxb.binding.content.ElementUse(contact._UseForTag(pyxb.namespace.ExpandedName(None, u'Email')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 48, 3))
st_1 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
transitions = []
transitions.append(fac.Transition(st_0, [
fac.UpdateInstruction(cc_0, True) ]))
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_0, False) ]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_1, True) ]))
st_1._set_transitionSet(transitions)
return fac.Automaton(states, counters, True, containing_state=None)
contact._Automaton = _BuildAutomaton_2()
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Name'), pyxb.binding.datatypes.string, scope=product, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 58, 3)))
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Description'), pyxb.binding.datatypes.string, scope=product, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 59, 3)))
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Type'), pyxb.binding.datatypes.string, scope=product, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 60, 3)))
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'ProductionDate'), _ImportedBinding_euclid_dm__sys.systemDateTime, scope=product, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 61, 3)))
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Producer'), _ImportedBinding_euclid_dm__sys.infraName, scope=product, documentation=u'Creator of the data.', location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 62, 3)))
product._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Source'), _ImportedBinding_euclid_dm__dss.dataContainer, scope=product, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 68, 4)))
def _BuildAutomaton_3 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_3
del _BuildAutomaton_3
import pyxb.utils.fac as fac
counters = set()
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'Name')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 58, 3))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = None
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'Description')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 59, 3))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = None
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'Type')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 60, 3))
st_2 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
final_update = None
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'ProductionDate')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 61, 3))
st_3 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_3)
final_update = None
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'Producer')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 62, 3))
st_4 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_4)
final_update = set()
symbol = pyxb.binding.content.ElementUse(product._UseForTag(pyxb.namespace.ExpandedName(None, u'Source')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 68, 4))
st_5 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_5)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_3, [
]))
st_2._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_4, [
]))
st_3._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_5, [
]))
st_4._set_transitionSet(transitions)
transitions = []
st_5._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
product._Automaton = _BuildAutomaton_3()
fileDescriptor._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Id'), pyxb.binding.datatypes.string, scope=fileDescriptor, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 81, 3)))
fileDescriptor._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Filename'), pyxb.binding.datatypes.string, scope=fileDescriptor, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 82, 3)))
fileDescriptor._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Path'), pyxb.binding.datatypes.string, scope=fileDescriptor, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 83, 3)))
fileDescriptor._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'StorageId'), pyxb.binding.datatypes.string, scope=fileDescriptor, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 84, 3)))
def _BuildAutomaton_4 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_4
del _BuildAutomaton_4
import pyxb.utils.fac as fac
counters = set()
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(fileDescriptor._UseForTag(pyxb.namespace.ExpandedName(None, u'Id')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 81, 3))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = None
symbol = pyxb.binding.content.ElementUse(fileDescriptor._UseForTag(pyxb.namespace.ExpandedName(None, u'Filename')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 82, 3))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = None
symbol = pyxb.binding.content.ElementUse(fileDescriptor._UseForTag(pyxb.namespace.ExpandedName(None, u'Path')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 83, 3))
st_2 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
final_update = set()
symbol = pyxb.binding.content.ElementUse(fileDescriptor._UseForTag(pyxb.namespace.ExpandedName(None, u'StorageId')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 84, 3))
st_3 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_3)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_3, [
]))
st_2._set_transitionSet(transitions)
transitions = []
st_3._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
fileDescriptor._Automaton = _BuildAutomaton_4()
taskProduct._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Id'), pyxb.binding.datatypes.string, scope=taskProduct, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 91, 12)))
taskProduct._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'PortName'), pyxb.binding.datatypes.string, scope=taskProduct, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 92, 12)))
taskProduct._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'ProductType'), pyxb.binding.datatypes.string, scope=taskProduct, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 93, 12)))
taskProduct._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'ProductId'), pyxb.binding.datatypes.string, scope=taskProduct, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 94, 12)))
taskProduct._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'LocalFile'), fileDescriptor, scope=taskProduct, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 95, 12)))
def _BuildAutomaton_5 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_5
del _BuildAutomaton_5
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 93, 12))
counters.add(cc_0)
cc_1 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 94, 12))
counters.add(cc_1)
cc_2 = fac.CounterCondition(min=0L, max=1, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 95, 12))
counters.add(cc_2)
states = []
final_update = None
symbol = pyxb.binding.content.ElementUse(taskProduct._UseForTag(pyxb.namespace.ExpandedName(None, u'Id')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 91, 12))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
symbol = pyxb.binding.content.ElementUse(taskProduct._UseForTag(pyxb.namespace.ExpandedName(None, u'PortName')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 92, 12))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.ElementUse(taskProduct._UseForTag(pyxb.namespace.ExpandedName(None, u'ProductType')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 93, 12))
st_2 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_2)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_1, False))
symbol = pyxb.binding.content.ElementUse(taskProduct._UseForTag(pyxb.namespace.ExpandedName(None, u'ProductId')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 94, 12))
st_3 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_3)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_2, False))
symbol = pyxb.binding.content.ElementUse(taskProduct._UseForTag(pyxb.namespace.ExpandedName(None, u'LocalFile')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 95, 12))
st_4 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_4)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
]))
transitions.append(fac.Transition(st_3, [
]))
transitions.append(fac.Transition(st_4, [
]))
st_1._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_2, [
fac.UpdateInstruction(cc_0, True) ]))
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_0, False) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_0, False) ]))
st_2._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_3, [
fac.UpdateInstruction(cc_1, True) ]))
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_1, False) ]))
st_3._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_4, [
fac.UpdateInstruction(cc_2, True) ]))
st_4._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
taskProduct._Automaton = _BuildAutomaton_5()
dataFileNameList._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'Id'), pyxb.binding.datatypes.string, scope=dataFileNameList, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 102, 12)))
dataFileNameList._AddElement(pyxb.binding.basis.element(pyxb.namespace.ExpandedName(None, u'FileName'), _ImportedBinding_euclid_dm__sys.dataFileName, scope=dataFileNameList, location=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 103, 12)))
def _BuildAutomaton_6 ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton_6
del _BuildAutomaton_6
import pyxb.utils.fac as fac
counters = set()
cc_0 = fac.CounterCondition(min=0L, max=None, metadata=pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 103, 12))
counters.add(cc_0)
states = []
final_update = set()
symbol = pyxb.binding.content.ElementUse(dataFileNameList._UseForTag(pyxb.namespace.ExpandedName(None, u'Id')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 102, 12))
st_0 = fac.State(symbol, is_initial=True, final_update=final_update, is_unordered_catenation=False)
states.append(st_0)
final_update = set()
final_update.add(fac.UpdateInstruction(cc_0, False))
symbol = pyxb.binding.content.ElementUse(dataFileNameList._UseForTag(pyxb.namespace.ExpandedName(None, u'FileName')), pyxb.utils.utility.Location(u'/home/sartor/workspace/EUCLID/svn_tot/schema/branches/challenge4/Dictionary/sys/sgs/euc-test-sgs.xsd', 103, 12))
st_1 = fac.State(symbol, is_initial=False, final_update=final_update, is_unordered_catenation=False)
states.append(st_1)
transitions = []
transitions.append(fac.Transition(st_1, [
]))
st_0._set_transitionSet(transitions)
transitions = []
transitions.append(fac.Transition(st_1, [
fac.UpdateInstruction(cc_0, True) ]))
st_1._set_transitionSet(transitions)
return fac.Automaton(states, counters, False, containing_state=None)
dataFileNameList._Automaton = _BuildAutomaton_6()
| 60.940928
| 343
| 0.759988
| 7,471
| 57,772
| 5.696292
| 0.049525
| 0.03386
| 0.042108
| 0.062034
| 0.821111
| 0.81486
| 0.790023
| 0.784078
| 0.774632
| 0.722419
| 0
| 0.016454
| 0.112113
| 57,772
| 947
| 344
| 61.00528
| 0.813198
| 0.058506
| 0
| 0.581903
| 1
| 0.170047
| 0.259148
| 0.236556
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.032761
| null | null | 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
f3464093094a02afe9c1bf0e30a6a43d56b40a8a
| 132
|
py
|
Python
|
src/bnn/util/plotting.py
|
beauCoker/variable_selection
|
174278c81192940a3faea76b43384f25c4ba2c13
|
[
"MIT"
] | null | null | null |
src/bnn/util/plotting.py
|
beauCoker/variable_selection
|
174278c81192940a3faea76b43384f25c4ba2c13
|
[
"MIT"
] | null | null | null |
src/bnn/util/plotting.py
|
beauCoker/variable_selection
|
174278c81192940a3faea76b43384f25c4ba2c13
|
[
"MIT"
] | 1
|
2021-03-09T18:09:31.000Z
|
2021-03-09T18:09:31.000Z
|
# standard library imports
# package imports
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
| 16.5
| 31
| 0.795455
| 22
| 132
| 4.772727
| 0.545455
| 0.314286
| 0.247619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 132
| 7
| 32
| 18.857143
| 0.954545
| 0.30303
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
f362b7da68e8d6fb99b47e0733872c5765187044
| 22,328
|
py
|
Python
|
manager/director/apps/sites/tests/test_actions.py
|
darius-kia/director4
|
1d2c2c4c3ec12cc9b7f846d5dc075ea3bbef36f9
|
[
"MIT"
] | 7
|
2020-08-23T23:08:34.000Z
|
2021-12-02T04:17:37.000Z
|
manager/director/apps/sites/tests/test_actions.py
|
darius-kia/director4
|
1d2c2c4c3ec12cc9b7f846d5dc075ea3bbef36f9
|
[
"MIT"
] | 43
|
2020-08-24T16:48:29.000Z
|
2022-03-02T19:45:54.000Z
|
manager/director/apps/sites/tests/test_actions.py
|
darius-kia/director4
|
1d2c2c4c3ec12cc9b7f846d5dc075ea3bbef36f9
|
[
"MIT"
] | 10
|
2020-08-17T20:42:52.000Z
|
2021-07-16T03:46:51.000Z
|
import json
import uuid
from unittest.mock import patch
from ....test.director_test import DirectorTestCase
from ....utils.appserver import AppserverConnectionError, AppserverProtocolError
from ....utils.balancer import BalancerProtocolError
from ..actions import (
build_docker_image,
create_real_site_database,
delete_site_database_and_object,
ensure_site_directories_exist,
find_pingable_appservers,
regen_database_password,
remove_all_site_files_dangerous,
remove_appserver_nginx_config,
remove_balancer_nginx_config,
remove_docker_image,
remove_docker_service,
restart_docker_service,
update_appserver_nginx_config,
update_balancer_certbot,
update_balancer_nginx_config,
update_docker_service,
)
from ..models import Database, DatabaseHost, DockerImage, Site
class ActionsTestCase(DirectorTestCase):
def setUp(self):
dockerimage = DockerImage.objects.get_or_create(
name="alpine:latest", friendly_name="Alpine", is_custom=False, is_user_visible=True
)[0]
self.site = Site.objects.get_or_create(
name="sysadmins",
description="test",
type="dynamic",
purpose="activity",
docker_image=dockerimage,
)[0]
def test_find_pingable_appservers(self):
with patch(
"director.apps.sites.actions.iter_pingable_appservers", return_value=iter([1, 2, 3, 5])
) as mock_ping:
result = find_pingable_appservers(self.site, {}) # type: ignore
self.assertEqual("Pinging appservers", next(result))
self.assertEqual("Pingable appservers: [1, 2, 3, 5]", next(result))
mock_ping.assert_called()
def test_update_appserver_nginx_config(self):
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = update_appserver_nginx_config(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Connecting to appserver 0 to update Nginx config", next(result))
self.assertEqual("Error updating Nginx config", next(result))
self.assertEqual("Disabling site Nginx config", next(result))
with self.assertRaises(AppserverProtocolError):
self.assertEqual("Re-raising exception", next(result))
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=None
) as mock_req:
result = update_appserver_nginx_config(self.site, {"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to update Nginx config", next(result))
self.assertEqual("Successfully updated Nginx config", next(result))
self.assertEqual("Reloading Nginx config on all appservers", next(result))
self.assertEqual("Reloading Nginx config on appserver 0", next(result))
self.assertEqual("Successfully reloaded configuration", next(result))
mock_req.assert_called()
def test_remove_appserver_nginx_config(self):
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = remove_appserver_nginx_config(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Connecting to appserver 0 to remove Nginx config", next(result))
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=None
) as mock_req:
result = remove_appserver_nginx_config(self.site, {"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to remove Nginx config", next(result))
self.assertEqual("Reloading Nginx config on all appservers", next(result))
self.assertEqual("Reloading Nginx config on appserver 0", next(result))
self.assertEqual("Done", next(result))
mock_req.assert_called()
def test_update_docker_service(self):
# First, make sure that a disabled site removes the Docker service
magic_str = str(uuid.uuid4())
with patch(
"director.apps.sites.actions.remove_docker_service", return_value=iter([magic_str])
) as mock_remove:
self.site.availability = "disabled"
self.site.save()
result = update_docker_service(self.site, {"pingable_appservers": [0]})
self.assertEqual(magic_str, next(result))
mock_remove.assert_called()
self.site.availability = "enabled"
self.site.save()
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = update_docker_service(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual(
"Connecting to appserver 0 to create/update Docker service", next(result)
)
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=None
) as mock_req:
result = update_docker_service(self.site, {"pingable_appservers": [0]})
self.assertEqual(
"Connecting to appserver 0 to create/update Docker service", next(result)
)
self.assertEqual("Created/updated Docker service", next(result))
mock_req.assert_called()
def test_restart_docker_service(self):
# First, make sure that a disabled site does nothing
self.site.availability = "disabled"
self.site.save()
result = restart_docker_service(self.site, {"pingable_appservers": [0]})
self.assertEqual("Site disabled; skipping", next(result))
self.site.availability = "enabled"
self.site.save()
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = restart_docker_service(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Connecting to appserver 0 to restart Docker service", next(result))
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=None
) as mock_req:
result = restart_docker_service(self.site, {"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to restart Docker service", next(result))
self.assertEqual("Restarted Docker service", next(result))
mock_req.assert_called_once_with(
0, f"/sites/{self.site.id}/restart-docker-service", method="POST"
)
def test_remove_docker_service(self):
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = remove_docker_service(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Connecting to appserver 0 to remove Docker service", next(result))
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=None
) as mock_req:
result = remove_docker_service(self.site, {"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to remove Docker service", next(result))
self.assertEqual("Removed Docker service", next(result))
mock_req.assert_called_once_with(
0, f"/sites/{self.site.id}/remove-docker-service", method="POST"
)
def test_build_docker_image(self):
# self.site does not have a custom Docker image, currently
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = build_docker_image(self.site, {"pingable_appservers": [0]})
self.assertEqual("Site does not have a custom Docker image; skipping", next(result))
# Make self.site.docker_image a custom one for this
self.site.docker_image.is_custom = True
self.site.docker_image.save()
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = build_docker_image(self.site, {"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to build Docker image", next(result))
# appserver 0 is not reachable
with self.assertRaises(Exception):
next(result)
def test_remove_docker_image(self):
# self.site does not have a custom Docker image, currently
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = remove_docker_image(self.site, {"pingable_appservers": [0]})
self.assertEqual("Site does not have a custom Docker image; skipping", next(result))
# Make self.site.docker_image a custom one for this
self.site.docker_image.is_custom = True
self.site.docker_image.save()
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = remove_docker_image(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Removing Docker image on appserver 0", next(result))
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=True
) as mock_req:
result = remove_docker_image(self.site, {"pingable_appservers": [0]})
self.assertEqual("Removing Docker image on appserver 0", next(result))
self.assertEqual("Removing Docker image from registry on appserver 0", next(result))
mock_req.assert_called_with(
0, "/sites/remove-docker-image", method="POST", params={"name": "alpine:latest"}
)
try:
next(result)
except StopIteration:
pass
mock_req.assert_called_with(
0, "/sites/remove-registry-image", method="POST", params={"name": "alpine:latest"}
)
def test_ensure_site_directories_exist(self):
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = ensure_site_directories_exist(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual(
"Connecting to appserver 0 to ensure site directories exist", next(result)
)
with self.assertRaises(AppserverProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=True
) as mock_req:
result = ensure_site_directories_exist(self.site, {"pingable_appservers": [0]})
self.assertEqual(
"Connecting to appserver 0 to ensure site directories exist", next(result)
)
try:
next(result)
except StopIteration:
pass
mock_req.assert_called_with(
0, f"/sites/{self.site.id}/ensure-directories-exist", method="POST"
)
def test_remove_all_site_files_dangerous(self):
with self.settings(DIRECTOR_APPSERVER_HOSTS=["director-apptest1:8000"]):
result = remove_all_site_files_dangerous(self.site, {"pingable_appservers": [0]})
# "director-apptest1:8000" obviously isn't pingable.
self.assertEqual("Connecting to appserver 0 to remove site files", next(result))
try:
next(result)
# If this test works, then we must have been passed to the try-catch.
# The false assertion below serves to fail the test if we are not
# in the try-catch.
self.assertFalse(True) # pylint: disable=redundant-unittest-assert
except (OSError, ConnectionRefusedError):
pass
def test_update_balancer_nginx_config(self):
with self.settings(
DIRECTOR_BALANCER_HOSTS=["director-baltest1:8000"], DIRECTOR_NUM_BALANCERS=1
):
with patch("director.apps.sites.actions.iter_pingable_balancers", return_value=[0]):
result = update_balancer_nginx_config(self.site, {})
# "director-baltest1:8000" obviously isn't pingable, but we patch it here.
self.assertEqual("Pinging balancers", next(result))
self.assertEqual("Pingable balancers: [0]", next(result))
self.assertEqual("Updating balancer 0", next(result))
with self.assertRaises(BalancerProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.balancer_open_http_request", return_value=True
) as mock_req:
result = update_balancer_nginx_config(self.site, {})
self.assertEqual("Pinging balancers", next(result))
self.assertEqual("Pingable balancers: [0]", next(result))
self.assertEqual("Updating balancer 0", next(result))
self.assertEqual("Updated balancer 0", next(result))
mock_req.assert_called_with(
0,
f"/sites/{self.site.id}/update-nginx",
method="POST",
data={"data": json.dumps(self.site.serialize_for_balancer())},
)
def test_remove_balancer_nginx_config(self):
with self.settings(
DIRECTOR_BALANCER_HOSTS=["director-baltest1:8000"], DIRECTOR_NUM_BALANCERS=1
):
with patch("director.apps.sites.actions.iter_pingable_balancers", return_value=[0]):
result = remove_balancer_nginx_config(self.site, {})
# "director-baltest1:8000" obviously isn't pingable, but we patch it here.
self.assertEqual("Pinging balancers", next(result))
self.assertEqual("Pingable balancers: [0]", next(result))
self.assertEqual("Removing Nginx config on balancer 0", next(result))
with self.assertRaises(BalancerProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.balancer_open_http_request", return_value=True
) as mock_req:
result = remove_balancer_nginx_config(self.site, {})
self.assertEqual("Pinging balancers", next(result))
self.assertEqual("Pingable balancers: [0]", next(result))
self.assertEqual("Removing Nginx config on balancer 0", next(result))
self.assertEqual("Removed Nginx config on balancer 0", next(result))
mock_req.assert_called_with(
0, f"/sites/{self.site.id}/remove-nginx", method="POST"
)
def test_update_balancer_certbot(self):
with self.settings(
DIRECTOR_BALANCER_HOSTS=["director-baltest1:8000"], DIRECTOR_NUM_BALANCERS=1
):
with patch("director.apps.sites.actions.iter_pingable_balancers", return_value=[0]):
result = update_balancer_certbot(self.site, {})
# "director-baltest1:8000" obviously isn't pingable, but we patch it here.
self.assertEqual("Setting up certbot for site", next(result))
with self.assertRaises(BalancerProtocolError):
next(result)
# Now, patch that method to bypass it
with patch(
"director.apps.sites.actions.balancer_open_http_request", return_value=True
) as mock_req:
result = update_balancer_certbot(self.site, {})
self.assertEqual("Setting up certbot for site", next(result))
self.assertEqual("Removing old domains", next(result))
mock_req.assert_called_with(
0,
f"/sites/{self.site.id}/certbot-setup",
method="POST",
data={"data": json.dumps(self.site.serialize_for_balancer())},
)
def test_delete_site_database_and_object(self):
# The site doesn't have a database object yet.
with self.assertRaises(AssertionError):
next(delete_site_database_and_object(site=self.site, scope={}))
dbhost = DatabaseHost.objects.create(hostname="test-postgres", port=5432, dbms="postgres")
database = Database.objects.create(host=dbhost, password="x")
self.site.database = database
self.site.save()
result = delete_site_database_and_object(site=self.site, scope={"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to delete real database", next(result))
with self.assertRaises(AppserverConnectionError):
next(result)
# Patch it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=True
) as mock_req:
result = delete_site_database_and_object(
site=self.site, scope={"pingable_appservers": [0]}
)
self.assertEqual("Connecting to appserver 0 to delete real database", next(result))
self.assertEqual("Deleting database object in model", next(result))
try:
next(result)
except StopIteration:
pass
mock_req.assert_called_once_with(
0,
"/sites/databases/delete",
method="POST",
data={"data": json.dumps(self.site.database.serialize_for_appserver())},
timeout=30,
)
self.assertIsNone(Site.objects.get(id=self.site.id).database)
def test_create_real_site_database(self):
# The site doesn't have a database object yet.
with self.assertRaises(AssertionError):
next(delete_site_database_and_object(site=self.site, scope={}))
dbhost = DatabaseHost.objects.create(hostname="test-postgres", port=5432, dbms="postgres")
database = Database.objects.create(host=dbhost, password="x")
self.site.database = database
self.site.save()
result = create_real_site_database(site=self.site, scope={"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to create real site database", next(result))
with self.assertRaises(AppserverConnectionError):
next(result)
# Patch it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=True
) as mock_req:
result = create_real_site_database(site=self.site, scope={"pingable_appservers": [0]})
self.assertEqual("Connecting to appserver 0 to create real site database", next(result))
try:
next(result)
except StopIteration:
pass
mock_req.assert_called_once_with(
0,
"/sites/databases/create",
method="POST",
data={"data": json.dumps(self.site.database.serialize_for_appserver())},
timeout=30,
)
def test_regen_database_password(self):
# The site doesn't have a database object yet.
with self.assertRaises(AssertionError):
next(delete_site_database_and_object(site=self.site, scope={}))
dbhost = DatabaseHost.objects.create(hostname="test-postgres", port=5432, dbms="postgres")
database = Database.objects.create(host=dbhost, password="x")
self.site.database = database
self.site.save()
result = regen_database_password(site=self.site, scope={"pingable_appservers": [0]})
self.assertEqual("Updating password in database model", next(result))
self.assertEqual("Connecting to appserver 0 to update real password", next(result))
with self.assertRaises(AppserverConnectionError):
next(result)
new_password = Database.objects.get(id=database.id).password
self.assertNotEqual("x", new_password)
# Patch it
with patch(
"director.apps.sites.actions.appserver_open_http_request", return_value=True
) as mock_req:
result = regen_database_password(site=self.site, scope={"pingable_appservers": [0]})
self.assertEqual("Updating password in database model", next(result))
self.assertEqual("Connecting to appserver 0 to update real password", next(result))
try:
next(result)
except StopIteration:
pass
mock_req.assert_called_once_with(
0,
"/sites/databases/create",
method="POST",
data={"data": json.dumps(self.site.database.serialize_for_appserver())},
timeout=30,
)
new_new_password = Database.objects.get(id=database.id).password
self.assertNotEqual(new_password, new_new_password)
| 42.368121
| 100
| 0.625672
| 2,437
| 22,328
| 5.558474
| 0.087813
| 0.059796
| 0.029972
| 0.051676
| 0.856268
| 0.828806
| 0.807988
| 0.800015
| 0.770412
| 0.76207
| 0
| 0.014413
| 0.275976
| 22,328
| 526
| 101
| 42.448669
| 0.823519
| 0.076675
| 0
| 0.686486
| 0
| 0
| 0.221569
| 0.079364
| 0
| 0
| 0
| 0
| 0.267568
| 1
| 0.045946
| false
| 0.056757
| 0.021622
| 0
| 0.07027
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
f36984010b7164f634e4c41c2d22ae962eef6282
| 16,801
|
py
|
Python
|
server/tests/test_apis.py
|
AruneshS/githubsrm
|
ce6ef452c0129fce369b6b8ad8b5da0ef6f44b65
|
[
"MIT"
] | 1
|
2022-03-22T17:24:22.000Z
|
2022-03-22T17:24:22.000Z
|
server/tests/test_apis.py
|
AruneshS/githubsrm
|
ce6ef452c0129fce369b6b8ad8b5da0ef6f44b65
|
[
"MIT"
] | null | null | null |
server/tests/test_apis.py
|
AruneshS/githubsrm
|
ce6ef452c0129fce369b6b8ad8b5da0ef6f44b65
|
[
"MIT"
] | null | null | null |
import os
from dotenv import load_dotenv
import requests
import pymongo
import unittest
import json
from githubsrm.core.settings import DATABASE
from . import Base
entry = Base()
class TestClient(unittest.TestCase):
'''
Integration tests
'''
@classmethod
def setUpClass(cls) -> None:
load_dotenv()
cls.client = requests.Session()
cls.pymongo_client = pymongo.MongoClient(DATABASE['mongo_uri'])
cls.db = cls.pymongo_client[os.getenv("TestDB")]
cls.base_url = "http://localhost:8000/"
cls.webhook = list(cls.db.webHook.find({}))[0]["token"]
def test_team_data(self):
'''
Checks valid response Status form team api
'''
response = self.client.get(self.base_url+'api/team')
self.assertEqual(response.status_code, 200)
def test_add_alpha(self):
"""
Add alpha maintainer
"""
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
self.clean()
def test_add_beta(self):
"""
Add beta maintainer
"""
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
id = dict(self.db.maintainer.find_one(
{"github_id": "riju561"}))["project_id"]
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps({**entry.beta_data, **{"project_id": id}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 201)
self.clean()
def test_add_contributor(self):
"""
add contributor
"""
self.clean()
response = self.client.post(
url=self.base_url+'admin/register', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/login', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
admin_jwt = response.json()["access_token"]
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
alpha = dict(self.db.maintainer.find_one({"github_id": "riju561"}))
data = {
"maintainer_id": alpha["_id"],
"project_id": alpha["project_id"],
"email": alpha["email"]
}
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps(data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "maintainer"})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps({**entry.project_details, **{"project_id": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "project"})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'api/contributor', data=json.dumps({**entry.contributor_data, **{"interested_project": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "contributor"})
self.assertEqual(response.status_code, 201)
self.clean()
def test_add_maintainer_after_contributor(self):
self.clean()
response = self.client.post(
url=self.base_url+'admin/register', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/login', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
admin_jwt = response.json()["access_token"]
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
alpha = dict(self.db.maintainer.find_one({"github_id": "riju561"}))
data = {
"maintainer_id": alpha["_id"],
"project_id": alpha["project_id"],
"email": alpha["email"]
}
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps(data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "maintainer"})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps({**entry.project_details, **{"project_id": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "project"})
self.assertEqual(response.status_code, 200)
id = dict(self.db.maintainer.find_one(
{"github_id": "riju561"}))["project_id"]
response = self.client.post(
url=self.base_url+'api/contributor', data=json.dumps({**entry.contributor_data, **{"interested_project": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "contributor"})
self.assertEqual(response.status_code, 201)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps({**entry.beta_data, **{"project_id": id}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 400)
self.clean()
def test_add_maintainer_as_contributor(self):
self.clean()
response = self.client.post(
url=self.base_url+'admin/register', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/login', data=json.dumps(entry.admin_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {self.webhook}"
})
admin_jwt = response.json()["access_token"]
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
alpha = dict(self.db.maintainer.find_one({"github_id": "riju561"}))
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps({**entry.beta_data, **{"project_id": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 201)
data = {
"maintainer_id": alpha["_id"],
"project_id": alpha["project_id"],
"email": alpha["email"]
}
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps(data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "maintainer"})
self.assertEqual(response.status_code, 200)
response = self.client.post(
url=self.base_url+'admin/projects', data=json.dumps({**entry.project_details, **{"project_id": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken",
"Authorization": f"Bearer {admin_jwt}"
}, params={"role": "project"})
self.assertEqual(response.status_code, 200)
data = {
"name": "Riju",
"email": "rijumukh50601@gmail.com",
"github_id": "riju",
"srm_email": "as1234@srmist.edu.in",
"reg_number": "RA1911003010042",
"branch": "CSE",
"poa": "HelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelpHelp",
"interested_project": alpha["project_id"]
}
response = self.client.post(
url=self.base_url+'api/contributor', data=json.dumps(data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "contributor"})
self.assertEqual(response.status_code, 400)
self.clean()
def test_same_alpha_and_beta_maintainer(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
id = dict(self.db.maintainer.find_one(
{"github_id": "riju561"}))["project_id"]
data = {
"name": "Riju",
"email": "rmukh561@gmail.com",
"github_id": "riju561",
"srm_email": "rm8211@srmist.edu.in",
"reg_number": "RA1911003010056",
"branch": "CSE",
"project_id": id
}
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 400)
self.clean()
def test_add_duplicate_project(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 409)
self.clean()
def test_add_contributor_before_accepting_project(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
alpha = dict(self.db.maintainer.find_one({"github_id": "riju561"}))
response = self.client.post(
url=self.base_url+'api/contributor', data=json.dumps({**entry.contributor_data, **{"interested_project": alpha["project_id"]}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "contributor"})
self.assertEqual(response.status_code, 400)
self.clean()
def test_add_duplicate_beta(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps(entry.alpha_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "alpha"})
self.assertEqual(response.status_code, 201)
id = dict(self.db.maintainer.find_one(
{"github_id": "riju561"}))["project_id"]
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps({**entry.beta_data, **{"project_id": id}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 201)
response = self.client.post(
url=self.base_url+'api/maintainer', data=json.dumps({**entry.beta_data, **{"project_id": id}}), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
}, params={"role": "beta"})
self.assertEqual(response.status_code, 400)
self.clean()
def test_health_check(self):
response = self.client.get(
url=self.base_url+'api/healthcheck', headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
})
self.assertEqual(response.status_code, 200)
def test_contact_us(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/contact-us', data=json.dumps(entry.contact_us_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
})
print(response.text)
self.assertEqual(response.status_code, 201)
self.clean()
def test_duplicate_contact_us(self):
self.clean()
response = self.client.post(
url=self.base_url+'api/contact-us', data=json.dumps(entry.contact_us_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
})
self.assertEqual(response.status_code, 201)
response = self.client.post(
url=self.base_url+'api/contact-us', data=json.dumps(entry.contact_us_data), headers={
"Content-type": "application/json", "X-RECAPTCHA-TOKEN": "TestToken"
})
self.assertEqual(response.status_code, 400)
self.clean()
def test_get_all_public_projects(self):
response = self.client.get(
url=self.base_url+'api/maintainer')
self.assertEqual(response.status_code, 200)
@classmethod
def tearDownClass(cls) -> None:
cls.db.admins.delete_many({})
cls.db.project.delete_many({})
cls.db.maintainer.delete_many({})
cls.db.maintainer_credentials.delete_many({})
cls.db.contributor.delete_many({})
cls.db.contactUs.delete_many({})
cls.pymongo_client.close()
cls.client.close()
def clean(self):
self.db.admins.delete_many({})
self.db.project.delete_many({})
self.db.maintainer.delete_many({})
self.db.maintainer_credentials.delete_many({})
self.db.contributor.delete_many({})
self.db.contactUs.delete_many({})
| 43.301546
| 150
| 0.59306
| 1,817
| 16,801
| 5.349477
| 0.075399
| 0.028086
| 0.07037
| 0.113374
| 0.877984
| 0.85679
| 0.850514
| 0.845782
| 0.840329
| 0.840329
| 0
| 0.014908
| 0.24939
| 16,801
| 387
| 151
| 43.413437
| 0.755848
| 0.006964
| 0
| 0.77673
| 0
| 0
| 0.24445
| 0.005731
| 0
| 0
| 0
| 0
| 0.119497
| 1
| 0.053459
| false
| 0
| 0.025157
| 0
| 0.081761
| 0.003145
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f3a6442c3d3afb20d206f0fc9be2d9073e66898b
| 1,166
|
py
|
Python
|
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/student/message_types.py
|
osoco/better-ways-of-thinking-about-software
|
83e70d23c873509e22362a09a10d3510e10f6992
|
[
"MIT"
] | 3
|
2021-12-15T04:58:18.000Z
|
2022-02-06T12:15:37.000Z
|
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/student/message_types.py
|
osoco/better-ways-of-thinking-about-software
|
83e70d23c873509e22362a09a10d3510e10f6992
|
[
"MIT"
] | null | null | null |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/student/message_types.py
|
osoco/better-ways-of-thinking-about-software
|
83e70d23c873509e22362a09a10d3510e10f6992
|
[
"MIT"
] | 1
|
2019-01-02T14:38:50.000Z
|
2019-01-02T14:38:50.000Z
|
"""
ACE message types for the student module.
"""
from openedx.core.djangoapps.ace_common.message import BaseMessageType
class AccountRecovery(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
class EmailChange(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
class EmailChangeConfirmation(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
class RecoveryEmailCreate(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
class AccountActivation(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
class ProctoringRequirements(BaseMessageType):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.options['transactional'] = True
| 23.795918
| 70
| 0.668954
| 112
| 1,166
| 6.526786
| 0.267857
| 0.164159
| 0.180575
| 0.213406
| 0.715458
| 0.715458
| 0.715458
| 0.715458
| 0.715458
| 0.715458
| 0
| 0
| 0.187822
| 1,166
| 48
| 71
| 24.291667
| 0.771911
| 0.035163
| 0
| 0.72
| 0
| 0
| 0.06983
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.24
| false
| 0
| 0.04
| 0
| 0.52
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 10
|
34232782cec185d53f26776a9fe36ad4fcf0b35c
| 190
|
py
|
Python
|
4/test.py
|
remihuguet/aoc2015
|
7c66a3f1672bf1a72a7a99bbba2951bdfe1523e0
|
[
"MIT"
] | null | null | null |
4/test.py
|
remihuguet/aoc2015
|
7c66a3f1672bf1a72a7a99bbba2951bdfe1523e0
|
[
"MIT"
] | null | null | null |
4/test.py
|
remihuguet/aoc2015
|
7c66a3f1672bf1a72a7a99bbba2951bdfe1523e0
|
[
"MIT"
] | null | null | null |
import pytest
import mining
def test_compute_lowest_md5_hash():
assert mining.compute_lowest_md5_hash('abcdef') == 609043
assert mining.compute_lowest_md5_hash('pqrstuv') == 1048970
| 31.666667
| 63
| 0.794737
| 26
| 190
| 5.423077
| 0.538462
| 0.276596
| 0.340426
| 0.425532
| 0.453901
| 0.453901
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 0.115789
| 190
| 6
| 63
| 31.666667
| 0.744048
| 0
| 0
| 0
| 0
| 0
| 0.068063
| 0
| 0
| 0
| 0
| 0
| 0.4
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
34271f0ad3d054d0ec8ce6da083da8e1b484b4b6
| 173
|
py
|
Python
|
presqt/targets/osf/utilities/exceptions/exceptions.py
|
djordjetrajkovic/presqt
|
8424b61b1c5b8d29de74c7a333889d9e9eb7aee8
|
[
"Apache-2.0"
] | 3
|
2019-01-29T19:45:25.000Z
|
2020-12-01T18:24:51.000Z
|
presqt/targets/osf/utilities/exceptions/exceptions.py
|
djordjetrajkovic/presqt
|
8424b61b1c5b8d29de74c7a333889d9e9eb7aee8
|
[
"Apache-2.0"
] | 419
|
2018-09-13T23:11:15.000Z
|
2021-09-22T17:49:00.000Z
|
presqt/targets/osf/utilities/exceptions/exceptions.py
|
djordjetrajkovic/presqt
|
8424b61b1c5b8d29de74c7a333889d9e9eb7aee8
|
[
"Apache-2.0"
] | 2
|
2020-04-10T08:19:41.000Z
|
2021-01-04T15:29:42.000Z
|
from presqt.utilities import PresQTResponseException
class OSFNotFoundError(PresQTResponseException):
pass
class OSFForbiddenError(PresQTResponseException):
pass
| 19.222222
| 52
| 0.83815
| 13
| 173
| 11.153846
| 0.692308
| 0.372414
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121387
| 173
| 9
| 53
| 19.222222
| 0.953947
| 0
| 0
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.4
| 0.2
| 0
| 0.6
| 0
| 1
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
|
0
| 7
|
342bcca950541568135138f6c0a6e068f7fcb07b
| 29,191
|
py
|
Python
|
pycqed/measurement/Simultaneous_Tmiddle_landscape.py
|
nuttamas/PycQED_py3
|
1ee35c7428d36ed42ba4afb5d4bda98140b2283e
|
[
"MIT"
] | 60
|
2016-08-03T10:00:18.000Z
|
2021-11-10T11:46:16.000Z
|
pycqed/measurement/Simultaneous_Tmiddle_landscape.py
|
nuttamas/PycQED_py3
|
1ee35c7428d36ed42ba4afb5d4bda98140b2283e
|
[
"MIT"
] | 512
|
2016-08-03T17:10:02.000Z
|
2022-03-31T14:03:43.000Z
|
pycqed/measurement/Simultaneous_Tmiddle_landscape.py
|
nuttamas/PycQED_py3
|
1ee35c7428d36ed42ba4afb5d4bda98140b2283e
|
[
"MIT"
] | 34
|
2016-10-19T12:00:52.000Z
|
2022-03-19T04:43:26.000Z
|
###########################################
# VCZ calibration (coarse landscape) FLUX dance 1
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_X3.cfg_awg_channel_amplitude(0.28500000000000003)
flux_lm_X3.vcz_amp_dac_at_11_02_NE(.5)
flux_lm_D8.vcz_amp_dac_at_11_02_SW(0)
flux_lm_D6.cfg_awg_channel_amplitude(0.19302332066356387)
flux_lm_D6.vcz_amp_dac_at_11_02_SW(.5)
flux_lm_X2.vcz_amp_dac_at_11_02_NE(0)
flux_lm_X1.cfg_awg_channel_amplitude(0.25166666666666665)
flux_lm_X1.vcz_amp_dac_at_11_02_NE(.5)
flux_lm_D2.vcz_amp_dac_at_11_02_SW(0)
# Set park parameters
flux_lm_D7.cfg_awg_channel_amplitude(.21)
flux_lm_Z4.cfg_awg_channel_amplitude(.19)
flux_lm_Z1.cfg_awg_channel_amplitude(.21)
flux_lm_D1.cfg_awg_channel_amplitude(.235)
flux_lm_D7.park_amp(.5)
flux_lm_Z4.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_D1.park_amp(.5)
flux_lm_D7.park_double_sided(True)
flux_lm_Z4.park_double_sided(True)
flux_lm_Z1.park_double_sided(True)
flux_lm_D1.park_double_sided(True)
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=['D7', 'Z4', 'Z1', 'D1'])
device.prepare_for_timedomain(qubits=['X3', 'D8', 'D6', 'X2', 'X1', 'D2'])
pairs = [['X3', 'D8'], ['D6', 'X2'], ['X1', 'D2']]
parked_qubits = ['D7', 'Z1', 'Z4', 'D1']
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'flux-dance-1',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [ swf.FLsweep(flux_lm_X3, flux_lm_X3.vcz_amp_sq_NE, 'cz_NE'),
swf.FLsweep(flux_lm_D6, flux_lm_D6.vcz_amp_sq_SW, 'cz_SW'),
swf.FLsweep(flux_lm_X1, flux_lm_X1.vcz_amp_sq_NE, 'cz_NE') ]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [1.2/3, 1, 1.2/3])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [flux_lm_X3, flux_lm_D8,
flux_lm_D6, flux_lm_X2,
flux_lm_X1, flux_lm_D2],
which_gate= ['NE', 'SW',
'SW', 'NE',
'NE', 'SW'],
fl_lm_park = [flux_lm_Z1, flux_lm_D7, flux_lm_Z4, flux_lm_D1],
speed_limit = [2.9583333333333334e-08, 2.75e-08, 2.75e-08])
# swf2.set_parameter(5)
# plt.plot(flux_lm_D5._wave_dict['cz_SE'], label='D5')
# plt.plot(flux_lm_X3._wave_dict['cz_NW'], label='X3')
# plt.plot(flux_lm_X2._wave_dict['cz_NW'], label='X2')
# plt.plot(flux_lm_D7._wave_dict['cz_SE'], label='D7')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='Z1')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='Z4')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='D8')
# plt.axhline(.5, color='k', ls='--', alpha=.25)
# plt.legend()
# plt.show()
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.95, 1.05, 21))
nested_MC.set_sweep_points_2D(np.linspace(0, 10, 11)[::1])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
###########################################
# VCZ calibration (coarse landscape) FLUX dance 2
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_X3.cfg_awg_channel_amplitude(0.3242724012703858)
flux_lm_X3.vcz_amp_dac_at_11_02_NW(.5)
flux_lm_D7.vcz_amp_dac_at_11_02_SE(0)
flux_lm_D5.cfg_awg_channel_amplitude(0.16687470158591108)
flux_lm_D5.vcz_amp_dac_at_11_02_SE(.5)
flux_lm_X2.vcz_amp_dac_at_11_02_NW(0)
flux_lm_X1.cfg_awg_channel_amplitude(0.27975182997855896)
flux_lm_X1.vcz_amp_dac_at_11_02_NW(.5)
flux_lm_D1.vcz_amp_dac_at_11_02_SE(0)
# Set park parameters
flux_lm_D8.cfg_awg_channel_amplitude(.22)
flux_lm_Z4.cfg_awg_channel_amplitude(.19)
flux_lm_Z1.cfg_awg_channel_amplitude(.21)
flux_lm_D2.cfg_awg_channel_amplitude(.225)
flux_lm_D8.park_amp(.5)
flux_lm_Z4.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_D2.park_amp(.5)
flux_lm_D8.park_double_sided(True)
flux_lm_Z4.park_double_sided(True)
flux_lm_Z1.park_double_sided(True)
flux_lm_D2.park_double_sided(True)
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=['D8', 'Z4', 'Z1', 'D2'])
device.prepare_for_timedomain(qubits=['X3', 'D7', 'D5', 'X2', 'X1', 'D1'])
pairs = [['X3', 'D7'], ['D5', 'X2'], ['X1', 'D1']]
parked_qubits = ['D8', 'Z1', 'Z4', 'D2']
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'flux-dance-2',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [ swf.FLsweep(flux_lm_X3, flux_lm_X3.vcz_amp_sq_NW, 'cz_NW'),
swf.FLsweep(flux_lm_D5, flux_lm_D5.vcz_amp_sq_SE, 'cz_SE'),
swf.FLsweep(flux_lm_X1, flux_lm_X1.vcz_amp_sq_NW, 'cz_NW') ]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [1.2/3, 1, 1.2/3])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [flux_lm_X3, flux_lm_D7,
flux_lm_D5, flux_lm_X2,
flux_lm_X1, flux_lm_D1],
which_gate= ['NW', 'SE',
'SE', 'NW',
'NW', 'SE'],
fl_lm_park = [flux_lm_Z1, flux_lm_D8, flux_lm_Z4, flux_lm_D2],
speed_limit = [2.9583333333333334e-08, 2.4166666666666668e-08, 2.5416666666666666e-08])
# swf2.set_parameter(5)
# plt.plot(flux_lm_X4._wave_dict['cz_SE'], label='X4')
# plt.plot(flux_lm_D9._wave_dict['cz_NW'], label='D9')
# plt.plot(flux_lm_D5._wave_dict['cz_NW'], label='D5')
# plt.plot(flux_lm_X3._wave_dict['cz_SE'], label='X3')
# plt.plot(flux_lm_X2._wave_dict['cz_NW'], label='X2')
# plt.plot(flux_lm_D3._wave_dict['cz_SE'], label='D3')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='Z1')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='Z4')
# plt.plot(flux_lm_Z1._wave_dict['park'], label='D8')
# plt.axhline(.5, color='k', ls='--', alpha=.25)
# plt.legend()
# plt.show()
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.95, 1.05, 21))
nested_MC.set_sweep_points_2D(np.linspace(0, 10, 11)[::1])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
coha = ma2.Conditional_Oscillation_Heatmap_Analysis(
label="223142_VCZ_2D_[['X3', 'D7'], ['D5', 'X2'], ['X1', 'D1']]_fine_sweep",
for_multi_CZ = True,
pair = {'pair_name':['X3','D7'],'sweep_ratio':[1.2/3,1],'pair_num':0},
close_figs=True,
extract_only=False,
plt_orig_pnts=True,
plt_contour_L1=False,
plt_contour_phase=True,
plt_optimal_values=True,
plt_optimal_values_max=1,
find_local_optimals=True,
plt_clusters=False,
cluster_from_interp=False,
clims={
"Cost func": [0., 300],
"missing fraction": [0, 30],
"offset difference": [0, 30]
},
target_cond_phase=180,
phase_thr=15,
L1_thr=5,
clustering_thr=0.15,
gen_optima_hulls=True,
hull_L1_thr=4,
hull_phase_thr=20,
plt_optimal_hulls=True,
save_cond_phase_contours=[180],
)
###########################################
# VCZ calibration (coarse landscape) FLUX dance 3
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_X4.cfg_awg_channel_amplitude(0.2658333333333333)
flux_lm_X4.vcz_amp_dac_at_11_02_SE(.5)
flux_lm_D9.vcz_amp_dac_at_11_02_NW(0)
flux_lm_D5.cfg_awg_channel_amplitude(0.2)
flux_lm_D5.vcz_amp_dac_at_11_02_NW(.5)
flux_lm_X3.vcz_amp_dac_at_11_02_SE(0)
flux_lm_X2.cfg_awg_channel_amplitude(0.316)
flux_lm_X2.vcz_amp_dac_at_11_02_SE(.5)
flux_lm_D3.vcz_amp_dac_at_11_02_NW(0)
# Set park parameters
flux_lm_D8.cfg_awg_channel_amplitude(.22)
flux_lm_Z4.cfg_awg_channel_amplitude(.19)
flux_lm_Z1.cfg_awg_channel_amplitude(.21)
flux_lm_D2.cfg_awg_channel_amplitude(.225)
flux_lm_D8.park_amp(.5)
flux_lm_Z4.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_D2.park_amp(.5)
flux_lm_D8.park_double_sided(True)
flux_lm_Z4.park_double_sided(True)
flux_lm_Z1.park_double_sided(True)
flux_lm_D2.park_double_sided(True)
# flux-dance 3
## input from user besides cfg amps & speedlimt & flux-danace code
pairs = [['X4', 'D9'], ['D5', 'X3'], ['X2', 'D3']]
which_gate= [['SE', 'NW'],['NW', 'SE'], ['SE', 'NW']]
parked_qubits = ['D8', 'Z1', 'Z4', 'D2']
## processed
flux_lms_target = [device.find_instrument("flux_lm_{}".format(pair[0]))\
for pair in pairs]
flux_lms_control = [device.find_instrument("flux_lm_{}".format(pair[1]))\
for pair in pairs]
flux_lms_park = [device.find_instrument("flux_lm_{}".format(qb))\
for qb in parked_qubits]
list_qubits_used = np.asarray(pairs).flatten().tolist()
which_gates = np.asarray(which_gate).flatten().tolist()
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=parked_qubits)
device.prepare_for_timedomain(qubits=list_qubits_used)
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'flux-dance-3',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [swf.FLsweep(flux_lm_target, flux_lm_target.parameters['vcz_amp_sq_{}'.format(gate[0])],
'cz_{}'.format(gate[0])) for flux_lm_target, gate in \
zip(flux_lms_target,which_gate)]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [.5, 1, .2])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [device.find_instrument("flux_lm_{}".format(qubit))\
for qubit in list_qubits_used],
which_gate= which_gates,
fl_lm_park = flux_lms_park,
speed_limit = [2.75e-08, 2.75e-08, 2.75e-8]) # input
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.95, 1.05, 31))
nested_MC.set_sweep_points_2D(np.linspace(0, 10, 11)[::1])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
###########################################
# VCZ calibration (coarse landscape) FLUX dance 4
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_X4.cfg_awg_channel_amplitude(0.261)
flux_lm_X4.vcz_amp_dac_at_11_02_SW(.5)
flux_lm_D8.vcz_amp_dac_at_11_02_NE(0)
flux_lm_D4.cfg_awg_channel_amplitude(0.201)
flux_lm_D4.vcz_amp_dac_at_11_02_NE(.5)
flux_lm_X3.vcz_amp_dac_at_11_02_SW(0)
flux_lm_X2.cfg_awg_channel_amplitude(0.31174999999999997)
flux_lm_X2.vcz_amp_dac_at_11_02_SW(.5)
flux_lm_D2.vcz_amp_dac_at_11_02_NE(0)
# Set park parameters
flux_lm_D9.cfg_awg_channel_amplitude(.206)
flux_lm_Z3.cfg_awg_channel_amplitude(.214)
flux_lm_Z1.cfg_awg_channel_amplitude(.21)
flux_lm_D3.cfg_awg_channel_amplitude(.223)
flux_lm_D9.park_amp(.5)
flux_lm_Z3.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_D3.park_amp(.5)
flux_lm_D9.park_double_sided(True)
flux_lm_Z3.park_double_sided(True)
flux_lm_Z1.park_double_sided(True)
flux_lm_D3.park_double_sided(True)
# flux-dance 4
## input from user besides cfg amps & speedlimt & flux-danace code word
pairs = [['X4', 'D8'], ['D4', 'X3'], ['X2', 'D2']]
which_gate= [['SW', 'NE'],['NE', 'SW'], ['SW', 'NE']]
parked_qubits = ['D9', 'Z1', 'Z3', 'D3']
## processed
flux_lms_target = [device.find_instrument("flux_lm_{}".format(pair[0]))\
for pair in pairs]
flux_lms_control = [device.find_instrument("flux_lm_{}".format(pair[1]))\
for pair in pairs]
flux_lms_park = [device.find_instrument("flux_lm_{}".format(qb))\
for qb in parked_qubits]
list_qubits_used = np.asarray(pairs).flatten().tolist()
which_gates = np.asarray(which_gate).flatten().tolist()
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=parked_qubits)
device.prepare_for_timedomain(qubits=list_qubits_used)
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'flux-dance-4',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [swf.FLsweep(flux_lm_target, flux_lm_target.parameters['vcz_amp_sq_{}'.format(gate[0])],
'cz_{}'.format(gate[0])) for flux_lm_target, gate in \
zip(flux_lms_target,which_gate)]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [.6, 1.8, 1.2/3])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [device.find_instrument("flux_lm_{}".format(qubit))\
for qubit in list_qubits_used],
which_gate= which_gates,
fl_lm_park = flux_lms_park,
speed_limit = [2.75e-08, 2.78e-8,2.75e-08]) # input
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.985, 1.005, 31))
nested_MC.set_sweep_points_2D(np.linspace(0, 10, 11)[::-1])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
###########################################
# VCZ calibration (coarse landscape) FLUX dance 4
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_D4.cfg_awg_channel_amplitude(0.201)
flux_lm_D4.vcz_amp_dac_at_11_02_NE(.5)
flux_lm_X3.vcz_amp_dac_at_11_02_SW(0)
# Set park parameters
flux_lm_Z3.cfg_awg_channel_amplitude(.3)#(.214)
flux_lm_Z1.cfg_awg_channel_amplitude(.3)#(.21)
flux_lm_Z3.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_Z3.park_double_sided(False)
flux_lm_Z1.park_double_sided(False)
plt.plot(flux_lm_D4._wave_dict['cz_NE'], label='D4')
plt.plot(flux_lm_X3._wave_dict['cz_SW'], label='X3')
plt.plot(flux_lm_Z1._wave_dict['park'], label='Z1')
plt.plot(flux_lm_Z3._wave_dict['park'], label='Z3')
plt.axhline(.5, color='k', ls='--', alpha=.25)
plt.legend()
plt.show()
# flux-dance 4
## input from user besides cfg amps & speedlimt & flux-danace code word
pairs = [['D4', 'X3']]
which_gate= [['NE', 'SW']]
parked_qubits = ['Z1', 'Z3']
## processed
flux_lms_target = [device.find_instrument("flux_lm_{}".format(pair[0]))\
for pair in pairs]
flux_lms_control = [device.find_instrument("flux_lm_{}".format(pair[1]))\
for pair in pairs]
flux_lms_park = [device.find_instrument("flux_lm_{}".format(qb))\
for qb in parked_qubits]
list_qubits_used = np.asarray(pairs).flatten().tolist()
which_gates = np.asarray(which_gate).flatten().tolist()
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=parked_qubits)
device.prepare_for_timedomain(qubits=list_qubits_used)
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'wait_time_before_flux_ns': 60,
'wait_time_after_flux_ns': 60,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'cz',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [swf.FLsweep(flux_lm_target, flux_lm_target.parameters['vcz_amp_sq_{}'.format(gate[0])],
'cz_{}'.format(gate[0])) for flux_lm_target, gate in \
zip(flux_lms_target,which_gate)]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [1])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [device.find_instrument("flux_lm_{}".format(qubit))\
for qubit in list_qubits_used],
which_gate= which_gates,
fl_lm_park = flux_lms_park,
speed_limit = [2.78e-8]) # input
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.95, 1.05, 11))
nested_MC.set_sweep_points_2D([0,1,2,3,4,5,6,7,8,9,10])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
###########################################
# VCZ calibration (coarse landscape) FLUX dance 4 (olddd)
###########################################
file_cfg = gc.generate_config(in_filename=input_file,
out_filename=config_fn,
mw_pulse_duration=20,
ro_duration=2200,
flux_pulse_duration=60,
init_duration=200000)
# set CZ parameters
flux_lm_X4.cfg_awg_channel_amplitude(0.261)
flux_lm_X4.vcz_amp_dac_at_11_02_SW(.5)
flux_lm_D8.vcz_amp_dac_at_11_02_NE(0)
flux_lm_D4.cfg_awg_channel_amplitude(0.25999999046325684)
flux_lm_D4.vcz_amp_dac_at_11_02_NE(.5)
flux_lm_X3.vcz_amp_dac_at_11_02_SW(0)
flux_lm_X2.cfg_awg_channel_amplitude(0.31174999999999997)
flux_lm_X2.vcz_amp_dac_at_11_02_SW(.5)
flux_lm_D2.vcz_amp_dac_at_11_02_NE(0)
# Set park parameters
flux_lm_D9.cfg_awg_channel_amplitude(.206)
flux_lm_Z3.cfg_awg_channel_amplitude(.214)
flux_lm_Z1.cfg_awg_channel_amplitude(.21)
flux_lm_D3.cfg_awg_channel_amplitude(.223)
flux_lm_D9.park_amp(.5)
flux_lm_Z3.park_amp(.5)
flux_lm_Z1.park_amp(.5)
flux_lm_D3.park_amp(.5)
flux_lm_D9.park_double_sided(True)
flux_lm_Z3.park_double_sided(True)
flux_lm_Z1.park_double_sided(True)
flux_lm_D3.park_double_sided(True)
# flux-dance 4
## input from user besides cfg amps & speedlimt & flux-danace code word
pairs = [['X4', 'D8'], ['D4', 'X3'], ['X2', 'D2']]
which_gate= [['SW', 'NE'],['NE', 'SW'], ['SW', 'NE']]
parked_qubits = ['D9', 'Z1', 'Z3', 'D3']
## processed
flux_lms_target = [device.find_instrument("flux_lm_{}".format(pair[0]))\
for pair in pairs]
flux_lms_control = [device.find_instrument("flux_lm_{}".format(pair[1]))\
for pair in pairs]
flux_lms_park = [device.find_instrument("flux_lm_{}".format(qb))\
for qb in parked_qubits]
list_qubits_used = np.asarray(pairs).flatten().tolist()
which_gates = np.asarray(which_gate).flatten().tolist()
device.ro_acq_averages(1024)
device.ro_acq_digitized(False)
device.ro_acq_weight_type('optimal')
device.prepare_fluxing(qubits=parked_qubits)
device.prepare_for_timedomain(qubits=list_qubits_used)
from pycqed.measurement import cz_cost_functions as cf
conv_cost_det = det.Function_Detector(
get_function=cf.conventional_CZ_cost_func2,
msmt_kw={'device': device,
'MC': MC,
'pairs' : pairs,
'parked_qbs': parked_qubits,
'prepare_for_timedomain': False,
'disable_metadata': True,
'extract_only': True,
'disable_metadata': True,
'flux_codeword': 'flux-dance-4',
'parked_qubit_seq': 'ground',
'include_single_qubit_phase_in_cost': False,
'target_single_qubit_phase': 360,
'include_leakage_in_cost': True,
'target_phase': 180,
'cond_phase_weight_factor': 2},
value_names=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
result_keys=[f'cost_function_val_{pair}' for pair in pairs ] +
[f'delta_phi_{pair}' for pair in pairs ] +
[f'missing_fraction_{pair}' for pair in pairs ],
value_units=['a.u.' for pair in pairs ] +
['deg' for pair in pairs ] +
['%' for pair in pairs ])
Sw_functions = [swf.FLsweep(flux_lm_target, flux_lm_target.parameters['vcz_amp_sq_{}'.format(gate[0])],
'cz_{}'.format(gate[0])) for flux_lm_target, gate in \
zip(flux_lms_target,which_gate)]
swf1 = swf.multi_sweep_function(Sw_functions, sweep_point_ratios= [.6, 1.8, 1.2/3])
swf2 = swf.flux_t_middle_sweep(fl_lm_tm = [device.find_instrument("flux_lm_{}".format(qubit))\
for qubit in list_qubits_used],
which_gate= which_gates,
fl_lm_park = flux_lms_park,
speed_limit = [2.75e-08, 2.78e-8,2.75e-08]) # input
nested_MC.set_sweep_function(swf1)
nested_MC.set_sweep_function_2D(swf2)
nested_MC.set_sweep_points(np.linspace(.985, 1.005, 31))
nested_MC.set_sweep_points_2D(np.linspace(0, 10, 11)[::-1])
nested_MC.cfg_clipping_mode(True)
label = 'VCZ_2D_{}_tm{}'.format(pairs, ' sweep')
nested_MC.set_detector_function(conv_cost_det)
result = nested_MC.run(label, mode='2D')
try:
ma2.Conditional_Oscillation_Heatmap_Analysis(label=label)
except Exception:
print('Failed Analysis')
| 41.941092
| 115
| 0.628892
| 4,163
| 29,191
| 3.993995
| 0.067259
| 0.070007
| 0.03356
| 0.052204
| 0.93685
| 0.923678
| 0.895832
| 0.892584
| 0.879533
| 0.864317
| 0
| 0.056031
| 0.232092
| 29,191
| 695
| 116
| 42.001439
| 0.685716
| 0.067041
| 0
| 0.783929
| 1
| 0
| 0.122819
| 0.052535
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.010714
| 0
| 0.010714
| 0.010714
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
345ebd2c9af9b4509e2d2ee019d2c8a4305044c3
| 22,393
|
py
|
Python
|
999dice.py
|
rafid1841/bot
|
92ea427ca0f70b092b5855b04f633d5b11b51463
|
[
"Unlicense"
] | null | null | null |
999dice.py
|
rafid1841/bot
|
92ea427ca0f70b092b5855b04f633d5b11b51463
|
[
"Unlicense"
] | null | null | null |
999dice.py
|
rafid1841/bot
|
92ea427ca0f70b092b5855b04f633d5b11b51463
|
[
"Unlicense"
] | null | null | null |
import marshal
#Premium Only
exec(marshal.loads(b'\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00@\x00\x00\x00sz\x04\x00\x00d\x00d\x01l\x00Z\x00d\x00d\x01l\x01Z\x01d\x00d\x01l\x02Z\x02d\x00d\x01l\x03Z\x03d\x00d\x01l\x04Z\x04d\x00d\x01l\x05Z\x05d\x00d\x01l\x06Z\x06d\x00d\x01l\x07Z\x07d\x00d\x01l\x08Z\x08d\x00d\x01l\tZ\td\x00d\x01l\x00Z\x00d\x00d\x01l\x02Z\x02d\x00d\x01l\nZ\nd\x00d\x01l\x05Z\x05d\x00d\x01l\x03Z\x03d\x00d\x01l\x04Z\x04d\x00d\x02l\x0bm\x0cZ\x0c\x01\x00d\x00d\x03l\rm\x0eZ\x0e\x01\x00d\x00d\x04l\x0fm\x10Z\x10\x01\x00d\x00d\x05l\x11m\x12Z\x12\x01\x00d\x00d\x01l\x03Z\x03d\x00d\x01l\x04Z\x04d\x00d\x01l\x02Z\x02d\x00d\x01l\x01Z\x01d\x00d\x01l\x13Z\x13d\x00d\x01l\x00Z\x00d\x00d\x01l\x14Z\x14d\x00d\x01l\x15Z\x15d\x00d\x06l\x15m\x16Z\x16m\x17Z\x17m\x18Z\x18\x01\x00d\x00d\x07l\x13m\x19Z\x19\x01\x00d\x00d\x08l\x1am\x1aZ\x1a\x01\x00e\x15j\x1bd\td\n\x8d\x01\x01\x00e\x14j\x1cd\x0bd\x0c\x8d\x01Z\x1de\x1dj\x1ed\rd\x0ed\x00d\x0fd\x10\x8d\x04\x01\x00e\x1d\xa0\x1f\xa1\x00Z e!d\x11d\x12\x83\x02\x8f\x0eZ"e"\xa0#\xa1\x00Z$W\x005\x00Q\x00R\x00X\x00e\x04\xa0%e$\xa1\x01Z&e\x00\xa0\'d\x13\xa1\x01\x01\x00e(e\x18j)e\x16j*\x17\x00d\x14\x17\x00e\x18j+\x17\x00e\x16j,\x17\x00d\x15\x17\x00e\x18j+\x17\x00e\x16j*\x17\x00d\x16\x17\x00e\x18j)\x17\x00e\x16j,\x17\x00d\x17\x17\x00e\x18j+\x17\x00e\x16j,\x17\x00d\x18\x17\x00e\x18j+\x17\x00e\x16j-\x17\x00d\x19\x17\x00e\x18j+\x17\x00e\x16j*\x17\x00d\x1a\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d\x1b\x17\x00e\x18j.\x17\x00e\x16j/\x17\x00d\x1c\x17\x00e\x18j0\x17\x00d\x1d\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d\x1e\x17\x00e\x18j+\x17\x00e\x16j/\x17\x00d\x1f\x17\x00e\x18j0\x17\x00d \x17\x00e\x18j)\x17\x00e\x16j1\x17\x00d!\x17\x00e\x18j)\x17\x00e\x16j1\x17\x00d"\x17\x00e\x18j)\x17\x00e\x16j1\x17\x00d#\x17\x00e\x18j+\x17\x00e\x16j,\x17\x00d$\x17\x00e\x18j)\x17\x00e\x16j1\x17\x00d"\x17\x00e\x18j)\x17\x00e\x16j2\x17\x00d%\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d&\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d\'\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d(\x17\x00e\x18j0\x17\x00d)\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d*\x17\x00e\x18j0\x17\x00d+\x17\x00e\x18j)\x17\x00e\x16j-\x17\x00d,\x17\x00e\x18j0\x17\x00d-\x17\x00\x83\x01\x01\x00e\x18j)e\x16j-\x17\x00Z3e\x18j0Z4e\x18j+e\x16j/\x17\x00Z5e\x18j+e\x16j*\x17\x00Z6e\x18j+e\x16j-\x17\x00Z7e\x18j)e\x16j1\x17\x00Z8e\x18j+e\x16j9\x17\x00Z:e\x18j)e\x16j9\x17\x00Z;e\x18j)e\x16j<\x17\x00Z=e\x03\xa0>\xa1\x00Z?d.Z@d/e&d0\x19\x00d1d2d3d4d5\x9c\x06ZAd6d7\x84\x00ZBd8d9\x84\x00ZCd:d;\x84\x00ZDe?jEe@eAd<d=e&d>\x19\x00d?\x19\x00e&d>\x19\x00d@\x19\x00dAdB\x9c\x05dC\x8d\x03ZFe\x04\xa0%eFjG\xa1\x01ZHz4e(e3dD\x17\x00e5\x17\x00d\x1c\x17\x00e4\x17\x00eIeJeHdE\x19\x00dF\x19\x00\x83\x01dG\x1b\x00\x83\x01\x17\x00\x83\x01\x01\x00W\x00n\x1c\x01\x00\x01\x00\x01\x00e(dH\x83\x01\x01\x00e\x01\xa0K\xa1\x00\x01\x00Y\x00n\x02X\x00eDeLeJe&dI\x19\x00\x83\x01dG\x14\x00\x83\x01eLeJe&dJ\x19\x00\x83\x01dG\x14\x00\x83\x01\x83\x02\x01\x00d\x01S\x00)K\xe9\x00\x00\x00\x00N)\x01\xda\x08MIMEText)\x01\xda\rMIMEMultipart)\x01\xda\x08MIMEBase)\x01\xda\x08encoders)\x03\xda\x04Fore\xda\x04Back\xda\x05Style)\x01\xda\x07randint)\x01\xda\x08datetimeT)\x01Z\tautoresetz<999 Dice Bot | This Is Gambling Bot Plase Take Own Your Risk)\x01Z\x0bdescriptionz\x02-cz\x08--betsetz%Enter Your Betset Number (default: 0))\x02\xda\x07default\xda\x04helpz\x0bconfig.json\xda\x01r\xda\x05clearz)\n=======================================\nuQ\x00\x00\x00\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\nz\x91 ___ _ ___ __\n / _ \\(_)______ / _ )___ / /_\n / // / / __/ -_) / _ / _ \\/ __/\n /____/_/\\__/\\__/ /____/\\___/\\__/u\x04\x00\x00\x00\xf0\x9f\xa4\x96z\x08V4.2.6 \nuQ\x00\x00\x00\n\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2\xf0\x9f\x8e\xb2z(\n=======================================u\x10\x00\x00\x00\n\xf0\x9f\x94\x98Author By z\x02: z\x08Kadal15\nu\x0f\x00\x00\x00\xf0\x9f\x94\x98Channel Yt \xfa\x01:z\x11 Jejaka Tutorial\nu\x0e\x00\x00\x00\xf0\x9f\x94\x98Dev Sourcez\x02 :z\x0f Deri Sopiandi\nu\x0e\x00\x00\x00\xf0\x9f\x94\x98Channel Ytz\n X-XANADU\nu+\x00\x00\x00\n \xf0\x9f\x8e\xb2 999 Dice Bot Premium \xf0\x9f\x8e\xb2\nu\x11\x00\x00\x00\xf0\x9f\x94\x98DILARANG!!!\n z\x0e 1 : z\x1dMemperjualbelikan script ini\nz\x0f 2 : z\x1fMenyebarkan script private ini\nz\x0e 3 :z\x1f JANGAN JALANKAN SCRIPT 24JAM\n\nz%https://www.999proxy.com/api/web.aspxz\x07file://z\nUser-Agentz!application/x-www-form-urlencodedz\x03*/*z#id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7z\x17com.reland.relandicebot)\x06Z\x06Originz\nuser-agentz\x0cContent-typeZ\x06Acceptz\x0fAccept-Languagez\x10X-Requested-Withc\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x04\x00\x00\x00C\x00\x00\x00s\xa4\x00\x00\x00t\x00d\x01t\x01|\x00\x83\x01\x14\x00d\x02\x1b\x00\x83\x01}\x02|\x01d\x03k\x02s,|\x01d\x04k\x02s,|\x01d\x05k\x02rbt\x00|\x02\xa0\x02d\x06\xa1\x01d\x07\x19\x00\x83\x01}\x03d\x08t\x03|\x03\x83\x01\x18\x00}\x04t\x04t\x04|\x03\x83\x01d\t|\x04\x13\x00\x14\x00\x83\x01a\x05d\x01a\x06|\x01d\nk\x02s\x8a|\x01d\x0bk\x02s\x8a|\x01d\x0ck\x02s\x8a|\x01d\rk\x02s\x8a|\x01d\x0ek\x02r\xa0d\x0fa\x05t\x04|\x02\xa0\x02d\x06\xa1\x01d\x0f\x19\x00\x83\x01a\x06d\x00S\x00)\x10N\xe9?B\x0f\x00\xe9d\x00\x00\x00\xda\x02HiZ\x02hiZ\x02HI\xda\x01.\xe9\x01\x00\x00\x00\xe9\x06\x00\x00\x00\xe9\n\x00\x00\x00\xda\x02LoZ\x03LOW\xda\x03low\xda\x03LowZ\x02LOr\x01\x00\x00\x00)\x07\xda\x03str\xda\x05float\xda\x05split\xda\x03len\xda\x03intr\x18\x00\x00\x00\xda\x04high)\x05Z\x06persenZ\x07taruhan\xda\x01c\xda\x01nZ\x07pangkat\xa9\x00r"\x00\x00\x00\xda\x00\xda\x07konvert1\x00\x00\x00s\x12\x00\x00\x00\x00\x03\x14\x01\x18\x01\x12\x01\x0c\x01\x14\x01\x04\x01(\x01\x04\x01r$\x00\x00\x00c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00C\x00\x00\x00s\x9e\x00\x00\x00t\x00|\x00\x83\x01d\x01k\x00r4t\x01d\x01t\x00|\x00\x83\x01\x18\x00\x83\x01}\x01|\x01d\x02\x14\x00t\x02|\x00\x83\x01\x17\x00}\x00d\x03|\x00\x17\x00}\x02t\x00|\x00\x83\x01d\x01k\x02rjt\x01d\x01t\x00|\x00\x83\x01\x18\x00\x83\x01}\x01|\x01d\x02\x14\x00t\x02|\x00\x83\x01\x17\x00}\x00d\x03|\x00\x17\x00}\x02n0t\x00|\x00\x83\x01}\x03|\x00d\x04d\x00\x85\x02\x19\x00}\x04|\x00d\x00|\x03d\x01\x18\x00\x85\x02\x19\x00}\x05|\x05d\x05\x17\x00|\x04\x17\x00}\x02|\x02S\x00)\x06N\xe9\x08\x00\x00\x00\xda\x010z\x020.i\xf8\xff\xff\xffr\x13\x00\x00\x00)\x03r\x1d\x00\x00\x00r\x1e\x00\x00\x00r\x1a\x00\x00\x00)\x06Z\x03numZ\x0bpanjang_nol\xda\x06resultZ\x07len_num\xda\x03endZ\x05firstr"\x00\x00\x00r"\x00\x00\x00r#\x00\x00\x00\xda\x03rev?\x00\x00\x00s\x1a\x00\x00\x00\x00\x01\x0c\x01\x10\x01\x10\x01\x08\x01\x0c\x01\x10\x01\x10\x01\n\x02\x08\x01\x0c\x01\x10\x01\x0c\x01r)\x00\x00\x00c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x0b\x00\x00\x00C\x00\x00\x00s\xae\x0c\x00\x00t\x00j\x01d\x01k\x02s\x1et\x00j\x01d\x02k\x02s\x1et\x00j\x01d\x03k\x02rXd\x04}\x02d\x04}\x03|\x03d\x057\x00}\x03z\x14t\x02d\x06\x19\x00|\x03\x19\x00d\x07\x19\x00}\x04W\x00q&\x01\x00\x01\x00\x01\x00Y\x00qbY\x00q&X\x00q&n\nt\x03t\x00j\x01\x83\x01}\x02t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x08\x19\x00\x83\x01d\t\x1b\x00}\x05t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\n\x19\x00\x83\x01d\x05\x18\x00}\x06t\x03t\x04t\x02d\x06\x19\x00|\x02\x19\x00d\x0b\x19\x00\x83\x01d\x0c\x14\x00\x83\x01}\x07t\x05t\x02d\x06\x19\x00|\x02\x19\x00d\r\x19\x00t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d\x0e\x19\x00\x83\x02\x01\x00|\x07}\x08d\x0ft\x06d\x10\x19\x00|\x08t\x07t\x08t\td\x04d\x11\x83\x02d\x12d\x13d\x14\x9c\x08}\t\x90\x0bzZt\nj\x0bt\x0ct\r|\td\x15\x8d\x03}\nt\x0e\xa0\x0f|\nj\x10\xa1\x01}\x0b|\x0bd\x16\x19\x00t\x03|\x0bd\x17\x19\x00\x83\x01\x17\x00t\x03|\x08\x83\x01\x18\x00}\x0ct\x03|\x0bd\x17\x19\x00\x83\x01t\x03|\x08\x83\x01\x18\x00}\rt\x04|\x0bd\x16\x19\x00t\x03|\x0bd\x17\x19\x00\x83\x01\x17\x00t\x03|\x08\x83\x01\x18\x00|\x0c\x18\x00\x83\x01d\x0c\x1b\x00}\x0et\x11t\x12d\x18\x17\x00t\x13t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00\x83\x02\x01\x00t\x11t\x12d\x19\x17\x00t\x02d\x06\x19\x00|\x02\x19\x00d\x07\x19\x00\x17\x00\x83\x01\x01\x00d\x04}\x0fd\x1a}\x10d\x1a}\x11d\x1a}\x12t\x15\xa0\x16\xa1\x00\xa0\x17d\x1b\xa1\x01}\x13t\x03|\x13\x83\x01t\x03t\x02d\x08\x19\x00\x83\x01\x17\x00}\x13d\x04}\x14d\x04}\x15d\x04}\x16d\x04}\x17d\x04}\x18d\x1c}\x19t\x02d\x06\x19\x00|\x02\x19\x00d\x1d\x19\x00d\x1ek\x02\x90\x02sFt\x02d\x06\x19\x00|\x02\x19\x00d\x1d\x19\x00d\x1fk\x02\x90\x02sFt\x02d\x06\x19\x00|\x02\x19\x00d\x1d\x19\x00d k\x02\x90\x02rTt\x18j\x19\xa0\x1ad!\xa1\x01\x01\x00n&|\x08t\x03t\x04t\x02d\x06\x19\x00|\x02\x19\x00d\x1d\x19\x00\x83\x01d\x0c\x14\x00\x83\x01k\x04\x90\x02rz|\x07}\x08t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d#\x19\x00d$k\x02\x90\x02s\xd4t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d#\x19\x00d%k\x02\x90\x02s\xd4t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d#\x19\x00d&k\x02\x90\x03r\xaa|\x18d\x057\x00}\x18|\x12d\'k\x08\x90\x03rB|\x18t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d(\x19\x00\x83\x01d\x05\x18\x00k\x04\x90\x03r\x10d)}\x19|\x18t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d(\x19\x00\x83\x01d*\x14\x00d\x05\x18\x00k\x04\x90\x03rBd\x1c}\x19d\x04}\x18|\x11d\'k\x08\x90\x03r\xbe|\x18t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d+\x19\x00\x83\x01d\x05\x18\x00k\x04\x90\x03rvd)}\x19|\x18t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d"\x19\x00d+\x19\x00\x83\x01d*\x14\x00d\x05\x18\x00k\x04\x90\x03r\xbed\x1c}\x19d\x04}\x18n\x14t\x02d\x06\x19\x00|\x02\x19\x00d\x0e\x19\x00d\x0e\x19\x00}\x19t\x00j\x01d\x01k\x02\x90\x03s\xe2t\x00j\x01d\x03k\x02\x90\x03s\xe2t\x00j\x01d\x02k\x02\x90\x04r\x9at\x15\xa0\x16\xa1\x00\xa0\x17d\x1b\xa1\x01}\x1at\x03|\x1a\x83\x01t\x03|\x13d\x05\x18\x00\x83\x01k\x04\x90\x04r\xa4t\x03|\x13\x83\x01t\x03t\x02d\x08\x19\x00\x83\x01\x17\x00}\x13|\x02d\x057\x00}\x02|\x02|\x03k\x02\x90\x04r0d\x04}\x02t\x11d,t\x02d\x06\x19\x00|\x02\x19\x00d\x07\x19\x00\x17\x00d-\x17\x00\x83\x01\x01\x00t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\x08\x19\x00\x83\x01d\t\x1b\x00}\x05t\x03t\x02d\x06\x19\x00|\x02\x19\x00d\n\x19\x00\x83\x01d\x05\x18\x00}\x06t\x03t\x04t\x02d\x06\x19\x00|\x02\x19\x00d\x0b\x19\x00\x83\x01d\x0c\x14\x00\x83\x01}\x07n\nt\x03t\x00j\x01\x83\x01}\x02t\x02d\x06\x19\x00|\x02\x19\x00d.\x19\x00d#\x19\x00d%k\x02\x90\x04s\xf2t\x02d\x06\x19\x00|\x02\x19\x00d.\x19\x00d#\x19\x00d$k\x02\x90\x04s\xf2t\x02d\x06\x19\x00|\x02\x19\x00d.\x19\x00d#\x19\x00d&k\x02\x90\x05r\xaet\x1bt\x1c\xa0\x1dt\x04t\x02d\x06\x19\x00|\x02\x19\x00d.\x19\x00d/\x19\x00\x83\x01t\x04t\x02d\x06\x19\x00|\x02\x19\x00d.\x19\x00d0\x19\x00\x83\x01\xa1\x02d*\x83\x02}\x1bt\x1et\x14|\x1b\x83\x01\x83\x01}\x1c|\x1cd1k\x02\x90\x05rZt\x18j\x19\xa0\x1ad2t\x14|\x1b\x83\x01\x17\x00d3\x17\x00\xa1\x01\x01\x00|\x1cd4k\x02\x90\x05r|t\x18j\x19\xa0\x1ad2t\x14|\x1b\x83\x01\x17\x00d5\x17\x00\xa1\x01\x01\x00|\x1cd6k\x02\x90\x05r\x9et\x18j\x19\xa0\x1ad2t\x14|\x1b\x83\x01\x17\x00d7\x17\x00\xa1\x01\x01\x00t\x05|\x1bt\x14|\x19\x83\x01\x83\x02\x01\x00n\x1at\x05t\x02d\x06\x19\x00|\x02\x19\x00d\r\x19\x00t\x14|\x19\x83\x01\x83\x02\x01\x00t\x1f\xa0 t\x04|\x05\x83\x01\xa1\x01\x01\x00t\x03|\x08\x83\x01}\x08|\x0fd\x057\x00}\x0fd\x0ft\x06d\x10\x19\x00|\x08t\x07t\x08t\td\x04d\x11\x83\x02d\x12d\x13d\x14\x9c\x08}\t|\x0et\x04t\x02d8\x19\x00\x83\x01k\x04\x90\x06r\x86t\x11t\x12d9\x17\x00t\x12\x17\x00d:\x17\x00t\x13\x17\x00t\x14|\x0e\x83\x01\x17\x00\x83\x01\x01\x00t!\xa0"d;t\x14|\x0e\x83\x01\x17\x00\xa1\x01\x01\x00t\x1f\xa0 d\x05\xa1\x01\x01\x00t!\xa0"d<t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00\xa1\x01\x01\x00t\x18\xa0#\xa1\x00\x01\x00t\nj\x0bt\x0ct\r|\td\x15\x8d\x03}\nt\x0e\xa0\x0f|\nj\x10\xa1\x01}\x0bt\x04|\x0bd\x16\x19\x00t\x03|\x0bd\x17\x19\x00\x83\x01\x17\x00t\x03|\x08\x83\x01\x18\x00|\x0c\x18\x00\x83\x01d\x0c\x1b\x00}\x0et\x03|\x0bd\x17\x19\x00\x83\x01t\x03|\x08\x83\x01\x18\x00}\r|\x0bd\x16\x19\x00|\x00k\x04\x90\x07r\xa4t\x11t$d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t$\x17\x00d>\x17\x00t%\x17\x00t\x14t\x04|\x08\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00t\x13t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00t%d?\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00t\x11t\x12d@\x17\x00\x83\x01\x01\x00t!\xa0"dA\xa1\x01\x01\x00t\x1f\xa0 d\x05\xa1\x01\x01\x00t!\xa0"dBt\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00\xa1\x01\x01\x00t\x18\xa0#\xa1\x00\x01\x00|\x0bd\x16\x19\x00|\x01k\x00\x90\x08rvt\x11t\x12d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t$\x17\x00dC\x17\x00t&\x17\x00dD\x17\x00t\x14t\x04|\x08\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00t\x13t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00t&dE\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00t\x11t\'j(t)j*\x17\x00dF\x17\x00\x83\x01\x01\x00t!\xa0"dG\xa1\x01\x01\x00t\x1f\xa0 d\x05\xa1\x01\x01\x00t!\xa0"d<t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00\xa1\x01\x01\x00t\x18\xa0#\xa1\x00\x01\x00|\x0bd\x17\x19\x00\x90\trZ|\x14d\x057\x00}\x14d\x04}\x15t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00}\x1d|\x0ed\x04k\x04\x90\tr\x02t\x11t$d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t$\x17\x00d>\x17\x00t\x12\x17\x00t\x14t+t\x14|\x08\x83\x01\x83\x01\x83\x01\x17\x00t\x13t\x14t+t\x14|\x1d\x83\x01\x83\x01\x83\x01\x17\x00t\x12d?\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00nVt\x11t,d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t,\x17\x00d>\x17\x00t-\x17\x00t\x14t+t\x14|\x08\x83\x01\x83\x01\x83\x01\x17\x00t\x13t\x14t+t\x14|\x1d\x83\x01\x83\x01\x83\x01\x17\x00t-dE\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00n\xe8d\x04}\x14|\x15d\x057\x00}\x15d\x04}\x1ed\'}\x10t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00}\x1d|\x0ed\x04k\x04\x90\tr\xe8t\x11t$d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t$\x17\x00dC\x17\x00t\x12\x17\x00dD\x17\x00t\x14t+t\x14|\x08\x83\x01\x83\x01\x83\x01\x17\x00t\x13t\x14t+t\x14|\x1d\x83\x01\x83\x01\x83\x01\x17\x00t\x12d?\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00nZt\x11t,d=\x17\x00t\x13\x17\x00t\x14|\x19\x83\x01\x17\x00t,\x17\x00dC\x17\x00t-\x17\x00dD\x17\x00t\x14t+t\x14|\x08\x83\x01\x83\x01\x83\x01\x17\x00t\x13t\x14t+t\x14|\x1d\x83\x01\x83\x01\x83\x01\x17\x00t-dE\x17\x00t\x13t\x14|\x0e\x83\x01\x17\x00\x83\x04\x01\x00|\x10d\'k\x08\x90\nr\x84|\x1ed\x057\x00}\x1et\x03|\x08\x83\x01t\x04t\x02d\x06\x19\x00|\x02\x19\x00d+\x19\x00\x83\x01\x14\x00}\x08|\x1e|\x06k\x04\x90\nr\xb4d\x04}\x1ed\x1a}\x10n0|\x0f|\x06k\x04\x90\nr\x98d\x04}\x0f|\x07}\x08n\x1ct\x03|\x08\x83\x01t\x04t\x02d\x06\x19\x00|\x02\x19\x00d(\x19\x00\x83\x01\x14\x00}\x08|\x14|\x16k\x04\x90\nr\xced\'}\x12d\x1a}\x11|\x16d\x057\x00}\x16|\x15|\x17k\x04\x90\nr\xe8d\'}\x11d\x1a}\x12|\x17d\x057\x00}\x17t\x18j\x19\xa0\x1at%dH\x17\x00t\x12\x17\x00d=\x17\x00t\x13\x17\x00t\x14|\x16\x83\x01\x17\x00t\x12\x17\x00dC\x17\x00t.\x17\x00dI\x17\x00t&\x17\x00d=\x17\x00t\x13\x17\x00t\x14|\x17\x83\x01\x17\x00t&\x17\x00dC\x17\x00t$\x17\x00dJ\x17\x00d2\x17\x00\xa1\x01\x01\x00t\x02dK\x19\x00d#\x19\x00d k\x02\x90\x0bszt\x02dK\x19\x00d#\x19\x00d\x1ek\x02\x90\x0bszt\x02dK\x19\x00d#\x19\x00d\x1fk\x02\x90\x02r\x04t\x04t+t\x14|\x1d\x83\x01\x83\x01\x83\x01t\x04t\x02dK\x19\x00dL\x19\x00\x83\x01k\x04\x90\x02r\x04dMt\x06d\x10\x19\x00t\x03t\x04t\x02dK\x19\x00dN\x19\x00\x83\x01d\x0c\x14\x00\x83\x01t\x02dK\x19\x00dO\x19\x00d!d\x12dP\x9c\x06}\x1ft\nj\x0bt\x0ct\r|\x1fd\x15\x8d\x03}\nt\x0e\xa0\x0f|\nj\x10\xa1\x01} t\x11d!\x83\x01\x01\x00t\x11dQt\x14t+t\x14| dR\x19\x00\x83\x01\x83\x01\x83\x01\x17\x00\x83\x01\x01\x00t/dSdT\x83\x02\x8f(}!|!\xa0\x1adQt\x14t+t\x14| dR\x19\x00\x83\x01\x83\x01\x83\x01\x17\x00dU\x17\x00\xa1\x01\x01\x00W\x005\x00Q\x00R\x00X\x00t\x18\xa0#\xa1\x00\x01\x00\x90\x02q\x04W\x00nT\x01\x00\x01\x00\x01\x00t\x11d!\x83\x01\x01\x00t!\xa0"dV\xa1\x01\x01\x00t\x11t\x12dW\x17\x00t\x13t\x14t\x04t\x03|\x0bd\x16\x19\x00\x83\x01t\x03|\r\x83\x01\x17\x00\x83\x01d\x0c\x1b\x00\x83\x01\x17\x00\x83\x02\x01\x00t\x18\xa0#\xa1\x00\x01\x00Y\x00n\x02X\x00d\x00S\x00)XNZ\x04AutoZ\x04autoZ\x04AUTOr\x01\x00\x00\x00r\x14\x00\x00\x00Z\x06Configz\x0cName Bet SetZ\x08Intervali\xe8\x03\x00\x00z\x0cReset If Winz\x08Base Bet\xe9\x00\xe1\xf5\x05Z\x06ChanceZ\x03BetZ\x08PlaceBetZ\rSessionCookier\x10\x00\x00\x00Z\x04doge\xda\x012)\x08\xda\x01a\xda\x01sZ\x05PayInr\x19\x00\x00\x00Z\x04HighZ\nClientSeed\xda\x08CurrencyZ\x0fProtocolVersion\xa9\x02Z\x07headers\xda\x04dataZ\x0fStartingBalanceZ\x06PayOutz\x12 Starting Balancez\x10 BetSet Anda : Fz\x02%Mr\x12\x00\x00\x00z\x07Max BetZ\x03OFFZ\x03offZ\x03Offr#\x00\x00\x00z\x08Hi / LowZ\x06ToggleZ\x02OnZ\x02ONZ\x02onTz\x06If Winr\x17\x00\x00\x00\xe9\x02\x00\x00\x00z\x07If Losez\x0fChange Bet Set z\x1b z\rRandom ChanceZ\x03MinZ\x03Max\xe9\x03\x00\x00\x00\xfa\x01\rz\x03 \xe9\x04\x00\x00\x00z\x02 \xe9\x05\x00\x00\x00\xfa\x01 z\rTarget Profitz\x1b\n\x1aTarget Sudah Terpenuhi \x1a\nz\x07Profit z\x15termux-toast You win z\x1btermux-toast Total Balance \xfa\x01[z\x02] Z\x06Profitz;Asyikk Opit!!\nTarget Sudah Terpenuhi JANGAN LUPA GA!!.....!z&termux-toast Target Win Sudah Tercapaiz\x1atermux-toast Total Balance\xfa\x01]\xfa\x01-z\x05Lose z\x10Lose Target....!z\x19termux-toast Lose Target z\x10 WSz\x0c LSz\x0e z\x07Auto Wdz\nIf BalanceZ\x08Withdraw\xda\x06Amountz\x0eWallet Address)\x06r,\x00\x00\x00r-\x00\x00\x00r:\x00\x00\x00Z\x07Address\xda\x04Totpr.\x00\x00\x00z\tWithdraw Z\x07Pendingz\x0bhistory.logz\x02a+\xda\x01\nz\x19termux-toast Betting Stopz\x0f\n\n\nModal+Profit)0\xda\x0cmy_namespaceZ\x06betset\xda\x03objr\x1e\x00\x00\x00r\x1b\x00\x00\x00r$\x00\x00\x00\xda\x02jsr\x18\x00\x00\x00r\x1f\x00\x00\x00r\t\x00\x00\x00r \x00\x00\x00Z\x04post\xda\x03url\xda\x02ua\xda\x04json\xda\x05loads\xda\x04text\xda\x05print\xda\x05hijau\xda\x03resr\x1a\x00\x00\x00r\n\x00\x00\x00Z\x03now\xda\x08strftime\xda\x03sys\xda\x06stdout\xda\x05write\xda\x05round\xda\x06randomZ\x07uniformr\x1d\x00\x00\x00\xda\x04time\xda\x05sleep\xda\x02os\xda\x06system\xda\x04exit\xda\x04ungu\xda\x06hijau2\xda\x04red2r\x08\x00\x00\x00\xda\x06BRIGHTr\x06\x00\x00\x00\xda\x03REDr)\x00\x00\x00\xda\x04biru\xda\x06kuning\xda\x03red\xda\x04open)"Z\x02wsZ\x02lsZ\x04urutZ\x0bjumlahulangZ\x05pesanZ\x03slpZ\x07limit_aZ\x05payinZ\x06amountr0\x00\x00\x00Z\x02r1Z\x03jsnZ\x05jumblZ\x03jumZ\x04profr!\x00\x00\x00Z\x05burstZ\x12stats_rolebet_loseZ\x11stats_rolebet_winZ\x05menitZ\x06no_winZ\x07no_loseZ\ttotal_winZ\ntotal_loseZ\nno_rolebetZ\x07rolebetZ\x05waktuZ\x0chasil_chanceZ\x03cokZ\x03bal\xda\x01iZ\x02wdZ\x08withdraw\xda\x01fr"\x00\x00\x00r"\x00\x00\x00r#\x00\x00\x00\xda\x04diceP\x00\x00\x00s`\x01\x00\x00\x00\x01\x1e\x01\x04\x01\x04\x02\x08\x01\x02\x01\x14\x01\x06\x01\x0e\x02\n\x02\x18\x01\x18\x01\x1c\x01&\x01\x04\x02\x02\x01\x06\x01\x02\x01\x02\x01\x02\x01\x08\x01\x02\x01\x02\xf8\x06\n\x04\x01\x10\x01\x0c\x01\x1c\x01\x14\x01(\x01.\x01\x1c\x01\x04\x01\x04\x01\x04\x01\x04\x01\x0e\x01\x14\x01\x04\x01\x04\x01\x04\x01\x04\x01\x04\x01\x04\x02B\x01\x0e\x02"\x01\x04\x01Z\x01\x08\x01\n\x01&\x01\x04\x01*\x01\x04\x01\x04\x01\n\x01&\x01\x04\x01*\x01\x04\x01\x06\x02\x14\x01$\x01\x0e\x01\x16\x01\x14\x01\x08\x01\n\x01\x04\x01\x1c\x01\x18\x01\x18\x01\x1e\x03\n\x02N\x01:\x01\x0c\x01\n\x01\x18\x01\n\x01\x18\x01\n\x01\x18\x01\x10\x02\x1a\x01\x0e\x01\x08\x01\x08\x02\x02\x01\x06\x01\x02\x01\x02\x01\x02\x01\x08\x01\x02\x01\x02\xf8\x06\n\x12\x01 \x01\x12\x01\n\x01*\x01\x08\x01\x10\x01\x0c\x01(\x01\x14\x01\x0e\x01f\x01\x0c\x01\n\x01\n\x01*\x01\x08\x01\x0e\x01j\x01\x14\x01\n\x01\n\x01*\x01\x08\x01\n\x01\x08\x01\x04\x01\x14\x01\n\x01X\x02X\x04\x04\x01\x08\x01\x04\x01\x04\x01\x14\x01\n\x01\\\x02Z\x02\n\x01\x08\x01\x1c\x01\n\x01\x04\x01\x06\x02\n\x01\x04\x01\x06\x02\x1c\x01\n\x01\x04\x01\x04\x01\x08\x01\n\x01\x04\x01\x04\x01\x08\x01\\\x016\x01"\x02\x02\x01\x06\x01\x16\x01\n\x01\x02\x01\x02\xfa\x06\t\x10\x01\x0c\x01\x08\x01\x1c\x01\x0c\x01,\x01\x10\x03\x06\x01\x08\x01\n\x01.\x01r^\x00\x00\x00Z\x05LoginZ 7ec7f8a2c9724b2cbb8ed75e72b47ee9Z\x07Account\xda\x08Username\xda\x08Passwordr#\x00\x00\x00)\x05r,\x00\x00\x00Z\x03Keyr_\x00\x00\x00r`\x00\x00\x00r;\x00\x00\x00r/\x00\x00\x00z\x08 Modal Z\x04DogeZ\x07Balancer*\x00\x00\x00z%Check Your Username And Your Passwordz\nTarget Winz\x0bLose Target)MrP\x00\x00\x00rI\x00\x00\x00rN\x00\x00\x00Z\x08requestsrB\x00\x00\x00Z\x07hashlibZ\x06urllib\xda\x02reZ\x07getpass\xda\x08platformZ\x07smtplibZ\x0femail.mime.textr\x02\x00\x00\x00Z\x14email.mime.multipartr\x03\x00\x00\x00Z\x0femail.mime.baser\x04\x00\x00\x00Z\x05emailr\x05\x00\x00\x00rM\x00\x00\x00Z\x08argparseZ\x08coloramar\x06\x00\x00\x00r\x07\x00\x00\x00r\x08\x00\x00\x00r\t\x00\x00\x00r\n\x00\x00\x00Z\x04initZ\x0eArgumentParserZ\x06parserZ\x0cadd_argumentZ\nparse_argsr=\x00\x00\x00r[\x00\x00\x00Z\x06myfile\xda\x04readr0\x00\x00\x00rC\x00\x00\x00r>\x00\x00\x00rQ\x00\x00\x00rE\x00\x00\x00rV\x00\x00\x00Z\x07MAGENTAZ\x06NORMALZ\x04CYANZ\x05GREENZ\x03DIMZ\x05WHITEZ\tRESET_ALLZ\x06YELLOWZ\x05BLACKrF\x00\x00\x00rG\x00\x00\x00Z\x04abu2rS\x00\x00\x00rT\x00\x00\x00rY\x00\x00\x00rW\x00\x00\x00rU\x00\x00\x00rZ\x00\x00\x00Z\x04BLUErX\x00\x00\x00Z\x07sessionr \x00\x00\x00r@\x00\x00\x00rA\x00\x00\x00r$\x00\x00\x00r)\x00\x00\x00r^\x00\x00\x00\xda\x03getr\r\x00\x00\x00rD\x00\x00\x00r?\x00\x00\x00r\x1a\x00\x00\x00r\x1b\x00\x00\x00rR\x00\x00\x00r\x1e\x00\x00\x00r"\x00\x00\x00r"\x00\x00\x00r"\x00\x00\x00r#\x00\x00\x00\xda\x08<module>\x01\x00\x00\x00sl\x00\x00\x00\x80\x01\x0c\x01\x0c\x01\x0c\x01\x0c\x018\x01\x08\x01\x14\x01\x0c\x01\x0c\x01\x0c\x02\x0c\x01\x04\x01\x02\x00\x02\x01\x02\x01\x02\xfd\x06\x05\x08\x01\x0c\x01\x12\x01\n\x01\n\x04\xff\x00\xa3\x01\x0c\x01\x06\x01\x0c\x01\x0c\x01\x0c\x01\x0c\x01\x0c\x01\x0c\x01\x0c\x01\x08\x02\x04\x02\x02\x01\x06\x01\x02\x01\x02\x01\x02\x01\x02\xfa\x06\t\x08\x0e\x08\x11\x08\x7f\x00J,\x01\x0c\x01\x02\x014\x01\x06\x01\x08\x01\x0e\x05'))
| 7,464.333333
| 22,362
| 0.750324
| 4,728
| 22,393
| 3.539975
| 0.153342
| 0.083169
| 0.04732
| 0.031547
| 0.551891
| 0.507498
| 0.465197
| 0.431917
| 0.392543
| 0.36721
| 0
| 0.355739
| 0.014067
| 22,393
| 3
| 22,362
| 7,464.333333
| 0.402346
| 0.000536
| 0
| 0
| 0
| 5
| 0.728093
| 0.501854
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0.5
| 0
| 0.5
| 0.5
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
|
0
| 12
|
caab2305bc37b95b653741ba3836ce43b11ae552
| 10,601
|
py
|
Python
|
tests/test_number.py
|
marcodeangelis/intervals
|
b4ab675e7b01fbda25b990b44553c3b5b922ae1d
|
[
"MIT"
] | 6
|
2022-02-21T15:38:41.000Z
|
2022-03-08T13:55:02.000Z
|
tests/test_number.py
|
marcodeangelis/intervals
|
b4ab675e7b01fbda25b990b44553c3b5b922ae1d
|
[
"MIT"
] | 4
|
2022-02-21T15:16:39.000Z
|
2022-02-21T18:00:44.000Z
|
tests/test_number.py
|
marcodeangelis/intervals
|
b4ab675e7b01fbda25b990b44553c3b5b922ae1d
|
[
"MIT"
] | null | null | null |
import unittest
import logging
import sys
import numpy
from intervals.number import Interval as I
from intervals.methods import (intervalise,lo,hi)
from .interval_generator import pick_endpoints_at_random_uniform
class TestIntervalArithmetic(unittest.TestCase):
def test_addition_by_endpoints_analysis(self):
"""
Test addition 100 times between random intervals.
"""
# log = logging.getLogger("TestLog")
# log.debug("testing addition hundred times between random intervals")
x = intervalise(pick_endpoints_at_random_uniform(n=100))
y = intervalise(pick_endpoints_at_random_uniform(n=100))
for xi,yi in zip(x,y):
xi_op_yi = xi+yi
a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)]
c = [ai+bj for ai in a for bj in b] # endpoints analysis
ea = [min(c), max(c)]
self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7)
self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7)
def test_subtraction_by_endpoints_analysis(self):
"""
Test subtraction 100 times between random intervals.
"""
x = intervalise(pick_endpoints_at_random_uniform(n=100))
y = intervalise(pick_endpoints_at_random_uniform(n=100))
for xi,yi in zip(x,y):
xi_op_yi = xi-yi
a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)]
c = [ai-bj for ai in a for bj in b] # endpoints analysis
ea = [min(c), max(c)]
self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7)
self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7)
def test_multiplication_by_endpoints_analysis(self):
"""
Test multiplication 100 times between random intervals.
"""
x = intervalise(pick_endpoints_at_random_uniform(n=100))
y = intervalise(pick_endpoints_at_random_uniform(n=100))
for xi,yi in zip(x,y):
xi_op_yi = xi*yi
a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)]
c = [ai*bj for ai in a for bj in b] # endpoints analysis
ea = [min(c), max(c)]
self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7)
self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7)
def test_division_by_endpoints_analysis(self):
"""
Test division 100 times between random intervals.
"""
x = intervalise(pick_endpoints_at_random_uniform(n=100))
y = intervalise(pick_endpoints_at_random_uniform(n=100,left_bound=0.001))
for xi,yi in zip(x,y):
xi_plus_yi = xi/yi
a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)]
c = [ai/bj for ai in a for bj in b] # endpoints analysis
ea = [min(c), max(c)]
self.assertAlmostEqual(lo(xi_plus_yi), ea[0], places=7)
self.assertAlmostEqual(hi(xi_plus_yi), ea[1], places=7)
def test_four_operations_between_interval_2darrays(self):
"""
Test element-wise operations between two dimensional arrays of intervals.
"""
x = intervalise(pick_endpoints_at_random_uniform(shape=(100,4)))
y = intervalise(pick_endpoints_at_random_uniform(shape=(100,4),left_bound=0.001))
x_add_y = x+y
x_sub_y = x-y
x_mul_y = x*y
x_div_y = x/y
for xi,yi,z1,z2,z3,z4 in zip(x,y,x_add_y,x_sub_y,x_mul_y,x_div_y):
xi_add_yi = xi+yi
xi_sub_yi = xi-yi
xi_mul_yi = xi*yi
xi_div_yi = xi/yi
self.assertAlmostEqual(lo(z1), lo(xi_add_yi), places=7)
self.assertAlmostEqual(hi(z1), hi(xi_add_yi), places=7)
self.assertAlmostEqual(lo(z2), lo(xi_sub_yi), places=7)
self.assertAlmostEqual(hi(z2), hi(xi_sub_yi), places=7)
self.assertAlmostEqual(lo(z3), lo(xi_mul_yi), places=7)
self.assertAlmostEqual(hi(z3), hi(xi_mul_yi), places=7)
self.assertAlmostEqual(lo(z4), lo(xi_div_yi), places=7)
self.assertAlmostEqual(hi(z4), hi(xi_div_yi), places=7)
def test_four_operations_between_interval_3darrays(self):
"""
Test element-wise operations between three dimensional arrays of intervals.
"""
x = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3)))
y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001))
x_add_y = x+y
x_sub_y = x-y
x_mul_y = x*y
x_div_y = x/y
for xi,yi,z1,z2,z3,z4 in zip(x,y,x_add_y,x_sub_y,x_mul_y,x_div_y):
xi_add_yi = xi+yi
xi_sub_yi = xi-yi
xi_mul_yi = xi*yi
xi_div_yi = xi/yi
self.assertAlmostEqual(lo(z1), lo(xi_add_yi), places=7)
self.assertAlmostEqual(hi(z1), hi(xi_add_yi), places=7)
self.assertAlmostEqual(lo(z2), lo(xi_sub_yi), places=7)
self.assertAlmostEqual(hi(z2), hi(xi_sub_yi), places=7)
self.assertAlmostEqual(lo(z3), lo(xi_mul_yi), places=7)
self.assertAlmostEqual(hi(z3), hi(xi_mul_yi), places=7)
self.assertAlmostEqual(lo(z4), lo(xi_div_yi), places=7)
self.assertAlmostEqual(hi(z4), hi(xi_div_yi), places=7)
def test_four_operations_between_scalar_and_arrays(self):
"""
Test element-wise operations between array-like and scalar intervals.
"""
a = intervalise(pick_endpoints_at_random_uniform(n=1,left_bound=-1,right_bound=1))
y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001))
a_add_y = a+y
a_sub_y = a-y
a_mul_y = a*y
a_div_y = a/y
for yi,z1,z2,z3,z4 in zip(y,a_add_y,a_sub_y,a_mul_y,a_div_y):
ai_add_yi = a+yi
ai_sub_yi = a-yi
ai_mul_yi = a*yi
ai_div_yi = a/yi
self.assertAlmostEqual(lo(z1), lo(ai_add_yi), places=7)
self.assertAlmostEqual(hi(z1), hi(ai_add_yi), places=7)
self.assertAlmostEqual(lo(z2), lo(ai_sub_yi), places=7)
self.assertAlmostEqual(hi(z2), hi(ai_sub_yi), places=7)
self.assertAlmostEqual(lo(z3), lo(ai_mul_yi), places=7)
self.assertAlmostEqual(hi(z3), hi(ai_mul_yi), places=7)
self.assertAlmostEqual(lo(z4), lo(ai_div_yi), places=7)
self.assertAlmostEqual(hi(z4), hi(ai_div_yi), places=7)
def test_four_operations_between_arrays_and_scalars(self):
"""
Test element-wise operations between array-like and scalar intervals.
"""
a = intervalise(pick_endpoints_at_random_uniform(n=1,left_bound=0.001,right_bound=1))
y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001))
y_add_a = y+a
y_sub_a = y-a
y_mul_a = y*a
y_div_a = y/a
for yi,z1,z2,z3,z4 in zip(y,y_add_a,y_sub_a,y_mul_a,y_div_a):
yi_add_ai = yi+a
yi_sub_ai = yi-a
yi_mul_ai = yi*a
yi_div_ai = yi/a
self.assertAlmostEqual(lo(z1), lo(yi_add_ai), places=7)
self.assertAlmostEqual(hi(z1), hi(yi_add_ai), places=7)
self.assertAlmostEqual(lo(z2), lo(yi_sub_ai), places=7)
self.assertAlmostEqual(hi(z2), hi(yi_sub_ai), places=7)
self.assertAlmostEqual(lo(z3), lo(yi_mul_ai), places=7)
self.assertAlmostEqual(hi(z3), hi(yi_mul_ai), places=7)
self.assertAlmostEqual(lo(z4), lo(yi_div_ai), places=7)
self.assertAlmostEqual(hi(z4), hi(yi_div_ai), places=7)
def test_four_operations_between_interval_and_numeric(self):
"""
Test element-wise operations between array-like and non-interval numbers.
"""
a = -10 + numpy.random.rand() * 20 # a random number between -10 and 10
y = intervalise(pick_endpoints_at_random_uniform(n=100,left_bound=0.001))
for yi in y:
yi_add_a = yi+a
yi_sub_a = yi-a
yi_mul_a = yi*a
yi_div_a = yi/a
yy = [lo(yi),hi(yi)]
c_add = [bj+a for bj in yy] # endpoints analysis
c_sub = [bj-a for bj in yy] # endpoints analysis
c_mul = [bj*a for bj in yy] # endpoints analysis
c_div = [bj/a for bj in yy] # endpoints analysis
ea_add = [min(c_add), max(c_add)]
ea_sub = [min(c_sub), max(c_sub)]
ea_mul = [min(c_mul), max(c_mul)]
ea_div = [min(c_div), max(c_div)]
self.assertAlmostEqual(lo(yi_add_a), ea_add[0], places=7)
self.assertAlmostEqual(hi(yi_add_a), ea_add[1], places=7)
self.assertAlmostEqual(lo(yi_sub_a), ea_sub[0], places=7)
self.assertAlmostEqual(hi(yi_sub_a), ea_sub[1], places=7)
self.assertAlmostEqual(lo(yi_mul_a), ea_mul[0], places=7)
self.assertAlmostEqual(hi(yi_mul_a), ea_mul[1], places=7)
self.assertAlmostEqual(lo(yi_div_a), ea_div[0], places=7)
self.assertAlmostEqual(hi(yi_div_a), ea_div[1], places=7)
def test_four_operations_between_arrays_and_numeric(self):
"""
Test element-wise operations between array-like and non-interval numbers.
"""
a = -10 + numpy.random.rand() * 20
y = intervalise(pick_endpoints_at_random_uniform(shape=(7,4,3),left_bound=0.001))
y_add_a = y+a
y_sub_a = y-a
y_mul_a = y*a
y_div_a = y/a
for yi,z1,z2,z3,z4 in zip(y,y_add_a,y_sub_a,y_mul_a,y_div_a):
yi_add_ai = yi+a
yi_sub_ai = yi-a
yi_mul_ai = yi*a
yi_div_ai = yi/a
self.assertAlmostEqual(lo(z1), lo(yi_add_ai), places=7)
self.assertAlmostEqual(hi(z1), hi(yi_add_ai), places=7)
self.assertAlmostEqual(lo(z2), lo(yi_sub_ai), places=7)
self.assertAlmostEqual(hi(z2), hi(yi_sub_ai), places=7)
self.assertAlmostEqual(lo(z3), lo(yi_mul_ai), places=7)
self.assertAlmostEqual(hi(z3), hi(yi_mul_ai), places=7)
self.assertAlmostEqual(lo(z4), lo(yi_div_ai), places=7)
self.assertAlmostEqual(hi(z4), hi(yi_div_ai), places=7)
def parsing_degenerate_intervals(self):
a = numpy.random.rand()
x = I(a)
self.assertEqual(lo(x), a)
self.assertEqual(hi(x), a)
if __name__ == '__main__':
# logging.basicConfig(stream=sys.stderr,level=logging.DEBUG)
# unittest.TextTestRunner().run(TestIntervalArithmetic())
# logging.basicConfig( stream=sys.stderr )
# logging.getLogger( "SomeTest.testSomething" ).setLevel( logging.DEBUG )
unittest.main()
| 47.752252
| 93
| 0.614187
| 1,641
| 10,601
| 3.711761
| 0.071907
| 0.193072
| 0.083073
| 0.21146
| 0.856345
| 0.799704
| 0.783123
| 0.742571
| 0.714004
| 0.621901
| 0
| 0.031874
| 0.263088
| 10,601
| 222
| 94
| 47.752252
| 0.747824
| 0.10999
| 0
| 0.555556
| 0
| 0
| 0.00087
| 0
| 0
| 0
| 0
| 0
| 0.322222
| 1
| 0.061111
| false
| 0
| 0.038889
| 0
| 0.105556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
caf07443beec9efe7e0a6e3dc4e5c8f6b931d079
| 165
|
py
|
Python
|
models/__init__.py
|
LeoZDong/detr
|
fbd1b41d58fa1b7a65f6a5a39a74368f8b823e07
|
[
"Apache-2.0"
] | null | null | null |
models/__init__.py
|
LeoZDong/detr
|
fbd1b41d58fa1b7a65f6a5a39a74368f8b823e07
|
[
"Apache-2.0"
] | null | null | null |
models/__init__.py
|
LeoZDong/detr
|
fbd1b41d58fa1b7a65f6a5a39a74368f8b823e07
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .detr import build
def build_model(args, pdif_args):
return build(args, pdif_args)
| 23.571429
| 70
| 0.751515
| 25
| 165
| 4.84
| 0.76
| 0.132231
| 0.198347
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163636
| 165
| 6
| 71
| 27.5
| 0.876812
| 0.412121
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 7
|
1b9cc2d706fefdb060adf85ec3c9652acfa8bffc
| 2,732
|
py
|
Python
|
test/strings/prefixes2.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 1,482
|
2015-10-16T21:59:32.000Z
|
2022-03-30T11:44:40.000Z
|
test/strings/prefixes2.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 226
|
2015-10-15T15:53:44.000Z
|
2022-03-25T03:08:27.000Z
|
test/strings/prefixes2.py
|
kylebarron/MagicPython
|
da6fa0793e2c85d3bf7709ff1d4f65ccf468db11
|
[
"MIT"
] | 129
|
2015-10-20T02:41:49.000Z
|
2022-03-22T01:44:36.000Z
|
a = U'S T R'
a = B'S T R'
a = R'S T R'
a = BR'S T R'
a = RB'S T R'
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
U : source.python, storage.type.string.python, string.quoted.single.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python
S T R : source.python, string.quoted.single.python
' : punctuation.definition.string.end.python, source.python, string.quoted.single.python
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
B : source.python, storage.type.string.python, string.quoted.binary.single.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python
S T R : source.python, string.quoted.binary.single.python
' : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
R : source.python, storage.type.string.python, string.quoted.raw.single.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python
S T R : source.python, string.quoted.raw.single.python
' : punctuation.definition.string.end.python, source.python, string.quoted.raw.single.python
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
BR : source.python, storage.type.string.python, string.quoted.raw.binary.single.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.raw.binary.single.python
S T R : source.python, string.quoted.raw.binary.single.python
' : punctuation.definition.string.end.python, source.python, string.quoted.raw.binary.single.python
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
RB : source.python, storage.type.string.python, string.quoted.raw.binary.single.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.raw.binary.single.python
S T R : source.python, string.quoted.raw.binary.single.python
' : punctuation.definition.string.end.python, source.python, string.quoted.raw.binary.single.python
| 55.755102
| 113
| 0.644949
| 324
| 2,732
| 5.438272
| 0.074074
| 0.272418
| 0.255392
| 0.204313
| 0.980704
| 0.980704
| 0.980704
| 0.980704
| 0.937571
| 0.876844
| 0
| 0
| 0.243777
| 2,732
| 48
| 114
| 56.916667
| 0.852856
| 0
| 0
| 0.577778
| 0
| 0.111111
| 0.009151
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
9409769d1852313ea878c94806b7f335dbbb9135
| 81
|
py
|
Python
|
src/common.py
|
Y-Ysss/minimal_git.py
|
d0e105b3408002cdeb113b3b7ed4373eb2e66840
|
[
"MIT"
] | null | null | null |
src/common.py
|
Y-Ysss/minimal_git.py
|
d0e105b3408002cdeb113b3b7ed4373eb2e66840
|
[
"MIT"
] | null | null | null |
src/common.py
|
Y-Ysss/minimal_git.py
|
d0e105b3408002cdeb113b3b7ed4373eb2e66840
|
[
"MIT"
] | null | null | null |
import os
import os
def is_windows() -> bool:
return os.name == 'nt'
| 11.571429
| 27
| 0.580247
| 12
| 81
| 3.833333
| 0.75
| 0.347826
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.296296
| 81
| 6
| 28
| 13.5
| 0.807018
| 0
| 0
| 0.5
| 0
| 0
| 0.026667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0.25
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 8
|
947b0f5a3c05992bf1974b51a59fb096e6a433c2
| 165
|
py
|
Python
|
ajenga/protocol/__init__.py
|
project-ajenga/Core
|
10a866f541d86298f7ed3922754d5232fe820b25
|
[
"MIT"
] | null | null | null |
ajenga/protocol/__init__.py
|
project-ajenga/Core
|
10a866f541d86298f7ed3922754d5232fe820b25
|
[
"MIT"
] | null | null | null |
ajenga/protocol/__init__.py
|
project-ajenga/Core
|
10a866f541d86298f7ed3922754d5232fe820b25
|
[
"MIT"
] | null | null | null |
from ajenga.protocol.api import Api
from ajenga.protocol.api import ApiResult
from ajenga.protocol.api import Code
from ajenga.protocol.api import MessageSendResult
| 33
| 49
| 0.854545
| 24
| 165
| 5.875
| 0.333333
| 0.283688
| 0.510638
| 0.595745
| 0.765957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.09697
| 165
| 4
| 50
| 41.25
| 0.946309
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
84b3f8a6ecb0fe8531caacfa234f3990907485c4
| 1,815
|
py
|
Python
|
python/cac_tripplanner/destinations/migrations/0037_auto_20180412_1256.py
|
azavea/cac-tripplanner
|
08eaa7e909484ac04687e078fbecba7e7fdc452e
|
[
"Apache-2.0"
] | 13
|
2015-08-07T13:54:53.000Z
|
2020-10-20T18:59:01.000Z
|
python/cac_tripplanner/destinations/migrations/0037_auto_20180412_1256.py
|
azavea/cac-tripplanner
|
08eaa7e909484ac04687e078fbecba7e7fdc452e
|
[
"Apache-2.0"
] | 1,177
|
2015-01-15T16:46:38.000Z
|
2022-03-29T13:37:37.000Z
|
python/cac_tripplanner/destinations/migrations/0037_auto_20180412_1256.py
|
azavea/cac-tripplanner
|
08eaa7e909484ac04687e078fbecba7e7fdc452e
|
[
"Apache-2.0"
] | 7
|
2015-01-19T20:10:38.000Z
|
2019-10-16T05:57:47.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-12 16:56
from django.db import migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('destinations', '0036_extradestinationpicture_extraeventpicture'),
]
operations = [
migrations.AlterField(
model_name='destination',
name='image',
field=image_cropping.fields.ImageRatioField('image_raw', '310x155', adapt_rotation=False, allow_fullsize=False, free_crop=False, help_text='The small image. Will be displayed at 310x155', hide_image_field=False, size_warning=True, verbose_name='image'),
),
migrations.AlterField(
model_name='destination',
name='wide_image',
field=image_cropping.fields.ImageRatioField('wide_image_raw', '680x400', adapt_rotation=False, allow_fullsize=False, free_crop=False, help_text='The large image. Will be displayed at 680x400', hide_image_field=False, size_warning=True, verbose_name='wide image'),
),
migrations.AlterField(
model_name='event',
name='image',
field=image_cropping.fields.ImageRatioField('image_raw', '310x155', adapt_rotation=False, allow_fullsize=False, free_crop=False, help_text='The small image. Will be displayed at 310x155', hide_image_field=False, size_warning=True, verbose_name='image'),
),
migrations.AlterField(
model_name='event',
name='wide_image',
field=image_cropping.fields.ImageRatioField('wide_image_raw', '680x400', adapt_rotation=False, allow_fullsize=False, free_crop=False, help_text='The large image. Will be displayed at 680x400', hide_image_field=False, size_warning=True, verbose_name='wide image'),
),
]
| 49.054054
| 275
| 0.694766
| 216
| 1,815
| 5.601852
| 0.282407
| 0.066116
| 0.078512
| 0.095868
| 0.826446
| 0.826446
| 0.784298
| 0.752066
| 0.752066
| 0.752066
| 0
| 0.047814
| 0.193388
| 1,815
| 36
| 276
| 50.416667
| 0.778689
| 0.038017
| 0
| 0.714286
| 1
| 0
| 0.231784
| 0.026391
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.071429
| 0
| 0.178571
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
ca55d9254ac0a9f62fe4d810319c6094df2b31e2
| 5,653
|
py
|
Python
|
frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
|
prasadarr/frappe
|
7159dc8046f1c2664f735890befbbba1c3b16b7e
|
[
"MIT"
] | 1
|
2021-02-17T03:02:00.000Z
|
2021-02-17T03:02:00.000Z
|
frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
|
sagarvora/frappe
|
8450afaa97c2a0f046eddaa493a88c2b4eb9dd5a
|
[
"MIT"
] | null | null | null |
frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py
|
sagarvora/frappe
|
8450afaa97c2a0f046eddaa493a88c2b4eb9dd5a
|
[
"MIT"
] | 1
|
2021-06-02T18:11:45.000Z
|
2021-06-02T18:11:45.000Z
|
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest, frappe
from frappe.utils import getdate
from frappe.desk.doctype.dashboard_chart.dashboard_chart import (get,
get_period_ending)
class TestDashboardChart(unittest.TestCase):
def test_period_ending(self):
self.assertEqual(get_period_ending('2019-04-10', 'Daily'),
getdate('2019-04-10'))
# fun fact: week ends on the day before 1st Jan of the year.
# for 2019 it is Monday
self.assertEqual(get_period_ending('2019-04-10', 'Weekly'),
getdate('2019-04-15'))
self.assertEqual(get_period_ending('2019-04-10', 'Monthly'),
getdate('2019-04-30'))
self.assertEqual(get_period_ending('2019-04-30', 'Monthly'),
getdate('2019-04-30'))
self.assertEqual(get_period_ending('2019-03-31', 'Monthly'),
getdate('2019-03-31'))
self.assertEqual(get_period_ending('2019-04-10', 'Quarterly'),
getdate('2019-06-30'))
self.assertEqual(get_period_ending('2019-06-30', 'Quarterly'),
getdate('2019-06-30'))
self.assertEqual(get_period_ending('2019-10-01', 'Quarterly'),
getdate('2019-12-31'))
def test_dashboard_chart(self):
if frappe.db.exists('Dashboard Chart', 'Test Dashboard Chart'):
frappe.delete_doc('Dashboard Chart', 'Test Dashboard Chart')
frappe.get_doc(dict(
doctype = 'Dashboard Chart',
chart_name = 'Test Dashboard Chart',
chart_type = 'Count',
document_type = 'DocType',
based_on = 'creation',
timespan = 'Last Year',
time_interval = 'Monthly',
filters_json = '{}',
timeseries = 1
)).insert()
result = get(chart_name ='Test Dashboard Chart',
to_date = '2019-04-11', refresh = 1)
self.assertEqual(result.get('labels')[0], '2018-04-30')
self.assertEqual(result.get('labels')[1], '2018-05-31')
self.assertEqual(result.get('labels')[2], '2018-06-30')
self.assertEqual(result.get('labels')[3], '2018-07-31')
self.assertEqual(result.get('labels')[4], '2018-08-31')
self.assertEqual(result.get('labels')[5], '2018-09-30')
self.assertEqual(result.get('labels')[6], '2018-10-31')
self.assertEqual(result.get('labels')[7], '2018-11-30')
self.assertEqual(result.get('labels')[8], '2018-12-31')
self.assertEqual(result.get('labels')[9], '2019-01-31')
self.assertEqual(result.get('labels')[10], '2019-02-28')
self.assertEqual(result.get('labels')[11], '2019-03-31')
self.assertEqual(result.get('labels')[12], '2019-04-30')
# self.assertEqual(result.get('datasets')[0].get('values')[:-1],
# [44, 28, 8, 11, 2, 6, 18, 6, 4, 5, 15, 13])
frappe.db.rollback()
def test_empty_dashboard_chart(self):
if frappe.db.exists('Dashboard Chart', 'Test Empty Dashboard Chart'):
frappe.delete_doc('Dashboard Chart', 'Test Empty Dashboard Chart')
frappe.db.sql('delete from `tabError Log`')
frappe.get_doc(dict(
doctype = 'Dashboard Chart',
chart_name = 'Test Empty Dashboard Chart',
chart_type = 'Count',
document_type = 'Error Log',
based_on = 'creation',
timespan = 'Last Year',
time_interval = 'Monthly',
filters_json = '{}',
timeseries = 1
)).insert()
result = get(chart_name ='Test Empty Dashboard Chart',
to_date = '2019-04-11', refresh = 1)
self.assertEqual(result.get('labels')[0], '2018-04-30')
self.assertEqual(result.get('labels')[1], '2018-05-31')
self.assertEqual(result.get('labels')[2], '2018-06-30')
self.assertEqual(result.get('labels')[3], '2018-07-31')
self.assertEqual(result.get('labels')[4], '2018-08-31')
self.assertEqual(result.get('labels')[5], '2018-09-30')
self.assertEqual(result.get('labels')[6], '2018-10-31')
self.assertEqual(result.get('labels')[7], '2018-11-30')
self.assertEqual(result.get('labels')[8], '2018-12-31')
self.assertEqual(result.get('labels')[9], '2019-01-31')
self.assertEqual(result.get('labels')[10], '2019-02-28')
self.assertEqual(result.get('labels')[11], '2019-03-31')
self.assertEqual(result.get('labels')[12], '2019-04-30')
frappe.db.rollback()
def test_chart_wih_one_value(self):
if frappe.db.exists('Dashboard Chart', 'Test Empty Dashboard Chart 2'):
frappe.delete_doc('Dashboard Chart', 'Test Empty Dashboard Chart 2')
frappe.db.sql('delete from `tabError Log`')
# create one data point
frappe.get_doc(dict(doctype = 'Error Log', creation = '2018-06-01 00:00:00')).insert()
frappe.get_doc(dict(
doctype = 'Dashboard Chart',
chart_name = 'Test Empty Dashboard Chart 2',
chart_type = 'Count',
document_type = 'Error Log',
based_on = 'creation',
timespan = 'Last Year',
time_interval = 'Monthly',
filters_json = '{}',
timeseries = 1
)).insert()
result = get(chart_name ='Test Empty Dashboard Chart 2',
to_date = '2019-04-11', refresh = 1)
self.assertEqual(result.get('labels')[0], '2018-04-30')
self.assertEqual(result.get('labels')[1], '2018-05-31')
self.assertEqual(result.get('labels')[2], '2018-06-30')
self.assertEqual(result.get('labels')[3], '2018-07-31')
self.assertEqual(result.get('labels')[4], '2018-08-31')
self.assertEqual(result.get('labels')[5], '2018-09-30')
self.assertEqual(result.get('labels')[6], '2018-10-31')
self.assertEqual(result.get('labels')[7], '2018-11-30')
self.assertEqual(result.get('labels')[8], '2018-12-31')
self.assertEqual(result.get('labels')[9], '2019-01-31')
self.assertEqual(result.get('labels')[10], '2019-02-28')
self.assertEqual(result.get('labels')[11], '2019-03-31')
self.assertEqual(result.get('labels')[12], '2019-04-30')
# only 1 data point with value
self.assertEqual(result.get('datasets')[0].get('values')[2], 1)
frappe.db.rollback()
| 37.437086
| 88
| 0.681762
| 821
| 5,653
| 4.612667
| 0.153471
| 0.194085
| 0.227357
| 0.259836
| 0.844996
| 0.824663
| 0.820966
| 0.794032
| 0.71719
| 0.689728
| 0
| 0.114873
| 0.122236
| 5,653
| 150
| 89
| 37.686667
| 0.648327
| 0.059084
| 0
| 0.683761
| 0
| 0
| 0.28566
| 0
| 0
| 0
| 0
| 0
| 0.410256
| 1
| 0.034188
| false
| 0
| 0.034188
| 0
| 0.076923
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
046ceef525ec4e0a7561c9be9bab88d6137c5b6e
| 117
|
py
|
Python
|
src/PatchMatch/__init__.py
|
harveyslash/Deep-Image-Analogy-TF
|
9bda06fbe3a5786217a3db112d2f162573b1dd90
|
[
"MIT"
] | 4
|
2018-02-27T21:43:42.000Z
|
2021-08-22T14:42:47.000Z
|
src/PatchMatch/__init__.py
|
harveyslash/Deep-Image-Analogy-TF
|
9bda06fbe3a5786217a3db112d2f162573b1dd90
|
[
"MIT"
] | null | null | null |
src/PatchMatch/__init__.py
|
harveyslash/Deep-Image-Analogy-TF
|
9bda06fbe3a5786217a3db112d2f162573b1dd90
|
[
"MIT"
] | 2
|
2018-02-25T21:50:08.000Z
|
2018-11-26T23:42:32.000Z
|
# from .PatchMatchOrig import PatchMatch as PatchMatchOrig
from .PatchMatchCuda import PatchMatch as PatchMatchOrig
| 29.25
| 58
| 0.854701
| 12
| 117
| 8.333333
| 0.5
| 0.32
| 0.36
| 0.64
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.119658
| 117
| 3
| 59
| 39
| 0.970874
| 0.478632
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
04c063038ce7ea86aae86ee8b335d86cd364bfa3
| 3,265
|
py
|
Python
|
pyaz/iot/dps/access_policy/__init__.py
|
py-az-cli/py-az-cli
|
9a7dc44e360c096a5a2f15595353e9dad88a9792
|
[
"MIT"
] | null | null | null |
pyaz/iot/dps/access_policy/__init__.py
|
py-az-cli/py-az-cli
|
9a7dc44e360c096a5a2f15595353e9dad88a9792
|
[
"MIT"
] | null | null | null |
pyaz/iot/dps/access_policy/__init__.py
|
py-az-cli/py-az-cli
|
9a7dc44e360c096a5a2f15595353e9dad88a9792
|
[
"MIT"
] | 1
|
2022-02-03T09:12:01.000Z
|
2022-02-03T09:12:01.000Z
|
from .... pyaz_utils import _call_az
def list(dps_name, resource_group):
'''
List all shared access policies in an Azure IoT Hub device provisioning service.
Required Parameters:
- dps_name -- IoT Provisioning Service name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
'''
return _call_az("az iot dps access-policy list", locals())
def show(access_policy_name, dps_name, resource_group):
'''
Show details of a shared access policies in an Azure IoT Hub device provisioning service.
Required Parameters:
- access_policy_name -- A friendly name for DPS access policy.
- dps_name -- IoT Provisioning Service name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
'''
return _call_az("az iot dps access-policy show", locals())
def create(access_policy_name, dps_name, resource_group, rights, no_wait=None, primary_key=None, secondary_key=None):
'''
Create a new shared access policy in an Azure IoT Hub device provisioning service.
Required Parameters:
- access_policy_name -- A friendly name for DPS access policy.
- dps_name -- IoT Provisioning Service name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- rights -- Access rights for the IoT provisioning service. Use space-separated list for multiple rights.
Optional Parameters:
- no_wait -- Do not wait for the long-running operation to finish.
- primary_key -- Primary SAS key value.
- secondary_key -- Secondary SAS key value.
'''
return _call_az("az iot dps access-policy create", locals())
def update(access_policy_name, dps_name, resource_group, no_wait=None, primary_key=None, rights=None, secondary_key=None):
'''
Update a shared access policy in an Azure IoT Hub device provisioning service.
Required Parameters:
- access_policy_name -- A friendly name for DPS access policy.
- dps_name -- IoT Provisioning Service name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
Optional Parameters:
- no_wait -- Do not wait for the long-running operation to finish.
- primary_key -- Primary SAS key value.
- rights -- Access rights for the IoT provisioning service. Use space-separated list for multiple rights.
- secondary_key -- Secondary SAS key value.
'''
return _call_az("az iot dps access-policy update", locals())
def delete(access_policy_name, dps_name, resource_group, no_wait=None):
'''
Delete a shared access policies in an Azure IoT Hub device provisioning service.
Required Parameters:
- access_policy_name -- A friendly name for DPS access policy.
- dps_name -- IoT Provisioning Service name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
Optional Parameters:
- no_wait -- Do not wait for the long-running operation to finish.
'''
return _call_az("az iot dps access-policy delete", locals())
| 42.960526
| 128
| 0.723737
| 456
| 3,265
| 5.04386
| 0.14693
| 0.09913
| 0.073913
| 0.043478
| 0.898696
| 0.898696
| 0.882174
| 0.85087
| 0.836957
| 0.836957
| 0
| 0
| 0.19755
| 3,265
| 75
| 129
| 43.533333
| 0.877863
| 0.694334
| 0
| 0
| 0
| 0
| 0.18946
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.454545
| false
| 0
| 0.090909
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 8
|
b6cb2c8be6cf884a33d1d0ce8307da3216ba00b9
| 646
|
py
|
Python
|
response_data/deploy_keys.py
|
ddeno/pyapi-gitlab
|
f74b6fb5c13cecae9524997847e928905cc60acf
|
[
"Apache-2.0"
] | 100
|
2015-12-03T18:59:50.000Z
|
2022-03-04T20:25:56.000Z
|
response_data/deploy_keys.py
|
ddeno/pyapi-gitlab
|
f74b6fb5c13cecae9524997847e928905cc60acf
|
[
"Apache-2.0"
] | 88
|
2015-12-02T08:59:35.000Z
|
2020-11-04T10:04:10.000Z
|
response_data/deploy_keys.py
|
ddeno/pyapi-gitlab
|
f74b6fb5c13cecae9524997847e928905cc60acf
|
[
"Apache-2.0"
] | 51
|
2015-01-04T21:07:22.000Z
|
2015-11-30T13:43:18.000Z
|
get_deploy_keys = [{"id": 1, "title": "Public key", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", "can_push": False, "created_at": "2013-10-02T10:12:29Z"}, {"id": 3, "title": "Another Public key", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", "can_push": True, "created_at": "2013-10-02T11:12:29Z"}]
| 323
| 645
| 0.834365
| 50
| 646
| 10.66
| 0.58
| 0.033771
| 0.045028
| 0.056285
| 0.821764
| 0.821764
| 0.821764
| 0.821764
| 0.821764
| 0.821764
| 0
| 0.129241
| 0.041796
| 646
| 1
| 646
| 646
| 0.731826
| 0
| 0
| 0
| 0
| 0
| 0.835913
| 0.619195
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 12
|
b6d5185c2d17040287982cbfcdf49499b6cb7e1a
| 5,074
|
py
|
Python
|
tests/statistical/optimizers/correctness/run-dea.py
|
JonathanLehner/korali
|
90f97d8e2fed2311f988f39cfe014f23ba7dd6cf
|
[
"MIT"
] | 43
|
2018-07-26T07:20:42.000Z
|
2022-03-02T10:23:12.000Z
|
tests/statistical/optimizers/correctness/run-dea.py
|
JonathanLehner/korali
|
90f97d8e2fed2311f988f39cfe014f23ba7dd6cf
|
[
"MIT"
] | 212
|
2018-09-21T10:44:07.000Z
|
2022-03-22T14:33:05.000Z
|
tests/statistical/optimizers/correctness/run-dea.py
|
JonathanLehner/korali
|
90f97d8e2fed2311f988f39cfe014f23ba7dd6cf
|
[
"MIT"
] | 16
|
2018-07-25T15:00:36.000Z
|
2022-03-22T14:19:46.000Z
|
#!/usr/bin/env python3
import os
import sys
import korali
sys.path.append('./model')
sys.path.append('./helpers')
from model import *
from helpers import *
#################################################
# DEA problem definition & run
#################################################
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Greedy"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-4)
#################################################
# Different Accept Rules
#################################################
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Best"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Improved"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Iterative"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
#################################################
# Different Mutation Rules
#################################################
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Mutation Rule"] = "Fixed"
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Iterative"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Mutation Rule"] = "Self Adaptive"
e["Solver"]["Parent Selection Rule"] = "Random"
e["Solver"]["Accept Rule"] = "Iterative"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
#################################################
# Different Parent Selection Rules
#################################################
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = evalmodel
e["Variables"][0]["Name"] = "X"
e["Variables"][0]["Lower Bound"] = -10.0
e["Variables"][0]["Upper Bound"] = +10.0
e["Solver"]["Type"] = "Optimizer/DEA"
e["Solver"]["Population Size"] = 10
e["Solver"]["Termination Criteria"]["Max Generations"] = 100
e["Solver"]["Parent Selection Rule"] = "Best"
e["Solver"]["Accept Rule"] = "Iterative"
e["Console Output"]["Verbosity"] = "Detailed"
e["File Output"]["Enabled"] = False
e["Random Seed"] = 1337
k = korali.Engine()
k.run(e)
checkMin(e, 0.23246, 1e-2)
| 24.872549
| 60
| 0.589279
| 644
| 5,074
| 4.642857
| 0.111801
| 0.086622
| 0.077258
| 0.04214
| 0.927759
| 0.927759
| 0.927759
| 0.927759
| 0.927759
| 0.927759
| 0
| 0.040388
| 0.107016
| 5,074
| 203
| 61
| 24.995074
| 0.61951
| 0.025818
| 0
| 0.890625
| 0
| 0
| 0.484602
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.039063
| 0
| 0.039063
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b6dcd186725f73c76289580468e9d9aa499ce39c
| 161
|
py
|
Python
|
vuserver/apitests/parallel/utils.py
|
vmware/test-automation-for-web-applications
|
9a34503f189151136e9e201b341d469719ed1901
|
[
"Apache-2.0"
] | 1
|
2022-02-23T02:37:02.000Z
|
2022-02-23T02:37:02.000Z
|
vuserver/apitests/parallel/utils.py
|
vmware/test-automation-for-web-applications
|
9a34503f189151136e9e201b341d469719ed1901
|
[
"Apache-2.0"
] | null | null | null |
vuserver/apitests/parallel/utils.py
|
vmware/test-automation-for-web-applications
|
9a34503f189151136e9e201b341d469719ed1901
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2022 VMware, Inc.
# SPDX-License-Identifier: Apache License 2.0
import time
def return_name():
return {"name": time.strftime("test%Y%m%d%H%M")}
| 23
| 52
| 0.701863
| 26
| 161
| 4.307692
| 0.807692
| 0.178571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043165
| 0.136646
| 161
| 7
| 52
| 23
| 0.76259
| 0.440994
| 0
| 0
| 0
| 0
| 0.204545
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 7
|
f3d2df9f38049b8d82a57e020dae3be73b1703c2
| 189
|
py
|
Python
|
theBroker/venv/Lib/site-packages/ttn/github_com/TheThingsNetwork/api/protocol/lorawan/__init__.py
|
emirgo/WeatherStation
|
f0f8c3464470991fc962d83cea20f3bcfd6a04b6
|
[
"MIT"
] | 32
|
2017-11-01T16:03:48.000Z
|
2021-11-16T12:35:34.000Z
|
theBroker/venv/Lib/site-packages/ttn/github_com/TheThingsNetwork/api/protocol/lorawan/__init__.py
|
emirgo/WeatherStation
|
f0f8c3464470991fc962d83cea20f3bcfd6a04b6
|
[
"MIT"
] | 28
|
2017-11-20T09:45:59.000Z
|
2021-12-14T09:31:24.000Z
|
theBroker/venv/Lib/site-packages/ttn/github_com/TheThingsNetwork/api/protocol/lorawan/__init__.py
|
emirgo/WeatherStation
|
f0f8c3464470991fc962d83cea20f3bcfd6a04b6
|
[
"MIT"
] | 22
|
2017-11-03T10:21:50.000Z
|
2021-04-08T05:20:51.000Z
|
from .device_address_pb2_grpc import *
from .device_address_pb2 import *
from .device_pb2_grpc import *
from .device_pb2 import *
from .lorawan_pb2_grpc import *
from .lorawan_pb2 import *
| 27
| 38
| 0.809524
| 29
| 189
| 4.896552
| 0.241379
| 0.352113
| 0.274648
| 0.359155
| 0.323944
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036364
| 0.126984
| 189
| 6
| 39
| 31.5
| 0.824242
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
f3f96e37de57543e6e38274cb0da11ebb2309413
| 27,019
|
py
|
Python
|
tests/test_stratify_flows.py
|
monash-emu/summer
|
e401fa986543ddade0082d271f9261d640b22bec
|
[
"BSD-2-Clause-FreeBSD"
] | 4
|
2021-11-05T02:47:34.000Z
|
2022-01-31T11:25:11.000Z
|
tests/test_stratify_flows.py
|
monash-emu/summer
|
e401fa986543ddade0082d271f9261d640b22bec
|
[
"BSD-2-Clause-FreeBSD"
] | 3
|
2021-04-28T22:29:32.000Z
|
2021-08-30T12:13:01.000Z
|
tests/test_stratify_flows.py
|
monash-emu/summer
|
e401fa986543ddade0082d271f9261d640b22bec
|
[
"BSD-2-Clause-FreeBSD"
] | 1
|
2021-04-29T05:52:34.000Z
|
2021-04-29T05:52:34.000Z
|
"""
Tests to ensure that flows get stratified correctly.
That is, when a stratification is applied, there are the right number of flows,
connected to the right compartments, with the right adjustments applied.
"""
import pytest
from summer import AgeStratification
from summer import Compartment as C
from summer import CompartmentalModel, StrainStratification, Stratification
from summer.adjust import Multiply, Overwrite
from summer.flows import (
CrudeBirthFlow,
DeathFlow,
ImportFlow,
InfectionFrequencyFlow,
TransitionFlow,
)
def test_stratify_entry_flows__with_no_explicit_adjustments():
"""
Ensure entry flows are stratified correctly when no adjustments are requested.
Expect flow to be conserved, split evenly over the new strata.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_importation_flow("imports", 10, "S", split_imports=False)
expected_flows = [ImportFlow("imports", C("S"), 10)]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
model.stratify_with(strat)
expected_flows = [
ImportFlow("imports", C("S", {"location": "urban"}), 10, [Multiply(0.5)]),
ImportFlow("imports", C("S", {"location": "rural"}), 10, [Multiply(0.5)]),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
strat = Stratification("age", ["young", "old"], ["S", "I", "R"])
model.stratify_with(strat)
expected_flows = [
ImportFlow(
"imports",
C("S", {"location": "urban", "age": "young"}),
10,
[Multiply(0.5), Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"location": "urban", "age": "old"}),
10,
[Multiply(0.5), Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"location": "rural", "age": "young"}),
10,
[Multiply(0.5), Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"location": "rural", "age": "old"}),
10,
[Multiply(0.5), Multiply(0.5)],
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_entry_flows__with_split_imports():
"""
Ensure split_import entry flows are scaled correctly (when added post-stratification)
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
strat = Stratification("age", ["young", "old"], ["S", "I", "R"])
model.stratify_with(strat)
model.add_importation_flow("imports", 10, "S", split_imports=True)
expected_flows = [
ImportFlow(
"imports",
C("S", {"age": "young"}),
10,
[Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"age": "old"}),
10,
[Multiply(0.5)],
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
strat.set_flow_adjustments("imports", {"urban": None, "rural": Multiply(0.7)})
model.stratify_with(strat)
expected_flows = [
ImportFlow(
"imports",
C("S", {"age": "young", "location": "urban"}),
10,
[Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"age": "young", "location": "rural"}),
10,
[Multiply(0.5), Multiply(0.7)],
),
ImportFlow(
"imports",
C("S", {"age": "old", "location": "urban"}),
10,
[Multiply(0.5)],
),
ImportFlow(
"imports",
C("S", {"age": "old", "location": "rural"}),
10,
[Multiply(0.5), Multiply(0.7)],
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_entry_flows__with_explicit_adjustments():
"""
Ensure entry flows are stratified correctly when adjustments are requested.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_importation_flow("imports", 10, "S", split_imports=False)
expected_flows = [ImportFlow("imports", C("S"), 10)]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
strat.set_flow_adjustments("imports", {"urban": Multiply(0.9), "rural": None})
model.stratify_with(strat)
expected_flows = [
ImportFlow(
"imports",
C("S", {"location": "urban"}),
10,
[Multiply(0.9)],
),
ImportFlow(
"imports",
C("S", {"location": "rural"}),
10,
[],
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
strat = Stratification("age", ["young", "old"], ["S", "I", "R"])
strat.set_flow_adjustments("imports", {"young": Multiply(0.8), "old": Overwrite(1)})
model.stratify_with(strat)
expected_flows = [
ImportFlow(
"imports",
C("S", {"location": "urban", "age": "young"}),
10,
[Multiply(0.9), Multiply(0.8)],
),
ImportFlow(
"imports",
C("S", {"location": "urban", "age": "old"}),
10,
[Multiply(0.9), Overwrite(1)],
),
ImportFlow(
"imports",
C("S", {"location": "rural", "age": "young"}),
10,
[Multiply(0.8)],
),
ImportFlow(
"imports",
C("S", {"location": "rural", "age": "old"}),
10,
[Overwrite(1)],
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_add_entry_flows_post_stratification():
"""
Ensure we can add flows after a model is stratified.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
model.stratify_with(strat)
with pytest.raises(AssertionError):
model.add_importation_flow("imports", 10, "S", split_imports=False, expected_flow_count=1)
assert len(model._flows) == 0
model.add_importation_flow("imports", 10, "S", split_imports=False, expected_flow_count=2)
assert len(model._flows) == 2
expected_flows = [
ImportFlow("imports", C("S", {"location": "urban"}), 10, []),
ImportFlow("imports", C("S", {"location": "rural"}), 10, []),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_add_entry_flows_post_stratification__with_filter():
"""
Ensure we can add flows after a model is stratified when a strata filter is applied
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
model.stratify_with(strat)
assert len(model._flows) == 0
model.add_importation_flow(
"imports", 10, "S", dest_strata={"location": "urban"}, split_imports=False, expected_flow_count=1
)
assert len(model._flows) == 1
expected_flows = [
ImportFlow("imports", C("S", {"location": "urban"}), 10, []),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify__age__validate_ageing_flows_added():
"""
Ensure, when using an age stratification, that ageing flows are automatically added
and that birth flows are all sent to age 0.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
model.add_crude_birth_flow("births", 0.02, "S")
assert len(model._flows) == 1
strat = AgeStratification("age", ["0", "5", "15"], ["S", "I", "R"])
model.stratify_with(strat)
# Expect ageing flows amongst age group and a birth flow that only goes to age 0.
expected_flows = [
CrudeBirthFlow("births", C("S", {"age": "0"}), 0.02),
TransitionFlow(
"ageing_SXage_0_to_SXage_5", C("S", {"age": "0"}), C("S", {"age": "5"}), 0.2
),
TransitionFlow(
"ageing_IXage_0_to_IXage_5", C("I", {"age": "0"}), C("I", {"age": "5"}), 0.2
),
TransitionFlow(
"ageing_RXage_0_to_RXage_5", C("R", {"age": "0"}), C("R", {"age": "5"}), 0.2
),
TransitionFlow(
"ageing_SXage_5_to_SXage_15", C("S", {"age": "5"}), C("S", {"age": "15"}), 0.1
),
TransitionFlow(
"ageing_IXage_5_to_IXage_15", C("I", {"age": "5"}), C("I", {"age": "15"}), 0.1
),
TransitionFlow(
"ageing_RXage_5_to_RXage_15", C("R", {"age": "5"}), C("R", {"age": "15"}), 0.1
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify__age__validate_ageing_flows_added_second():
"""
Ensure that age stratification works when applied after a previous stratification.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
model.add_crude_birth_flow("births", 0.02, "S")
assert len(model._flows) == 1
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
model.stratify_with(strat)
strat = AgeStratification("age", ["0", "5", "15"], ["S", "I", "R"])
model.stratify_with(strat)
# Expect ageing flows amongst age group and a birth flow that only goes to age 0.
expected_flows = [
CrudeBirthFlow("births", C("S", {"location": "urban", "age": "0"}), 0.02, [Multiply(0.5)]),
CrudeBirthFlow("births", C("S", {"location": "rural", "age": "0"}), 0.02, [Multiply(0.5)]),
TransitionFlow(
"ageing_SXlocation_urbanXage_0_to_SXlocation_urbanXage_5",
C("S", {"location": "urban", "age": "0"}),
C("S", {"location": "urban", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_SXlocation_ruralXage_0_to_SXlocation_ruralXage_5",
C("S", {"location": "rural", "age": "0"}),
C("S", {"location": "rural", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_IXlocation_urbanXage_0_to_IXlocation_urbanXage_5",
C("I", {"location": "urban", "age": "0"}),
C("I", {"location": "urban", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_IXlocation_ruralXage_0_to_IXlocation_ruralXage_5",
C("I", {"location": "rural", "age": "0"}),
C("I", {"location": "rural", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_RXlocation_urbanXage_0_to_RXlocation_urbanXage_5",
C("R", {"location": "urban", "age": "0"}),
C("R", {"location": "urban", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_RXlocation_ruralXage_0_to_RXlocation_ruralXage_5",
C("R", {"location": "rural", "age": "0"}),
C("R", {"location": "rural", "age": "5"}),
0.2,
),
TransitionFlow(
"ageing_SXlocation_urbanXage_5_to_SXlocation_urbanXage_15",
C("S", {"location": "urban", "age": "5"}),
C("S", {"location": "urban", "age": "15"}),
0.1,
),
TransitionFlow(
"ageing_SXlocation_ruralXage_5_to_SXlocation_ruralXage_15",
C("S", {"location": "rural", "age": "5"}),
C("S", {"location": "rural", "age": "15"}),
0.1,
),
TransitionFlow(
"ageing_IXlocation_urbanXage_5_to_IXlocation_urbanXage_15",
C("I", {"location": "urban", "age": "5"}),
C("I", {"location": "urban", "age": "15"}),
0.1,
),
TransitionFlow(
"ageing_IXlocation_ruralXage_5_to_IXlocation_ruralXage_15",
C("I", {"location": "rural", "age": "5"}),
C("I", {"location": "rural", "age": "15"}),
0.1,
),
TransitionFlow(
"ageing_RXlocation_urbanXage_5_to_RXlocation_urbanXage_15",
C("R", {"location": "urban", "age": "5"}),
C("R", {"location": "urban", "age": "15"}),
0.1,
),
TransitionFlow(
"ageing_RXlocation_ruralXage_5_to_RXlocation_ruralXage_15",
C("R", {"location": "rural", "age": "5"}),
C("R", {"location": "rural", "age": "15"}),
0.1,
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_exit_flows():
"""
Ensure exit flows are stratified correctly.
Death flows should remain the same after stratification, so that everyone in all of the stratified compartments
continues to die at the same rate as before stratification.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_death_flow("d_S", 3, "S")
model.add_death_flow("d_I", 5, "I")
model.add_death_flow("d_R", 7, "R")
expected_flows = [
DeathFlow("d_S", C("S"), 3),
DeathFlow("d_I", C("I"), 5),
DeathFlow("d_R", C("R"), 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply partial stratification
strat = Stratification("location", ["urban", "rural"], ["S", "I"])
model.stratify_with(strat)
expected_flows = [
DeathFlow("d_S", C("S", {"location": "urban"}), 3),
DeathFlow("d_S", C("S", {"location": "rural"}), 3),
DeathFlow("d_I", C("I", {"location": "urban"}), 5),
DeathFlow("d_I", C("I", {"location": "rural"}), 5),
DeathFlow("d_R", C("R"), 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply partial stratification with flow adjustments
strat = Stratification("age", ["young", "old"], ["I", "R"])
strat.set_flow_adjustments("d_I", {"young": Multiply(0.5), "old": Multiply(2)})
strat.set_flow_adjustments("d_R", {"young": Multiply(0.5), "old": Multiply(2)})
model.stratify_with(strat)
expected_flows = [
DeathFlow("d_S", C("S", {"location": "urban"}), 3),
DeathFlow("d_S", C("S", {"location": "rural"}), 3),
DeathFlow("d_I", C("I", {"location": "urban", "age": "young"}), 5, [Multiply(0.5)]),
DeathFlow("d_I", C("I", {"location": "urban", "age": "old"}), 5, [Multiply(2)]),
DeathFlow("d_I", C("I", {"location": "rural", "age": "young"}), 5, [Multiply(0.5)]),
DeathFlow("d_I", C("I", {"location": "rural", "age": "old"}), 5, [Multiply(2)]),
DeathFlow("d_R", C("R", {"age": "young"}), 7, [Multiply(0.5)]),
DeathFlow("d_R", C("R", {"age": "old"}), 7, [Multiply(2)]),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_add_exit_flows_post_stratification():
"""
Ensure user can add exit flows post stratification.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
# Apply partial stratification
strat = Stratification("location", ["urban", "rural"], ["S", "I"])
model.stratify_with(strat)
assert len(model._flows) == 0
model.add_death_flow("d_S", 3, "S")
model.add_death_flow("d_I", 5, "I")
model.add_death_flow("d_R", 7, "R")
expected_flows = [
DeathFlow("d_S", C("S", {"location": "urban"}), 3),
DeathFlow("d_S", C("S", {"location": "rural"}), 3),
DeathFlow("d_I", C("I", {"location": "urban"}), 5),
DeathFlow("d_I", C("I", {"location": "rural"}), 5),
DeathFlow("d_R", C("R"), 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_add_exit_flows_post_stratification__with_filter():
"""
Ensure user can add exit flows post stratification when a strata filter is applied
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
assert len(model._flows) == 0
# Apply partial stratification
strat = Stratification("location", ["urban", "rural"], ["S", "I"])
model.stratify_with(strat)
assert len(model._flows) == 0
model.add_death_flow("d_S", 3, "S", source_strata={"location": "rural"}, expected_flow_count=1)
model.add_death_flow("d_I", 5, "I", source_strata={"location": "rural"}, expected_flow_count=1)
# FIXME: Ask Matt, would it be better if this just crashed?
model.add_death_flow("d_R", 7, "R", source_strata={"location": "rural"}, expected_flow_count=0)
expected_flows = [
DeathFlow("d_S", C("S", {"location": "rural"}), 3),
DeathFlow("d_I", C("I", {"location": "rural"}), 5),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_source_and_dest_stratified():
"""
Ensure transition flows are stratified correctly when both the flow source and dest are stratified.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_infection_frequency_flow("infection", 0.03, "S", "I")
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
InfectionFrequencyFlow(
"infection", C("S"), C("I"), 0.03, model._get_infection_frequency_multiplier
),
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = Stratification("location", ["urban", "rural"], ["S", "I", "R"])
model.stratify_with(strat)
expected_flows = [
InfectionFrequencyFlow(
"infection",
C("S", {"location": "urban"}),
C("I", {"location": "urban"}),
0.03,
model._get_infection_frequency_multiplier,
),
InfectionFrequencyFlow(
"infection",
C("S", {"location": "rural"}),
C("I", {"location": "rural"}),
0.03,
model._get_infection_frequency_multiplier,
),
TransitionFlow(
"recovery", C("I", {"location": "urban"}), C("R", {"location": "urban"}), 1 / 7
),
TransitionFlow(
"recovery", C("I", {"location": "rural"}), C("R", {"location": "rural"}), 1 / 7
),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_source_only_stratified():
"""
Ensure transition flows are stratified correctly when only the flow source is stratified.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = Stratification("location", ["urban", "rural"], ["S", "I"])
model.stratify_with(strat)
expected_flows = [
TransitionFlow("recovery", C("I", {"location": "urban"}), C("R"), 1 / 7),
TransitionFlow("recovery", C("I", {"location": "rural"}), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_dest_only_stratified():
"""
Ensure transition flows are stratified correctly when only the flow destination is stratified.
Expect an person-conserving adjustment of 1/N to be applied to each flow - N being the number of new strata.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = Stratification("location", ["urban", "rural"], ["R"])
model.stratify_with(strat)
expected_flows = [
TransitionFlow("recovery", C("I"), C("R", {"location": "urban"}), 1 / 7, [Multiply(0.5)]),
TransitionFlow("recovery", C("I"), C("R", {"location": "rural"}), 1 / 7, [Multiply(0.5)]),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_dest_only_stratified__with_adjustments():
"""
Ensure transition flows are stratified correctly when only the flow destination is stratified.
Expect adjustments to override the automatic person-conserving adjustment.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = Stratification("location", ["urban", "rural"], ["R"])
strat.set_flow_adjustments("recovery", {"urban": Overwrite(0.7), "rural": Overwrite(0.1)})
model.stratify_with(strat)
expected_flows = [
TransitionFlow("recovery", C("I"), C("R", {"location": "urban"}), 1 / 7, [Overwrite(0.7)]),
TransitionFlow("recovery", C("I"), C("R", {"location": "rural"}), 1 / 7, [Overwrite(0.1)]),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_dest_only_stratified__with_strains():
"""
Ensure transition flows are stratified correctly when only the flow destination is stratified.
Expect the strain stratification to ignore the automatic person-conserving adjustment.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = StrainStratification("location", ["urban", "rural"], ["R"])
model.stratify_with(strat)
# No adjustments added
expected_flows = [
TransitionFlow("recovery", C("I"), C("R", {"location": "urban"}), 1 / 7),
TransitionFlow("recovery", C("I"), C("R", {"location": "rural"}), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
def test_stratify_transition_flows__with_dest_only_stratified__with_adjustments_and_strains():
"""
Ensure transition flows are stratified correctly when only the flow destination is stratified.
Expect adjustments to override the automatic person-conserving adjustment when using a strain strat.
"""
model = CompartmentalModel(
times=[0, 5], compartments=["S", "I", "R"], infectious_compartments=["I"]
)
model.add_transition_flow("recovery", 1 / 7, "I", "R")
expected_flows = [
TransitionFlow("recovery", C("I"), C("R"), 1 / 7),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
# Apply stratification
strat = StrainStratification("location", ["urban", "rural"], ["R"])
strat.set_flow_adjustments("recovery", {"urban": Overwrite(0.7), "rural": Overwrite(0.1)})
model.stratify_with(strat)
expected_flows = [
TransitionFlow("recovery", C("I"), C("R", {"location": "urban"}), 1 / 7, [Overwrite(0.7)]),
TransitionFlow("recovery", C("I"), C("R", {"location": "rural"}), 1 / 7, [Overwrite(0.1)]),
]
assert len(expected_flows) == len(model._flows)
assert all([a._is_equal(e) for e, a in zip(expected_flows, model._flows)])
| 38.543509
| 116
| 0.563862
| 3,216
| 27,019
| 4.541356
| 0.055659
| 0.077439
| 0.038275
| 0.043684
| 0.860733
| 0.850599
| 0.809243
| 0.786238
| 0.725573
| 0.698459
| 0
| 0.022568
| 0.258744
| 27,019
| 700
| 117
| 38.598571
| 0.706661
| 0.098301
| 0
| 0.708955
| 0
| 0
| 0.148353
| 0.035045
| 0
| 0
| 0
| 0.001429
| 0.136194
| 1
| 0.029851
| false
| 0
| 0.106343
| 0
| 0.136194
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ed998cc8824239f468eda71e38958d9f53abc409
| 10,567
|
py
|
Python
|
exapi/request_creators/binance/spot/trading/interface.py
|
astsu-dev/exapi
|
1ef39ccdd77e9ddb60ec6eaa16a2cc26e1ac3e12
|
[
"MIT"
] | null | null | null |
exapi/request_creators/binance/spot/trading/interface.py
|
astsu-dev/exapi
|
1ef39ccdd77e9ddb60ec6eaa16a2cc26e1ac3e12
|
[
"MIT"
] | null | null | null |
exapi/request_creators/binance/spot/trading/interface.py
|
astsu-dev/exapi
|
1ef39ccdd77e9ddb60ec6eaa16a2cc26e1ac3e12
|
[
"MIT"
] | null | null | null |
"""Has binance trading request creator interface."""
from typing import Optional, Protocol
from exapi.request_creators.request import Request
from exapi.typedefs.binance import (OrderResponseType, OrderSide,
OrderType, TimeInForce)
class IBinanceSpotTradingRequestCreator(Protocol):
"""Has methods for creating requests to binance spot trading api."""
def create_new_test_order_request(self, symbol: str,
side: OrderSide,
type: OrderType,
time_in_force: Optional[TimeInForce] = None,
quantity: Optional[str] = None,
quote_order_qty: Optional[str] = None,
price: Optional[str] = None,
new_client_order_id: Optional[str] = None,
stop_price: Optional[str] = None,
iceberg_qty: Optional[str] = None,
new_order_resp_type: Optional[OrderResponseType] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates new test order request.
Args:
symbol (str)
side (OrderSide)
type (OrderType)
time_in_force (Optional[TimeInForce], optional)
quantity (Optional[str], optional)
quote_order_qty (Optional[str], optional)
price (Optional[str], optional)
new_client_order_id (Optional[str], optional): A unique id among open orders.
Automatically generated if not sent.
stop_price (Optional[str], optional): Used with STOP_LOSS, STOP_LOSS_LIMIT,
TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
iceberg_qty (Optional[str], optional): Used with LIMIT, STOP_LOSS_LIMIT,
and TAKE_PROFIT_LIMIT to create an iceberg order.
new_order_resp_type ([type], optional): Set the response JSON. ACK, RESULT, or FULL;
MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_new_order_request(self, symbol: str,
side: OrderSide,
type: OrderType,
time_in_force: Optional[TimeInForce] = None,
quantity: Optional[str] = None,
quote_order_qty: Optional[str] = None,
price: Optional[str] = None,
new_client_order_id: Optional[str] = None,
stop_price: Optional[str] = None,
iceberg_qty: Optional[str] = None,
new_order_resp_type: Optional[OrderResponseType] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates new test order request.
Args:
symbol (str)
side (OrderSide)
type (OrderType)
time_in_force (Optional[TimeInForce], optional)
quantity (Optional[str], optional)
quote_order_qty (Optional[str], optional)
price (Optional[str], optional)
new_client_order_id (Optional[str], optional): A unique id among open orders.
Automatically generated if not sent.
stop_price (Optional[str], optional): Used with STOP_LOSS, STOP_LOSS_LIMIT,
TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
iceberg_qty (Optional[str], optional): Used with LIMIT, STOP_LOSS_LIMIT,
and TAKE_PROFIT_LIMIT to create an iceberg order.
new_order_resp_type ([type], optional): Set the response JSON. ACK, RESULT, or FULL;
MARKET and LIMIT order types default to FULL, all other orders default to ACK.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_cancel_order_request(self, symbol: str,
order_id: Optional[int] = None,
orig_client_order_id: Optional[str] = None,
new_client_order_id: Optional[str] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates cancel order request.
Args:
symbol (str)
order_id (Optional[int], optional)
orig_client_order_id (Optional[str], optional)
new_client_order_id (Optional[str], optional): Used to uniquely identify this cancel.
Automatically generated by default.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_cancel_orders_request(self, symbol: str,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates cancel all orders request.
Args:
symbol (str)
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_query_order_request(self, symbol: str,
order_id: Optional[int] = None,
orig_client_order_id: Optional[str] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates query order request.
Args:
symbol (str)
order_id (Optional[int], optional)
orig_client_order_id (Optional[str], optional)
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_get_current_open_orders_request(self, symbol: Optional[str] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates get current open orders request.
Args:
symbol (Optional[str], optional): If the symbol is not sent,
orders for all symbols will be returned in an array.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_get_all_orders_request(self, symbol: str,
order_id: Optional[int] = None,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
limit: Optional[int] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates get all orders request.
Args:
symbol (str)
order_id (Optional[int], optional)
start_time (Optional[int], optional)
end_time (Optional[int], optional)
limit (Optional[int], optional): Default 500; max 1000.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_get_account_info_request(self, recv_window: Optional[int] = None,
timestamp: Optional[int] = None,
) -> Request:
"""Creates get account info request.
Args:
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
def create_get_trades_request(self, symbol: str,
start_time: Optional[int] = None,
end_time: Optional[int] = None,
from_id: Optional[int] = None,
limit: Optional[int] = None,
recv_window: Optional[int] = None,
timestamp: Optional[int] = None
) -> Request:
"""Creates get account trades request.
Args:
symbol (str)
start_time (Optional[int], optional)
end_time (Optional[int], optional)
from_id (Optional[int], optional): trade id to fetch from.
Default gets most recent trades.
limit (Optional[int], optional): Default 500; max 1000.
recv_window (Optional[int], optional): The value cannot be greater than 60000.
timestamp (Optional[int]): if None current timestamp in milliseconds will be used.
Returns:
Request
"""
| 47.599099
| 97
| 0.515757
| 1,008
| 10,567
| 5.25496
| 0.121032
| 0.116292
| 0.07929
| 0.071361
| 0.880498
| 0.867095
| 0.854823
| 0.854823
| 0.854823
| 0.83821
| 0
| 0.009504
| 0.412511
| 10,567
| 221
| 98
| 47.81448
| 0.84375
| 0.449607
| 0
| 0.780822
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.123288
| false
| 0
| 0.041096
| 0
| 0.178082
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
edc1e7748970b8e3c1d9fed71e49e21edc0919d6
| 142
|
py
|
Python
|
models/backbone/__init__.py
|
briana-jin-zhang/spatial-segmentation
|
1e9716d71692eebd5794f9129b833315625661fc
|
[
"Apache-2.0"
] | 733
|
2020-04-05T20:59:38.000Z
|
2022-03-27T05:01:29.000Z
|
models/backbone/__init__.py
|
PooyaAlamirpour/deocclusion
|
17e4a93dad1369ceb4d91c4564a93c99af398c77
|
[
"Apache-2.0"
] | 44
|
2020-04-26T10:53:25.000Z
|
2022-01-13T02:29:29.000Z
|
models/backbone/__init__.py
|
PooyaAlamirpour/deocclusion
|
17e4a93dad1369ceb4d91c4564a93c99af398c77
|
[
"Apache-2.0"
] | 98
|
2020-04-07T10:43:37.000Z
|
2022-03-27T05:01:32.000Z
|
from .unet import *
from .vae import *
from .others import *
from .pconv_unet import *
from .discriminator import *
from .resnet_cls import *
| 20.285714
| 28
| 0.746479
| 20
| 142
| 5.2
| 0.45
| 0.480769
| 0.269231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.169014
| 142
| 6
| 29
| 23.666667
| 0.881356
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
edc2df061c731be177dc6d2b77dbcb804aae3f1d
| 166,328
|
py
|
Python
|
linkml_runtime/linkml_model/meta.py
|
dalito/linkml-runtime
|
192a33962aed06f727ffad1a697003ac6ec85c2c
|
[
"CC0-1.0"
] | null | null | null |
linkml_runtime/linkml_model/meta.py
|
dalito/linkml-runtime
|
192a33962aed06f727ffad1a697003ac6ec85c2c
|
[
"CC0-1.0"
] | null | null | null |
linkml_runtime/linkml_model/meta.py
|
dalito/linkml-runtime
|
192a33962aed06f727ffad1a697003ac6ec85c2c
|
[
"CC0-1.0"
] | null | null | null |
# Auto generated from meta.yaml by pythongen.py version: 0.9.0
# Generation date: 2022-04-30T01:16:48
# Schema: meta
#
# id: https://w3id.org/linkml/meta
# description: The metamodel for schemas defined using the Linked Data Modeling Language framework. For more
# information on LinkML, see [linkml.io](https://linkml.io) Core metaclasses: *
# [SchemaDefinition](https://w3id.org/linkml/SchemaDefinition) *
# [ClassDefinition](https://w3id.org/linkml/ClassDefinition) *
# [SlotDefinition](https://w3id.org/linkml/SlotDefinition) Every LinkML model instantiates
# SchemaDefinition, all classes in the model instantiate ClassDefinition, and so on Note that the
# LinkML metamodel instantiates itself. For a non-normative introduction to LinkML schemas, see the
# tutorial and schema guide on [linkml.io/linkml]. For canonical reference documentation on any
# metamodel construct, refer to the official URI for each construct, e.g.
# [https://w3id.org/linkml/is_a](https://w3id.org/linkml/is_a)
# license: https://creativecommons.org/publicdomain/zero/1.0/
import dataclasses
import sys
import re
from jsonasobj2 import JsonObj, as_dict
from typing import Optional, List, Union, Dict, ClassVar, Any
from dataclasses import dataclass
from linkml_runtime.utils.slot import Slot
from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode
from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int
from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs
from linkml_runtime.utils.formatutils import camelcase, underscore, sfx
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
from rdflib import Namespace, URIRef
from linkml_runtime.utils.curienamespace import CurieNamespace
from .annotations import Annotation, AnnotationTag
from .extensions import Extension, ExtensionTag
from .types import Boolean, Datetime, Integer, Ncname, String, Uri, Uriorcurie
from linkml_runtime.utils.metamodelcore import Bool, NCName, URI, URIorCURIE, XSDDateTime
metamodel_version = "1.7.0"
version = "2.0.0"
# Overwrite dataclasses _init_fn to add **kwargs in __init__
dataclasses._init_fn = dataclasses_init_fn_with_kwargs
# Namespaces
OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#')
BIBO = CurieNamespace('bibo', 'http://purl.org/ontology/bibo/')
DCTERMS = CurieNamespace('dcterms', 'http://purl.org/dc/terms/')
LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/')
OSLC = CurieNamespace('oslc', 'http://open-services.net/ns/core#')
OWL = CurieNamespace('owl', 'http://www.w3.org/2002/07/owl#')
PAV = CurieNamespace('pav', 'http://purl.org/pav/')
PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#')
QB = CurieNamespace('qb', 'http://purl.org/linked-data/cube#')
RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#')
SCHEMA = CurieNamespace('schema', 'http://schema.org/')
SH = CurieNamespace('sh', 'https://w3id.org/shacl/')
SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#')
SKOSXL = CurieNamespace('skosxl', 'http://www.w3.org/2008/05/skos-xl#')
SWRL = CurieNamespace('swrl', 'http://www.w3.org/2003/11/swrl#')
VANN = CurieNamespace('vann', 'https://vocab.org/vann/')
XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#')
DEFAULT_ = LINKML
# Types
# Class references
class ElementName(extended_str):
pass
class SchemaDefinitionName(NCName):
pass
class TypeDefinitionName(ElementName):
pass
class SubsetDefinitionName(ElementName):
pass
class DefinitionName(ElementName):
pass
class EnumDefinitionName(ElementName):
pass
class SlotDefinitionName(DefinitionName):
pass
class ClassDefinitionName(DefinitionName):
pass
class SettingSettingKey(NCName):
pass
class PrefixPrefixPrefix(NCName):
pass
class LocalNameLocalNameSource(NCName):
pass
class AltDescriptionSource(extended_str):
pass
class PermissibleValueText(extended_str):
pass
class UniqueKeyUniqueKeyName(extended_str):
pass
@dataclass
class CommonMetadata(YAMLRoot):
"""
Generic metadata shared across definitions
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.CommonMetadata
class_class_curie: ClassVar[str] = "linkml:CommonMetadata"
class_name: ClassVar[str] = "common_metadata"
class_model_uri: ClassVar[URIRef] = LINKML.CommonMetadata
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class Element(YAMLRoot):
"""
a named element in the model
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Element
class_class_curie: ClassVar[str] = "linkml:Element"
class_name: ClassVar[str] = "element"
class_model_uri: ClassVar[URIRef] = LINKML.Element
name: Union[str, ElementName] = None
id_prefixes: Optional[Union[Union[str, NCName], List[Union[str, NCName]]]] = empty_list()
definition_uri: Optional[Union[str, URIorCURIE]] = None
local_names: Optional[Union[Dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], List[Union[dict, "LocalName"]]]] = empty_dict()
conforms_to: Optional[str] = None
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, ElementName):
self.name = ElementName(self.name)
if not isinstance(self.id_prefixes, list):
self.id_prefixes = [self.id_prefixes] if self.id_prefixes is not None else []
self.id_prefixes = [v if isinstance(v, NCName) else NCName(v) for v in self.id_prefixes]
if self.definition_uri is not None and not isinstance(self.definition_uri, URIorCURIE):
self.definition_uri = URIorCURIE(self.definition_uri)
self._normalize_inlined_as_dict(slot_name="local_names", slot_type=LocalName, key_name="local_name_source", keyed=True)
if self.conforms_to is not None and not isinstance(self.conforms_to, str):
self.conforms_to = str(self.conforms_to)
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class SchemaDefinition(Element):
"""
a collection of subset, type, slot and class definitions
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.SchemaDefinition
class_class_curie: ClassVar[str] = "linkml:SchemaDefinition"
class_name: ClassVar[str] = "schema_definition"
class_model_uri: ClassVar[URIRef] = LINKML.SchemaDefinition
name: Union[str, SchemaDefinitionName] = None
id: Union[str, URI] = None
version: Optional[str] = None
imports: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
license: Optional[str] = None
prefixes: Optional[Union[Dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], List[Union[dict, "Prefix"]]]] = empty_dict()
emit_prefixes: Optional[Union[Union[str, NCName], List[Union[str, NCName]]]] = empty_list()
default_curi_maps: Optional[Union[str, List[str]]] = empty_list()
default_prefix: Optional[str] = None
default_range: Optional[Union[str, TypeDefinitionName]] = None
subsets: Optional[Union[Dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], List[Union[dict, "SubsetDefinition"]]]] = empty_dict()
types: Optional[Union[Dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], List[Union[dict, "TypeDefinition"]]]] = empty_dict()
enums: Optional[Union[Dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], List[Union[dict, "EnumDefinition"]]]] = empty_dict()
slots: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]] = empty_dict()
classes: Optional[Union[Dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], List[Union[dict, "ClassDefinition"]]]] = empty_dict()
metamodel_version: Optional[str] = None
source_file: Optional[str] = None
source_file_date: Optional[Union[str, XSDDateTime]] = None
source_file_size: Optional[int] = None
generation_date: Optional[Union[str, XSDDateTime]] = None
slot_names_unique: Optional[Union[bool, Bool]] = None
settings: Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]] = empty_dict()
categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
keywords: Optional[Union[str, List[str]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.default_prefix is None:
self.default_prefix = sfx(str(self.id))
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, SchemaDefinitionName):
self.name = SchemaDefinitionName(self.name)
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, URI):
self.id = URI(self.id)
if self.version is not None and not isinstance(self.version, str):
self.version = str(self.version)
if not isinstance(self.imports, list):
self.imports = [self.imports] if self.imports is not None else []
self.imports = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.imports]
if self.license is not None and not isinstance(self.license, str):
self.license = str(self.license)
self._normalize_inlined_as_dict(slot_name="prefixes", slot_type=Prefix, key_name="prefix_prefix", keyed=True)
if not isinstance(self.emit_prefixes, list):
self.emit_prefixes = [self.emit_prefixes] if self.emit_prefixes is not None else []
self.emit_prefixes = [v if isinstance(v, NCName) else NCName(v) for v in self.emit_prefixes]
if not isinstance(self.default_curi_maps, list):
self.default_curi_maps = [self.default_curi_maps] if self.default_curi_maps is not None else []
self.default_curi_maps = [v if isinstance(v, str) else str(v) for v in self.default_curi_maps]
if self.default_prefix is not None and not isinstance(self.default_prefix, str):
self.default_prefix = str(self.default_prefix)
if self.default_range is not None and not isinstance(self.default_range, TypeDefinitionName):
self.default_range = TypeDefinitionName(self.default_range)
self._normalize_inlined_as_dict(slot_name="subsets", slot_type=SubsetDefinition, key_name="name", keyed=True)
self._normalize_inlined_as_dict(slot_name="types", slot_type=TypeDefinition, key_name="name", keyed=True)
self._normalize_inlined_as_dict(slot_name="enums", slot_type=EnumDefinition, key_name="name", keyed=True)
self._normalize_inlined_as_dict(slot_name="slots", slot_type=SlotDefinition, key_name="name", keyed=True)
self._normalize_inlined_as_dict(slot_name="classes", slot_type=ClassDefinition, key_name="name", keyed=True)
if self.metamodel_version is not None and not isinstance(self.metamodel_version, str):
self.metamodel_version = str(self.metamodel_version)
if self.source_file is not None and not isinstance(self.source_file, str):
self.source_file = str(self.source_file)
if self.source_file_date is not None and not isinstance(self.source_file_date, XSDDateTime):
self.source_file_date = XSDDateTime(self.source_file_date)
if self.source_file_size is not None and not isinstance(self.source_file_size, int):
self.source_file_size = int(self.source_file_size)
if self.generation_date is not None and not isinstance(self.generation_date, XSDDateTime):
self.generation_date = XSDDateTime(self.generation_date)
if self.slot_names_unique is not None and not isinstance(self.slot_names_unique, Bool):
self.slot_names_unique = Bool(self.slot_names_unique)
self._normalize_inlined_as_dict(slot_name="settings", slot_type=Setting, key_name="setting_key", keyed=True)
if not isinstance(self.categories, list):
self.categories = [self.categories] if self.categories is not None else []
self.categories = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.categories]
if not isinstance(self.keywords, list):
self.keywords = [self.keywords] if self.keywords is not None else []
self.keywords = [v if isinstance(v, str) else str(v) for v in self.keywords]
super().__post_init__(**kwargs)
@dataclass
class AnonymousTypeExpression(YAMLRoot):
_inherited_slots: ClassVar[List[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"]
class_class_uri: ClassVar[URIRef] = LINKML.AnonymousTypeExpression
class_class_curie: ClassVar[str] = "linkml:AnonymousTypeExpression"
class_name: ClassVar[str] = "anonymous_type_expression"
class_model_uri: ClassVar[URIRef] = LINKML.AnonymousTypeExpression
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class TypeDefinition(Element):
"""
A data type definition.
"""
_inherited_slots: ClassVar[List[str]] = ["base", "uri", "repr", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"]
class_class_uri: ClassVar[URIRef] = LINKML.TypeDefinition
class_class_curie: ClassVar[str] = "linkml:TypeDefinition"
class_name: ClassVar[str] = "type_definition"
class_model_uri: ClassVar[URIRef] = LINKML.TypeDefinition
name: Union[str, TypeDefinitionName] = None
typeof: Optional[Union[str, TypeDefinitionName]] = None
base: Optional[str] = None
uri: Optional[Union[str, URIorCURIE]] = None
repr: Optional[str] = None
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
none_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list()
any_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list()
all_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, TypeDefinitionName):
self.name = TypeDefinitionName(self.name)
if self.typeof is not None and not isinstance(self.typeof, TypeDefinitionName):
self.typeof = TypeDefinitionName(self.typeof)
if self.base is not None and not isinstance(self.base, str):
self.base = str(self.base)
if self.uri is not None and not isinstance(self.uri, URIorCURIE):
self.uri = URIorCURIE(self.uri)
if self.repr is not None and not isinstance(self.repr, str):
self.repr = str(self.repr)
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class SubsetDefinition(Element):
"""
the name and description of a subset
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.SubsetDefinition
class_class_curie: ClassVar[str] = "linkml:SubsetDefinition"
class_name: ClassVar[str] = "subset_definition"
class_model_uri: ClassVar[URIRef] = LINKML.SubsetDefinition
name: Union[str, SubsetDefinitionName] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, SubsetDefinitionName):
self.name = SubsetDefinitionName(self.name)
super().__post_init__(**kwargs)
@dataclass
class Definition(Element):
"""
base class for definitions
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Definition
class_class_curie: ClassVar[str] = "linkml:Definition"
class_name: ClassVar[str] = "definition"
class_model_uri: ClassVar[URIRef] = LINKML.Definition
name: Union[str, DefinitionName] = None
is_a: Optional[Union[str, DefinitionName]] = None
abstract: Optional[Union[bool, Bool]] = None
mixin: Optional[Union[bool, Bool]] = None
mixins: Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]] = empty_list()
apply_to: Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]] = empty_list()
values_from: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
created_by: Optional[Union[str, URIorCURIE]] = None
created_on: Optional[Union[str, XSDDateTime]] = None
last_updated_on: Optional[Union[str, XSDDateTime]] = None
modified_by: Optional[Union[str, URIorCURIE]] = None
status: Optional[Union[str, URIorCURIE]] = None
string_serialization: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.is_a is not None and not isinstance(self.is_a, DefinitionName):
self.is_a = DefinitionName(self.is_a)
if self.abstract is not None and not isinstance(self.abstract, Bool):
self.abstract = Bool(self.abstract)
if self.mixin is not None and not isinstance(self.mixin, Bool):
self.mixin = Bool(self.mixin)
if not isinstance(self.mixins, list):
self.mixins = [self.mixins] if self.mixins is not None else []
self.mixins = [v if isinstance(v, DefinitionName) else DefinitionName(v) for v in self.mixins]
if not isinstance(self.apply_to, list):
self.apply_to = [self.apply_to] if self.apply_to is not None else []
self.apply_to = [v if isinstance(v, DefinitionName) else DefinitionName(v) for v in self.apply_to]
if not isinstance(self.values_from, list):
self.values_from = [self.values_from] if self.values_from is not None else []
self.values_from = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.values_from]
if self.created_by is not None and not isinstance(self.created_by, URIorCURIE):
self.created_by = URIorCURIE(self.created_by)
if self.created_on is not None and not isinstance(self.created_on, XSDDateTime):
self.created_on = XSDDateTime(self.created_on)
if self.last_updated_on is not None and not isinstance(self.last_updated_on, XSDDateTime):
self.last_updated_on = XSDDateTime(self.last_updated_on)
if self.modified_by is not None and not isinstance(self.modified_by, URIorCURIE):
self.modified_by = URIorCURIE(self.modified_by)
if self.status is not None and not isinstance(self.status, URIorCURIE):
self.status = URIorCURIE(self.status)
if self.string_serialization is not None and not isinstance(self.string_serialization, str):
self.string_serialization = str(self.string_serialization)
super().__post_init__(**kwargs)
@dataclass
class EnumDefinition(Element):
"""
List of values that constrain the range of a slot
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.EnumDefinition
class_class_curie: ClassVar[str] = "linkml:EnumDefinition"
class_name: ClassVar[str] = "enum_definition"
class_model_uri: ClassVar[URIRef] = LINKML.EnumDefinition
name: Union[str, EnumDefinitionName] = None
code_set: Optional[Union[str, URIorCURIE]] = None
code_set_tag: Optional[str] = None
code_set_version: Optional[str] = None
pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None
permissible_values: Optional[Union[Dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], List[Union[dict, "PermissibleValue"]]]] = empty_dict()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, EnumDefinitionName):
self.name = EnumDefinitionName(self.name)
if self.code_set is not None and not isinstance(self.code_set, URIorCURIE):
self.code_set = URIorCURIE(self.code_set)
if self.code_set_tag is not None and not isinstance(self.code_set_tag, str):
self.code_set_tag = str(self.code_set_tag)
if self.code_set_version is not None and not isinstance(self.code_set_version, str):
self.code_set_version = str(self.code_set_version)
if self.pv_formula is not None and not isinstance(self.pv_formula, PvFormulaOptions):
self.pv_formula = PvFormulaOptions(self.pv_formula)
self._normalize_inlined_as_dict(slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True)
super().__post_init__(**kwargs)
@dataclass
class StructuredAlias(YAMLRoot):
"""
object that contains meta data about a synonym or alias including where it came from (source) and its scope
(narrow, broad, etc.)
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = SKOSXL.Label
class_class_curie: ClassVar[str] = "skosxl:Label"
class_name: ClassVar[str] = "structured_alias"
class_model_uri: ClassVar[URIRef] = LINKML.StructuredAlias
literal_form: str = None
predicate: Optional[Union[str, "AliasPredicateEnum"]] = None
categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.literal_form):
self.MissingRequiredField("literal_form")
if not isinstance(self.literal_form, str):
self.literal_form = str(self.literal_form)
if self.predicate is not None and not isinstance(self.predicate, AliasPredicateEnum):
self.predicate = AliasPredicateEnum(self.predicate)
if not isinstance(self.categories, list):
self.categories = [self.categories] if self.categories is not None else []
self.categories = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.categories]
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
class Expression(YAMLRoot):
"""
general mixin for any class that can represent some form of expression
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Expression
class_class_curie: ClassVar[str] = "linkml:Expression"
class_name: ClassVar[str] = "expression"
class_model_uri: ClassVar[URIRef] = LINKML.Expression
@dataclass
class TypeExpression(Expression):
_inherited_slots: ClassVar[List[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"]
class_class_uri: ClassVar[URIRef] = LINKML.TypeExpression
class_class_curie: ClassVar[str] = "linkml:TypeExpression"
class_name: ClassVar[str] = "type_expression"
class_model_uri: ClassVar[URIRef] = LINKML.TypeExpression
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class AnonymousExpression(YAMLRoot):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.AnonymousExpression
class_class_curie: ClassVar[str] = "linkml:AnonymousExpression"
class_name: ClassVar[str] = "anonymous_expression"
class_model_uri: ClassVar[URIRef] = LINKML.AnonymousExpression
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class PathExpression(YAMLRoot):
"""
An expression that describes an abstract path from an object to another through a sequence of slot lookups
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.PathExpression
class_class_curie: ClassVar[str] = "linkml:PathExpression"
class_name: ClassVar[str] = "path_expression"
class_model_uri: ClassVar[URIRef] = LINKML.PathExpression
followed_by: Optional[Union[dict, "PathExpression"]] = None
none_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list()
any_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list()
reversed: Optional[Union[bool, Bool]] = None
traverse: Optional[Union[str, SlotDefinitionName]] = None
range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.followed_by is not None and not isinstance(self.followed_by, PathExpression):
self.followed_by = PathExpression(**as_dict(self.followed_by))
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.all_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.exactly_one_of]
if self.reversed is not None and not isinstance(self.reversed, Bool):
self.reversed = Bool(self.reversed)
if self.traverse is not None and not isinstance(self.traverse, SlotDefinitionName):
self.traverse = SlotDefinitionName(self.traverse)
if self.range_expression is not None and not isinstance(self.range_expression, AnonymousClassExpression):
self.range_expression = AnonymousClassExpression(**as_dict(self.range_expression))
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class SlotExpression(Expression):
"""
an expression that constrains the range of values a slot can take
"""
_inherited_slots: ClassVar[List[str]] = ["range", "required", "recommended", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "equals_expression", "minimum_cardinality", "maximum_cardinality"]
class_class_uri: ClassVar[URIRef] = LINKML.SlotExpression
class_class_curie: ClassVar[str] = "linkml:SlotExpression"
class_name: ClassVar[str] = "slot_expression"
class_model_uri: ClassVar[URIRef] = LINKML.SlotExpression
range: Optional[Union[str, ElementName]] = None
range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None
required: Optional[Union[bool, Bool]] = None
recommended: Optional[Union[bool, Bool]] = None
inlined: Optional[Union[bool, Bool]] = None
inlined_as_list: Optional[Union[bool, Bool]] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
equals_expression: Optional[str] = None
minimum_cardinality: Optional[int] = None
maximum_cardinality: Optional[int] = None
has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None
all_members: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]] = empty_dict()
none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.range is not None and not isinstance(self.range, ElementName):
self.range = ElementName(self.range)
if self.range_expression is not None and not isinstance(self.range_expression, AnonymousClassExpression):
self.range_expression = AnonymousClassExpression(**as_dict(self.range_expression))
if self.required is not None and not isinstance(self.required, Bool):
self.required = Bool(self.required)
if self.recommended is not None and not isinstance(self.recommended, Bool):
self.recommended = Bool(self.recommended)
if self.inlined is not None and not isinstance(self.inlined, Bool):
self.inlined = Bool(self.inlined)
if self.inlined_as_list is not None and not isinstance(self.inlined_as_list, Bool):
self.inlined_as_list = Bool(self.inlined_as_list)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.equals_expression is not None and not isinstance(self.equals_expression, str):
self.equals_expression = str(self.equals_expression)
if self.minimum_cardinality is not None and not isinstance(self.minimum_cardinality, int):
self.minimum_cardinality = int(self.minimum_cardinality)
if self.maximum_cardinality is not None and not isinstance(self.maximum_cardinality, int):
self.maximum_cardinality = int(self.maximum_cardinality)
if self.has_member is not None and not isinstance(self.has_member, AnonymousSlotExpression):
self.has_member = AnonymousSlotExpression(**as_dict(self.has_member))
self._normalize_inlined_as_dict(slot_name="all_members", slot_type=SlotDefinition, key_name="name", keyed=True)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class AnonymousSlotExpression(AnonymousExpression):
_inherited_slots: ClassVar[List[str]] = ["range", "required", "recommended", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "equals_expression", "minimum_cardinality", "maximum_cardinality"]
class_class_uri: ClassVar[URIRef] = LINKML.AnonymousSlotExpression
class_class_curie: ClassVar[str] = "linkml:AnonymousSlotExpression"
class_name: ClassVar[str] = "anonymous_slot_expression"
class_model_uri: ClassVar[URIRef] = LINKML.AnonymousSlotExpression
range: Optional[Union[str, ElementName]] = None
range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None
required: Optional[Union[bool, Bool]] = None
recommended: Optional[Union[bool, Bool]] = None
inlined: Optional[Union[bool, Bool]] = None
inlined_as_list: Optional[Union[bool, Bool]] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
equals_expression: Optional[str] = None
minimum_cardinality: Optional[int] = None
maximum_cardinality: Optional[int] = None
has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None
all_members: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]] = empty_dict()
none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.range is not None and not isinstance(self.range, ElementName):
self.range = ElementName(self.range)
if self.range_expression is not None and not isinstance(self.range_expression, AnonymousClassExpression):
self.range_expression = AnonymousClassExpression(**as_dict(self.range_expression))
if self.required is not None and not isinstance(self.required, Bool):
self.required = Bool(self.required)
if self.recommended is not None and not isinstance(self.recommended, Bool):
self.recommended = Bool(self.recommended)
if self.inlined is not None and not isinstance(self.inlined, Bool):
self.inlined = Bool(self.inlined)
if self.inlined_as_list is not None and not isinstance(self.inlined_as_list, Bool):
self.inlined_as_list = Bool(self.inlined_as_list)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.equals_expression is not None and not isinstance(self.equals_expression, str):
self.equals_expression = str(self.equals_expression)
if self.minimum_cardinality is not None and not isinstance(self.minimum_cardinality, int):
self.minimum_cardinality = int(self.minimum_cardinality)
if self.maximum_cardinality is not None and not isinstance(self.maximum_cardinality, int):
self.maximum_cardinality = int(self.maximum_cardinality)
if self.has_member is not None and not isinstance(self.has_member, AnonymousSlotExpression):
self.has_member = AnonymousSlotExpression(**as_dict(self.has_member))
self._normalize_inlined_as_dict(slot_name="all_members", slot_type=SlotDefinition, key_name="name", keyed=True)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class SlotDefinition(Definition):
"""
the definition of a property or a slot
"""
_inherited_slots: ClassVar[List[str]] = ["domain", "multivalued", "inherited", "readonly", "ifabsent", "list_elements_unique", "list_elements_ordered", "shared", "key", "identifier", "designates_type", "role", "relational_role", "range", "required", "recommended", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "equals_expression", "minimum_cardinality", "maximum_cardinality"]
class_class_uri: ClassVar[URIRef] = LINKML.SlotDefinition
class_class_curie: ClassVar[str] = "linkml:SlotDefinition"
class_name: ClassVar[str] = "slot_definition"
class_model_uri: ClassVar[URIRef] = LINKML.SlotDefinition
name: Union[str, SlotDefinitionName] = None
singular_name: Optional[str] = None
domain: Optional[Union[str, ClassDefinitionName]] = None
slot_uri: Optional[Union[str, URIorCURIE]] = None
multivalued: Optional[Union[bool, Bool]] = None
inherited: Optional[Union[bool, Bool]] = None
readonly: Optional[str] = None
ifabsent: Optional[str] = None
list_elements_unique: Optional[Union[bool, Bool]] = None
list_elements_ordered: Optional[Union[bool, Bool]] = None
shared: Optional[Union[bool, Bool]] = None
key: Optional[Union[bool, Bool]] = None
identifier: Optional[Union[bool, Bool]] = None
designates_type: Optional[Union[bool, Bool]] = None
alias: Optional[str] = None
owner: Optional[Union[str, DefinitionName]] = None
domain_of: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list()
subproperty_of: Optional[Union[str, SlotDefinitionName]] = None
symmetric: Optional[Union[bool, Bool]] = None
reflexive: Optional[Union[bool, Bool]] = None
locally_reflexive: Optional[Union[bool, Bool]] = None
irreflexive: Optional[Union[bool, Bool]] = None
asymmetric: Optional[Union[bool, Bool]] = None
transitive: Optional[Union[bool, Bool]] = None
inverse: Optional[Union[str, SlotDefinitionName]] = None
is_class_field: Optional[Union[bool, Bool]] = None
transitive_form_of: Optional[Union[str, SlotDefinitionName]] = None
reflexive_transitive_form_of: Optional[Union[str, SlotDefinitionName]] = None
role: Optional[str] = None
is_usage_slot: Optional[Union[bool, Bool]] = None
usage_slot_name: Optional[str] = None
relational_role: Optional[Union[str, "RelationalRoleEnum"]] = None
slot_group: Optional[Union[str, SlotDefinitionName]] = None
is_grouping_slot: Optional[Union[bool, Bool]] = None
path_rule: Optional[Union[dict, PathExpression]] = None
disjoint_with: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list()
children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None
is_a: Optional[Union[str, SlotDefinitionName]] = None
mixins: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list()
apply_to: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list()
range: Optional[Union[str, ElementName]] = None
range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None
required: Optional[Union[bool, Bool]] = None
recommended: Optional[Union[bool, Bool]] = None
inlined: Optional[Union[bool, Bool]] = None
inlined_as_list: Optional[Union[bool, Bool]] = None
minimum_value: Optional[int] = None
maximum_value: Optional[int] = None
pattern: Optional[str] = None
structured_pattern: Optional[Union[dict, "PatternExpression"]] = None
equals_string: Optional[str] = None
equals_string_in: Optional[Union[str, List[str]]] = empty_list()
equals_number: Optional[int] = None
equals_expression: Optional[str] = None
minimum_cardinality: Optional[int] = None
maximum_cardinality: Optional[int] = None
has_member: Optional[Union[dict, AnonymousSlotExpression]] = None
all_members: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]] = empty_dict()
none_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list()
any_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list()
all_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, SlotDefinitionName):
self.name = SlotDefinitionName(self.name)
if self.singular_name is not None and not isinstance(self.singular_name, str):
self.singular_name = str(self.singular_name)
if self.domain is not None and not isinstance(self.domain, ClassDefinitionName):
self.domain = ClassDefinitionName(self.domain)
if self.slot_uri is not None and not isinstance(self.slot_uri, URIorCURIE):
self.slot_uri = URIorCURIE(self.slot_uri)
if self.multivalued is not None and not isinstance(self.multivalued, Bool):
self.multivalued = Bool(self.multivalued)
if self.inherited is not None and not isinstance(self.inherited, Bool):
self.inherited = Bool(self.inherited)
if self.readonly is not None and not isinstance(self.readonly, str):
self.readonly = str(self.readonly)
if self.ifabsent is not None and not isinstance(self.ifabsent, str):
self.ifabsent = str(self.ifabsent)
if self.list_elements_unique is not None and not isinstance(self.list_elements_unique, Bool):
self.list_elements_unique = Bool(self.list_elements_unique)
if self.list_elements_ordered is not None and not isinstance(self.list_elements_ordered, Bool):
self.list_elements_ordered = Bool(self.list_elements_ordered)
if self.shared is not None and not isinstance(self.shared, Bool):
self.shared = Bool(self.shared)
if self.key is not None and not isinstance(self.key, Bool):
self.key = Bool(self.key)
if self.identifier is not None and not isinstance(self.identifier, Bool):
self.identifier = Bool(self.identifier)
if self.designates_type is not None and not isinstance(self.designates_type, Bool):
self.designates_type = Bool(self.designates_type)
if self.alias is not None and not isinstance(self.alias, str):
self.alias = str(self.alias)
if self.owner is not None and not isinstance(self.owner, DefinitionName):
self.owner = DefinitionName(self.owner)
if not isinstance(self.domain_of, list):
self.domain_of = [self.domain_of] if self.domain_of is not None else []
self.domain_of = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.domain_of]
if self.subproperty_of is not None and not isinstance(self.subproperty_of, SlotDefinitionName):
self.subproperty_of = SlotDefinitionName(self.subproperty_of)
if self.symmetric is not None and not isinstance(self.symmetric, Bool):
self.symmetric = Bool(self.symmetric)
if self.reflexive is not None and not isinstance(self.reflexive, Bool):
self.reflexive = Bool(self.reflexive)
if self.locally_reflexive is not None and not isinstance(self.locally_reflexive, Bool):
self.locally_reflexive = Bool(self.locally_reflexive)
if self.irreflexive is not None and not isinstance(self.irreflexive, Bool):
self.irreflexive = Bool(self.irreflexive)
if self.asymmetric is not None and not isinstance(self.asymmetric, Bool):
self.asymmetric = Bool(self.asymmetric)
if self.transitive is not None and not isinstance(self.transitive, Bool):
self.transitive = Bool(self.transitive)
if self.inverse is not None and not isinstance(self.inverse, SlotDefinitionName):
self.inverse = SlotDefinitionName(self.inverse)
if self.is_class_field is not None and not isinstance(self.is_class_field, Bool):
self.is_class_field = Bool(self.is_class_field)
if self.transitive_form_of is not None and not isinstance(self.transitive_form_of, SlotDefinitionName):
self.transitive_form_of = SlotDefinitionName(self.transitive_form_of)
if self.reflexive_transitive_form_of is not None and not isinstance(self.reflexive_transitive_form_of, SlotDefinitionName):
self.reflexive_transitive_form_of = SlotDefinitionName(self.reflexive_transitive_form_of)
if self.role is not None and not isinstance(self.role, str):
self.role = str(self.role)
if self.is_usage_slot is not None and not isinstance(self.is_usage_slot, Bool):
self.is_usage_slot = Bool(self.is_usage_slot)
if self.usage_slot_name is not None and not isinstance(self.usage_slot_name, str):
self.usage_slot_name = str(self.usage_slot_name)
if self.relational_role is not None and not isinstance(self.relational_role, RelationalRoleEnum):
self.relational_role = RelationalRoleEnum(self.relational_role)
if self.slot_group is not None and not isinstance(self.slot_group, SlotDefinitionName):
self.slot_group = SlotDefinitionName(self.slot_group)
if self.is_grouping_slot is not None and not isinstance(self.is_grouping_slot, Bool):
self.is_grouping_slot = Bool(self.is_grouping_slot)
if self.path_rule is not None and not isinstance(self.path_rule, PathExpression):
self.path_rule = PathExpression(**as_dict(self.path_rule))
if not isinstance(self.disjoint_with, list):
self.disjoint_with = [self.disjoint_with] if self.disjoint_with is not None else []
self.disjoint_with = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.disjoint_with]
if self.children_are_mutually_disjoint is not None and not isinstance(self.children_are_mutually_disjoint, Bool):
self.children_are_mutually_disjoint = Bool(self.children_are_mutually_disjoint)
if self.is_a is not None and not isinstance(self.is_a, SlotDefinitionName):
self.is_a = SlotDefinitionName(self.is_a)
if not isinstance(self.mixins, list):
self.mixins = [self.mixins] if self.mixins is not None else []
self.mixins = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.mixins]
if not isinstance(self.apply_to, list):
self.apply_to = [self.apply_to] if self.apply_to is not None else []
self.apply_to = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.apply_to]
if self.range is not None and not isinstance(self.range, ElementName):
self.range = ElementName(self.range)
if self.range_expression is not None and not isinstance(self.range_expression, AnonymousClassExpression):
self.range_expression = AnonymousClassExpression(**as_dict(self.range_expression))
if self.required is not None and not isinstance(self.required, Bool):
self.required = Bool(self.required)
if self.recommended is not None and not isinstance(self.recommended, Bool):
self.recommended = Bool(self.recommended)
if self.inlined is not None and not isinstance(self.inlined, Bool):
self.inlined = Bool(self.inlined)
if self.inlined_as_list is not None and not isinstance(self.inlined_as_list, Bool):
self.inlined_as_list = Bool(self.inlined_as_list)
if self.minimum_value is not None and not isinstance(self.minimum_value, int):
self.minimum_value = int(self.minimum_value)
if self.maximum_value is not None and not isinstance(self.maximum_value, int):
self.maximum_value = int(self.maximum_value)
if self.pattern is not None and not isinstance(self.pattern, str):
self.pattern = str(self.pattern)
if self.structured_pattern is not None and not isinstance(self.structured_pattern, PatternExpression):
self.structured_pattern = PatternExpression(**as_dict(self.structured_pattern))
if self.equals_string is not None and not isinstance(self.equals_string, str):
self.equals_string = str(self.equals_string)
if not isinstance(self.equals_string_in, list):
self.equals_string_in = [self.equals_string_in] if self.equals_string_in is not None else []
self.equals_string_in = [v if isinstance(v, str) else str(v) for v in self.equals_string_in]
if self.equals_number is not None and not isinstance(self.equals_number, int):
self.equals_number = int(self.equals_number)
if self.equals_expression is not None and not isinstance(self.equals_expression, str):
self.equals_expression = str(self.equals_expression)
if self.minimum_cardinality is not None and not isinstance(self.minimum_cardinality, int):
self.minimum_cardinality = int(self.minimum_cardinality)
if self.maximum_cardinality is not None and not isinstance(self.maximum_cardinality, int):
self.maximum_cardinality = int(self.maximum_cardinality)
if self.has_member is not None and not isinstance(self.has_member, AnonymousSlotExpression):
self.has_member = AnonymousSlotExpression(**as_dict(self.has_member))
self._normalize_inlined_as_dict(slot_name="all_members", slot_type=SlotDefinition, key_name="name", keyed=True)
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of]
super().__post_init__(**kwargs)
@dataclass
class ClassExpression(YAMLRoot):
"""
A boolean expression that can be used to dynamically determine membership of a class
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.ClassExpression
class_class_curie: ClassVar[str] = "linkml:ClassExpression"
class_name: ClassVar[str] = "class_expression"
class_model_uri: ClassVar[URIRef] = LINKML.ClassExpression
any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of]
self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True)
super().__post_init__(**kwargs)
@dataclass
class AnonymousClassExpression(AnonymousExpression):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.AnonymousClassExpression
class_class_curie: ClassVar[str] = "linkml:AnonymousClassExpression"
class_name: ClassVar[str] = "anonymous_class_expression"
class_model_uri: ClassVar[URIRef] = LINKML.AnonymousClassExpression
is_a: Optional[Union[str, DefinitionName]] = None
any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list()
slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.is_a is not None and not isinstance(self.is_a, DefinitionName):
self.is_a = DefinitionName(self.is_a)
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of]
self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True)
super().__post_init__(**kwargs)
@dataclass
class ClassDefinition(Definition):
"""
the definition of a class or interface
"""
_inherited_slots: ClassVar[List[str]] = ["defining_slots", "represents_relationship"]
class_class_uri: ClassVar[URIRef] = LINKML.ClassDefinition
class_class_curie: ClassVar[str] = "linkml:ClassDefinition"
class_name: ClassVar[str] = "class_definition"
class_model_uri: ClassVar[URIRef] = LINKML.ClassDefinition
name: Union[str, ClassDefinitionName] = None
slots: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list()
slot_usage: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict()
attributes: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict()
class_uri: Optional[Union[str, URIorCURIE]] = None
subclass_of: Optional[Union[str, URIorCURIE]] = None
union_of: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list()
defining_slots: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list()
tree_root: Optional[Union[bool, Bool]] = None
unique_keys: Optional[Union[Dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], List[Union[dict, "UniqueKey"]]]] = empty_dict()
rules: Optional[Union[Union[dict, "ClassRule"], List[Union[dict, "ClassRule"]]]] = empty_list()
classification_rules: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list()
slot_names_unique: Optional[Union[bool, Bool]] = None
represents_relationship: Optional[Union[bool, Bool]] = None
disjoint_with: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list()
children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None
is_a: Optional[Union[str, ClassDefinitionName]] = None
mixins: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list()
apply_to: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list()
any_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list()
exactly_one_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list()
none_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list()
all_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list()
slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.name):
self.MissingRequiredField("name")
if not isinstance(self.name, ClassDefinitionName):
self.name = ClassDefinitionName(self.name)
if not isinstance(self.slots, list):
self.slots = [self.slots] if self.slots is not None else []
self.slots = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.slots]
self._normalize_inlined_as_dict(slot_name="slot_usage", slot_type=SlotDefinition, key_name="name", keyed=True)
self._normalize_inlined_as_dict(slot_name="attributes", slot_type=SlotDefinition, key_name="name", keyed=True)
if self.class_uri is not None and not isinstance(self.class_uri, URIorCURIE):
self.class_uri = URIorCURIE(self.class_uri)
if self.subclass_of is not None and not isinstance(self.subclass_of, URIorCURIE):
self.subclass_of = URIorCURIE(self.subclass_of)
if not isinstance(self.union_of, list):
self.union_of = [self.union_of] if self.union_of is not None else []
self.union_of = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.union_of]
if not isinstance(self.defining_slots, list):
self.defining_slots = [self.defining_slots] if self.defining_slots is not None else []
self.defining_slots = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.defining_slots]
if self.tree_root is not None and not isinstance(self.tree_root, Bool):
self.tree_root = Bool(self.tree_root)
self._normalize_inlined_as_dict(slot_name="unique_keys", slot_type=UniqueKey, key_name="unique_key_name", keyed=True)
if not isinstance(self.rules, list):
self.rules = [self.rules] if self.rules is not None else []
self.rules = [v if isinstance(v, ClassRule) else ClassRule(**as_dict(v)) for v in self.rules]
if not isinstance(self.classification_rules, list):
self.classification_rules = [self.classification_rules] if self.classification_rules is not None else []
self.classification_rules = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.classification_rules]
if self.slot_names_unique is not None and not isinstance(self.slot_names_unique, Bool):
self.slot_names_unique = Bool(self.slot_names_unique)
if self.represents_relationship is not None and not isinstance(self.represents_relationship, Bool):
self.represents_relationship = Bool(self.represents_relationship)
if not isinstance(self.disjoint_with, list):
self.disjoint_with = [self.disjoint_with] if self.disjoint_with is not None else []
self.disjoint_with = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.disjoint_with]
if self.children_are_mutually_disjoint is not None and not isinstance(self.children_are_mutually_disjoint, Bool):
self.children_are_mutually_disjoint = Bool(self.children_are_mutually_disjoint)
if self.is_a is not None and not isinstance(self.is_a, ClassDefinitionName):
self.is_a = ClassDefinitionName(self.is_a)
if not isinstance(self.mixins, list):
self.mixins = [self.mixins] if self.mixins is not None else []
self.mixins = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.mixins]
if not isinstance(self.apply_to, list):
self.apply_to = [self.apply_to] if self.apply_to is not None else []
self.apply_to = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.apply_to]
if not isinstance(self.any_of, list):
self.any_of = [self.any_of] if self.any_of is not None else []
self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of]
if not isinstance(self.exactly_one_of, list):
self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else []
self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of]
if not isinstance(self.none_of, list):
self.none_of = [self.none_of] if self.none_of is not None else []
self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of]
if not isinstance(self.all_of, list):
self.all_of = [self.all_of] if self.all_of is not None else []
self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of]
self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True)
super().__post_init__(**kwargs)
class ClassLevelRule(YAMLRoot):
"""
A rule that is applied to classes
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.ClassLevelRule
class_class_curie: ClassVar[str] = "linkml:ClassLevelRule"
class_name: ClassVar[str] = "class_level_rule"
class_model_uri: ClassVar[URIRef] = LINKML.ClassLevelRule
@dataclass
class ClassRule(ClassLevelRule):
"""
A rule that applies to instances of a class
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.ClassRule
class_class_curie: ClassVar[str] = "linkml:ClassRule"
class_name: ClassVar[str] = "class_rule"
class_model_uri: ClassVar[URIRef] = LINKML.ClassRule
preconditions: Optional[Union[dict, AnonymousClassExpression]] = None
postconditions: Optional[Union[dict, AnonymousClassExpression]] = None
elseconditions: Optional[Union[dict, AnonymousClassExpression]] = None
bidirectional: Optional[Union[bool, Bool]] = None
open_world: Optional[Union[bool, Bool]] = None
rank: Optional[int] = None
deactivated: Optional[Union[bool, Bool]] = None
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.preconditions is not None and not isinstance(self.preconditions, AnonymousClassExpression):
self.preconditions = AnonymousClassExpression(**as_dict(self.preconditions))
if self.postconditions is not None and not isinstance(self.postconditions, AnonymousClassExpression):
self.postconditions = AnonymousClassExpression(**as_dict(self.postconditions))
if self.elseconditions is not None and not isinstance(self.elseconditions, AnonymousClassExpression):
self.elseconditions = AnonymousClassExpression(**as_dict(self.elseconditions))
if self.bidirectional is not None and not isinstance(self.bidirectional, Bool):
self.bidirectional = Bool(self.bidirectional)
if self.open_world is not None and not isinstance(self.open_world, Bool):
self.open_world = Bool(self.open_world)
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
if self.deactivated is not None and not isinstance(self.deactivated, Bool):
self.deactivated = Bool(self.deactivated)
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
super().__post_init__(**kwargs)
@dataclass
class PatternExpression(YAMLRoot):
"""
a regular expression pattern used to evaluate conformance of a string
"""
_inherited_slots: ClassVar[List[str]] = ["syntax"]
class_class_uri: ClassVar[URIRef] = LINKML.PatternExpression
class_class_curie: ClassVar[str] = "linkml:PatternExpression"
class_name: ClassVar[str] = "pattern_expression"
class_model_uri: ClassVar[URIRef] = LINKML.PatternExpression
syntax: Optional[str] = None
interpolated: Optional[Union[bool, Bool]] = None
partial_match: Optional[Union[bool, Bool]] = None
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.syntax is not None and not isinstance(self.syntax, str):
self.syntax = str(self.syntax)
if self.interpolated is not None and not isinstance(self.interpolated, Bool):
self.interpolated = Bool(self.interpolated)
if self.partial_match is not None and not isinstance(self.partial_match, Bool):
self.partial_match = Bool(self.partial_match)
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class ImportExpression(YAMLRoot):
"""
an expression describing an import
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.ImportExpression
class_class_curie: ClassVar[str] = "linkml:ImportExpression"
class_name: ClassVar[str] = "import_expression"
class_model_uri: ClassVar[URIRef] = LINKML.ImportExpression
import_from: Union[str, URIorCURIE] = None
import_as: Optional[Union[str, NCName]] = None
import_map: Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]] = empty_dict()
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.import_from):
self.MissingRequiredField("import_from")
if not isinstance(self.import_from, URIorCURIE):
self.import_from = URIorCURIE(self.import_from)
if self.import_as is not None and not isinstance(self.import_as, NCName):
self.import_as = NCName(self.import_as)
self._normalize_inlined_as_dict(slot_name="import_map", slot_type=Setting, key_name="setting_key", keyed=True)
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class Setting(YAMLRoot):
"""
assignment of a key to a value
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Setting
class_class_curie: ClassVar[str] = "linkml:Setting"
class_name: ClassVar[str] = "setting"
class_model_uri: ClassVar[URIRef] = LINKML.Setting
setting_key: Union[str, SettingSettingKey] = None
setting_value: str = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.setting_key):
self.MissingRequiredField("setting_key")
if not isinstance(self.setting_key, SettingSettingKey):
self.setting_key = SettingSettingKey(self.setting_key)
if self._is_empty(self.setting_value):
self.MissingRequiredField("setting_value")
if not isinstance(self.setting_value, str):
self.setting_value = str(self.setting_value)
super().__post_init__(**kwargs)
@dataclass
class Prefix(YAMLRoot):
"""
prefix URI tuple
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Prefix
class_class_curie: ClassVar[str] = "linkml:Prefix"
class_name: ClassVar[str] = "prefix"
class_model_uri: ClassVar[URIRef] = LINKML.Prefix
prefix_prefix: Union[str, PrefixPrefixPrefix] = None
prefix_reference: Union[str, URI] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.prefix_prefix):
self.MissingRequiredField("prefix_prefix")
if not isinstance(self.prefix_prefix, PrefixPrefixPrefix):
self.prefix_prefix = PrefixPrefixPrefix(self.prefix_prefix)
if self._is_empty(self.prefix_reference):
self.MissingRequiredField("prefix_reference")
if not isinstance(self.prefix_reference, URI):
self.prefix_reference = URI(self.prefix_reference)
super().__post_init__(**kwargs)
@dataclass
class LocalName(YAMLRoot):
"""
an attributed label
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.LocalName
class_class_curie: ClassVar[str] = "linkml:LocalName"
class_name: ClassVar[str] = "local_name"
class_model_uri: ClassVar[URIRef] = LINKML.LocalName
local_name_source: Union[str, LocalNameLocalNameSource] = None
local_name_value: str = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.local_name_source):
self.MissingRequiredField("local_name_source")
if not isinstance(self.local_name_source, LocalNameLocalNameSource):
self.local_name_source = LocalNameLocalNameSource(self.local_name_source)
if self._is_empty(self.local_name_value):
self.MissingRequiredField("local_name_value")
if not isinstance(self.local_name_value, str):
self.local_name_value = str(self.local_name_value)
super().__post_init__(**kwargs)
@dataclass
class Example(YAMLRoot):
"""
usage example and description
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.Example
class_class_curie: ClassVar[str] = "linkml:Example"
class_name: ClassVar[str] = "example"
class_model_uri: ClassVar[URIRef] = LINKML.Example
value: Optional[str] = None
description: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.value is not None and not isinstance(self.value, str):
self.value = str(self.value)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
super().__post_init__(**kwargs)
@dataclass
class AltDescription(YAMLRoot):
"""
an attributed description
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.AltDescription
class_class_curie: ClassVar[str] = "linkml:AltDescription"
class_name: ClassVar[str] = "alt_description"
class_model_uri: ClassVar[URIRef] = LINKML.AltDescription
source: Union[str, AltDescriptionSource] = None
description: str = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.source):
self.MissingRequiredField("source")
if not isinstance(self.source, AltDescriptionSource):
self.source = AltDescriptionSource(self.source)
if self._is_empty(self.description):
self.MissingRequiredField("description")
if not isinstance(self.description, str):
self.description = str(self.description)
super().__post_init__(**kwargs)
@dataclass
class PermissibleValue(YAMLRoot):
"""
a permissible value, accompanied by intended text and an optional mapping to a concept URI
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.PermissibleValue
class_class_curie: ClassVar[str] = "linkml:PermissibleValue"
class_name: ClassVar[str] = "permissible_value"
class_model_uri: ClassVar[URIRef] = LINKML.PermissibleValue
text: Union[str, PermissibleValueText] = None
description: Optional[str] = None
meaning: Optional[Union[str, URIorCURIE]] = None
is_a: Optional[Union[str, PermissibleValueText]] = None
mixins: Optional[Union[Union[str, PermissibleValueText], List[Union[str, PermissibleValueText]]]] = empty_list()
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], List[Union[dict, AltDescription]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, Example], List[Union[dict, Example]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.text):
self.MissingRequiredField("text")
if not isinstance(self.text, PermissibleValueText):
self.text = PermissibleValueText(self.text)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
if self.meaning is not None and not isinstance(self.meaning, URIorCURIE):
self.meaning = URIorCURIE(self.meaning)
if self.is_a is not None and not isinstance(self.is_a, PermissibleValueText):
self.is_a = PermissibleValueText(self.is_a)
if not isinstance(self.mixins, list):
self.mixins = [self.mixins] if self.mixins is not None else []
self.mixins = [v if isinstance(v, PermissibleValueText) else PermissibleValueText(v) for v in self.mixins]
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
@dataclass
class UniqueKey(YAMLRoot):
"""
a collection of slots whose values uniquely identify an instance of a class
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML.UniqueKey
class_class_curie: ClassVar[str] = "linkml:UniqueKey"
class_name: ClassVar[str] = "unique_key"
class_model_uri: ClassVar[URIRef] = LINKML.UniqueKey
unique_key_name: Union[str, UniqueKeyUniqueKeyName] = None
unique_key_slots: Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]] = None
extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict()
annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict()
description: Optional[str] = None
alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], List[Union[dict, AltDescription]]]] = empty_dict()
title: Optional[str] = None
deprecated: Optional[str] = None
todos: Optional[Union[str, List[str]]] = empty_list()
notes: Optional[Union[str, List[str]]] = empty_list()
comments: Optional[Union[str, List[str]]] = empty_list()
examples: Optional[Union[Union[dict, Example], List[Union[dict, Example]]]] = empty_list()
in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list()
from_schema: Optional[Union[str, URI]] = None
imported_from: Optional[str] = None
source: Optional[Union[str, URIorCURIE]] = None
in_language: Optional[str] = None
see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None
deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None
aliases: Optional[Union[str, List[str]]] = empty_list()
structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list()
mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list()
rank: Optional[int] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.unique_key_name):
self.MissingRequiredField("unique_key_name")
if not isinstance(self.unique_key_name, UniqueKeyUniqueKeyName):
self.unique_key_name = UniqueKeyUniqueKeyName(self.unique_key_name)
if self._is_empty(self.unique_key_slots):
self.MissingRequiredField("unique_key_slots")
if not isinstance(self.unique_key_slots, list):
self.unique_key_slots = [self.unique_key_slots] if self.unique_key_slots is not None else []
self.unique_key_slots = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.unique_key_slots]
self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True)
self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True)
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True)
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.deprecated is not None and not isinstance(self.deprecated, str):
self.deprecated = str(self.deprecated)
if not isinstance(self.todos, list):
self.todos = [self.todos] if self.todos is not None else []
self.todos = [v if isinstance(v, str) else str(v) for v in self.todos]
if not isinstance(self.notes, list):
self.notes = [self.notes] if self.notes is not None else []
self.notes = [v if isinstance(v, str) else str(v) for v in self.notes]
if not isinstance(self.comments, list):
self.comments = [self.comments] if self.comments is not None else []
self.comments = [v if isinstance(v, str) else str(v) for v in self.comments]
if not isinstance(self.examples, list):
self.examples = [self.examples] if self.examples is not None else []
self.examples = [v if isinstance(v, Example) else Example(**as_dict(v)) for v in self.examples]
if not isinstance(self.in_subset, list):
self.in_subset = [self.in_subset] if self.in_subset is not None else []
self.in_subset = [v if isinstance(v, SubsetDefinitionName) else SubsetDefinitionName(v) for v in self.in_subset]
if self.from_schema is not None and not isinstance(self.from_schema, URI):
self.from_schema = URI(self.from_schema)
if self.imported_from is not None and not isinstance(self.imported_from, str):
self.imported_from = str(self.imported_from)
if self.source is not None and not isinstance(self.source, URIorCURIE):
self.source = URIorCURIE(self.source)
if self.in_language is not None and not isinstance(self.in_language, str):
self.in_language = str(self.in_language)
if not isinstance(self.see_also, list):
self.see_also = [self.see_also] if self.see_also is not None else []
self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also]
if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE):
self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement)
if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE):
self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement)
if not isinstance(self.aliases, list):
self.aliases = [self.aliases] if self.aliases is not None else []
self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases]
self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False)
if not isinstance(self.mappings, list):
self.mappings = [self.mappings] if self.mappings is not None else []
self.mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.mappings]
if not isinstance(self.exact_mappings, list):
self.exact_mappings = [self.exact_mappings] if self.exact_mappings is not None else []
self.exact_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.exact_mappings]
if not isinstance(self.close_mappings, list):
self.close_mappings = [self.close_mappings] if self.close_mappings is not None else []
self.close_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.close_mappings]
if not isinstance(self.related_mappings, list):
self.related_mappings = [self.related_mappings] if self.related_mappings is not None else []
self.related_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.related_mappings]
if not isinstance(self.narrow_mappings, list):
self.narrow_mappings = [self.narrow_mappings] if self.narrow_mappings is not None else []
self.narrow_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.narrow_mappings]
if not isinstance(self.broad_mappings, list):
self.broad_mappings = [self.broad_mappings] if self.broad_mappings is not None else []
self.broad_mappings = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.broad_mappings]
if self.rank is not None and not isinstance(self.rank, int):
self.rank = int(self.rank)
super().__post_init__(**kwargs)
# Enumerations
class PvFormulaOptions(EnumDefinitionImpl):
"""
The formula used to generate the set of permissible values from the code_set values
"""
CODE = PermissibleValue(text="CODE",
description="The permissible values are the set of possible codes in the code set")
CURIE = PermissibleValue(text="CURIE",
description="The permissible values are the set of CURIES in the code set")
URI = PermissibleValue(text="URI",
description="The permissible values are the set of code URIs in the code set")
FHIR_CODING = PermissibleValue(text="FHIR_CODING",
description="The permissible values are the set of FHIR coding elements derived from the code set")
_defn = EnumDefinition(
name="PvFormulaOptions",
description="The formula used to generate the set of permissible values from the code_set values",
)
class PresenceEnum(EnumDefinitionImpl):
"""
enumeration of conditions by which a slot value should be set
"""
UNCOMMITTED = PermissibleValue(text="UNCOMMITTED")
PRESENT = PermissibleValue(text="PRESENT")
ABSENT = PermissibleValue(text="ABSENT")
_defn = EnumDefinition(
name="PresenceEnum",
description="enumeration of conditions by which a slot value should be set",
)
class RelationalRoleEnum(EnumDefinitionImpl):
"""
enumeration of roles a slot on a relationship class can play
"""
SUBJECT = PermissibleValue(text="SUBJECT",
description="a slot with this role connects a relationship to its subject/source node",
meaning=RDF.subject)
OBJECT = PermissibleValue(text="OBJECT",
description="a slot with this role connects a relationship to its object/target node",
meaning=RDF.object)
PREDICATE = PermissibleValue(text="PREDICATE",
description="a slot with this role connects a relationship to its predicate/property",
meaning=RDF.predicate)
NODE = PermissibleValue(text="NODE",
description="a slot with this role connects a symmetric relationship to a node that represents either subject or object node")
OTHER_ROLE = PermissibleValue(text="OTHER_ROLE",
description="a slot with this role connects a relationship to a node that is not subject/object/predicate")
_defn = EnumDefinition(
name="RelationalRoleEnum",
description="enumeration of roles a slot on a relationship class can play",
)
class AliasPredicateEnum(EnumDefinitionImpl):
EXACT_SYNONYM = PermissibleValue(text="EXACT_SYNONYM",
meaning=SKOS.exactMatch)
RELATED_SYNONYM = PermissibleValue(text="RELATED_SYNONYM",
meaning=SKOS.relatedMatch)
BROAD_SYNONYM = PermissibleValue(text="BROAD_SYNONYM",
meaning=SKOS.broaderMatch)
NARROW_SYNONYM = PermissibleValue(text="NARROW_SYNONYM",
meaning=SKOS.narrowerMatch)
_defn = EnumDefinition(
name="AliasPredicateEnum",
)
# Slots
| 55.313602
| 486
| 0.707013
| 21,782
| 166,328
| 5.221835
| 0.022358
| 0.025268
| 0.071293
| 0.027114
| 0.887069
| 0.841536
| 0.815627
| 0.775079
| 0.759078
| 0.746154
| 0
| 0.000642
| 0.185309
| 166,328
| 3,006
| 487
| 55.332003
| 0.838745
| 0.016455
| 0
| 0.672803
| 1
| 0
| 0.045524
| 0.011475
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012885
| false
| 0.006443
| 0.030833
| 0
| 0.390244
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
edd14463158797087f840b928eb7808921ac770c
| 8,259
|
py
|
Python
|
website/src/comments/views.py
|
iamcholo/videoplatform
|
72dd1db73e1c940e5992dacbb63feb8fc11394e3
|
[
"Apache-2.0"
] | null | null | null |
website/src/comments/views.py
|
iamcholo/videoplatform
|
72dd1db73e1c940e5992dacbb63feb8fc11394e3
|
[
"Apache-2.0"
] | 9
|
2020-06-05T19:18:35.000Z
|
2022-03-11T23:30:50.000Z
|
website/src/comments/views.py
|
iamcholo/videoplatform
|
72dd1db73e1c940e5992dacbb63feb8fc11394e3
|
[
"Apache-2.0"
] | null | null | null |
import json
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.utils import timezone
from utilities.paginator import paginator
from utilities.network import get_client_ip
from django.shortcuts import get_object_or_404
from comments.forms import CommentsModelForm
from user_site.decorators import login_required
from posts.models import PostItem
from comments.models import Comments
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
"""
implementar google capcha
"""
def post_comment_ajax(request, id, parent=None):
context = {'success': False,'comment':{}}
post = get_object_or_404(PostItem, pk=int(id))
if request.user.is_authenticated() or request.user_site.is_authenticated() :
ip = get_client_ip(request)
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
if request.method == "POST":
x = request.POST
form = CommentsModelForm(
autor=autor,
ip=ip,
parent=parent,
target=post,
data=x
)
if form.is_valid():
m = form.save()
context['success'] = True
context['comment'] = {
'logo': autor.get_logo(64,64),
'message': m.comment,
'publish_date': m.created.strftime("%Y-%m-%d %H:%M:%S"),
'modify_date': m.modified.strftime("%Y-%m-%d %H:%M:%S"),
}
else:
messages.add_message(request, messages.WARNING, _('AN_ERROR_OCURRED_LABEL'))
return HttpResponse(json.dumps(context), content_type="application/json")
def post_comment(request, id, parent=None):
redirect_to = request.REQUEST.get('next', '')
post = get_object_or_404(PostItem, pk=int(id))
if request.user.is_authenticated() or request.user_site.is_authenticated() :
ip = get_client_ip(request)
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
if request.method == "POST":
x = request.POST
form = CommentsModelForm(
autor=autor,
ip=ip,
parent=parent,
target=post,
data=x
)
if form.is_valid():
m = form.save()
else:
messages.add_message(request, messages.WARNING, _('AN_ERROR_OCURRED_LABEL'))
return HttpResponseRedirect(redirect_to)
def edit_post_comment_ajax(request, id, post_id):
context = {'success': False,'comment':{}}
if request.user.is_authenticated() or request.user_site.is_authenticated() :
ip = get_client_ip(request)
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
model = ContentType.objects.get_for_model(autor)
comment = get_object_or_404(
Comments,
pk=int(id),
content_type=model.model_class(),
autor_object_id=model.id,
target__id=int(post_id)
)
if request.method == "POST":
x = request.POST
form = CommentsModelForm(
data=x,
ip=ip,
instance=comment
)
if form.is_valid():
m = form.save()
context['success'] = True
context['comment'] = {
'logo': autor.get_logo(64,64),
'message': m.comment,
'publish_date': m.created.strftime("%Y-%m-%d %H:%M:%S"),
'modify_date': m.modified.strftime("%Y-%m-%d %H:%M:%S"),
}
return HttpResponse(json.dumps(context), content_type="application/json")
def edit_post_comment(request, id, post_id):
redirect_to = request.REQUEST.get('next', '')
if request.user.is_authenticated() or request.user_site.is_authenticated() :
ip = get_client_ip(request)
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
model = ContentType.objects.get_for_model(autor)
comment = get_object_or_404(
Comments,
pk=int(id),
content_type=model.model_class(),
autor_object_id=model.id,
target__id=int(post_id)
)
if request.method == "POST":
x = request.POST
form = CommentsModelForm(
data=x,
ip=ip,
instance=comment
)
if form.is_valid():
m = form.save()
if request.method == "POST":
if form.is_valid():
m = form.save()
return HttpResponseRedirect(redirect_to)
def delete_post_comment_ajax(request, id, post_id):
context = {'success': False}
if request.user.is_authenticated() or request.user_site.is_authenticated():
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
model = ContentType.objects.get_for_model(autor)
comment = get_object_or_404(
Comments,
pk=int(id),
content_type=model.model_class(),
autor_object_id=model.id,
target__id=int(post_id)
)
context['success'] = True
return HttpResponse(json.dumps(context), content_type="application/json")
def delete_post_comment(request, id, post_id):
redirect_to = request.REQUEST.get('next', '')
if request.user.is_authenticated() or request.user_site.is_authenticated():
if request.user.is_authenticated():
autor = request.user
else:
autor = request.user_site
model = ContentType.objects.get_for_model(autor)
comment = get_object_or_404(
Comments,
pk=int(id),
content_type=model.model_class(),
autor_object_id=model.id,
target__id=int(post_id)
)
return HttpResponseRedirect(redirect_to)
def get_comments_ajax(request, id, page=1):
post = get_object_or_404(PostItem, pk=int(id))
context = {'comments':[]}
for comment in paginator(
page,
Comments.objects.filter(target=post,status='published')
):
c = {
'logo': comment.autor.get_logo(64,64),
'message': comment.comment,
'publish_date': comment.created.strftime("%Y-%m-%d %H:%M:%S"),
'modify_date': comment.modified.strftime("%Y-%m-%d %H:%M:%S"),
'level': comment.level,
}
context['comments'].append(c)
return HttpResponse(json.dumps(context), content_type="application/json")
def get_comments(request, id, page=1):
post = get_object_or_404(PostItem, pk=int(id))
context = {'comments':[]}
for comment in paginator(
page,
Comments.objects.filter(target=post,status='published')
):
c = {
'logo': comment.autor.get_logo(64,64),
'message': comment.comment,
'publish_date': comment.created.strftime("%Y-%m-%d %H:%M:%S"),
'modify_date': comment.modified.strftime("%Y-%m-%d %H:%M:%S"),
}
context['comments'].append(c)
template_name = [
'modules/comments/%s-post-%d.html' % (post.post_type, post.id),
'modules/comments/%s-post-%s.html' % (post.post_type, post.slug),
'modules/comments/%s-post.html' % post.post_type,
'modules/comments/comments.html'
]
return TemplateResponse(request, template_name, context)
| 35.294872
| 93
| 0.550188
| 892
| 8,259
| 4.904709
| 0.131166
| 0.075429
| 0.035657
| 0.041143
| 0.800457
| 0.760457
| 0.753371
| 0.748343
| 0.748343
| 0.748343
| 0
| 0.00823
| 0.337934
| 8,259
| 234
| 94
| 35.294872
| 0.79188
| 0
| 0
| 0.787879
| 0
| 0
| 0.082603
| 0.020901
| 0
| 0
| 0
| 0
| 0
| 1
| 0.040404
| false
| 0
| 0.065657
| 0
| 0.146465
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ede96fdd87c07e44a88666b2273e4fee72cf6cb2
| 632
|
py
|
Python
|
Introducao-Python/ex113.py
|
reglabel/Estudos
|
b989e0287aa69756cfd4bbc7291860b6ce053a6c
|
[
"MIT"
] | null | null | null |
Introducao-Python/ex113.py
|
reglabel/Estudos
|
b989e0287aa69756cfd4bbc7291860b6ce053a6c
|
[
"MIT"
] | null | null | null |
Introducao-Python/ex113.py
|
reglabel/Estudos
|
b989e0287aa69756cfd4bbc7291860b6ce053a6c
|
[
"MIT"
] | null | null | null |
def leiaInt(msg=''):
while True:
try:
valor = int(input(msg))
except KeyboardInterrupt:
print(f"\033[31mO usuário preferiu não digitar esse número.\033[m")
return 0
except (ValueError, TypeError):
print(f"\033[31mERRO!Digite um número inteiro válido\033[m")
continue
else:
return valor
def leiaFloat(msg=''):
while True:
try:
valor = float(input(msg))
except KeyboardInterrupt:
print(f"\033[31mO usuário preferiu não digitar esse número.\033[m")
return 0
except (ValueError, TypeError):
print(f"\033[31mERRO!Digite um número inteiro válido\033[m")
continue
else:
return valor
| 23.407407
| 70
| 0.696203
| 88
| 632
| 5
| 0.397727
| 0.054545
| 0.081818
| 0.068182
| 0.931818
| 0.840909
| 0.840909
| 0.840909
| 0.840909
| 0.840909
| 0
| 0.066148
| 0.186709
| 632
| 26
| 71
| 24.307692
| 0.789883
| 0
| 0
| 0.833333
| 0
| 0
| 0.338608
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.083333
| false
| 0
| 0
| 0
| 0.25
| 0.166667
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b661a6e1f344b1233755303f50ad9a6aaaa06f84
| 12,829
|
py
|
Python
|
dual_encoder/layer/dense.py
|
stevezheng23/dual_encoder_tf
|
953f3aea507f265ce21319d99fd3e9f9d4c06bec
|
[
"Apache-2.0"
] | 1
|
2019-03-20T03:25:45.000Z
|
2019-03-20T03:25:45.000Z
|
dual_encoder/layer/dense.py
|
stevezheng23/dual_encoder_tf
|
953f3aea507f265ce21319d99fd3e9f9d4c06bec
|
[
"Apache-2.0"
] | null | null | null |
dual_encoder/layer/dense.py
|
stevezheng23/dual_encoder_tf
|
953f3aea507f265ce21319d99fd3e9f9d4c06bec
|
[
"Apache-2.0"
] | 1
|
2021-09-30T17:07:24.000Z
|
2021-09-30T17:07:24.000Z
|
import numpy as np
import tensorflow as tf
from util.default_util import *
from util.dual_encoder_util import *
from layer.basic import *
__all__ = ["Dense", "DoubleDense", "StackedDense", "StackedDoubleDense"]
class Dense(object):
"""dense layer"""
def __init__(self,
unit_dim,
activation,
dropout,
layer_dropout=0.0,
layer_norm=False,
residual_connect=False,
use_bias=False,
num_gpus=1,
default_gpu_id=0,
regularizer=None,
random_seed=0,
trainable=True,
scope="dense"):
"""initialize dense layer"""
self.unit_dim = unit_dim
self.activation = activation
self.dropout = dropout
self.layer_dropout = layer_dropout
self.layer_norm = layer_norm
self.residual_connect = residual_connect
self.use_bias = use_bias
self.regularizer = regularizer
self.random_seed = random_seed
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, num_gpus)
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
weight_initializer = create_variable_initializer("glorot_uniform", self.random_seed)
bias_initializer = create_variable_initializer("zero")
self.dense_layer = tf.layers.Dense(units=self.unit_dim, activation=None, use_bias=self.use_bias,
kernel_initializer=weight_initializer, bias_initializer=bias_initializer,
kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable)
self.dense_activation = create_activation_function(self.activation)
self.dropout_layer = Dropout(rate=self.dropout, num_gpus=num_gpus,
default_gpu_id=default_gpu_id, random_seed=self.random_seed)
if self.layer_norm == True:
self.norm_layer = LayerNorm(layer_dim=self.unit_dim,
num_gpus=num_gpus, default_gpu_id=default_gpu_id, trainable=self.trainable)
def __call__(self,
input_data,
input_mask):
"""call dense layer"""
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
input_dense = input_data
input_dense_mask = input_mask
if self.layer_norm == True:
input_dense, input_dense_mask = self.norm_layer(input_dense, input_dense_mask)
input_dense = self.dense_layer(input_dense)
if self.dense_activation != None:
input_dense = self.dense_activation(input_dense)
input_dense, input_dense_mask = self.dropout_layer(input_dense, input_dense_mask)
if self.residual_connect == True:
output_dense, output_mask = tf.cond(tf.random_uniform([]) < self.layer_dropout,
lambda: (input_data, input_mask),
lambda: (input_dense + input_data, input_mask))
else:
output_dense = input_dense
output_mask = input_mask
return output_dense, output_mask
class DoubleDense(object):
"""double-dense layer"""
def __init__(self,
unit_dim,
inner_scale,
activation,
dropout,
layer_dropout=0.0,
layer_norm=False,
residual_connect=False,
use_bias=False,
num_gpus=1,
default_gpu_id=0,
regularizer=None,
random_seed=0,
trainable=True,
scope="double_dense"):
"""initialize double-dense layer"""
self.unit_dim = unit_dim
self.inner_scale = inner_scale
self.activation = activation
self.dropout = dropout
self.layer_dropout = layer_dropout
self.layer_norm = layer_norm
self.residual_connect = residual_connect
self.use_bias = use_bias
self.regularizer = regularizer
self.random_seed = random_seed
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, num_gpus)
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
weight_initializer = create_variable_initializer("glorot_uniform", self.random_seed)
bias_initializer = create_variable_initializer("zero")
self.inner_dense_layer = tf.layers.Dense(units=self.unit_dim * self.inner_scale, activation=None, use_bias=self.use_bias,
kernel_initializer=weight_initializer, bias_initializer=bias_initializer,
kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable)
self.outer_dense_layer = tf.layers.Dense(units=self.unit_dim, activation=None, use_bias=self.use_bias,
kernel_initializer=weight_initializer, bias_initializer=bias_initializer,
kernel_regularizer=self.regularizer, bias_regularizer=self.regularizer, trainable=self.trainable)
self.dense_activation = create_activation_function(self.activation)
self.dropout_layer = Dropout(rate=self.dropout, num_gpus=num_gpus,
default_gpu_id=default_gpu_id, random_seed=self.random_seed)
if self.layer_norm == True:
self.norm_layer = LayerNorm(layer_dim=self.unit_dim,
num_gpus=num_gpus, default_gpu_id=default_gpu_id, trainable=self.trainable)
def __call__(self,
input_data,
input_mask):
"""call double-dense layer"""
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
input_dense = input_data
input_dense_mask = input_mask
if self.layer_norm == True:
input_dense, input_dense_mask = self.norm_layer(input_dense, input_dense_mask)
input_dense = self.inner_dense_layer(input_dense)
if self.dense_activation != None:
input_dense = self.dense_activation(input_dense)
input_dense = self.outer_dense_layer(input_dense)
input_dense, input_dense_mask = self.dropout_layer(input_dense, input_dense_mask)
if self.residual_connect == True:
output_dense, output_mask = tf.cond(tf.random_uniform([]) < self.layer_dropout,
lambda: (input_data, input_mask),
lambda: (input_dense + input_data, input_mask))
else:
output_dense = input_dense
output_mask = input_mask
return output_dense, output_mask
class StackedDense(object):
"""stacked dense layer"""
def __init__(self,
num_layer,
unit_dim,
activation,
dropout,
layer_dropout=None,
layer_norm=False,
residual_connect=False,
use_bias=False,
num_gpus=1,
default_gpu_id=0,
regularizer=None,
random_seed=0,
trainable=True,
scope="stacked_dense"):
"""initialize stacked dense layer"""
self.num_layer = num_layer
self.unit_dim = unit_dim
self.activation = activation
self.dropout = dropout
self.layer_dropout = layer_dropout
self.layer_norm = layer_norm
self.residual_connect = residual_connect
self.use_bias = use_bias
self.num_gpus = num_gpus
self.default_gpu_id = default_gpu_id
self.regularizer = regularizer
self.random_seed = random_seed
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, num_gpus)
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
self.dense_layer_list = []
for i in range(self.num_layer):
layer_scope = "layer_{0}".format(i)
sublayer_dropout = self.dropout[i] if self.dropout != None else 0.0
sublayer_layer_dropout = self.layer_dropout[i] if self.layer_dropout != None else 0.0
dense_layer = Dense(unit_dim=self.unit_dim, activation=self.activation,
dropout=sublayer_dropout, layer_dropout=sublayer_layer_dropout, layer_norm=self.layer_norm,
residual_connect=self.residual_connect, use_bias=self.use_bias, num_gpus=self.num_gpus,
default_gpu_id=self.default_gpu_id, regularizer=self.regularizer, random_seed=self.random_seed,
trainable=self.trainable, scope=layer_scope)
self.dense_layer_list.append(dense_layer)
def __call__(self,
input_data,
input_mask):
"""call stacked dense layer"""
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
input_dense = input_data
input_dense_mask = input_mask
for dense_layer in self.dense_layer_list:
input_dense, input_dense_mask = dense_layer(input_dense, input_dense_mask)
output_dense = input_dense
output_mask = input_dense_mask
return output_dense, output_mask
class StackedDoubleDense(object):
"""stacked double-dense layer"""
def __init__(self,
num_layer,
unit_dim,
inner_scale,
activation,
dropout,
layer_dropout=None,
layer_norm=False,
residual_connect=False,
use_bias=False,
num_gpus=1,
default_gpu_id=0,
regularizer=None,
random_seed=0,
trainable=True,
scope="stacked_double_dense"):
"""initialize stacked double-dense layer"""
self.num_layer = num_layer
self.unit_dim = unit_dim
self.inner_scale = inner_scale
self.activation = activation
self.dropout = dropout
self.layer_dropout = layer_dropout
self.layer_norm = layer_norm
self.residual_connect = residual_connect
self.use_bias = use_bias
self.num_gpus = num_gpus
self.default_gpu_id = default_gpu_id
self.regularizer = regularizer
self.random_seed = random_seed
self.trainable = trainable
self.scope = scope
self.device_spec = get_device_spec(default_gpu_id, num_gpus)
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
self.dense_layer_list = []
for i in range(self.num_layer):
layer_scope = "layer_{0}".format(i)
sublayer_dropout = self.dropout[i] if self.dropout != None else 0.0
sublayer_layer_dropout = self.layer_dropout[i] if self.layer_dropout != None else 0.0
dense_layer = DoubleDense(unit_dim=self.unit_dim, inner_scale=self.inner_scale, activation=self.activation,
dropout=sublayer_dropout, layer_dropout=sublayer_layer_dropout, layer_norm=self.layer_norm,
residual_connect=self.residual_connect, use_bias=self.use_bias, num_gpus=self.num_gpus,
default_gpu_id=self.default_gpu_id, regularizer=self.regularizer, random_seed=self.random_seed,
trainable=self.trainable, scope=layer_scope)
self.dense_layer_list.append(dense_layer)
def __call__(self,
input_data,
input_mask):
"""call stacked double-dense layer"""
with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.device(self.device_spec):
input_dense = input_data
input_dense_mask = input_mask
for dense_layer in self.dense_layer_list:
input_dense, input_dense_mask = dense_layer(input_dense, input_dense_mask)
output_dense = input_dense
output_mask = input_dense_mask
return output_dense, output_mask
| 43.784983
| 133
| 0.603788
| 1,439
| 12,829
| 5.030577
| 0.061849
| 0.06907
| 0.039785
| 0.041442
| 0.944882
| 0.936593
| 0.933554
| 0.926095
| 0.920984
| 0.90565
| 0
| 0.00299
| 0.322083
| 12,829
| 292
| 134
| 43.934932
| 0.829366
| 0.023151
| 0
| 0.908333
| 0
| 0
| 0.012028
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.033333
| false
| 0
| 0.020833
| 0
| 0.0875
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b695a669b88f5fd037157b9f5da2b1251b083825
| 168
|
py
|
Python
|
gurtel/timezone.py
|
oddbird/gurtel
|
6400ae0e65618b6477ae5ae4791ac618c8112b7a
|
[
"BSD-3-Clause"
] | null | null | null |
gurtel/timezone.py
|
oddbird/gurtel
|
6400ae0e65618b6477ae5ae4791ac618c8112b7a
|
[
"BSD-3-Clause"
] | null | null | null |
gurtel/timezone.py
|
oddbird/gurtel
|
6400ae0e65618b6477ae5ae4791ac618c8112b7a
|
[
"BSD-3-Clause"
] | null | null | null |
from datetime import datetime
import pytz
def now():
"""Return timezone-aware current datetime, in UTC."""
return datetime.utcnow().replace(tzinfo=pytz.utc)
| 18.666667
| 57
| 0.720238
| 22
| 168
| 5.5
| 0.681818
| 0.231405
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160714
| 168
| 8
| 58
| 21
| 0.858156
| 0.279762
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
fca9efa83536307f7e7b64793b956158054e62f5
| 28,774
|
py
|
Python
|
src/containerapp/azext_containerapp/tests/latest/test_containerapp_commands.py
|
Caoxuyang/azure-cli-extensions
|
d2011261f29033cb31a1064256727d87049ab423
|
[
"MIT"
] | null | null | null |
src/containerapp/azext_containerapp/tests/latest/test_containerapp_commands.py
|
Caoxuyang/azure-cli-extensions
|
d2011261f29033cb31a1064256727d87049ab423
|
[
"MIT"
] | null | null | null |
src/containerapp/azext_containerapp/tests/latest/test_containerapp_commands.py
|
Caoxuyang/azure-cli-extensions
|
d2011261f29033cb31a1064256727d87049ab423
|
[
"MIT"
] | null | null | null |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import os
import time
import unittest
from azure.cli.testsdk.scenario_tests import AllowLargeResponse, live_only
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, JMESPathCheck)
from msrestazure.tools import parse_resource_id
TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
class ContainerappIdentityTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
def test_containerapp_identity_e2e(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
user_identity_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))
self.cmd('containerapp identity assign --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('identity create -g {} -n {}'.format(resource_group, user_identity_name))
self.cmd('containerapp identity assign --user-assigned {} -g {} -n {}'.format(user_identity_name, resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned, UserAssigned'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned, UserAssigned'),
])
self.cmd('containerapp identity remove --user-assigned {} -g {} -n {}'.format(user_identity_name, resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity remove --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="canadacentral")
def test_containerapp_identity_system(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {} --system-assigned'.format(resource_group, ca_name, env_name))
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity remove --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
self.cmd('containerapp identity assign --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity remove --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
@AllowLargeResponse(8192)
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_identity_user(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
user_identity_name1 = self.create_random_name(prefix='containerapp-user1', length=24)
user_identity_name2 = self.create_random_name(prefix='containerapp-user2', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))
self.cmd('identity create -g {} -n {}'.format(resource_group, user_identity_name1))
self.cmd('identity create -g {} -n {}'.format(resource_group, user_identity_name2))
self.cmd('containerapp identity assign --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity assign --user-assigned {} {} -g {} -n {}'.format(user_identity_name1, user_identity_name2, resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned, UserAssigned'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned, UserAssigned'),
])
self.cmd('containerapp identity remove --user-assigned {} -g {} -n {}'.format(user_identity_name1, resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned, UserAssigned'),
])
self.cmd('containerapp identity remove --user-assigned {} -g {} -n {}'.format(user_identity_name2, resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'SystemAssigned'),
])
self.cmd('containerapp identity remove --system-assigned -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
self.cmd('containerapp identity show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('type', 'None'),
])
class ContainerappIngressTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_ingress_e2e(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {} --ingress external --target-port 80'.format(resource_group, ca_name, env_name))
self.cmd('containerapp ingress show -g {} -n {}'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('external', True),
JMESPathCheck('targetPort', 80),
])
self.cmd('containerapp ingress disable -g {} -n {}'.format(resource_group, ca_name, env_name))
containerapp_def = self.cmd('containerapp show -g {} -n {}'.format(resource_group, ca_name)).get_output_in_json()
self.assertEqual("fqdn" in containerapp_def["properties"]["configuration"], False)
self.cmd('containerapp ingress enable -g {} -n {} --type internal --target-port 81 --allow-insecure --transport http2'.format(resource_group, ca_name, env_name))
self.cmd('containerapp ingress show -g {} -n {}'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('external', False),
JMESPathCheck('targetPort', 81),
JMESPathCheck('allowInsecure', True),
JMESPathCheck('transport', "Http2"),
])
self.cmd('containerapp ingress show -g {} -n {}'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('external', False),
JMESPathCheck('targetPort', 81),
JMESPathCheck('allowInsecure', True),
JMESPathCheck('transport', "Http2"),
])
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_ingress_traffic_e2e(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {} --ingress external --target-port 80'.format(resource_group, ca_name, env_name))
self.cmd('containerapp ingress show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('external', True),
JMESPathCheck('targetPort', 80),
])
self.cmd('containerapp ingress traffic set -g {} -n {} --revision-weight latest=100'.format(resource_group, ca_name), checks=[
JMESPathCheck('[0].latestRevision', True),
JMESPathCheck('[0].weight', 100),
])
self.cmd('containerapp update -g {} -n {} --cpu 1.0 --memory 2Gi'.format(resource_group, ca_name))
revisions_list = self.cmd('containerapp revision list -g {} -n {}'.format(resource_group, ca_name)).get_output_in_json()
self.cmd('containerapp ingress traffic set -g {} -n {} --revision-weight latest=50 {}=50'.format(resource_group, ca_name, revisions_list[0]["name"]), checks=[
JMESPathCheck('[0].latestRevision', True),
JMESPathCheck('[0].weight', 50),
JMESPathCheck('[1].revisionName', revisions_list[0]["name"]),
JMESPathCheck('[1].weight', 50),
])
self.cmd('containerapp ingress traffic show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('[0].latestRevision', True),
JMESPathCheck('[0].weight', 50),
JMESPathCheck('[1].revisionName', revisions_list[0]["name"]),
JMESPathCheck('[1].weight', 50),
])
revisions_list = self.cmd('containerapp revision list -g {} -n {}'.format(resource_group, ca_name)).get_output_in_json()
for revision in revisions_list:
self.assertEqual(revision["properties"]["trafficWeight"], 50)
@AllowLargeResponse(8192)
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_custom_domains_e2e(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
app = self.cmd('containerapp create -g {} -n {} --environment {} --ingress external --target-port 80'.format(resource_group, ca_name, env_name)).get_output_in_json()
self.cmd('containerapp hostname list -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('length(@)', 0),
])
# list hostnames with a wrong location
self.cmd('containerapp hostname list -g {} -n {} -l "{}"'.format(resource_group, ca_name, "eastus2"), checks={
JMESPathCheck('length(@)', 0),
}, expect_failure=True)
# create an App service domain and update its txt records
contacts = os.path.join(TEST_DIR, 'domain-contact.json')
zone_name = "{}.com".format(ca_name)
subdomain_1 = "devtest"
subdomain_2 = "clitest"
txt_name_1 = "asuid.{}".format(subdomain_1)
txt_name_2 = "asuid.{}".format(subdomain_2)
hostname_1 = "{}.{}".format(subdomain_1, zone_name)
hostname_2 = "{}.{}".format(subdomain_2, zone_name)
verification_id = app["properties"]["customDomainVerificationId"]
self.cmd("appservice domain create -g {} --hostname {} --contact-info=@'{}' --accept-terms".format(resource_group, zone_name, contacts)).get_output_in_json()
self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_1, verification_id)).get_output_in_json()
self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_2, verification_id)).get_output_in_json()
# upload cert, add hostname & binding
pfx_file = os.path.join(TEST_DIR, 'cert.pfx')
pfx_password = 'test12'
cert_id = self.cmd('containerapp ssl upload -n {} -g {} --environment {} --hostname {} --certificate-file "{}" --password {}'.format(ca_name, resource_group, env_name, hostname_1, pfx_file, pfx_password), checks=[
JMESPathCheck('[0].name', hostname_1),
]).get_output_in_json()[0]["certificateId"]
self.cmd('containerapp hostname list -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].name', hostname_1),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
])
# get cert thumbprint
cert_thumbprint = self.cmd('containerapp env certificate list -n {} -g {} -c {}'.format(env_name, resource_group, cert_id), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].id', cert_id),
]).get_output_in_json()[0]["properties"]["thumbprint"]
# add binding by cert thumbprint
self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --thumbprint {}'.format(resource_group, ca_name, hostname_2, cert_thumbprint), expect_failure=True)
self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --thumbprint {} -e {}'.format(resource_group, ca_name, hostname_2, cert_thumbprint, env_name), checks=[
JMESPathCheck('length(@)', 2),
])
self.cmd('containerapp hostname list -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('length(@)', 2),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
JMESPathCheck('[1].bindingType', "SniEnabled"),
JMESPathCheck('[1].certificateId', cert_id),
])
# delete hostname with a wrong location
self.cmd('containerapp hostname delete -g {} -n {} --hostname {} -l "{}" --yes'.format(resource_group, ca_name, hostname_1, "eastus2"), expect_failure=True)
self.cmd('containerapp hostname delete -g {} -n {} --hostname {} -l "{}" --yes'.format(resource_group, ca_name, hostname_1, app["location"]), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].name', hostname_2),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
]).get_output_in_json()
self.cmd('containerapp hostname list -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].name', hostname_2),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
])
self.cmd('containerapp hostname delete -g {} -n {} --hostname {} --yes'.format(resource_group, ca_name, hostname_2), checks=[
JMESPathCheck('length(@)', 0),
]).get_output_in_json()
# add binding by cert id
self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --certificate {}'.format(resource_group, ca_name, hostname_2, cert_id), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
JMESPathCheck('[0].name', hostname_2),
]).get_output_in_json()
self.cmd('containerapp hostname delete -g {} -n {} --hostname {} --yes'.format(resource_group, ca_name, hostname_2), checks=[
JMESPathCheck('length(@)', 0),
]).get_output_in_json()
# add binding by cert name, with and without environment
cert_name = parse_resource_id(cert_id)["resource_name"]
self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --certificate {}'.format(resource_group, ca_name, hostname_1, cert_name), expect_failure=True)
self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --certificate {} -e {}'.format(resource_group, ca_name, hostname_1, cert_name, env_name), checks=[
JMESPathCheck('length(@)', 1),
JMESPathCheck('[0].bindingType', "SniEnabled"),
JMESPathCheck('[0].certificateId', cert_id),
JMESPathCheck('[0].name', hostname_1),
]).get_output_in_json()
self.cmd('containerapp hostname delete -g {} -n {} --hostname {} --yes'.format(resource_group, ca_name, hostname_1), checks=[
JMESPathCheck('length(@)', 0),
]).get_output_in_json()
class ContainerappDaprTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_dapr_e2e(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))
self.cmd('containerapp dapr enable -g {} -n {} --dapr-app-id containerapp1 --dapr-app-port 80 --dapr-app-protocol http'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('appId', "containerapp1"),
JMESPathCheck('appPort', 80),
JMESPathCheck('appProtocol', "http"),
JMESPathCheck('enabled', True),
])
self.cmd('containerapp show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('properties.configuration.dapr.appId', "containerapp1"),
JMESPathCheck('properties.configuration.dapr.appPort', 80),
JMESPathCheck('properties.configuration.dapr.appProtocol', "http"),
JMESPathCheck('properties.configuration.dapr.enabled', True),
])
self.cmd('containerapp dapr disable -g {} -n {}'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('appId', "containerapp1"),
JMESPathCheck('appPort', 80),
JMESPathCheck('appProtocol', "http"),
JMESPathCheck('enabled', False),
])
self.cmd('containerapp show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('properties.configuration.dapr.appId', "containerapp1"),
JMESPathCheck('properties.configuration.dapr.appPort', 80),
JMESPathCheck('properties.configuration.dapr.appProtocol', "http"),
JMESPathCheck('properties.configuration.dapr.enabled', False),
])
class ContainerappEnvStorageTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus")
def test_containerapp_env_storage(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-env', length=24)
storage_name = self.create_random_name(prefix='storage', length=24)
shares_name = self.create_random_name(prefix='share', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
while containerapp_env["properties"]["provisioningState"].lower() == "waiting":
time.sleep(5)
containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()
self.cmd('storage account create -g {} -n {} --kind StorageV2 --sku Standard_ZRS --enable-large-file-share'.format(resource_group, storage_name))
self.cmd('storage share-rm create -g {} -n {} --storage-account {} --access-tier "TransactionOptimized" --quota 1024'.format(resource_group, shares_name, storage_name))
storage_keys = self.cmd('az storage account keys list -g {} -n {}'.format(resource_group, storage_name)).get_output_in_json()[0]
self.cmd('containerapp env storage set -g {} -n {} --storage-name {} --azure-file-account-name {} --azure-file-account-key {} --access-mode ReadOnly --azure-file-share-name {}'.format(resource_group, env_name, storage_name, storage_name, storage_keys["value"], shares_name), checks=[
JMESPathCheck('name', storage_name),
])
self.cmd('containerapp env storage show -g {} -n {} --storage-name {}'.format(resource_group, env_name, storage_name), checks=[
JMESPathCheck('name', storage_name),
])
self.cmd('containerapp env storage list -g {} -n {}'.format(resource_group, env_name), checks=[
JMESPathCheck('[0].name', storage_name),
])
self.cmd('containerapp env storage remove -g {} -n {} --storage-name {} --yes'.format(resource_group, env_name, storage_name))
self.cmd('containerapp env storage list -g {} -n {}'.format(resource_group, env_name), checks=[
JMESPathCheck('length(@)', 0),
])
| 59.205761
| 291
| 0.662647
| 3,312
| 28,774
| 5.533514
| 0.072162
| 0.086539
| 0.110929
| 0.059366
| 0.871665
| 0.846456
| 0.830141
| 0.823812
| 0.807988
| 0.779015
| 0
| 0.01113
| 0.181935
| 28,774
| 485
| 292
| 59.327835
| 0.76745
| 0.033016
| 0
| 0.737288
| 0
| 0.045198
| 0.323432
| 0.016003
| 0
| 0
| 0
| 0
| 0.00565
| 1
| 0.022599
| false
| 0.00565
| 0.016949
| 0
| 0.050847
| 0.011299
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
fce35e4f8d1c042c465a296421144c00ebd4c0f1
| 4,358
|
py
|
Python
|
dame_flame/utils/data.py
|
saksham-jain01/DAME-FLAME-Python-Package
|
1362baeadc05cf7ba368e40b0f2873c758c0c515
|
[
"MIT"
] | 43
|
2020-08-10T20:51:49.000Z
|
2022-03-09T08:50:37.000Z
|
dame_flame/utils/data.py
|
saksham-jain01/DAME-FLAME-Python-Package
|
1362baeadc05cf7ba368e40b0f2873c758c0c515
|
[
"MIT"
] | 31
|
2020-02-11T20:29:26.000Z
|
2022-02-26T10:08:17.000Z
|
dame_flame/utils/data.py
|
saksham-jain01/DAME-FLAME-Python-Package
|
1362baeadc05cf7ba368e40b0f2873c758c0c515
|
[
"MIT"
] | 22
|
2020-05-07T23:53:53.000Z
|
2021-08-05T14:41:59.000Z
|
# -*- coding: utf-8 -*-
"""Generate data for examples"""
# author: Neha Gupta, Tianyu Wang, Duke University; Awa Dieng, Yameng Liu
# Copyright Duke University 2020
# License: MIT
import pandas as pd
import numpy as np
def generate_uniform_given_importance(num_control=1000, num_treated=1000,
num_cov=4, min_val=0,
max_val=3, covar_importance=[4, 3, 2, 1],
bi_mean=2, bi_stdev=1):
"""
This generates data according to the discrete uniform distribution
"""
x_c = np.random.randint(min_val, max_val, size=(num_control, num_cov))
x_t = np.random.randint(min_val, max_val, size=(num_treated, num_cov))
y_c = np.dot(x_c, np.array(covar_importance)) # y for control group
# this is beta
treatment_eff_coef = np.random.normal(bi_mean, bi_stdev, size=num_cov)
treatment_effect = np.dot(x_t, treatment_eff_coef) # this is beta*x
# yc is just the 1st term of the below summation. Thus, CATT is the 2nd term
y_t = np.dot(x_t, np.array(covar_importance)) + treatment_effect
true_catt = treatment_effect
df1 = pd.DataFrame(x_c, columns=range(num_cov))
df1['outcome'] = y_c
df1['treated'] = 0
df2 = pd.DataFrame(x_t, columns=range(num_cov))
df2['outcome'] = y_t
df2['treated'] = 1
data_frame = pd.concat([df2, df1])
data_frame = data_frame.reset_index()
data_frame = data_frame.drop(['index'], axis=1)
return data_frame, true_catt
def generate_binomial_given_importance(num_control=1000, num_treated=1000,
num_cov=5, bernoulli_param=0.5,
bi_mean=2, bi_stdev=1,
covar_importance=[4, 3, 2, 1, 0.01]):
'''
This function generates data where the covariates exponentially decay with
importance. The x's are all binary.
'''
# data for control group
x_c = np.random.binomial(1, bernoulli_param, size=(num_control, num_cov))
# data for treated group
x_t = np.random.binomial(1, bernoulli_param, size=(num_treated, num_cov))
y_c = np.dot(x_c, np.array(covar_importance)) # y for control group
# this is beta
treatment_eff_coef = np.random.normal(bi_mean, bi_stdev, size=num_cov)
treatment_effect = np.dot(x_t, treatment_eff_coef) # this is beta*x
# yc is just the 1st term of the below summation. Thus, CATT is the 2nd term
y_t = np.dot(x_t, np.array(covar_importance)) + treatment_effect
true_catt = treatment_effect
df1 = pd.DataFrame(x_c, columns=range(num_cov))
df1['outcome'] = y_c
df1['treated'] = 0
df2 = pd.DataFrame(x_t, columns=range(num_cov))
df2['outcome'] = y_t
df2['treated'] = 1
data_frame = pd.concat([df2, df1])
data_frame = data_frame.reset_index()
data_frame = data_frame.drop(['index'], axis=1)
return data_frame, true_catt
def generate_binomial_decay_importance(num_control=1000, num_treated=1000,
num_cov=5, bernoulli_param=0.5,
bi_mean=2, bi_stdev=1):
'''
This function generates data where the covariates exponentially decay with
importance. The x's are all binary.
'''
# data for control group
x_c = np.random.binomial(1, bernoulli_param, size=(num_control, num_cov))
# data for treated group
x_t = np.random.binomial(1, bernoulli_param, size=(num_treated, num_cov))
dense_bs = [64*((1/4)**(i+1)) for i in range(num_cov)]
y_c = np.dot(x_c, np.array(dense_bs)) # y for control group
# this is beta
treatment_eff_coef = np.random.normal(bi_mean, bi_stdev, size=num_cov)
treatment_effect = np.dot(x_t, treatment_eff_coef) # this is beta*x
# yc is just the 1st term of the below summation. Thus, CATT is the 2nd term
y_t = np.dot(x_t, np.array(dense_bs)) + treatment_effect
true_catt = treatment_effect
df1 = pd.DataFrame(x_c, columns=range(num_cov))
df1['outcome'] = y_c
df1['treated'] = 0
df2 = pd.DataFrame(x_t, columns=range(num_cov))
df2['outcome'] = y_t
df2['treated'] = 1
data_frame = pd.concat([df2, df1])
data_frame = data_frame.reset_index()
data_frame = data_frame.drop(['index'], axis=1)
return data_frame, true_catt
| 35.721311
| 80
| 0.643873
| 668
| 4,358
| 3.97006
| 0.17515
| 0.042986
| 0.020362
| 0.015837
| 0.88914
| 0.884238
| 0.86991
| 0.862745
| 0.862745
| 0.839744
| 0
| 0.031307
| 0.245067
| 4,358
| 121
| 81
| 36.016529
| 0.774772
| 0.209959
| 0
| 0.784615
| 1
| 0
| 0.029421
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.046154
| false
| 0
| 0.169231
| 0
| 0.261538
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
1e849de6734743136d2b1165120b00caa51e53b9
| 115,594
|
py
|
Python
|
uecho/std/objects_scsl.py
|
cybergarage/uecho-py
|
6b0dc72b9c3770d79b812bad75ea201c820b089a
|
[
"Apache-2.0"
] | null | null | null |
uecho/std/objects_scsl.py
|
cybergarage/uecho-py
|
6b0dc72b9c3770d79b812bad75ea201c820b089a
|
[
"Apache-2.0"
] | null | null | null |
uecho/std/objects_scsl.py
|
cybergarage/uecho-py
|
6b0dc72b9c3770d79b812bad75ea201c820b089a
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (C) 2021 Satoshi Konno. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# To the extent possible under law, Sony Computer Science Laboratories, Inc has waived
# all copyright and related or neighboring rights to ECHONETLite-ObjectDatabase.
# This work is published from: Japan.
#
# GENERATED FROM objects.pl DO NOT EDIT THIS FILE.
from .reader import Object, Property
__std_scsl_objects: dict = {}
def get_all_std_scsl_objects() -> dict:
return __std_scsl_objects
# Gas leak sensor (0x0001)
obj = Object("Gas leak sensor", 0x00, 0x01)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Gas leak occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Gas leak occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x01)] = obj
# Crime prevention sensor (0x0002)
obj = Object("Crime prevention sensor", 0x00, 0x02)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Invasion occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Invasion occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x02)] = obj
# Emergency button (0x0003)
obj = Object("Emergency button", 0x00, 0x03)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB1, "Emergency occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Emergency occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x03)] = obj
# First-aid sensor (0x0004)
obj = Object("First-aid sensor", 0x00, 0x04)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "First-aid occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "First-aid occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x04)] = obj
# Earthquake sensor (0x0005)
obj = Object("Earthquake sensor", 0x00, 0x05)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Earthquake occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Earthquake occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x05)] = obj
# Electric leak sensor (0x0006)
obj = Object("Electric leak sensor", 0x00, 0x06)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Electric leak occurrence status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Electric leak occurrence status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x06)] = obj
# Human detection sensor (0x0007)
obj = Object("Human detection sensor", 0x00, 0x07)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Human detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x07)] = obj
# Visitor sensor (0x0008)
obj = Object("Visitor sensor", 0x00, 0x08)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Visitor detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBE, "Visitor detection holding time", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x00, 0x08)] = obj
# Call sensor (0x0009)
obj = Object("Call sensor", 0x00, 0x09)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Call status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBE, "Call holding time", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x00, 0x09)] = obj
# Condensation sensor (0x000A)
obj = Object("Condensation sensor", 0x00, 0x0A)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Condensation detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x0A)] = obj
# Air pollution sensor (0x000B)
obj = Object("Air pollution sensor", 0x00, 0x0B)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Air pollution detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x0B)] = obj
# Oxygen sensor (0x000C)
obj = Object("Oxygen sensor", 0x00, 0x0C)
obj.add_property(Property(0x80, "Operation status", "unsigned short", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of oxygen concentration", "unsigned short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x0C)] = obj
# Illuminance sensor (0x000D)
obj = Object("Illuminance sensor", 0x00, 0x0D)
obj.add_property(Property(0x80, "Operation status", "unsigned short", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured illuminance value 1", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Measured illuminance value 2", "unsigned short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x0D)] = obj
# Sound sensor (0x000E)
obj = Object("Sound sensor", 0x00, 0x0E)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Sound detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBE, "Sound detection holding time", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x00, 0x0E)] = obj
# Mailing sensor (0x000F)
obj = Object("Mailing sensor", 0x00, 0x0F)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Mailing detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x0F)] = obj
# Weight sensor (0x0010)
obj = Object("Weight sensor", 0x00, 0x10)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Weight detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x10)] = obj
# Temperature sensor (0x0011)
obj = Object("Temperature sensor", 0x00, 0x11)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured temperature value", "signed short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x11)] = obj
# Humidity sensor (0x0012)
obj = Object("Humidity sensor", 0x00, 0x12)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of relative humidity", "unsigned char", 1, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x12)] = obj
# Rain sensor (0x0013)
obj = Object("Rain sensor", 0x00, 0x13)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Rain detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x13)] = obj
# Water level sensor (0x0014)
obj = Object("Water level sensor", 0x00, 0x14)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Water level over detection threshold level", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Water level over detection status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of water level", "unsigned char", 1, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x14)] = obj
# Bath water level sensor (0x0015)
obj = Object("Bath water level sensor", 0x00, 0x15)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Bath water level over detection threshold level", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Bath water level over detection status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of bath water level", "unsigned char", 1, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x15)] = obj
# Bath heating status sensor (0x0016)
obj = Object("Bath heating status sensor", 0x00, 0x16)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Bath heating detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x16)] = obj
# Water leak sensor (0x0017)
obj = Object("Water leak sensor", 0x00, 0x17)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Water leak detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x17)] = obj
# Water overflow sensor (0x0018)
obj = Object("Water overflow sensor", 0x00, 0x18)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Water overflow detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x18)] = obj
# Fire sensor (0x0019)
obj = Object("Fire sensor", 0x00, 0x19)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Fire occurrence detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Fire occurrence detection status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x19)] = obj
# Cigarette smoke sensor (0x001A)
obj = Object("Cigarette smoke sensor", 0x00, 0x1A)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Smoke (cigarette) detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x1A)] = obj
# CO2 sensor (0x001B)
obj = Object("CO2 sensor", 0x00, 0x1B)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of CO2 concentration", "unsigned short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x1B)] = obj
# Gas sensor (0x001C)
obj = Object("Gas sensor", 0x00, 0x1C)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Gas detection status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of gas concentration", "unsigned short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x1C)] = obj
# VOC sensor (0x001D)
obj = Object("VOC sensor", 0x00, 0x1D)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "VOC detection status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of VOC concentration", "unsigned short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x1D)] = obj
# Differential pressure sensor (0x001E)
obj = Object("Differential pressure sensor", 0x00, 0x1E)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of differential pressure", "signed short", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x1E)] = obj
# Air speed sensor (0x001F)
obj = Object("Air speed sensor", 0x00, 0x1F)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of air speed", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Air flow direction", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x00, 0x1F)] = obj
# Odor sensor (0x0020)
obj = Object("Odor sensor", 0x00, 0x20)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Odor detection status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE0, "Measured odor value", "unsigned char", 1, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x20)] = obj
# Flame sensor (0x0021)
obj = Object("Flame sensor", 0x00, 0x21)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Flame detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xBF, "Flame detection status resetting", "unsigned char", 1, "-", "optional", "-"))
__std_scsl_objects[(0x00, 0x21)] = obj
# Electric energy sensor (0x0022)
obj = Object("Electric energy sensor", 0x00, 0x22)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Integral electric energy", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Medium-capacity sensor instantaneous electric energy", "signed long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Small-capacity sensor instantaneous electric energy", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Large-capacity sensor instantaneous electric energy", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Integral electric energy measurement log", "unsigned long × 48", 192, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Effective voltage value", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x00, 0x22)] = obj
# Current value sensor (0x0023)
obj = Object("Current value sensor", 0x00, 0x23)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured current value 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Rated voltage to be measured", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Measured current value 2", "unsigned long", 4, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x23)] = obj
# Water flow rate sensor (0x0025)
obj = Object("Water flow rate sensor", 0x00, 0x25)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Integral flow rate", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Flow rate", "unsigned long", 4, "mandatory", "-", "-"))
__std_scsl_objects[(0x00, 0x25)] = obj
# Micromotion sensor (0x0026)
obj = Object("Micromotion sensor", 0x00, 0x26)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Micromotion detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xB2, "Detection counter", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xBC, "Sampling count", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xBD, "Sampling cycle", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x00, 0x26)] = obj
# Passage sensor (0x0027)
obj = Object("Passage sensor", 0x00, 0x27)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBE, "Passage detection hold time", "unsigned char", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Passage detection direction", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x27)] = obj
# Bed presence sensor (0x0028)
obj = Object("Bed presence sensor", 0x00, 0x28)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Bed presence detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x28)] = obj
# Open/close sensor (0x0029)
obj = Object("Open/close sensor", 0x00, 0x29)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Degree-of-openi ng detection status 1", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Degree-of-openi ng detection status 2", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x29)] = obj
# Activity amount sensor (0x002A)
obj = Object("Activity amount sensor", 0x00, 0x2A)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Activity amount level 1", "unsigned char × max 128", 0, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Maximum number of human body ID's", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Activity amount level 2", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Human body existence information", "unsigned char × 16", 16, "optional", "-", "-"))
__std_scsl_objects[(0x00, 0x2A)] = obj
# Human body location sensor (0x002B)
obj = Object("Human body location sensor", 0x00, 0x2B)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Human body detection location 1", "unsigned char × 3 x max 128", 0, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Maximum number of human body ID's", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Human body detection location 2", "unsigned char × 3", 3, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Human body existence information", "unsigned char × 16", 16, "optional", "-", "-"))
__std_scsl_objects[(0x00, 0x2B)] = obj
# Snow sensor (0x002C)
obj = Object("Snow sensor", 0x00, 0x2C)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Detection threshold level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Snow detection status", "unsigned char", 1, "mandatory", "-", "mandatory"))
__std_scsl_objects[(0x00, 0x2C)] = obj
# Home air conditioner (0x0130)
obj = Object("Home air conditioner", 0x01, 0x30)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB0, "Operation mode setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB1, "Automatic temperature control setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB2, "Normal/high- speed/silent operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB3, "Set temperature value", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB4, "Set value of relative humidity in dehumidifying mode", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB5, "Set temperature value in cooling mode", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB6, "Set temperature value in heating mode", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB7, "Set temperature value in dehumidifying mode", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB8, "Rated power consumption", "unsigned short × 4", 8, "optional", "-", "-"))
obj.add_property(Property(0xB9, "Measured value of current consumption", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xBA, "Measured value of room relative humidity", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBB, "Measured value of room temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBC, "Set temperature value of user remote control", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBD, "Measured cooled air temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBE, "Measured outdoor air temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBF, "Relative temperature setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA0, "Air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA1, "Automatic control of air flow direction setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA3, "Automatic swing of air flow setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA4, "Air flow direction (vertical) setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA5, "Air flow direction (horizontal) setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xAA, "Special state", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xAB, "Non-priority state", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC0, "Ventilation function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC1, "Humidifier function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC2, "Ventilation air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC4, "Degree of humidification setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC6, "Mounted air cleaning method", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC7, "Air purifier function setting", "unsigned char ×8", 8, "optional", "optional", "-"))
obj.add_property(Property(0xC8, "Mounted air refresh method", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC9, "Air refresher function setting", "unsigned char × 8", 8, "optional", "optional", "-"))
obj.add_property(Property(0xCA, "Mounted self-cleaning method", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xCB, "Self-cleaning function setting", "unsigned char × 8", 8, "optional", "optional", "-"))
obj.add_property(Property(0xCC, "Special function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xCD, "Operation status of components", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xCE, "Thermostat setting override function", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xCF, "Air purification mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer-based reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "ON timer setting (relative time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer-based reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "OFF timer setting (relative time)", "unsigned char × 2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x01, 0x30)] = obj
# Ventilation fan (0x0133)
obj = Object("Ventilation fan", 0x01, 0x33)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xBF, "Ventilation auto setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA0, "Set value of ventilation air flow rate", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x01, 0x33)] = obj
# Air conditioner ventilation fan (0x0134)
obj = Object("Air conditioner ventilation fan", 0x01, 0x34)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB4, "Set value of room relative humidity", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBF, "Ventilation auto setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBA, "Measured value of room relative humidity", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xA0, "Set value of ventilation air flow rate", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Heat exchanger operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC0, "Measured value of CO2 concentration", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC1, "Smoke (cigarette) detection status", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x01, 0x34)] = obj
# Air cleaner (0x0135)
obj = Object("Air cleaner", 0x01, 0x35)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE1, "Filter change notice", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xA0, "Air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC1, "Smoke (cigarette) detection status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC2, "Optical catalyst operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC0, "Air pollution detection status", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x01, 0x35)] = obj
# Humidifier (0x0139)
obj = Object("Humidifier", 0x01, 0x39)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xC0, "Humidifying setting 1", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xC1, "Humidifying setting 2", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB4, "Measured value of relative humidity", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0x94, "Reservation set of OFF timer", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x96, "Relative time value set of OFF timer", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xC2, "Ion emission setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC3, "Implemented ion emission method", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC4, "Special operation mode setting", "unsigned short", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC5, "Water amount level", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x01, 0x39)] = obj
# Electric heater (0x0142)
obj = Object("Electric heater", 0x01, 0x42)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB1, "Automatic temperature control setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB3, "Temperature setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xBB, "Measured room temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBC, "Remotely set temperature", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xA0, "Air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer-based reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "ON timer setting (relative time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer-based reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "Set value of OFF timer relative time", "unsigned char × 2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x01, 0x42)] = obj
# Fan heater (0x0143)
obj = Object("Fan heater", 0x01, 0x43)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB3, "Temperature setting value", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xBB, "Measured temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Automatic temperature control setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting value (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "ON timer setting value (relative time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting value (time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "OFF timer value ( relative time)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xC0, "Extentional operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC1, "Extentional operation timer time setting value", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xC2, "Ion emission setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC3, "Implemented ion emission method", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC4, "Oil amount level", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x01, 0x43)] = obj
# Package-type commercial air conditioner (indoor unit) (0x0145)
obj = Object("Package-type commercial air conditioner (indoor unit)", 0x01, 0x45)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB0, "Operation mode setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB3, "Temperature setting 1", "signed char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB4, "“Relative humidity setting for ‘dehumidifica- tion’ mode” 1", "unsigned char", 1, "optional", "optional", "mandatory"))
obj.add_property(Property(0xB5, "“Temperature setting for ‘cooling’ mode” 1", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB6, "“Temperature setting for ‘heating’ mode” 1", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB7, "“Temperature setting for ‘dehumidifica- tion’ mode” 1", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB8, "Rated power consumption of indoor unit", "unsigned short × 4", 8, "optional", "-", "-"))
obj.add_property(Property(0xB9, "Measured electric current consumption of indoor unit", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xBA, "Measured indoor relative humidity 1", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBB, "Measured indoor temperature 1", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBF, "Relative temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA0, "Air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA4, "“Air flow direction (vertical)” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA5, "“Air flow direction (horizontal)” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xAA, "“Special” state", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xAC, "Thermostat state", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xAE, "Current function (“automatic” operation mode)", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xC0, "Ventilation mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC1, "Combined operation of indoor unit and total heat exchanger", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC2, "Ventilation air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xCD, "“Disabling of air conditioner” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xCE, "Thermostat setting override function", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xCF, "Filter cleaning reminder lamp setting", "unsigned char", 1, "optional", "optional", "mandatory"))
obj.add_property(Property(0xDB, "Measured power consumption of indoor unit", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Aperture of expansion valve", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Temperature setting 2", "unsigned short", 2, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE4, "“Relative humidity setting for ‘dehumidificatio n’ mode” 2", "unsigned short", 2, "optional", "optional", "mandatory"))
obj.add_property(Property(0xE5, "“Temperature setting for ‘cooling’ mode” 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "“Temperature setting for ‘heating’ mode” 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "“Temperature setting for ‘dehumidificatio n’ mode” 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Measured indoor relative humidity 2", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xEB, "Measured indoor temperature 2", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0x90, "“ON timer-based reservation” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting (time)", "unsigned char×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "ON timer setting (relative time)", "unsigned char×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "“OFF timer-based reservation” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting (time)", "unsigned char×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "OFF timer setting (relative time)", "unsigned char×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x01, 0x45)] = obj
# Package-type commercial air conditioner (outdoor unit) (0x0146)
obj = Object("Package-type commercial air conditioner (outdoor unit)", 0x01, 0x46)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Operation mode setting", "unsigned char", 1, "optional", "optional", "mandatory"))
obj.add_property(Property(0xB8, "Rated power consumption of outdoor unit", "unsigned short × 3", 6, "optional", "-", "-"))
obj.add_property(Property(0xB9, "Measured electric current consumption of outdoor unit", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xBE, "Measured outdoor air temperature 1", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xAA, "“Special” state", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD0, "Operation status of compressor", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD1, "Operation mode information", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xD2, "Fan rotation speed", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xDB, "Measured power consumption of outdoor unit", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xEE, "Measured outdoor air temperature 2", "signed short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x01, 0x46)] = obj
# Electrically operated shade (0x0260)
obj = Object("Electrically operated shade", 0x02, 0x60)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Open/close setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE1, "Degree-of-openi ng level", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE2, "Set value of shade angle", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Shade open/close speed", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x60)] = obj
# Electrically operated shutter (0x0261)
obj = Object("Electrically operated shutter", 0x02, 0x61)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Open/close setting 1", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE1, "Extent of opening 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Blind angle setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Shutter speed", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Extent of opening 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Electric lock setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Open/close setting 2", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
__std_scsl_objects[(0x02, 0x61)] = obj
# Electrically operated storm window (0x0263)
obj = Object("Electrically operated storm window", 0x02, 0x63)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Open/close setting 1", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE1, "Extent of opening 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Blind angle setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Shutter speed", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Extent of opening 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Electric lock setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE7, "Open/close setting 2", "unsigned char", 1, "optional", "optional", "mandatory"))
__std_scsl_objects[(0x02, 0x63)] = obj
# Garden sprinkler (0x0267)
obj = Object("Garden sprinkler", 0x02, 0x67)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Sprinkle valve open/close setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE1, "Sprinkle interval setting", "unsigned long", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Number of sprinkles setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Sprinkle time setting 1", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Sprinkle time setting 2", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Sprinkle duration setting", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x67)] = obj
# Electric water heater (0x026B)
obj = Object("Electric water heater", 0x02, 0x6B)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "“Automatic water heating” setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB1, "“Automatic water temperature control” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB2, "Water heater status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB3, "Water heating temperature setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xC0, "“Daytime reheating permission” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC1, "Measured temperature of water in water heater", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC2, "Alarm status", "unsigned char × 2", 4, "optional", "-", "mandatory"))
obj.add_property(Property(0xD1, "“Temperature of supplied water” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD3, "Bath water temperature setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Bath water volume setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Measured amount of water remaining in tank", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Tank capacity", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE3, "“Automatic bath water heating” mode setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE5, "“Addition of hot water” function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "“Slight bath water temperature lowering” function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Bath water volume setting 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Bath water volume setting 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEE, "Bath water volume setting 3", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xD4, "Bath water volume setting 4", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD5, "Bath water volume setting 4- Maximum settable level", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xDB, "Rated power consumption of H/P unit in wintertime", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Rated power consumption of H/P unit in in-between seasons", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xDD, "Rated power consumption of H/P unit in summertime", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x6B)] = obj
# Bidet-equipped toilet(with electrically warmed seat) (0x026E)
obj = Object("Bidet-equipped toilet(with electrically warmed seat)", 0x02, 0x6E)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Temperature level of toilet seat", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Heater setting of toilet seat", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE2, "Temporal halt setting of toilet seat", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Temporal halt start time of toilet seat", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Temporal halt time duration of toilet seat", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Temperature level setting of room heating", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Room heating setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Room heating status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE8, "Start time of room heating", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Duration time of room heating", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Special operation mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "Human detection status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEC, "Seating detection status", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x6E)] = obj
# Electric key (0x026F)
obj = Object("Electric key", 0x02, 0x6F)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Lock setting 1", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE1, "Lock setting 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Lock status of door guard", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Door open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Occupant/ non-occupant status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Alarm status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE6, "Auto lock mode setting", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x6F)] = obj
# Hot water generator (0x0272)
obj = Object("Hot water generator", 0x02, 0x72)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xD0, "Hot water heating status", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xD1, "Set value of hot water temperature", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD2, "Hot water Warmer setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xDA, "“Duration of automatic operation” setting", "unsigned char× 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xDB, "Remaining automatic operation time", "unsigned char × 2", 2, "optional", "-", "-"))
obj.add_property(Property(0xE1, "Set value of bath temperature", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Bath water heater status", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Bath auto mode setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE4, "Bath additional boil-up operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Bath hot water adding operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Bath water temperature lowering operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Bath hot water volume setting 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Bath hot water volume setting 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEE, "Bath hot water volume setting 3", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Bathroom priority setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Shower hot water supply status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEB, "Kitchen hot water supply status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEC, "Hot water warmer ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Set value of hot water warmer ON timer time", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "Set value of ON timer time", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Set value of ON timer relative time", "unsigned char × 2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x72)] = obj
# Bathroom dryer (0x0273)
obj = Object("Bathroom dryer", 0x02, 0x73)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Operation setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB1, "Ventilation operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB2, "Bathroom pre-warmer operation setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB3, "Bathroom heater operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB4, "Bathroom dryer operation setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB5, "Cool air circulator operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBA, "Measured relative bathroom humidity", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xBB, "Measured bathroom temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC2, "Ventilation air flow rate setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xCF, "Filter cleaning reminder sign setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Human body detection status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0x90, "“ON timer-based reservation” setting 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "“ON timer-based reservation” setting 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting (time)", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "ON timer setting (relative time)", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "“OFF timer-based reservation” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting (time)", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "OFF timer setting (relative time)", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x73)] = obj
# Home solar power generation (0x0279)
obj = Object("Home solar power generation", 0x02, 0x79)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xD0, "System-interconnected type", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE0, "Measured instantaneous amount of electricity generated", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Measured cumulative amount of electric energy generated", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Resetting cumulative amount of electric energy generated", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xE3, "Measured cumulative amount of electric energy sold", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Resetting cumulative amount of electric energy sold", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xE5, "Power generation output limit setting 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Power generation output limit setting 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Limit setting for the amount of electricity sold", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Rated power generation output (System-interconnected)", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Rated power generation output (Independent)", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x79)] = obj
# Cold / hot water heat source equipment (0x027A)
obj = Object("Cold / hot water heat source equipment", 0x02, 0x7A)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Operation mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Water temperature setting 1", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE2, "Water temperature setting 2", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE3, "Measured temperature of outward water (Exit water Temperature)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Measured temperature of inward water (Entrance water temperature)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Special operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Daily timer setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Daily timer setting 1", "unsigned char × 6", 6, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Daily timer setting 2", "unsigned char × 6", 6, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Relative ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "Time set by OFF timer", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "Relative OFF timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x7A)] = obj
# Floor heater (0x027B)
obj = Object("Floor heater", 0x02, 0x7B)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE0, "Temperature setting 1", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE1, "Temperature setting 2", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE2, "Measured room temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Measured floor temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Zone change setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Special operation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Daily timer setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Daily timer setting 1", "unsigned char × 6", 6, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Daily timer setting 2", "unsigned char × 6", 6, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "Time set by ON timer", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Relative ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "Time set by OFF timer", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x96, "Relative OFF timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x7B)] = obj
# Fuel cell (0x027C)
obj = Object("Fuel cell", 0x02, 0x7C)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xC1, "Measured temperature of water in water heater", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC2, "Rated power generation output", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC3, "Heating value of hot water storage tank", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC4, "Measured instantaneous power generation output", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xC5, "Measured cumulative power generation output", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC6, "Cumulative power generation output reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xC7, "Measured instantaneous gas consumption", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC8, "Measured cumulative gas consumption", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xC9, "Cumulative gas consumption reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xCA, "Power generation setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xCB, "Power generation status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xCC, "Measured in-house instantaneous power consumption", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xCD, "Measured in-house cumulative power consumption", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xCE, "In-house cumulative power consumption reset", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xD0, "System interconnected type", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE1, "Measured remaining hot water amount", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Tank capacity", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x7C)] = obj
# Storage battery (0x027D)
obj = Object("Storage battery", 0x02, 0x7D)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xC8, "Minimum/maxim um charge electric energy", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xC9, "Minimum/maxim um discharge electric energy", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xCA, "Minimum/maxim um charge current", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xCB, "Minimum/maxim um discharge current", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xCF, "Working operation status", "", 0, "", "", ""))
obj.add_property(Property(0xD0, "Rated electric energy", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD1, "Rated capacity", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD2, "Rated voltage", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Measured instantaneous charge/discharge electric energy", "signed long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Measured instantaneous charge/discharge current", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Measured instantaneous charge/discharge voltage", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Measured cumulative discharge electric energy", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD7, "“Measured cumulative discharge electric energy” reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xD8, "Measured cumulative charge electric energy", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD9, "“Measured cumulative charge electric energy” reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xDA, "Operation mode setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xDB, "System-interconn ected type", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Minimum/maximum charging power (Independent)", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDD, "Minimum/maximum discharging power (Independent)", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDE, "Minimum/maxim um charging current (Independent)", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xDF, "Minimum/maxim um discharging current (Independent)", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xE0, "Charging/dischar ging amount setting 1", "signed long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Charging/dischar ging amount setting 2", "signed short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Remaining stored electricity 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Remaining stored electricity 2", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE4, "Remaining stored electricity 3", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE5, "Battery state of health", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE6, "Battery type", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE7, "Charging amount setting 1", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Discharging amount setting 1", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Charging amount setting 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Discharging amount setting 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "Charge electric energy setting", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Discharge electric energy setting", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Charge current setting", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEE, "Discharge current setting", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEF, "Rated voltage (Independent)", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x7D)] = obj
# Electric vehicle (0x027E)
obj = Object("Electric vehicle", 0x02, 0x7E)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xC0, "V2H stored electricity 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC1, "V2H stored electricity 2", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xC2, "V2H remaining available capacity 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC3, "V2H remaining available capacity 2", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xC4, "V2H remaining available capacity 3", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xC5, "Rated charge capacity", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC6, "Rated discharge capacity", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC7, "Chargeable/discharge able status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xC8, "Minimum/maximum charge electric energy", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xC9, "Minimum/maximum discharge electric energy", "unsigned long ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xCA, "Minimum/maximum charge current", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xCB, "Minimum/maximum discharge current", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xD0, "Used capacity 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xD1, "Used capacity 2", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xD2, "Rated voltage", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Measured instantaneous charge/discharge electric energy", "signed long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Measured instantaneous charge/discharge current", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Measured instantaneous charge/discharge voltage", "signed short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Measured cumulative discharge electric energy", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD7, "Cumulative discharge electric energy reset setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD8, "Measured cumulative charge electric energy", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD9, "Cumulative charge electric energy reset setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xDA, "Operation mode setting", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xDB, "System-interconnecte d type", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Remaining battery capacity1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Remaining battery capacity2", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE4, "Remaining battery capacity3", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE5, "Deterioration status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE7, "Charging amount setting 1", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Discharging amount setting 1", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Charging amount setting 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Discharging amount setting 2", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "Charge electric energy setting", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Discharge electric energy setting", "unsigned long", 4, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Charge current setting", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEE, "Discharge current setting", "unsigned short", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x7E)] = obj
# Engine cogeneration (0x027F)
obj = Object("Engine cogeneration", 0x02, 0x7F)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xC1, "Measured temperature of water in water heater", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xC2, "Rated power generation output", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC3, "Heating value of hot water storage tank", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC4, "Measured instantaneous power generation output", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xC5, "Measured cumulative power generation output", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC6, "Cumulative power generation output reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xC7, "Measured instantaneous gas consumption", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xC8, "Measured cumulative gas consumption", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xC9, "Cumulative gas consumption reset setting", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xCA, "Power generation setting ", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xCB, "Power generation status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xCC, "Measured in-house instantaneous power consumption", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xCD, "Measured in-house cumulative power consumption", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xCE, "In-house cumulative power consumption reset", "unsigned char", 1, "-", "optional", "-"))
obj.add_property(Property(0xD0, "System interconnected type", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE1, "Measured remaining hot water amount", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Tank capacity", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x7F)] = obj
# Electric energy meter (0x0280)
obj = Object("Electric energy meter", 0x02, 0x80)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Integral electric energy measurement value", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Integral electric energy unit", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Integral electric energy measurement log 1", "unsigned long × 48", 192, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Integral electric energy measurement log 2", "unsigned long ×48 ×45", 8640, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x80)] = obj
# Water flow meter (0x0281)
obj = Object("Water flow meter", 0x02, 0x81)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xD0, "Flowing water classification", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD1, "Owner classification", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Measured cumulative amount of flowing water", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Unit for measured cumulative amounts of flowing water", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Historical data of measured cumulative amounts of flowing water", "unsigned long ×48", 192, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Detection of abnormal value in metering data", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE4, "Security data information", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE5, "ID number setting", "unsigned char", 6, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Verification expiration information", "unsigned char", 6, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x81)] = obj
# Gas meter (0x0282)
obj = Object("Gas meter", 0x02, 0x82)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Integral gas consumption measurement value", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Integral gas consumption measurement log", "unsigned long × 48", 192, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x82)] = obj
# LP gas meter (0x0283)
obj = Object("LP gas meter", 0x02, 0x83)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Integral gas consumption of metering data 1", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Integral gas consumption of metering data 2", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Error detection statusof metering data", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE3, "Security data 1", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Security data 2", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Center valve shut-off status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE6, "Center valve shut-off recovery permission setting status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE7, "Emergency valve shut-off status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE8, "Shut-off valve open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE9, "Residual volume control warning", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xEA, "Set value of residual volume control warning level 1", "unsigned char × 3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "Set value of residual volume control warning level 2", "unsigned char × 3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Set value of residual volume control warning level 3", "unsigned char ×3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Slight leak timer value (gas flow rate continuation)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEE, "Slight leak timer value (without pressure increase)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEF, "Shut-off reason log", "unsigned char × 3", 3, "optional", "-", "-"))
obj.add_property(Property(0xD0, "Maximum value of supply pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD1, "Minimum value of supply pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD2, "Current value of supply pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Maximum value of block pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Minimum value of block pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Current value of block pressure data", "unsigned short", 2, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Number of block pressure/supply pressure error days:time", "unsigned char × 4", 4, "optional", "-", "-"))
obj.add_property(Property(0xD7, "Test call setting", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x83)] = obj
# Distribution panel metering (0x0287)
obj = Object("Distribution panel metering", 0x02, 0x87)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Master rated capacity", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Number of measurement channels (simplex)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB2, "Channel range specification for cumulative amount of electric power consumption measurement (simplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xB3, "Measured cumulative amount of electric power consumption list (simplex)", "unsigned char + unsigned char + (unsigned long (Max) × 60)", 0, "optional", "-", "-"))
obj.add_property(Property(0xB4, "Channel range specification for instantaneous current measurement (simplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xB5, "Measured instantaneous current list (simplex)", "unsigned char + unsigned char + (signed short × 2 (Max) × 60)", 0, "optional", "-", "-"))
obj.add_property(Property(0xB6, "Channel range specification for instantaneous power consumption measurement (simplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xB7, "Measured instantaneous power consumption list (simplex)", "unsigned char + unsigned char + (signed long (Max) × 60)", 0, "optional", "-", "-"))
obj.add_property(Property(0xB8, "Number of measurement channels (duplex)", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB9, "Channel range specification for cumulative amount of electric power consumption measurement (duplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xBA, "Measured cumulative amount of electric power consumption list (duplex)", "unsigned char + unsigned char + (unsigned long + unsigned long (Max) × 30)", 0, "optional", "-", "-"))
obj.add_property(Property(0xBB, "Channel range specification for instantaneous current measurement (duplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xBC, "Measured instantaneous current list (duplex)", "unsigned char + unsigned char + (signed short × 2 (Max) × 60)", 0, "optional", "-", "-"))
obj.add_property(Property(0xBD, "Channel range specification for instantaneous power consumption measurement (duplex)", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xBE, "Measured instantaneous power consumption list (duplex)", "unsigned char + unsigned char + (signed long (Max) × 60)", 0, "optional", "-", "-"))
obj.add_property(Property(0xC0, "Measured cumulative amount of electric energy (normal direction)", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC1, "Measured cumulative amount of electric energy (reverse direction)", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xC2, "Unit for cumulative amounts of electric energy", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xC3, "Historical data of measured cumulative amounts of electric energy (normal direction)", "unsigned short +unsign ed long ×48", 194, "optional", "-", "-"))
obj.add_property(Property(0xC4, "Historical data of measured cumulative amounts of electric energy (reverse direction)", "unsigned short +unsign ed long ×48", 194, "optional", "-", "-"))
obj.add_property(Property(0xC5, "Day for which the historical data of measured cumulative amounts of electric energy is to be retrieved", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC6, "Measured instantaneo us amount of electric energy", "signed long", 4, "optional", "-", "-"))
obj.add_property(Property(0xC7, "Measured instantaneous currents", "signed short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xC8, "Measured instantaneous voltages", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xD0, "Measurement channel 1", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD1, "Measurement channel 2", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD2, "Measurement channel 3", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Measurement channel 4", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Measurement channel 5", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Measurement channel 6", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Measurement channel 7", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD7, "Measurement channel 8", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD8, "Measurement channel 9", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xD9, "Measurement channel 10", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDA, "Measurement channel 11", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDB, "Measurement channel 12", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Measurement channel 13", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDD, "Measurement channel 14", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDE, "Measurement channel 15", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xDF, "Measurement channel 16", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE0, "Measurement channel 17", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE1, "Measurement channel 18", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Measurement channel 19", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Measurement channel 20", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Measurement channel 21", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Measurement channel 22", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE6, "Measurement channel 23", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE7, "Measurement channel 24", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE8, "Measurement channel 25", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xE9, "Measurement channel 26", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xEA, "Measurement channel 27", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xEB, "Measurement channel 28", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xEC, "Measurement channel 29", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xED, "Measurement channel 30", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xEE, "Measurement channel 31", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
obj.add_property(Property(0xEF, "Measurement channel 32", "unsigned long + signed short ×2", 8, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x87)] = obj
# Smart electric energy meter (0x0288)
obj = Object("Smart electric energy meter", 0x02, 0x88)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xD0, "Electric energy meter classification", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD1, "Owner classification", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD2, "Phases and wires setting status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Composite transformation ratio", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Multiplying factor for composite transformation ratio", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Meter type certification number", "unsigned char × 10", 10, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Year and month of inspection expiry", "unsigned char × 6", 6, "optional", "optional", "-"))
obj.add_property(Property(0xD7, "Number of effective digits for cumulative amounts of electric energy", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE0, "Measured cumulative amount of electric energy (normal direction)", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Unit for cumulative amounts of electric energy (normal and reverse directions)", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xE2, "Historical data of measured cumulative amounts of electric energy (normal direction)", "unsigned short + unsigned long ×48", 194, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Measured cumulative amounts of electric energy (reverse direction)", "unsigned long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Historical data of measured cumulative amounts of electric energy (reverse direction)", "unsigned short +unsigned long ×48", 194, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Day for which the historical data of measured cumulative amounts of electric energy is to be retrieved", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Measured instantaneous electric energy", "signed long", 4, "optional", "-", "-"))
obj.add_property(Property(0xE8, "Measured instantaneous currents", "signed short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xE9, "Measured instantaneous voltages", "unsigned short ×2", 4, "optional", "-", "-"))
obj.add_property(Property(0xEA, "Cumulative amounts of electric energy measured at fixed time (normal direction)", "unsigned char ×4 + unsigned char×3 + unsigned long ", 11, "mandatory", "-", "-"))
obj.add_property(Property(0xEB, "Cumulative amounts of electric energy measured at fixed time (reverse direction)", "unsigned char ×4 + unsigned char ×3 + unsigned long", 11, "optional", "-", "-"))
__std_scsl_objects[(0x02, 0x88)] = obj
# Smart gas meter (0x0289)
obj = Object("Smart gas meter", 0x02, 0x89)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Gas meter classification setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Owner classification setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Measured cumulative gas consumption", "unsigned long", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xE3, "Unit for measured cumulative gas consumption", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE4, "Historical data of measured cumulative gas consumption", "unsigned short +unsigne d long ×48", 194, "optional", "-", "-"))
obj.add_property(Property(0xE5, "Day setting for which the historical data of measured cumulative gas consumption is to be retrieved", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Detection of abnormal value in metering data", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE7, "Security data information", "unsigned char ×10", 10, "optional", "-", "-"))
obj.add_property(Property(0xE8, "Valve closure by the Center", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE9, "Permission from the Center to reopen the valve closed by the Center", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEA, "Emergency closure of shutoff valve", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEB, "Shutoff valve status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xEC, "Historical data of shutoff reasons", "unsigned char ×3", 3, "optional", "-", "-"))
obj.add_property(Property(0xED, "ID number setting", "unsigned char", 6, "optional", "optional", "-"))
obj.add_property(Property(0xEE, "Verification expiration setting", "unsigned char", 6, "optional", "optional", "-"))
obj.add_property(Property(0xD0, "Measured cumulative gas consumption information with date and time", "unsigne d char×4+ unsigne d char×3+ unsigne d long", 11, "mandatory", "-", "-"))
obj.add_property(Property(0xD1, "Historical information of cumulative gas consumption", "unsigne d char×4+ unsigne d char×3+ unsigne d long×24 +unsign ed long+un signed short", 109, "-", "-", "-"))
__std_scsl_objects[(0x02, 0x89)] = obj
# General lighting class (0x0290)
obj = Object("General lighting class", 0x02, 0x90)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB0, "Illuminance level", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Light color setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB2, "Illuminance level step setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB3, "Light color step setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB4, "Maximum specifiable values", "unsigned char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xB5, "Maximum value of settable level for night lighting", "unsigned char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xB6, "Lighting mode setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xB7, "Illuminance level setting for main lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB8, "Illuminance level step setting for main lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB9, "Illuminance level setting for night lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBA, "Illuminance level step setting for night lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBB, "Light color setting for main lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBC, "Light color level step setting for main lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBD, "Light color setting for night lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBE, "Light color level step setting for night lighting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xBF, "Lighting mode status in auto mode", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xC0, "RGB setting for color lighting", "unsigned char×3", 3, "optional", "optional", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x94, "OFF timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x95, "OFF timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0x90)] = obj
# Buzzer (0x02A0)
obj = Object("Buzzer", 0x02, 0xA0)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB1, "Sound generation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Buzzer sound type", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x02, 0xA0)] = obj
# Electric hot water pot(electric thermos) (0x03B2)
obj = Object("Electric hot water pot(electric thermos)", 0x03, 0xB2)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Cover open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "No-water warning", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xB2, "Boil-up setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Boil-up/warmer mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Set value of warmer temperature", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Hot water discharge status", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xE3, "Lock status", "unsigned char", 1, "optional", "-", "-"))
__std_scsl_objects[(0x03, 0xB2)] = obj
# Refrigerator (0x03B7)
obj = Object("Refrigerator", 0x03, 0xB7)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Door open/close status", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xB1, "Door open warning", "unsigned char", 1, "optional", "-", "mandatory"))
obj.add_property(Property(0xB2, "Refrigerator compartment door status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB3, "Freezer compartment door status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB4, "Ice compartment door status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB5, "Vegetable compartment door status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB6, "Multi-refrigera- ting mode compartment door", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE0, "Maximum allowable temperature setting level", "unsigned char × 8", 8, "optional", "-", "-"))
obj.add_property(Property(0xE2, "Refrigerator compartment temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Freezer compartment temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Ice temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Vegetable compartment temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Multi-refrigera- ting mode compartment temperature setting", "signed char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Refrigerator compartment temperature level setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Freezer compartment temperature level setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "ice compartment temperature level setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Vegetable compartment temperature level setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Multi-refrigera- ting mode compartment temperature level setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD1, "Measured refrigerator compartment temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD2, "Measured freezer compartment temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD3, "Measured subzero-fresh compartment temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Measured vegetable compartment temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Measured multi-refrigeratin g mode compartment temperature", "signed char", 1, "optional", "-", "-"))
obj.add_property(Property(0xD8, "Compressor rotation speed", "unsigned char", 2, "optional", "-", "-"))
obj.add_property(Property(0xDA, "Measured electric current consumption", "unsigned char", 2, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Rated power consumption", "unsigned char", 2, "optional", "-", "-"))
obj.add_property(Property(0xA0, "Quick freeze function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA1, "Quick refrigeration function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA4, "Icemaker setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA5, "Icemaker operation status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xA6, "Icemaker tank status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xA8, "Refrigerator compartment humidification function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA9, "Vegetable compartment humidification function setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xAD, "Deodorization function setting", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xB7)] = obj
# Combination microwave oven(Electronic oven) (0x03B8)
obj = Object("Combination microwave oven(Electronic oven)", 0x03, 0xB8)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Door open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Heating status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB2, "Heating setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "Heating mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Automatic heating setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Automatic heating level setting", "unsigned cha", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD0, "Automatic heating menu setting", "unsigned cha", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD1, "Oven mode setting", "unsigned cha", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD5, "Oven preheating setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD6, "Fermenting mode setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Chamber temperature setting", "signed short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Food temperature setting", "signed short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Heating time setting", "unsigned char ×3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "Remaining heating time setting", "unsigned char ×3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Microwave heating power setting", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Prompt message setting", "unsigned char ×2 ×4", 8, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "“Accessories to combination microwave oven” setting", "unsigned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Display character string setting", "unsigned short ×20", 40, "-", "optional", "-"))
obj.add_property(Property(0xEB, "Two-stage microwave heating setting (duration)", "unsigned char ×3 ×2", 6, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Two-stage microwave heating setting (heating power)", "unsigned short ×2", 4, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xB8)] = obj
# Cooking heater (0x03B9)
obj = Object("Cooking heater", 0x03, 0xB9)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB1, "Heating status", "unsigned char × 4", 4, "mandatory", "-", "-"))
obj.add_property(Property(0xB2, "Heating setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB3, "“All stop” setting", "unsigned char", 1, "-", "mandatory", "-"))
obj.add_property(Property(0xE7, "Heating power setting", "unsigned char × 4", 8, "optional", "optional", "-"))
obj.add_property(Property(0xE3, "Heating temperature setting", "unsigned char × 3", 3, "optional", "optional", "-"))
obj.add_property(Property(0xE0, "“Heating modes of stoves” setting", "unsigned char × 3", 3, "optional", "optional", "-"))
obj.add_property(Property(0x96, "Relative time settings of OFF timers", "unsigned char × 3 × 4", 12, "optional", "optional", "-"))
obj.add_property(Property(0xA1, "Child lock setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xA2, "Radiant heater lock setting", "unsigned char", 1, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xB9)] = obj
# Rice cooker (0x03BB)
obj = Object("Rice cooker", 0x03, 0xBB)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Cover open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB1, "Rice cooking status", "unsigned char", 1, "mandatory", "-", "-"))
obj.add_property(Property(0xB2, "Rice cooking control setting", "unsigned char", 1, "mandatory", "mandatory", "-"))
obj.add_property(Property(0xE1, "Warmer setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Inner pot removal status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE6, "Cover removal status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0x90, "Rice cooking reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "Set value of rice cooking reservation setting time", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Set value of rice cooking reservation setting relative time", "unsigned char × 2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xBB)] = obj
# Washing machine (0x03C5)
obj = Object("Washing machine", 0x03, 0xC5)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Door/cover open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB2, "Washing machine setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Current stage of washing cycle", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE6, "Time remaining to complete washing cycle", "unsigned char × 3", 3, "optional", "-", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Relative time-based ON timer setting", "unsigned char × 2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xC5)] = obj
# Clothes dryer (0x03C6)
obj = Object("Clothes dryer", 0x03, 0xC6)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Door/cover open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB2, "Drying setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE1, "Drying status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE6, "Remaining drying time", "unsigned char ×3", 3, "optional", "-", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Relative time-based ON timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xC6)] = obj
# Washer and dryer (0x03D3)
obj = Object("Washer and dryer", 0x03, 0xD3)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xB0, "Door/cover open/close status", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xB2, "Washer and dryer setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD0, "Washer and dryer cycle setting 1 (Note 1)", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD1, "Washer and dryer cycle setting 2 (Note 1)", "unsig ned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD2, "Drying cycle setting (Note1)", "unsig ned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD3, "Washer and dryer cycle option list 1", "unsig ned char ×12 ", 12, "optional", "-", "-"))
obj.add_property(Property(0xD4, "Washer and dryer cycle option list 2", "unsig ned char ×4 ", 4, "optional", "-", "-"))
obj.add_property(Property(0xD5, "Washer and dryer cycle option list 3", "unsig ned char ×4 ", 4, "optional", "-", "-"))
obj.add_property(Property(0xD6, "Water flow rate setting", "unsig ned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xD7, "“Rotation speed for spin drying” setting", "unsig ned short", 2, "optional", "optional", "-"))
obj.add_property(Property(0xD8, "“Degree of drying” setting", "unsig ned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xDB, "Remaining washing time", "unsign ed char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xDC, "Remaining drying time", "unsign ed char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xDF, "Elapsed time on the ON timer", "unsign ed char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xE1, "Presoaking time setting", "unsign ed char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE2, "Current stage of washer and dryer cycle", "unsigned char", 1, "optional", "-", "-"))
obj.add_property(Property(0xE3, "Water volume setting 1", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE4, "Water volume setting 2", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE5, "Washing time setting", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xE6, "“Number of times of rinsing” setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE7, "Rinsing process setting", "unsigned char ×4", 4, "optional", "optional", "-"))
obj.add_property(Property(0xE8, "Spin drying time setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xE9, "Drying time setting", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0xEA, "Warm water setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEB, "Bathtub water recycle setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEC, "Wrinkling minimization setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xED, "Time remaining to complete washer and dryer cycle", "unsigned char ×2", 2, "optional", "-", "-"))
obj.add_property(Property(0xEE, "Door/cover lock setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xEF, "Washer and dryer cycle", "unsigned Char ×24", 24, "optional", "-", "-"))
obj.add_property(Property(0x90, "ON timer reservation setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0x91, "ON timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
obj.add_property(Property(0x92, "Relative time-based ON timer setting", "unsigned char ×2", 2, "optional", "optional", "-"))
__std_scsl_objects[(0x03, 0xD3)] = obj
# Weighing machine (0x0401)
obj = Object("Weighing machine", 0x04, 0x01)
obj.add_property(Property(0x80, "Operation status", "unsigned short", 1, "mandatory", "optional", "mandatory"))
obj.add_property(Property(0xE0, "Measured value of body weight", "unsigned short", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xE1, "Measured value of body fat", "unsigned short", 2, "optional", "-", "-"))
__std_scsl_objects[(0x04, 0x01)] = obj
# Switch (supporting JEM-A / HA terminals) (0x05FD)
obj = Object("Switch (supporting JEM-A / HA terminals)", 0x05, 0xFD)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xE0, "Connected device", "unsigned char", 12, "optional", "optional", "-"))
__std_scsl_objects[(0x05, 0xFD)] = obj
# Display (0x0601)
obj = Object("Display", 0x06, 0x01)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB0, "Display control setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Character string setting acceptance status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xB2, "Supported character codes", "unsigned char×2", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xB3, "Character string to present to the user", "unsigned char× Max 247", 0, "optional", "mandatory", "-"))
obj.add_property(Property(0xB4, "Length of character string accepted", "unsigned char", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x06, 0x01)] = obj
# Television (0x0602)
obj = Object("Television", 0x06, 0x02)
obj.add_property(Property(0x80, "Operation status", "unsigned char", 1, "mandatory", "mandatory", "mandatory"))
obj.add_property(Property(0xB0, "Display control setting", "unsigned char", 1, "optional", "optional", "-"))
obj.add_property(Property(0xB1, "Character string setting acceptance status", "unsigned char", 1, "mandatory", "-", "mandatory"))
obj.add_property(Property(0xB2, "Supported character codes", "unsigned char× 2", 2, "mandatory", "-", "-"))
obj.add_property(Property(0xB3, "Character string to present to the user", "unsigned char× Max 247", 0, "optional", "mandatory", "-"))
obj.add_property(Property(0xB4, "Length of character string accepted", "unsigned char× 2", 2, "mandatory", "-", "-"))
__std_scsl_objects[(0x06, 0x02)] = obj
| 90.875786
| 209
| 0.706291
| 14,619
| 115,594
| 5.512279
| 0.059443
| 0.066043
| 0.1541
| 0.242157
| 0.84559
| 0.828936
| 0.809813
| 0.789201
| 0.762198
| 0.713541
| 0
| 0.043483
| 0.104123
| 115,594
| 1,271
| 210
| 90.947286
| 0.732778
| 0.029552
| 0
| 0.287184
| 0
| 0.000935
| 0.499429
| 0.000393
| 0
| 0
| 0.044366
| 0
| 0
| 1
| 0.000935
| false
| 0.002806
| 0.000935
| 0.000935
| 0.002806
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
1ea77da10052c034b3a00079a4248164521d8698
| 138
|
py
|
Python
|
apdt/alz/__init__.py
|
zhaofeng-shu33/apdt
|
34ca212c9a7b294ee31f1c4ed4fa7569fbcc629e
|
[
"Apache-2.0"
] | null | null | null |
apdt/alz/__init__.py
|
zhaofeng-shu33/apdt
|
34ca212c9a7b294ee31f1c4ed4fa7569fbcc629e
|
[
"Apache-2.0"
] | null | null | null |
apdt/alz/__init__.py
|
zhaofeng-shu33/apdt
|
34ca212c9a7b294ee31f1c4ed4fa7569fbcc629e
|
[
"Apache-2.0"
] | null | null | null |
from apdt.alz.utils import haversine, IDW
from apdt.alz.find_sites import find_sites_range
from apdt.alz.eventdetect import wavelet_detect
| 46
| 48
| 0.862319
| 23
| 138
| 5
| 0.565217
| 0.208696
| 0.286957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.086957
| 138
| 3
| 49
| 46
| 0.912698
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
1ead3320f1ee5f1575e6eacf0a5daa857b87b772
| 366
|
py
|
Python
|
sdat/tools_merge/__init__.py
|
Chipeyown/SPLiT-seq-Data-Analysis_Toolkit
|
903fdbeeed8d0ef91c7a08af6226731297b21bdc
|
[
"MIT"
] | 4
|
2019-09-11T07:20:22.000Z
|
2020-09-04T09:21:18.000Z
|
sdat/tools_merge/__init__.py
|
Chipeyown/SPLiT-seq-Data-Analysis_Toolkit
|
903fdbeeed8d0ef91c7a08af6226731297b21bdc
|
[
"MIT"
] | 1
|
2019-09-10T01:37:18.000Z
|
2019-09-10T01:45:42.000Z
|
sdat/tools_merge/__init__.py
|
Chipeyown/SPLiT-seq-Data-Analysis_Toolkit
|
903fdbeeed8d0ef91c7a08af6226731297b21bdc
|
[
"MIT"
] | 1
|
2020-09-17T02:24:06.000Z
|
2020-09-17T02:24:06.000Z
|
from sdat.tools_merge.merge_fastq import *
from sdat.tools_merge.merge_reads_per_cell import *
from sdat.tools_merge.merge_barcode import *
from sdat.tools_merge.merge_filter_ratio import *
from sdat.tools_merge.merge_sam import *
from sdat.tools_merge.merge_rmdup_log import *
from sdat.tools_merge.merge_cell_log import *
from sdat.tools_merge.merge_cell import *
| 40.666667
| 51
| 0.846995
| 61
| 366
| 4.737705
| 0.245902
| 0.221453
| 0.359862
| 0.49827
| 0.83045
| 0.750865
| 0.249135
| 0.249135
| 0
| 0
| 0
| 0
| 0.087432
| 366
| 8
| 52
| 45.75
| 0.865269
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 9
|
949626b520f3b44e67265535d008e00d5fddf40c
| 6,845
|
py
|
Python
|
tests/dhcpv6/kea_only/user_chk/test_v6_user_check_general_logs.py
|
isc-projects/forge
|
dfec8b41003d6b5a229f69ee93616e0e5cc6d71b
|
[
"0BSD"
] | 22
|
2015-02-27T11:51:05.000Z
|
2022-02-28T12:39:29.000Z
|
tests/dhcpv6/kea_only/user_chk/test_v6_user_check_general_logs.py
|
isc-projects/forge
|
dfec8b41003d6b5a229f69ee93616e0e5cc6d71b
|
[
"0BSD"
] | 16
|
2018-10-30T15:00:12.000Z
|
2019-01-11T17:55:13.000Z
|
tests/dhcpv6/kea_only/user_chk/test_v6_user_check_general_logs.py
|
isc-projects/forge
|
dfec8b41003d6b5a229f69ee93616e0e5cc6d71b
|
[
"0BSD"
] | 11
|
2015-02-27T11:51:36.000Z
|
2021-03-30T08:33:54.000Z
|
"""Kea6 User Check Hook Library - Logging"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_control
import srv_msg
import misc
@pytest.mark.v6
@pytest.mark.kea_only
@pytest.mark.user_check
@pytest.mark.IA_NA
@pytest.mark.logging
def test_user_check_hook_IA_NA_no_registry_logging():
# Without a user registry and multiple subnets
# Subnet selection will use subnet interface for subnet selection hint
misc.test_setup()
srv_msg.remove_file_from_server('/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
srv_control.configure_loggers('kea-dhcp6.callouts', 'ERROR', 'None')
srv_control.configure_loggers('kea-dhcp6.hooks', 'ERROR', 'None')
srv_control.add_hooks('libdhcp_user_chk.so')
srv_control.build_and_send_config_files()
srv_control.start_srv_during_process('DHCP', 'configuration')
# DHCP server is started.
#
# Test Procedure:
# Client does include client-id.
# Client does include IA_Address.
# Client does include IA-NA.
# Client sends SOLICIT message.
#
# Pass Criteria:
# Server MUST respond with ADVERTISE message.
# Response MUST include option 3.
# Response option 3 MUST contain sub-option 5.
# Response sub-option 5 from option 3 MUST contain address 3000::5.
# File stored in kea.log MUST NOT contain line or phrase: DEBUG \[kea-dhcp6.hooks
# File stored in kea.log MUST contain line or phrase: ERROR \[kea-dhcp6.hooks
# File stored in kea.log MUST NOT contain line or phrase: DEBUG \[kea-dhcp6.callouts
@pytest.mark.v6
@pytest.mark.kea_only
@pytest.mark.user_check
@pytest.mark.IA_NA
@pytest.mark.logging
def test_user_check_hook_IA_NA_with_registry_unknown_user_logging():
# With a user registry and multiple subnets
# an unknown user should get last subnet
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv6/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
srv_control.add_hooks('libdhcp_user_chk.so')
srv_control.configure_loggers('kea-dhcp6.callouts', 'DEBUG', 99)
srv_control.configure_loggers('kea-dhcp6.hooks', 'INFO', 'None')
srv_control.build_and_send_config_files()
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
# Send a query from an unregistered user
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01')
srv_msg.client_does_include('Client', 'client-id')
srv_msg.client_does_include('Client', 'IA_Address')
srv_msg.client_does_include('Client', 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', 'ADVERTISE')
srv_msg.response_check_include_option(3)
srv_msg.response_check_option_content(3, 'sub-option', 5)
srv_msg.response_check_suboption_content(5, 3, 'addr', '1000::5')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv6/kea_only/user_chk/outcome_1.txt')
srv_msg.log_contains(r'INFO \[kea-dhcp6.hooks')
srv_msg.log_contains(r'DEBUG \[kea-dhcp6.callouts')
@pytest.mark.v6
@pytest.mark.kea_only
@pytest.mark.user_check
@pytest.mark.IA_NA
@pytest.mark.logging
def test_user_check_hook_IA_NA_with_registry_unknown_user_logging_2():
# With a user registry and multiple subnets
# an unknown user should get last subnet
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv6/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
srv_control.add_hooks('libdhcp_user_chk.so')
srv_control.configure_loggers('kea-dhcp6.callouts', 'DEBUG', 99)
srv_control.configure_loggers('kea-dhcp6.hooks', 'DEBUG', 99)
srv_control.build_and_send_config_files()
# DHCP server failed to start. During configuration process.
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
# Send a query from an unregistered user
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01')
srv_msg.client_does_include('Client', 'client-id')
srv_msg.client_does_include('Client', 'IA_Address')
srv_msg.client_does_include('Client', 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', 'ADVERTISE')
srv_msg.response_check_include_option(3)
srv_msg.response_check_option_content(3, 'sub-option', 5)
srv_msg.response_check_suboption_content(5, 3, 'addr', '1000::5')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv6/kea_only/user_chk/outcome_1.txt')
srv_msg.forge_sleep(10, 'seconds')
srv_control.start_srv('DHCP', 'stopped')
misc.test_setup()
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
srv_control.add_hooks('libdhcp_user_chk.so')
srv_control.configure_loggers('kea-dhcp6.callouts', 'DEBUG', 99)
srv_control.configure_loggers('kea-dhcp6.hooks', 'INFO', 'None')
srv_control.build_and_send_config_files()
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
# Send a query from an unregistered user
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:02')
srv_msg.client_does_include('Client', 'client-id')
srv_msg.client_does_include('Client', 'IA_Address')
srv_msg.client_does_include('Client', 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', 'ADVERTISE')
srv_msg.response_check_include_option(3)
srv_msg.response_check_option_content(3, 'sub-option', 5)
srv_msg.response_check_suboption_content(5, 3, 'addr', '1000::5')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
# That test works, we don't need last step:
# Client compares downloaded file from server with local file stored in:
# tests/dhcpv6/kea_only/user_chk/outcome_1.txt.
| 42.515528
| 88
| 0.733674
| 1,053
| 6,845
| 4.459639
| 0.144349
| 0.05494
| 0.03833
| 0.048978
| 0.839225
| 0.828152
| 0.82155
| 0.799404
| 0.799404
| 0.78322
| 0
| 0.040102
| 0.140248
| 6,845
| 160
| 89
| 42.78125
| 0.757859
| 0.208035
| 0
| 0.838095
| 0
| 0
| 0.254133
| 0.096229
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028571
| true
| 0.028571
| 0.038095
| 0
| 0.066667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
94c8055632fb47ec2865018f0eb7726341786c51
| 7,510
|
py
|
Python
|
scripts/measure similarity.py
|
adowaconan/working_memory
|
2d2811c0213b0f6f60759d53c345220a72e45f94
|
[
"MIT"
] | null | null | null |
scripts/measure similarity.py
|
adowaconan/working_memory
|
2d2811c0213b0f6f60759d53c345220a72e45f94
|
[
"MIT"
] | null | null | null |
scripts/measure similarity.py
|
adowaconan/working_memory
|
2d2811c0213b0f6f60759d53c345220a72e45f94
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 22 19:30:55 2018
@author: ning
"""
import mne
import os
from glob import glob
#import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from tqdm import tqdm
#import scipy.io as so
import re
import scipy.spatial as sp
import pickle
working_dir = 'D:/working_memory/encode_delay_similarity/'
saving_dir = 'D:\\working_memory\\working_memory\\results\\similarity measure\\pdf\\'
if not os.path.exists(saving_dir):
os.mkdir(saving_dir)
epochs_ = glob(os.path.join(working_dir,'*load2*-epo.fif'))
results = {}
for e in epochs_:
plt.close('all')
epochs = mne.read_epochs(e,preload=True)
sub,load,day = re.findall('\d+',e)
for window_size in [int(10),int(20),int(50),int(100)]:
# due to mne python add additional last sample to the data, we take it out and make it a even number length for the time dimension
images = epochs.copy().crop(0,4).get_data()[:,:,:4000]*1e6
delay = epochs.copy().crop(4,9.8).get_data()[:,:,:5800]*1e6
# get the number of trials
n_trials = images.shape[0]
# segmenting the data with a window_size ms nonoverlapping sharp window
images = images.reshape(n_trials,61,window_size,-1)
delay = delay.reshape(n_trials,61,window_size,-1)
# average over the window_size ms window
images_ = images.mean(2)
delay_ = delay.mean(2)
# compute the euclidean distance and cosine distance in matrix operations
euclidean,cosine = [],[]
for trial in tqdm(range(images.shape[0]),desc='sub%s_load%s_day%s'%(sub,load,day)):
# euclidean distance
temp_confusion = 0-sp.distance.cdist(images_[trial].T,delay_[trial].T,'euclidean')
euclidean.append(temp_confusion)
# cosine distance
# subtract from 1 because the algorithm have cosine distance subtracted from 1,
# so subtract it from 1 will give us the value of cosine
temp_confusion = 1 - sp.distance.cdist(images_[trial].T,delay_[trial].T,'cosine')
cosine.append(temp_confusion)
# covert to numpy array
euclidean = np.array(euclidean)
cosine = np.array(cosine)
# save the result in a dictionary
results={'euclidean_distances':euclidean,'cosine_distance':cosine}
# pickle save result for each subject
pickle.dump(results,open(os.path.join(working_dir,
'similarity measure result_sub%s_load%s_day%s_windowsize_%d.p'%(sub,load,day,window_size)),'wb') )
# take the mean over the trials
euclidean_mean = euclidean.mean(0)
# plot the mean euclidean distance over trials
fig,ax = plt.subplots(figsize=(12,12))
im = ax.imshow(euclidean_mean,origin='lower',aspect='auto',cmap='RdBu_r',extent=[0,6000,0,4000])
ax.set(xlabel='Delay',ylabel='Encode',title='Euclidean distance\nsub%s_load%s_day%s\nwindowsize_%d'%(sub,load,day,window_size))
for a in [2000]:
ax.axhline(a,color='k',lw=2,)
plt.colorbar(im)
fig.savefig(os.path.join(saving_dir,'Euclidean distance_sub%s_load%s_day%s_windowsize_%d.pdf'%(sub,load,day,window_size)),dpi=300)
# plot the mean cosine distance over trials
cosine_mean = cosine.mean(0)
fig,ax = plt.subplots(figsize=(12,12))
im = ax.imshow(cosine_mean,origin='lower',aspect='auto',cmap='RdBu_r',extent=[0,6000,0,4000],)#vmin=0.75,vmax=.85)
ax.set(xlabel='Delay',ylabel='Encode',title='Cosine distance\nsub%s_load%s_day%s\nwindowsize_%d'%(sub,load,day,window_size))
for a in [2000]:
ax.axhline(a,color='k',lw=2,)
plt.colorbar(im)
fig.savefig(os.path.join(saving_dir,'Cosine distance_sub%s_load%s_day%s_windowsize_%d.pdf'%(sub,load,day,window_size)),dpi=300)
plt.close('all')
#pickle.dump(results,open(os.path.join(working_dir,'similarity measure results.p'),'wb') )
#python "D:\\working_memory\\working_memory\\scripts\\preprocessing encode delay autoreject.py"
epochs_ = glob(os.path.join(working_dir,'*load5*-epo.fif'))
for e in epochs_:
plt.close('all')
epochs = mne.read_epochs(e,preload=True)
sub,load,day = re.findall('\d+',e)
for window_size in [int(10),int(20),int(50),int(100)]:
# due to mne python add additional last sample to the data, we take it out and make it a even number length for the time dimension
images = epochs.copy().crop(0,10).get_data()[:,:,:10000]*1e6
delay = epochs.copy().crop(10,15.8).get_data()[:,:,:5800]*1e6
# get the number of trials
n_trials = images.shape[0]
# segmenting the data with a window_size ms nonoverlapping sharp window
images = images.reshape(n_trials,61,window_size,-1)
delay = delay.reshape(n_trials,61,window_size,-1)
# average over the window_size ms window
images_ = images.mean(2)
delay_ = delay.mean(2)
# compute the euclidean distance and cosine distance in matrix operations
euclidean,cosine = [],[]
for trial in tqdm(range(images.shape[0]),desc='distance'):
# euclidean distance
temp_confusion = 0-sp.distance.cdist(images_[trial].T,delay_[trial].T,'euclidean')
euclidean.append(temp_confusion)
# cosine distance
# subtract from 1 because the algorithm have cosine distance subtracted from 1,
# so subtract it from 1 will give us the value of cosine
temp_confusion = 1 - sp.distance.cdist(images_[trial].T,delay_[trial].T,'cosine')
cosine.append(temp_confusion)
# covert to numpy array
euclidean = np.array(euclidean)
cosine = np.array(cosine)
# save the result in a dictionary
results={'euclidean_distances':euclidean,'cosine_distance':cosine}
# pickle save result for each subject
pickle.dump(results,open(os.path.join(working_dir,
'similarity measure result_sub%s_load%s_day%s_windowsize_%d.p'%(sub,load,day,window_size)),'wb') )
# take the mean over the trials
euclidean_mean = euclidean.mean(0)
# plot the mean euclidean distance over trials
fig,ax = plt.subplots(figsize=(12,12))
im = ax.imshow(euclidean_mean,origin='lower',aspect='auto',cmap='RdBu_r',extent=[0,6000,0,10000])
ax.set(xlabel='Delay',ylabel='Encode',title='Euclidean distance\nsub%s_load%s_day%s\nwindowsize_%d'%(sub,load,day,window_size))
for a in [2000,4000,6000,8000]:
ax.axhline(a,color='k',lw=2,)
plt.colorbar(im)
fig.savefig(os.path.join(saving_dir,'Euclidean distance_sub%s_load%s_day%s_windowsize_%d.pdf'%(sub,load,day,window_size)),dpi=300)
# plot the mean cosine distance over trials
cosine_mean = cosine.mean(0)
fig,ax = plt.subplots(figsize=(12,12))
im = ax.imshow(cosine_mean,origin='lower',aspect='auto',cmap='RdBu_r',extent=[0,6000,0,10000],)#vmin=0.75,vmax=.85)
ax.set(xlabel='Delay',ylabel='Encode',title='Cosine distance\nsub%s_load%s_day%s\nwindowsize_%d'%(sub,load,day,window_size))
for a in [2000,4000,6000,8000]:
ax.axhline(a,color='k',lw=2,)
plt.colorbar(im)
fig.savefig(os.path.join(saving_dir,'Cosine distance_sub%s_load%s_day%s_windowsize_%d.pdf'%(sub,load,day,window_size)),dpi=300)
plt.close('all')
| 52.517483
| 147
| 0.653928
| 1,113
| 7,510
| 4.290207
| 0.18239
| 0.041885
| 0.027225
| 0.020733
| 0.899058
| 0.878534
| 0.875812
| 0.863246
| 0.863246
| 0.863246
| 0
| 0.038702
| 0.212117
| 7,510
| 143
| 148
| 52.517483
| 0.768295
| 0.234221
| 0
| 0.729167
| 0
| 0
| 0.16398
| 0.093027
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.09375
| 0
| 0.09375
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
94ce6b4eb034abc49093728ad615c8816ffc9ca9
| 5,225
|
py
|
Python
|
tests/tests.py
|
jeanlucmargot/pyvax
|
18a6b3ff94661868c142d8e074fe9f2875d0bd56
|
[
"BSD-3-Clause"
] | null | null | null |
tests/tests.py
|
jeanlucmargot/pyvax
|
18a6b3ff94661868c142d8e074fe9f2875d0bd56
|
[
"BSD-3-Clause"
] | 1
|
2021-02-17T17:47:39.000Z
|
2021-02-23T19:47:33.000Z
|
tests/tests.py
|
jeanlucmargot/pyvax
|
18a6b3ff94661868c142d8e074fe9f2875d0bd56
|
[
"BSD-3-Clause"
] | 1
|
2021-02-09T02:34:06.000Z
|
2021-02-09T02:34:06.000Z
|
""" adaptation of part of Lawrence M. Baker's libvaxdata test suite for Gary Doran's PyVAX wrapper
Authors
-------
| Jean-Luc Margot (jlm@epss.ucla.edu)
Jean-Luc Margot
University of California, Los Angeles.
"""
import pyvax as pv
import numpy as np
from pytest import approx
def func_i2(x):
fstr = pv.from_vax_i2(x)
print(np.frombuffer(fstr, dtype=np.int16, count=1))
return np.frombuffer(fstr, dtype=np.int16, count=1)
def func_i4(x):
fstr = pv.from_vax_i4(x)
print(np.frombuffer(fstr, dtype=np.int32, count=1))
return np.frombuffer(fstr, dtype=np.int32, count=1)
def func_f4(x):
fstr = pv.from_vax_r4(x)
print(np.frombuffer(fstr, dtype=np.float32, count=1))
return np.frombuffer(fstr, dtype=np.float32, count=1)
def func_d8(x):
fstr = pv.from_vax_d8(x)
print(np.frombuffer(fstr, dtype=np.float64, count=1))
return np.frombuffer(fstr, dtype=np.float64, count=1)
def func_g8(x):
fstr = pv.from_vax_g8(x)
print(np.frombuffer(fstr, dtype=np.float64, count=1))
return np.frombuffer(fstr, dtype=np.float64, count=1)
def test_i2():
assert func_i2(b'\x01\x00') == 1
assert func_i2(b'\xFF\xFF') == -1
assert func_i2(b'\x00\x01') == 256
assert func_i2(b'\x00\xFF') == -256
assert func_i2(b'\x39\x30') == 12345
assert func_i2(b'\xC7\xCF') == -12345
def test_i4():
assert func_i4(b'\x01\x00\x00\x00') == 1
assert func_i4(b'\xFF\xFF\xFF\xFF') == -1
assert func_i4(b'\x00\x01\x00\x00') == 256
assert func_i4(b'\x00\xFF\xFF\xFF') == -256
assert func_i4(b'\x00\x00\x01\x00') == 65536
assert func_i4(b'\x00\x00\xFF\xFF') == -65536
assert func_i4(b'\x00\x00\x00\x01') == 16777216
assert func_i4(b'\x00\x00\x00\xFF') == -16777216
assert func_i4(b'\x15\xCD\x5B\x07') == 123456789
assert func_i4(b'\xEB\x32\xA4\xF8') == -123456789
def test_f4():
assert func_f4(b'\x80\x40\x00\x00') == approx(1.000000, rel=1e-7)
assert func_f4(b'\x80\xC0\x00\x00') == approx(-1.000000, rel=1e-7)
assert func_f4(b'\x60\x41\x00\x00') == approx(3.500000, rel=1e-7)
assert func_f4(b'\x60\xC1\x00\x00') == approx(-3.500000, rel=1e-7)
assert func_f4(b'\x49\x41\xD0\x0F') == approx(3.141590, rel=1e-7)
assert func_f4(b'\x49\xC1\xD0\x0F') == approx(-3.141590, rel=1e-7)
assert func_f4(b'\xF0\x7D\xC2\xBD') == approx(9.9999999E+36, rel=1e-7)
assert func_f4(b'\xF0\xFD\xC2\xBD') == approx(-9.9999999E+36, rel=1e-7)
assert func_f4(b'\x08\x03\xEA\x1C') == approx(9.9999999E-38, rel=1e-7)
assert func_f4(b'\x08\x83\xEA\x1C') == approx(-9.9999999E-38, rel=1e-7)
assert func_f4(b'\x9E\x40\x52\x06') == approx(1.234568, rel=1e-7)
assert func_f4(b'\x9E\xC0\x52\x06') == approx(-1.234568, rel=1e-7)
def test_d8():
assert func_d8(b'\x80\x40\x00\x00\x00\x00\x00\x00') == approx(1.000000000000000, rel=1e-14)
assert func_d8(b'\x80\xC0\x00\x00\x00\x00\x00\x00') == approx(-1.000000000000000, rel=1e-14)
assert func_d8(b'\x60\x41\x00\x00\x00\x00\x00\x00') == approx(3.500000000000000, rel=1e-14)
assert func_d8(b'\x60\xC1\x00\x00\x00\x00\x00\x00') == approx(-3.500000000000000, rel=1e-14)
assert func_d8(b'\x49\x41\xDA\x0F\x21\xA2\xBE\x68') == approx(3.141592653589793, rel=1e-14)
assert func_d8(b'\x49\xC1\xDA\x0F\x21\xA2\xBE\x68') == approx(-3.141592653589793, rel=1e-14)
assert func_d8(b'\xF0\x7D\xC2\xBD\xBB\x1A\xDB\x48') == approx(1.0000000000000000E+37, rel=1e-14)
assert func_d8(b'\xF0\xFD\xC2\xBD\xBB\x1A\xDB\x48') == approx(-1.0000000000000000E+37, rel=1e-14)
assert func_d8(b'\x08\x03\xEA\x1C\x54\x14\x75\x5C') == approx(9.9999999999999999E-38, rel=1e-14)
assert func_d8(b'\x08\x83\xEA\x1C\x54\x14\x75\x5C') == approx(-9.9999999999999999E-38, rel=1e-14)
assert func_d8(b'\x9E\x40\x52\x06\x62\x14\xE7\xCE') == approx(1.234567890123450, rel=1e-14)
assert func_d8(b'\x9E\xC0\x52\x06\x62\x14\xE7\xCE') == approx(-1.234567890123450, rel=1e-14)
def test_g8():
assert func_g8(b'\x10\x40\x00\x00\x00\x00\x00\x00') == approx(1.000000000000000, rel=1e-14)
assert func_g8(b'\x10\xC0\x00\x00\x00\x00\x00\x00') == approx(-1.000000000000000, rel=1e-14)
assert func_g8(b'\x2C\x40\x00\x00\x00\x00\x00\x00') == approx(3.500000000000000, rel=1e-14)
assert func_g8(b'\x2C\xC0\x00\x00\x00\x00\x00\x00') == approx(-3.500000000000000, rel=1e-14)
assert func_g8(b'\x29\x40\xFB\x21\x44\x54\x18\x2D') == approx(3.141592653589793, rel=1e-14)
assert func_g8(b'\x29\xC0\xFB\x21\x44\x54\x18\x2D') == approx(-3.141592653589793, rel=1e-14)
assert func_g8(b'\xBE\x47\xB8\x17\x57\x43\x1B\x69') == approx(1.0000000000000000E+37, rel=1e-14)
assert func_g8(b'\xBE\xC7\xB8\x17\x57\x43\x1B\x69') == approx(-1.0000000000000000E+37, rel=1e-14)
assert func_g8(b'\x61\x38\x9D\x03\x8A\x42\x8F\x8B') == approx(9.9999999999999999E-38, rel=1e-14)
assert func_g8(b'\x61\xB8\x9D\x03\x8A\x42\x8F\x8B') == approx(-9.9999999999999999E-38, rel=1e-14)
assert func_g8(b'\x13\x40\xCA\xC0\x8C\x42\xDD\x59') == approx(1.234567890123450, rel=1e-14)
assert func_g8(b'\x13\xC0\xCA\xC0\x8C\x42\xDD\x59') == approx(-1.234567890123450, rel=1e-14)
| 51.22549
| 101
| 0.661435
| 944
| 5,225
| 3.584746
| 0.17161
| 0.093972
| 0.093085
| 0.085106
| 0.846336
| 0.752069
| 0.739953
| 0.713061
| 0.591608
| 0.591608
| 0
| 0.266295
| 0.142584
| 5,225
| 101
| 102
| 51.732673
| 0.489063
| 0.04
| 0
| 0.05
| 0
| 0
| 0.233273
| 0.153385
| 0
| 0
| 0
| 0
| 0.65
| 1
| 0.125
| false
| 0
| 0.0375
| 0
| 0.225
| 0.0625
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a20c117f9124efd7316972181772b34258fa401d
| 3,051
|
py
|
Python
|
design_pattern/structural/decorator/wow_example.py
|
kannandreams/python-advance-concepts
|
e4c4f34cd37b431a43c115bb248273125b96b7b1
|
[
"MIT"
] | 2
|
2021-01-18T12:16:08.000Z
|
2021-01-24T07:38:18.000Z
|
design_pattern/structural/decorator/wow_example.py
|
kannandreams/python-advance-concepts
|
e4c4f34cd37b431a43c115bb248273125b96b7b1
|
[
"MIT"
] | null | null | null |
design_pattern/structural/decorator/wow_example.py
|
kannandreams/python-advance-concepts
|
e4c4f34cd37b431a43c115bb248273125b96b7b1
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
class INoodles(object):
def get_ingredients(self):
pass
def get_cost(self):
pass
def get_service_tax(self):
return self.get_cost() * 1.00
class IRice(object):
def get_ingredients(self):
pass
def get_cost(self):
pass
def get_service_tax(self):
return self.get_cost() * 1.00
class RiceNoodles(INoodles):
def get_ingredients(self):
return 'RiceNoodles'
def get_cost(self):
return 5.00
class EggNoodles(INoodles):
def get_ingredients(self):
return 'EggNoodles'
def get_cost(self):
return 5.00
class WhiteRice(IRice):
def get_ingredients(self):
return 'WhiteRice'
def get_cost(self):
return 5.00
class INoodlesDecorator(INoodles):
def __init__(self, decorated_noodle):
self.decorated_noodle = decorated_noodle
def get_cost(self):
return self.decorated_noodle.get_cost()
def get_ingredients(self):
return self.decorated_noodle.get_ingredients()
class IRiceDecorator(IRice):
def __init__(self, decorated_noodle):
self.decorated_rice = decorated_rice
def get_cost(self):
return self.decorated_rice.get_cost()
def get_ingredients(self):
return self.decorated_rice.get_ingredients()
class VegMix(INoodlesDecorator):
def __init__(self, decorated_noodle):
INoodlesDecorator.__init__(self, decorated_noodle)
def get_cost(self):
return self.decorated_noodle.get_cost()
def get_ingredients(self):
return self.decorated_noodle.get_ingredients() + ', Vegetables'
class Chicken(INoodlesDecorator):
def __init__(self, decorated_noodle):
INoodlesDecorator.__init__(self, decorated_noodle)
def get_cost(self):
return self.decorated_noodle.get_cost() + 0.5
def get_ingredients(self):
return self.decorated_noodle.get_ingredients() + ', Chicken'
class Tofu(INoodlesDecorator):
def __init__(self, decorated_noodle):
INoodlesDecorator.__init__(self, decorated_noodle)
def get_cost(self):
return self.decorated_noodle.get_cost() + 0.35
def get_ingredients(self):
return self.decorated_noodle.get_ingredients() + ', Tofu'
if __name__ == '__main__':
mynoodle = EggNoodles()
print('Ingredients: ' + mynoodle.get_ingredients() + '; Cost: ' +
str(mynoodle.get_cost())+'; sales tax = '+str(mynoodle.get_service_tax()))
mynoodle = VegMix(mynoodle)
print('Ingredients: '+mynoodle.get_ingredients() +
'; Cost: '+str(mynoodle.get_cost())+'; sales tax = '+str(mynoodle.get_service_tax()))
mynoodle = Chicken(mynoodle)
print('Ingredients: '+mynoodle.get_ingredients() +
'; Cost: '+str(mynoodle.get_cost())+'; sales tax = '+str(mynoodle.get_service_tax()))
mynoodle = Tofu(mynoodle)
print('Ingredients: '+mynoodle.get_ingredients() +
'; Cost: '+str(mynoodle.get_cost())+'; sales tax = '+str(mynoodle.get_service_tax()))
| 25.214876
| 95
| 0.67355
| 355
| 3,051
| 5.467606
| 0.11831
| 0.068006
| 0.166409
| 0.108192
| 0.846986
| 0.833076
| 0.791345
| 0.734158
| 0.690881
| 0.666667
| 0
| 0.008319
| 0.212062
| 3,051
| 120
| 96
| 25.425
| 0.799085
| 0
| 0
| 0.602564
| 0
| 0
| 0.067191
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.346154
| false
| 0.051282
| 0.012821
| 0.230769
| 0.717949
| 0.051282
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 9
|
bf6fb18a6af1c76c4c5eee6165cd641fc3455ec5
| 227
|
py
|
Python
|
src/prefopt/optimization/__init__.py
|
prefopt/prefopt
|
45f3368e44cf16664ff5427a4f643f45b800d236
|
[
"MIT"
] | 11
|
2017-12-06T16:15:35.000Z
|
2021-02-17T14:37:13.000Z
|
src/prefopt/optimization/__init__.py
|
prefopt/prefopt
|
45f3368e44cf16664ff5427a4f643f45b800d236
|
[
"MIT"
] | 2
|
2017-11-21T01:26:43.000Z
|
2018-01-19T23:12:01.000Z
|
src/prefopt/optimization/__init__.py
|
prefopt/prefopt
|
45f3368e44cf16664ff5427a4f643f45b800d236
|
[
"MIT"
] | 3
|
2017-11-22T17:15:49.000Z
|
2018-02-02T02:57:57.000Z
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .base import * # pylint: disable=wildcard-import
from .grid_search import * # pylint: disable=wildcard-import
| 32.428571
| 61
| 0.819383
| 29
| 227
| 5.896552
| 0.448276
| 0.175439
| 0.280702
| 0.315789
| 0.385965
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127753
| 227
| 6
| 62
| 37.833333
| 0.863636
| 0.277533
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0.2
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
bfc9fac6d91d582910535c02dc0e55a552c349d5
| 1,757
|
py
|
Python
|
Dashboard with Django/app/migrations/0005_auto_20180518_1329.py
|
reddyprasade/Data-Analysis-with-Python-
|
2440e23486856eea5556c8262467b3a618032bc2
|
[
"MIT"
] | 1
|
2021-06-29T23:15:05.000Z
|
2021-06-29T23:15:05.000Z
|
Dashboard with Django/app/migrations/0005_auto_20180518_1329.py
|
reddyprasade/Data-Analysis-with-Python-
|
2440e23486856eea5556c8262467b3a618032bc2
|
[
"MIT"
] | null | null | null |
Dashboard with Django/app/migrations/0005_auto_20180518_1329.py
|
reddyprasade/Data-Analysis-with-Python-
|
2440e23486856eea5556c8262467b3a618032bc2
|
[
"MIT"
] | 1
|
2021-12-20T10:04:53.000Z
|
2021-12-20T10:04:53.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-05-18 07:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0004_auto_20180518_1257'),
]
operations = [
migrations.AlterField(
model_name='crimes_against_women',
name='Rape_Cases_Reported',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Above_50_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Between_10to14_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Between_14to18_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Between_18to30_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Between_30to50_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_Upto_10_Yrs',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='crimes_against_women',
name='Victims_of_Rape_Total',
field=models.IntegerField(null=True),
),
]
| 31.375
| 49
| 0.602732
| 172
| 1,757
| 5.837209
| 0.337209
| 0.159363
| 0.199203
| 0.231076
| 0.748008
| 0.717131
| 0.717131
| 0.717131
| 0.666335
| 0.666335
| 0
| 0.042811
| 0.29539
| 1,757
| 55
| 50
| 31.945455
| 0.768174
| 0.038702
| 0
| 0.666667
| 1
| 0
| 0.218861
| 0.087782
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.041667
| 0
| 0.104167
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
44d80a3f4a45ae57b97b3ca7b73e24ac122f6240
| 319
|
py
|
Python
|
PyKartRider/apiKey.py
|
gooday2die/PyKartRider
|
808ed0e4b9a5591bbd9fff822e75eb811d7dfad9
|
[
"MIT"
] | null | null | null |
PyKartRider/apiKey.py
|
gooday2die/PyKartRider
|
808ed0e4b9a5591bbd9fff822e75eb811d7dfad9
|
[
"MIT"
] | null | null | null |
PyKartRider/apiKey.py
|
gooday2die/PyKartRider
|
808ed0e4b9a5591bbd9fff822e75eb811d7dfad9
|
[
"MIT"
] | null | null | null |
key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiMTcyODUwNjU5NSIsImF1dGhfaWQiOiIyIiwidG9rZW5fdHlwZSI6IkFjY2Vzc1Rva2VuIiwic2VydmljZV9pZCI6IjQzMDAxMTM5MyIsIlgtQXBwLVJhdGUtTGltaXQiOiI1MDA6MTAiLCJuYmYiOjE2NDMyNzE2NDAsImV4cCI6MTY1ODgyMzY0MCwiaWF0IjoxNjQzMjcxNjQwfQ.2DVXqObm6S77Dy2s6MwPumCfB7-BaXFeufWC_kvBSU0"
| 319
| 319
| 0.974922
| 6
| 319
| 51.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116719
| 0.00627
| 319
| 1
| 319
| 319
| 0.861199
| 0
| 0
| 0
| 0
| 0
| 0.971875
| 0.971875
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
7840f13a941ae09e9039880e339c5530d66c04fc
| 1,086
|
py
|
Python
|
mdstudio/mdstudio/logging/brand.py
|
NLeSC/LIEStudio
|
03c163b4a2590b4e2204621e1c941c28a9624887
|
[
"Apache-2.0"
] | 10
|
2017-09-14T07:26:15.000Z
|
2021-04-01T09:33:03.000Z
|
mdstudio/mdstudio/logging/brand.py
|
NLeSC/LIEStudio
|
03c163b4a2590b4e2204621e1c941c28a9624887
|
[
"Apache-2.0"
] | 117
|
2017-09-13T08:09:48.000Z
|
2019-10-03T12:19:13.000Z
|
mdstudio/mdstudio/logging/brand.py
|
NLeSC/LIEStudio
|
03c163b4a2590b4e2204621e1c941c28a9624887
|
[
"Apache-2.0"
] | 1
|
2018-09-26T09:40:51.000Z
|
2018-09-26T09:40:51.000Z
|
ascii_brand = """
[49m[K[0m[12C[48;5;102m [3C [49m
[11C[48;5;102m [17C [49m
[10C[48;5;102m [7C[48;5;209m [7C[48;5;102m [49m
[9C[48;5;102m [21C [49m
[7C[48;5;102m [8C[48;5;209m [48;5;203m [12C[48;5;102m [49m
[7C[48;5;102m [9C[48;5;209m [14C[48;5;102m [49m
[5C[48;5;102m [15C[48;5;209m [8C[48;5;102m [49m
[48;5;102m [2C[48;5;208m [48;5;209m [3C[48;5;167m [11C[48;5;102m [49m
[48;5;102m [2C[48;5;209m [2C [48;5;173m [8C[48;5;209m [2C[48;5;102m [49m
[5C[48;5;102m [1C[48;5;209m [1C[48;5;102m [49m
[7C[48;5;102m [1C[48;5;209m [1C [1C[48;5;102m [49m
[7C[48;5;102m [1C[48;5;209m [1C[48;5;102m [49m
[9C[48;5;102m [2C[48;5;209m [2C[48;5;102m [49m
[10C[48;5;102m [1C[48;5;209m [1C[48;5;102m [49m
[11C[48;5;102m [17C [49m
[12C[48;5;102m [3C [0m
"""
| 60.333333
| 107
| 0.430939
| 302
| 1,086
| 1.900662
| 0.092715
| 0.224739
| 0.299652
| 0.376307
| 0.904181
| 0.832753
| 0.832753
| 0.789199
| 0.789199
| 0.682927
| 0
| 0.451613
| 0.286372
| 1,086
| 18
| 108
| 60.333333
| 0.150968
| 0
| 0
| 0.111111
| 0
| 0.611111
| 0.980681
| 0.025759
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 14
|
7879e84341382ee26c84edcd5d5ab31383b6f7ef
| 3,194
|
py
|
Python
|
py/py_0008_largest_product_in_a_series.py
|
lcsm29/project-euler
|
fab794ece5aa7a11fc7c2177f26250f40a5b1447
|
[
"MIT"
] | null | null | null |
py/py_0008_largest_product_in_a_series.py
|
lcsm29/project-euler
|
fab794ece5aa7a11fc7c2177f26250f40a5b1447
|
[
"MIT"
] | null | null | null |
py/py_0008_largest_product_in_a_series.py
|
lcsm29/project-euler
|
fab794ece5aa7a11fc7c2177f26250f40a5b1447
|
[
"MIT"
] | null | null | null |
# Solution of;
# Project Euler Problem 8: Largest product in a series
# https://projecteuler.net/problem=8
#
# The four adjacent digits in the 1000-digit number that have
# the greatest product are 9 × 9 × 8 × 9 = 5832.
#
# 73167176531330624919225119674426574742355349194934
# 96983520312774506326239578318016984801869478851843
# 85861560789112949495459501737958331952853208805511
# 12540698747158523863050715693290963295227443043557
# 66896648950445244523161731856403098711121722383113
# 62229893423380308135336276614282806444486645238749
# 30358907296290491560440772390713810515859307960866
# 70172427121883998797908792274921901699720888093776
# 65727333001053367881220235421809751254540594752243
# 52584907711670556013604839586446706324415722155397
# 53697817977846174064955149290862569321978468622482
# 83972241375657056057490261407972968652414535100474
# 82166370484403199890008895243450658541227588666881
# 16427171479924442928230863465674813919123162824586
# 17866458359124566529476545682848912883142607690042
# 24219022671055626321111109370544217506941658960408
# 07198403850962455444362981230987879927244284909188
# 84580156166097919133875499200524063689912560717606
# 05886116467109405077541002256983155200055935729725
# 71636269561882670428252483600823257530420752963450
#
# the thirteen adjacent digits in the 1000-digit number that have
# the greatest product. What is the value of this product?
#
# by lcsm29 http://github.com/lcsm29/project-euler
import timed
# from functools import reduce
# import operator
def fn_brute(n):
g_product = 0
for i in range(1001 - n):
# tmp = reduce(operator.mul, [int(c) for c in kdigit[i:i + n]], 1)
# the above was removed because it's slower than the following
tmp = 1
for j in [int(c) for c in kdigit[i:i + n]]:
tmp *= j
if max(g_product, tmp) == tmp:
g_product = tmp
return g_product
kdigit = (
"73167176531330624919225119674426574742355349194934"
"96983520312774506326239578318016984801869478851843"
"85861560789112949495459501737958331952853208805511"
"12540698747158523863050715693290963295227443043557"
"66896648950445244523161731856403098711121722383113"
"62229893423380308135336276614282806444486645238749"
"30358907296290491560440772390713810515859307960866"
"70172427121883998797908792274921901699720888093776"
"65727333001053367881220235421809751254540594752243"
"52584907711670556013604839586446706324415722155397"
"53697817977846174064955149290862569321978468622482"
"83972241375657056057490261407972968652414535100474"
"82166370484403199890008895243450658541227588666881"
"16427171479924442928230863465674813919123162824586"
"17866458359124566529476545682848912883142607690042"
"24219022671055626321111109370544217506941658960408"
"07198403850962455444362981230987879927244284909188"
"84580156166097919133875499200524063689912560717606"
"05886116467109405077541002256983155200055935729725"
"71636269561882670428252483600823257530420752963450"
)
if __name__ == '__main__':
n = 13
i = 700
prob_id = 8
timed.caller(fn_brute, n, i, prob_id)
| 39.925
| 74
| 0.820601
| 201
| 3,194
| 12.975124
| 0.497512
| 0.01227
| 0.01227
| 0.014571
| 0.827454
| 0.827454
| 0.827454
| 0.827454
| 0.827454
| 0.812883
| 0
| 0.732014
| 0.129618
| 3,194
| 79
| 75
| 40.43038
| 0.205036
| 0.492486
| 0
| 0
| 0
| 0
| 0.636364
| 0.631313
| 0
| 0
| 0
| 0
| 0
| 1
| 0.027027
| false
| 0
| 0.027027
| 0
| 0.081081
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
1539f6d9114aa7e87454fa1ac284c1aa0b8ba8e6
| 10,481
|
py
|
Python
|
pyphabricatordb/nuance.py
|
veblush/PyPhabricatorDb
|
154efbe225d593e9f073d73fd428171f1dd0536b
|
[
"MIT"
] | null | null | null |
pyphabricatordb/nuance.py
|
veblush/PyPhabricatorDb
|
154efbe225d593e9f073d73fd428171f1dd0536b
|
[
"MIT"
] | null | null | null |
pyphabricatordb/nuance.py
|
veblush/PyPhabricatorDb
|
154efbe225d593e9f073d73fd428171f1dd0536b
|
[
"MIT"
] | null | null | null |
# coding: utf-8
from sqlalchemy import BINARY, Column, Index, Integer, String, VARBINARY
from sqlalchemy import String, Unicode, ForeignKey
from sqlalchemy.orm import relationship, backref
from dbdatetime import dbdatetime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class Edge(Base):
__tablename__ = 'edge'
__table_args__ = (
Index('key_dst', 'dst', 'type', 'src', unique=True),
Index('src', 'src', 'type', 'dateCreated', 'seq')
)
src = Column(String, primary_key=True, nullable=False)
type = Column(Integer, primary_key=True, nullable=False)
dst = Column(String, primary_key=True, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
seq = Column(Integer, nullable=False)
dataID = Column(Integer)
class EdgeData(Base):
__tablename__ = 'edgedata'
id = Column(Integer, primary_key=True)
data = Column(Unicode, nullable=False)
class NuanceItem(Base):
__tablename__ = 'nuance_item'
__table_args__ = (
Index('key_queue', 'queuePHID', 'status'),
Index('key_owner', 'ownerPHID', 'status'),
Index('key_requestor', 'requestorPHID', 'status'),
Index('key_source', 'sourcePHID', 'status')
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
ownerPHID = Column(String)
requestorPHID = Column(String, nullable=False)
sourcePHID = Column(String, nullable=False)
sourceLabel = Column(Unicode(255))
status = Column(Integer, nullable=False)
data = Column(Unicode, nullable=False)
mailKey = Column(BINARY(20), nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
queuePHID = Column(String, nullable=False)
class NuanceItemTransaction(Base):
__tablename__ = 'nuance_itemtransaction'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
authorPHID = Column(String, nullable=False)
objectPHID = Column(String, nullable=False, index=True)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentPHID = Column(String)
commentVersion = Column(Integer, nullable=False)
transactionType = Column(Unicode(32), nullable=False)
oldValue = Column(Unicode, nullable=False)
newValue = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
usermetadata = Column('metadata', Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceItemTransactionComment(Base):
__tablename__ = 'nuance_itemtransaction_comment'
__table_args__ = (
Index('key_version', 'transactionPHID', 'commentVersion', unique=True),
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
transactionPHID = Column(String)
authorPHID = Column(String, nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentVersion = Column(Integer, nullable=False)
content = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
isDeleted = Column(Integer, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceQueue(Base):
__tablename__ = 'nuance_queue'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
name = Column(Unicode(255))
mailKey = Column(BINARY(20), nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceQueueTransaction(Base):
__tablename__ = 'nuance_queuetransaction'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
authorPHID = Column(String, nullable=False)
objectPHID = Column(String, nullable=False, index=True)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentPHID = Column(String)
commentVersion = Column(Integer, nullable=False)
transactionType = Column(Unicode(32), nullable=False)
oldValue = Column(Unicode, nullable=False)
newValue = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
usermetadata = Column('metadata', Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceQueueTransactionComment(Base):
__tablename__ = 'nuance_queuetransaction_comment'
__table_args__ = (
Index('key_version', 'transactionPHID', 'commentVersion', unique=True),
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
transactionPHID = Column(String)
authorPHID = Column(String, nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentVersion = Column(Integer, nullable=False)
content = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
isDeleted = Column(Integer, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceRequestor(Base):
__tablename__ = 'nuance_requestor'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
data = Column(Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceRequestorSource(Base):
__tablename__ = 'nuance_requestorsource'
__table_args__ = (
Index('key_source', 'sourcePHID', 'id'),
Index('key_requestor', 'requestorPHID', 'id'),
Index('key_source_key', 'sourcePHID', 'sourceKey', unique=True)
)
id = Column(Integer, primary_key=True)
requestorPHID = Column(String, nullable=False)
sourcePHID = Column(String, nullable=False)
sourceKey = Column(Unicode(128), nullable=False)
data = Column(Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceRequestorTransaction(Base):
__tablename__ = 'nuance_requestortransaction'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
authorPHID = Column(String, nullable=False)
objectPHID = Column(String, nullable=False, index=True)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentPHID = Column(String)
commentVersion = Column(Integer, nullable=False)
transactionType = Column(Unicode(32), nullable=False)
oldValue = Column(Unicode, nullable=False)
newValue = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
usermetadata = Column('metadata', Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceRequestorTransactionComment(Base):
__tablename__ = 'nuance_requestortransaction_comment'
__table_args__ = (
Index('key_version', 'transactionPHID', 'commentVersion', unique=True),
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
transactionPHID = Column(String)
authorPHID = Column(String, nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentVersion = Column(Integer, nullable=False)
content = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
isDeleted = Column(Integer, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceSource(Base):
__tablename__ = 'nuance_source'
__table_args__ = (
Index('key_type', 'type', 'dateModified'),
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
name = Column(Unicode(255))
type = Column(Unicode(32), nullable=False)
data = Column(Unicode, nullable=False)
mailKey = Column(BINARY(20), nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
defaultQueuePHID = Column(String, nullable=False)
class NuanceSourceTransaction(Base):
__tablename__ = 'nuance_sourcetransaction'
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
authorPHID = Column(String, nullable=False)
objectPHID = Column(String, nullable=False, index=True)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentPHID = Column(String)
commentVersion = Column(Integer, nullable=False)
transactionType = Column(Unicode(32), nullable=False)
oldValue = Column(Unicode, nullable=False)
newValue = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
usermetadata = Column('metadata', Unicode, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
class NuanceSourceTransactionComment(Base):
__tablename__ = 'nuance_sourcetransaction_comment'
__table_args__ = (
Index('key_version', 'transactionPHID', 'commentVersion', unique=True),
)
id = Column(Integer, primary_key=True)
phid = Column(String, nullable=False, unique=True)
transactionPHID = Column(String)
authorPHID = Column(String, nullable=False)
viewPolicy = Column(String, nullable=False)
editPolicy = Column(String, nullable=False)
commentVersion = Column(Integer, nullable=False)
content = Column(Unicode, nullable=False)
contentSource = Column(Unicode, nullable=False)
isDeleted = Column(Integer, nullable=False)
dateCreated = Column(dbdatetime, nullable=False)
dateModified = Column(dbdatetime, nullable=False)
| 38.251825
| 79
| 0.722641
| 1,074
| 10,481
| 6.912477
| 0.091248
| 0.231142
| 0.134698
| 0.168373
| 0.790005
| 0.774515
| 0.766568
| 0.748922
| 0.743669
| 0.743669
| 0
| 0.003325
| 0.167828
| 10,481
| 274
| 80
| 38.251825
| 0.847856
| 0.00124
| 0
| 0.70354
| 0
| 0
| 0.072227
| 0.023502
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.022124
| 0
| 0.893805
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 9
|
155765ee6b468dc21830e966eeeb82f6f762dd91
| 12,590
|
py
|
Python
|
cvxOpt.py
|
neu-spiral/SeverityScoreForROP
|
4892f18022965c06d3a5dbefe535883ffa002fc6
|
[
"MIT"
] | null | null | null |
cvxOpt.py
|
neu-spiral/SeverityScoreForROP
|
4892f18022965c06d3a5dbefe535883ffa002fc6
|
[
"MIT"
] | null | null | null |
cvxOpt.py
|
neu-spiral/SeverityScoreForROP
|
4892f18022965c06d3a5dbefe535883ffa002fc6
|
[
"MIT"
] | null | null | null |
# """
# This script contains the function generated by cvxopt package.
# 1 The Logistic function is to solve the logistic lasso (L1) regression problem with only feature and labels (No comparison included).
# 2 The Log_Log is to solve logistic lasso (L1) regression with Bradley Terry comparison model.
# 3 The SVM_Log function is to solve SVM for absolute labels and Logistic regression for comparison labels.
from cvxopt import solvers, matrix, spdiag, log, exp, div, spmatrix
import numpy as np
import cvxopt.modeling as cvm
import sys
from sklearn.linear_model import LogisticRegression
def Logistic(absDataOrigin,absLabels, lamda,alpha=1):
# This function uses both absolute label data and comparison data to train the logistic regression model.
# Equation: min_{beta, const} sum(logisticLoss(absData))+lamda*norm(beta,1)
# Parameter:
# ------------
# absDataOrigin : N by d numpy matrix where N the number of absolute label data and d is the dimension of data
# abslabels : (N,) numpy array, +1 means positive label and -1 represents negative labels
# lamda : weight on L1 penalty. Large lamda would have more zeros in beta.
# Return:
# ------------
# beta : the logistic regression model parameter
# const : the logistic regression global constant.
absN,d = np.shape(absDataOrigin)
absData = np.concatenate((np.array(absDataOrigin),np.ones([absN,1])),axis = 1)
# A : y_i * x_i since y_i is a scalar
A = np.multiply(absLabels.T, absData.T).T #absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
A = matrix(A)
def F(x=None, z=None):
# beta without constant x[:d], constant x[d], t = x[d+1:]
if x is None: return 2 * d, matrix(0.0,(2*d+1,1)) # m = 2 *d is the number of constraints
e = A*x[:d+1] # 0 - d contains the constant
w = exp(e)
f = matrix(0.0,(2*d+1,1))
f[0] = alpha*(-sum(e) + sum(log(1+w))) + lamda * sum(x[d+1::])# from d+1 withou the constant
f[1:d+1] = x[:d] - x[d+1:] # beta - t < 0
f[d+1:] = -x[:d] - x[d+1:] # -beta - t <0
Df = matrix(0.0,(2*d+1,2*d+1))
# Df[0,:d+1] = (matrix(A.T * (div(w,1+w)-1.0))).T
Df[0, :d + 1] = alpha*(matrix(A.T * (div(w, 1 + w) - 1.0))).T
Df[0,d+1:] = lamda
Df[1:d+1,0:d] = spdiag(matrix(1.0,(d,1)))
Df[d+1:, 0:d] = spdiag(matrix(-1.0,(d,1)))
Df[1:d+1,d+1:] = spdiag(matrix(-1.0,(d,1)))
Df[d+1:,d+1:] = spdiag(matrix(-1.0,(d,1)))
if z is None: return f ,Df
H = matrix(0.0,(2*d+1,2*d+1))
H[0:d+1,0:d+1] = alpha*(A.T *spdiag(div(w, (1 + w) ** 2)) * A)
return f, Df, z[0]*H
solvers.options['show_progress'] = False
sol = solvers.cp(F)
beta, const = sol['x'][0:d], sol['x'][d]
return beta, const
def Log_Log(absDataOrigin,absLabels,cmpDataOrigin,cmpLabels, absWeight, lamda):
# This function uses both absolute label data and comparison data to train the logistic regression model.
# The comparison data and label must be included.
# Equation: min_{beta, const} alpha*sum(logisticLoss(absData))+(1-alpha)*sum(logisticLoss(cmpData))+lamda*norm(beta,1)
# Parameter:
# ------------
# absDataOrigin : N by d numpy matrix where N the number of absolute label data and d is the dimension of data
# abslabels : (N,) numpy array, +1 means positive label and -1 represents negative labels
# cmpDataOrigin : N by d numpy matrix where N the number of comparion label data and d is the dimension of data
# cmpLabels : (N,) numpy array, +1 means positive label and -1 represents negative labels
# absWeight : the Weight on absolute label data. And (1-absWeight) would be the weight on comparison data.
# lamda : weight on L1 penalty. Large lamda would have more zeros in beta.
# normalizeWeight : binary value. 1 describes the normalize factor on the absWeight and cmpWeight by its number of data.
# 0 shows no normalied factor happen.
# Return:
# ------------
# beta : the logistic regression model parameter
# const : the logistic regression global constant.
absN,d = np.shape(absDataOrigin)
cmpN,_ = np.shape(cmpDataOrigin)
cmpWeight = 1.0 - absWeight
if cmpWeight == 1:
mdl = LogisticRegression(penalty='l1', C=1. / lamda)
mdl.fit(cmpDataOrigin, cmpLabels)
beta = mdl.coef_.T
const = mdl.intercept_
return beta, const
elif absWeight == 1:
mdl = LogisticRegression(penalty='l1', C=1. / lamda)
mdl.fit(absDataOrigin, absLabels)
beta = mdl.coef_.T
const = mdl.intercept_
return beta, const
else:
absData = np.concatenate((np.array(absDataOrigin),np.ones([absN,1])),axis = 1)
cmpData = np.concatenate((np.array(cmpDataOrigin),np.ones([cmpN,1])),axis=1)
# A : y_i * x_i since y_i is a scalar
absA = np.multiply(absLabels, absData.T).T # absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
absA = matrix(absA)
cmpA = np.multiply(cmpLabels, cmpData.T).T # absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
cmpA = matrix(cmpA)
def F(x=None, z=None):
# beta without constant x[:d], constant x[d], t = x[d+1:]
if x is None: return 2 * d, matrix(0.0,(2*d+1,1)) # m = 2 *d is the number of constraints
absE = absA*x[:d+1] # 0 - d contains the constant
absW = exp(absE)
cmpE = cmpA*x[:d+1]
cmpW = exp(cmpE)
f = matrix(0.0,(2*d+1,1))
f[0] = absWeight*(-sum(absE) + sum(log(1+absW))) + cmpWeight*(-sum(cmpE) + sum(log(1+cmpW))) + lamda * sum(x[d+1:])# from d+1 withou the constant
f[1:d+1] = x[:d] - x[d+1:] # beta - t < 0
f[d+1:] = -x[:d] - x[d+1:] # -beta - t <0
Df = matrix(0.0,(2*d+1,2*d+1))
Df[0,:d+1] = absWeight*(matrix(absA.T * (div(absW,1+absW)-1.0))).T + cmpWeight*(matrix(cmpA.T * (div(cmpW,1+cmpW)-1.0))).T
Df[0,d+1:] = lamda
Df[1:d+1,0:d] = spdiag(matrix(1.0,(d,1)))
Df[d+1:, 0:d] = spdiag(matrix(-1.0,(d,1)))
Df[1:d+1,d+1:] = spdiag(matrix(-1.0,(d,1)))
Df[d+1:,d+1:] = spdiag(matrix(-1.0,(d,1)))
if z is None: return f ,Df
H = matrix(0.0,(2*d+1,2*d+1))
H[0:d+1,0:d+1] = absWeight*(absA.T *spdiag(div(absW, (1 + absW) ** 2)) * absA) + cmpWeight*(cmpA.T *spdiag(div(cmpW, (1 +cmpW) ** 2)) * cmpA)
return f, Df, z[0]*H
solvers.options['show_progress'] = False
sol = solvers.cp(F)
beta, const = sol['x'][0:d], sol['x'][d]
return beta, const
def SVM_Log(absDataOrigin,absLabels,cmpDataOrigin,cmpLabels, absWeight, lamda,cmpIgnore=False):
# This function uses both absolute label data to train the SVM primal model and comparison data is using Bradley-Terry model.
# The comparison data and label must be included.
# Equation:
# Parameter:
# ------------
# absDataOrigin : N by d numpy matrix where N the number of absolute label data and d is the dimension of data
# abslabels : (N,) numpy array, +1 means positive label and -1 represents negative labels
# cmpDataOrigin : N by d numpy matrix where N the number of comparion label data and d is the dimension of data
# cmpLabels : (N,) numpy array, +1 means positive label and -1 represents negative labels
# absWeight : the Weight on absolute label data. And (1-absWeight) would be the weight on comparison data.
# lamda : weight on L1 penalty. Large lamda would have more zeros in beta.
# cmpIgnore : boolean variable. If True, the function will completely ignore the comparison data and labels. Please let them be None when input. And absWeight will be 1.
# Return:
# ------------
# beta : the SVM model parameter
# const : the SVM global constant.
if cmpIgnore is True:
# This component is currently wrong. Guess it is not satisfied the CVXOPT assumptions.
absWeight = 1
absN, d = np.shape(absDataOrigin)
absData = np.concatenate((np.array(absDataOrigin), np.ones([absN, 1])), axis=1)
# y_i times x_i and y_i is a scalar number
absA = np.multiply(absLabels,absData.T).T # absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
absA = matrix(absA)
def F(x=None, z=None):
# The cvxopt matrix slicing does not include the last number.
# x[0:d] is beta; x[d] is const; x[d+1:2*d+1] is t ; x[2*d+1:] is zeta
if x is None: return 2 * d + 2*absN, matrix(0.0, (2*d+1+absN, 1))
absS = absA * x[:d + 1] # 0 - d contains the constant. Absolute label scores.
f = matrix(0.0,(2*d+1+2*absN,1))
f[0] = absWeight*sum(x[2*d+1:]) + lamda * sum(x[d+1:2*d+1])
f[1: d + 1] = x[:d] - x[d+1:2*d+1] # beta - t <= 0
f[d + 1: 2*d+1] = -x[:d] - x[d+1:2*d+1] # -beta - t <= 0
f[2*d+1:2*d+1+absN] = -absS-x[2*d+1:]+1 # -y_i(beta.T*x_i)-zeta_i+1 <=0
f[2*d+1+absN:] = -x[2*d+1:]
Df = matrix(0.0, (2*d+1+2*absN, 2*d+1+absN))
Df[0, d+1 : 2*d+1] = lamda
Df[0, 2*d+1:] = absWeight
Df[1 : d+1, 0:d] = spdiag(matrix(1.0, (d, 1)))
Df[d+1: 2*d+1, 0:d] = spdiag(matrix(-1.0, (d, 1)))
Df[1 : d+1, d+1 : 2*d+1] = spdiag(matrix(-1.0, (d, 1)))
Df[d+1 : 2*d+1, d+1 : 2*d+1] = spdiag(matrix(-1.0, (d, 1)))
Df[2*d+1:2*d+1+absN, 0:d+1] = -absA
Df[2*d+1:2*d+1+absN , 2*d+1:] = spdiag(matrix(-1.0,(absN,1)))
Df[2*d+1+absN:,2*d+1:] = spdiag(matrix(-1.0,(absN,1)))
if z is None: return f, Df
H = matrix(0.0, (2*d+1+absN, 2*d+1+absN))
return f, Df, z[0] * H
solvers.options['show_progress'] = False
sol = solvers.cp(F)
beta, const = sol['x'][0:d], sol['x'][d]
return beta, const
else:
if absWeight>1.0 or absWeight<0.0: sys.exit('The absWeight must be in [0.0, 1.0]')
cmpWeight = 1.0 - absWeight
absN, d = np.shape(absDataOrigin)
cmpN, _ = np.shape(cmpDataOrigin)
absData = np.concatenate((np.array(absDataOrigin), np.ones([absN, 1])), axis=1)
cmpData = np.concatenate((np.array(cmpDataOrigin), np.ones([cmpN, 1])), axis=1)
# y_i times x_i and y_i is a scalar number
absA = np.multiply(absLabels,absData.T).T # absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
absA = matrix(absA)
cmpA = np.multiply(cmpLabels,cmpData.T).T # absData must be in N, d matrix, and absLabels must be in (N,1) or (N,) matrix
cmpA = matrix(cmpA)
def F(x=None, z=None):
# The cvxopt matrix slicing does not include the last number.
# x[0:d] is beta; x[d] is const; x[d+1:2*d+1] is t ; x[2*d+1:] is zeta
if x is None: return 2 * d + 2*absN, matrix(0.0, (2*d+1+absN, 1))
absS = absA * x[:d + 1] # 0 - d contains the constant. Absolute label scores.
cmpE = cmpA * x[:d + 1]
cmpW = exp(cmpE)
f = matrix(0.0,(2*d+1+2*absN,1))
f[0] = absWeight*sum(x[2*d+1:])+ cmpWeight*(-sum(cmpE) + sum(log(1+cmpW))) + lamda * sum(x[d+1:2*d+1])
f[1: d + 1] = x[:d] - x[d+1:2*d+1] # beta - t <= 0
f[d + 1: 2*d+1] = -x[:d] - x[d+1:2*d+1] # -beta - t <= 0
f[2*d+1:2*d+1+absN] = -absS-x[2*d+1:]+1 # -y_i(beta.T*x_i)-zeta_i+1 <=0
f[2*d+1+absN:] = -x[2*d+1:]
Df = matrix(0.0, (2*d+1+2*absN, 2*d+1+absN))
Df[0, 0:d+1] = cmpWeight * (matrix(cmpA.T * (div(cmpW, 1 + cmpW) - 1.0))).T
Df[0, d+1 : 2*d+1] = lamda
Df[0, 2*d+1:] = absWeight
Df[1 : d+1, 0:d] = spdiag(matrix(1.0, (d, 1)))
Df[d+1: 2*d+1, 0:d] = spdiag(matrix(-1.0, (d, 1)))
Df[1 : d+1, d+1 : 2*d+1] = spdiag(matrix(-1.0, (d, 1)))
Df[d+1 : 2*d+1, d+1 : 2*d+1] = spdiag(matrix(-1.0, (d, 1)))
Df[2*d+1:2*d+1+absN, 0:d+1] = -absA
Df[2*d+1:2*d+1+absN , 2*d+1:] = spdiag(matrix(-1.0,(absN,1)))
Df[2*d+1+absN:,2*d+1:] = spdiag(matrix(-1.0,(absN,1)))
if z is None: return f, Df
H = matrix(0.0, (2*d+1+absN, 2*d+1+absN))
H[0:d + 1, 0:d + 1] = cmpWeight * (cmpA.T * spdiag(div(cmpW, (1 + cmpW) ** 2)) * cmpA)
return f, Df, z[0] * H
solvers.options['show_progress'] = False
sol = solvers.cp(F)
beta, const = sol['x'][0:d], sol['x'][d]
return beta, const
| 52.89916
| 169
| 0.572597
| 2,203
| 12,590
| 3.256468
| 0.086246
| 0.045163
| 0.030945
| 0.016727
| 0.794815
| 0.793142
| 0.793142
| 0.770003
| 0.766657
| 0.752579
| 0
| 0.05293
| 0.258697
| 12,590
| 237
| 170
| 53.122363
| 0.71574
| 0.378872
| 0
| 0.8
| 1
| 0
| 0.012804
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.045161
| false
| 0
| 0.032258
| 0
| 0.141935
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
155f6c2f0777bf05d5b7164a4f723c2b98e90f0f
| 10,910
|
py
|
Python
|
petl/test/transform/test_maps.py
|
arturponinski/petl
|
9215549d9351139b13c5b275515d0cc752ee72b8
|
[
"MIT"
] | 435
|
2015-01-14T20:52:55.000Z
|
2018-07-16T06:08:41.000Z
|
petl/test/transform/test_maps.py
|
arturponinski/petl
|
9215549d9351139b13c5b275515d0cc752ee72b8
|
[
"MIT"
] | 184
|
2015-01-11T19:40:45.000Z
|
2018-07-25T11:50:53.000Z
|
petl/test/transform/test_maps.py
|
arturponinski/petl
|
9215549d9351139b13c5b275515d0cc752ee72b8
|
[
"MIT"
] | 103
|
2015-01-13T11:13:59.000Z
|
2018-06-06T03:41:29.000Z
|
from __future__ import absolute_import, print_function, division
from collections import OrderedDict
from petl.test.failonerror import assert_failonerror
from petl.test.helpers import ieq
from petl.transform.maps import fieldmap, rowmap, rowmapmany
from functools import partial
def test_fieldmap():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65, 51.9))
mappings = OrderedDict()
mappings['subject_id'] = 'id'
mappings['gender'] = 'sex', {'male': 'M', 'female': 'F'}
mappings['age_months'] = 'age', lambda v: v * 12
mappings['bmi'] = lambda rec: rec['weight'] / rec['height'] ** 2
actual = fieldmap(table, mappings)
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2),
(5, '-', 25 * 12, 51.9 / 1.65 ** 2))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
# do it with suffix
actual = fieldmap(table)
actual['subject_id'] = 'id'
actual['gender'] = 'sex', {'male': 'M', 'female': 'F'}
actual['age_months'] = 'age', lambda v: v * 12
actual['bmi'] = '{weight} / {height}**2'
ieq(expect, actual)
# test short rows
table2 = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65))
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2),
(5, '-', 25 * 12, None))
actual = fieldmap(table2, mappings)
ieq(expect, actual)
def test_fieldmap_record_access():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65, 51.9))
mappings = OrderedDict()
mappings['subject_id'] = 'id'
mappings['gender'] = 'sex', {'male': 'M', 'female': 'F'}
mappings['age_months'] = 'age', lambda v: v * 12
mappings['bmi'] = lambda rec: rec.weight / rec.height ** 2
actual = fieldmap(table, mappings)
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2),
(5, '-', 25 * 12, 51.9 / 1.65 ** 2))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
def test_fieldmap_empty():
table = (('foo', 'bar'),)
expect = (('foo', 'baz'),)
mappings = OrderedDict()
mappings['foo'] = 'foo'
mappings['baz'] = 'bar', lambda v: v * 2
actual = fieldmap(table, mappings)
ieq(expect, actual)
def test_fieldmap_failonerror():
input_ = (('foo',), ('A',), (1,))
mapper_ = {'bar': ('foo', lambda v: v.lower())}
expect_ = (('bar',), ('a',), (None,))
assert_failonerror(
input_fn=partial(fieldmap, input_, mapper_),
expected_output=expect_)
def test_rowmap():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65, 51.9))
def rowmapper(row):
transmf = {'male': 'M', 'female': 'F'}
return [row[0],
transmf[row[1]] if row[1] in transmf else row[1],
row[2] * 12,
row[4] / row[3] ** 2]
actual = rowmap(table, rowmapper, header=['subject_id', 'gender',
'age_months', 'bmi'])
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2),
(5, '-', 25 * 12, 51.9 / 1.65 ** 2))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
# test short rows
table2 = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65))
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2))
actual = rowmap(table2, rowmapper, header=['subject_id', 'gender',
'age_months', 'bmi'])
ieq(expect, actual)
def test_rowmap_empty():
table = (('id', 'sex', 'age', 'height', 'weight'),)
def rowmapper(row):
transmf = {'male': 'M', 'female': 'F'}
return [row[0],
transmf[row[1]] if row[1] in transmf else row[1],
row[2] * 12,
row[4] / row[3] ** 2]
actual = rowmap(table, rowmapper, header=['subject_id', 'gender',
'age_months', 'bmi'])
expect = (('subject_id', 'gender', 'age_months', 'bmi'),)
ieq(expect, actual)
def test_rowmap_failonerror():
input_ = (('foo',), ('A',), (1,), ('B',))
mapper = lambda r: [r[0].lower()]
# exceptions in rowmappers do not generate an output row
expect_ = (('foo',), ('a',), ('b',))
assert_failonerror(
input_fn=partial(rowmap, input_, mapper, header=('foo',)),
expected_output=expect_)
def test_recordmap():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65, 51.9))
def recmapper(rec):
transmf = {'male': 'M', 'female': 'F'}
return [rec['id'],
transmf[rec['sex']] if rec['sex'] in transmf else rec['sex'],
rec['age'] * 12,
rec['weight'] / rec['height'] ** 2]
actual = rowmap(table, recmapper, header=['subject_id', 'gender',
'age_months', 'bmi'])
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2),
(5, '-', 25 * 12, 51.9 / 1.65 ** 2))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
# test short rows
table2 = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, 'female', 17, 1.78, 74.4),
(4, 'male', 21, 1.33, 45.2),
(5, '-', 25, 1.65))
expect = (('subject_id', 'gender', 'age_months', 'bmi'),
(1, 'M', 16 * 12, 62.0 / 1.45 ** 2),
(2, 'F', 19 * 12, 55.4 / 1.34 ** 2),
(3, 'F', 17 * 12, 74.4 / 1.78 ** 2),
(4, 'M', 21 * 12, 45.2 / 1.33 ** 2))
actual = rowmap(table2, recmapper, header=['subject_id', 'gender',
'age_months', 'bmi'])
ieq(expect, actual)
def test_rowmapmany():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, '-', 17, 1.78, 74.4),
(4, 'male', 21, 1.33))
def rowgenerator(row):
transmf = {'male': 'M', 'female': 'F'}
yield [row[0], 'gender',
transmf[row[1]] if row[1] in transmf else row[1]]
yield [row[0], 'age_months', row[2] * 12]
yield [row[0], 'bmi', row[4] / row[3] ** 2]
actual = rowmapmany(table, rowgenerator, header=['subject_id', 'variable',
'value'])
expect = (('subject_id', 'variable', 'value'),
(1, 'gender', 'M'),
(1, 'age_months', 16 * 12),
(1, 'bmi', 62.0 / 1.45 ** 2),
(2, 'gender', 'F'),
(2, 'age_months', 19 * 12),
(2, 'bmi', 55.4 / 1.34 ** 2),
(3, 'gender', '-'),
(3, 'age_months', 17 * 12),
(3, 'bmi', 74.4 / 1.78 ** 2),
(4, 'gender', 'M'),
(4, 'age_months', 21 * 12))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
def test_rowmapmany_failonerror():
input_ = (('foo',), ('A',), (1,), ('B',))
mapper = lambda r: [r[0].lower()]
expect_ = (('foo',), ('a',), ('b',),)
assert_failonerror(
input_fn=partial(rowmapmany, input_, mapper, header=('foo',)),
expected_output=expect_)
def test_recordmapmany():
table = (('id', 'sex', 'age', 'height', 'weight'),
(1, 'male', 16, 1.45, 62.0),
(2, 'female', 19, 1.34, 55.4),
(3, '-', 17, 1.78, 74.4),
(4, 'male', 21, 1.33))
def rowgenerator(rec):
transmf = {'male': 'M', 'female': 'F'}
yield [rec['id'], 'gender',
transmf[rec['sex']] if rec['sex'] in transmf else rec['sex']]
yield [rec['id'], 'age_months', rec['age'] * 12]
yield [rec['id'], 'bmi', rec['weight'] / rec['height'] ** 2]
actual = rowmapmany(table, rowgenerator, header=['subject_id', 'variable',
'value'])
expect = (('subject_id', 'variable', 'value'),
(1, 'gender', 'M'),
(1, 'age_months', 16 * 12),
(1, 'bmi', 62.0 / 1.45 ** 2),
(2, 'gender', 'F'),
(2, 'age_months', 19 * 12),
(2, 'bmi', 55.4 / 1.34 ** 2),
(3, 'gender', '-'),
(3, 'age_months', 17 * 12),
(3, 'bmi', 74.4 / 1.78 ** 2),
(4, 'gender', 'M'),
(4, 'age_months', 21 * 12))
ieq(expect, actual)
ieq(expect, actual) # can iteratate twice?
| 37.62069
| 78
| 0.433639
| 1,417
| 10,910
| 3.272406
| 0.078335
| 0.050464
| 0.058227
| 0.050464
| 0.832219
| 0.810869
| 0.772267
| 0.751132
| 0.745309
| 0.706923
| 0
| 0.127933
| 0.343721
| 10,910
| 289
| 79
| 37.750865
| 0.519693
| 0.022548
| 0
| 0.757322
| 0
| 0
| 0.134447
| 0
| 0
| 0
| 0
| 0
| 0.016736
| 1
| 0.066946
| false
| 0
| 0.025105
| 0
| 0.104603
| 0.004184
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ec93da8a669fd0fb3f0c933c5cf3849cc4199540
| 23,079
|
py
|
Python
|
scripts/routines.py
|
tyo-nu/SimAL
|
8e9c289bbd77ce2a0bcd998f2dee27990af74a0f
|
[
"MIT"
] | 2
|
2018-11-18T01:49:27.000Z
|
2021-08-24T01:49:00.000Z
|
scripts/routines.py
|
tyo-nu/SimAL
|
8e9c289bbd77ce2a0bcd998f2dee27990af74a0f
|
[
"MIT"
] | null | null | null |
scripts/routines.py
|
tyo-nu/SimAL
|
8e9c289bbd77ce2a0bcd998f2dee27990af74a0f
|
[
"MIT"
] | 1
|
2020-08-17T14:00:48.000Z
|
2020-08-17T14:00:48.000Z
|
__author__ = 'Dante'
import random
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score as acc
import numpy as np
import density_weight as dw
import matplotlib as plt
from matplotlib import pyplot
import math
from sklearn import cross_validation as cv
from collections import Counter
import scipy.cluster.hierarchy as sch
from structures import fingerprinter as fptr
from structures import kernel_fns as kf
from chem import chem
def dw_performance(matrix, classes, filename, initial=2, iterations=100, beta=1.0, C=1.0, gamma=0.005, degree=2, kernel='rbf', batch=1, decf=False, seed=None, simfp=fptr.integer_sim):
"""This function takes as input the positive and negative samples from a known isozyme and compares how the learning curve
changes between an SVC trained on an increasing number of randomly selected samples and an SVC trained with an increasing
number of samples selected via an uncertainty sampling/density weighting method."""
rand_res = []
dw_res = []
k_dict = {'rbf': 'rbf', 'poly': 'poly', 'tanimoto': kf.tanimoto}
#Iterates n times.
for iteration in range(iterations):
#If you set the random_state kwarg, it will make the test set uniform across all iterations.
x_train, x_test, y_train, y_test = cv.train_test_split(matrix, classes, test_size=0.4, random_state=seed)
i = range(x_train.shape[0])
#Change the second argument to start with a different number of samples. The while loop ensures that the initial
#training smaple is instantiated with at least one example from each class.
rand_train = random.sample(i, initial)
while set(y_train[rand_train]) != {-1, 1}:
del rand_train[-1]
for index in random.sample(i, 1):
rand_train.append(index)
#Initialize the training set for the DW curve with the same points as the random curve.
dw_train = []
dw_train += rand_train
#Results storage.
n = []
rand_scores = []
dw_scores = []
#Each data point in each iteration si created here.
while len(rand_train) < x_train.shape[0]:
clf_rand = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
clf_dw = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
n.append(len(rand_train))
#Fit, predict and generate accuracy scores.
clf_rand.fit(x_train[rand_train], y_train[rand_train])
clf_dw.fit(x_train[dw_train], y_train[dw_train])
r = clf_rand.predict(x_test)
d = clf_dw.predict(x_test)
rand_scores.append(acc(y_test, r))
dw_scores.append(acc(y_test, d))
#Update the available points that can be chosen for random.
available_rand_ = list(set(i) - set(rand_train))
if len(available_rand_) != 0 and len(available_rand_) % batch < len(available_rand_):
for index in random.sample(available_rand_, batch):
rand_train.append(index)
elif len(available_rand_) != 0 and len(available_rand_) % batch == len(available_rand_):
rand_train += available_rand_
else:
pass
#Update the available points that can be chosen for DW, and create index table to maintain identity of each
#example as they are depleted.
available_dw_ = list(set(i) - set(dw_train))
index_table_ = {orig: update for update, orig in enumerate(available_dw_)}
pairwise_tc_avg = dw.avg_proximity(x_train[available_dw_], x_train[available_dw_], f=simfp)
if len(available_dw_) != 0 and len(available_dw_) % batch < len(available_dw_):
if decf:
xi = [dw.weight(dw.hyper_distance(clf_dw.decision_function(x_train[a])), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
else:
xi = [dw.weight(dw.entropy(clf_dw.predict_proba(x_train[a])[:, 0]), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
foo = sorted(zip(available_dw_, xi), key=lambda x: x[1], reverse=True)
dw_train += [ele[0] for ele in foo[:batch]]
elif len(available_dw_) != 0 and len(available_dw_) % batch == len(available_dw_):
dw_train += available_dw_
else:
pass
clf_rand_last = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree).fit(x_train[rand_train], y_train[rand_train])
clf_dw_last = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree).fit(x_train[dw_train], y_train[dw_train])
n.append(len(rand_train))
r_last = clf_rand_last.predict(x_test)
d_last = clf_dw_last.predict(x_test)
rand_scores.append(acc(y_test, r_last))
dw_scores.append(acc(y_test, d_last))
rand_res.append(np.array(rand_scores))
dw_res.append(np.array(dw_scores))
rand_avg = np.sum(np.vstack(tuple(rand_res)), 0) / iterations
dw_avg = np.sum(np.vstack(tuple(dw_res)), 0) / iterations
rand_err = 1.96 * np.std(np.vstack(tuple(rand_res)), 0) / math.sqrt(iterations)
dw_err = 1.96 * np.std(np.vstack(tuple(dw_res)), 0) / math.sqrt(iterations)
xdesc = 'Number of Training Samples'
ydesc = 'Accuracy Score'
plt.rcParams['font.sans-serif'] = ['Arial']
pyplot.errorbar(n, rand_avg, fmt='s-', yerr=rand_err, color='darkred', markersize=9, lw=2, label='Random Selection')
pyplot.errorbar(n, dw_avg, fmt='v-', yerr=dw_err, color='darkblue', markersize=9, lw=2, label='Density Weighted')
pyplot.tick_params(labelsize=14)
leg_title = "Final Accuracy = %s\nC = %s" % (str(round(rand_avg[-1], 3) * 100) + '%', str(C))
pyplot.legend(loc=4, title=leg_title)
pyplot.xlabel(xdesc, size=18, labelpad=14)
pyplot.ylabel(ydesc, size=18, labelpad=14)
pyplot.savefig(filename + "C_%s_decisionf_%s.svg" % (str(C), str(decf)))
pyplot.show()
def dw_ins(matrix, classes, filename, smiles_acc, initial=2, iterations=100, beta=1.0, C=1.0, gamma=0.005, degree=2, kernel='rbf', decf=False, batch=1, seed=None):
"""This function trains SVCs--initialized with a number of compounds from randomly partitioned train/test sets--with
progressively more compounds from the test set selected via active learning and outputs a figure showing the
distribution of selections of compounds in the unlabelled set."""
k_dict = {'rbf': 'rbf', 'poly': 'poly', 'tanimoto': kf.tanimoto}
rankings = {k: [] for k in smiles_acc}
#Iterates n times.
for iteration in range(iterations):
#Set the random_state kwarg, it will make the test set uniform across al iterations.
x_train, x_test, y_train, y_test = cv.train_test_split(matrix, classes, test_size=0.4, random_state=seed)
i = range(x_train.shape[0])
#Change the second argument to start with a different number of samples.
rand_train = random.sample(i, initial)
while set(y_train['label'][rand_train]) != {-1, 1}:
del rand_train[-1]
for index in random.sample(i, 1):
rand_train.append(index)
#Initialize the training set for the DW curve with the same points as the random curve.
dw_train = []
dw_train += rand_train
#Results storage.
n = []
#Each data point in each iteration is created here.
while len(dw_train) < x_train.shape[0]:
clf_dw = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
n.append(len(dw_train))
#Fit, predict and generate accuracy scores.
clf_dw.fit(x_train[dw_train], y_train['label'][dw_train])
#Update the available points that can be chosen for DW, and create index table to maintain identity of each
#example as they are depleted.
available_dw_ = list(set(i) - set(dw_train))
index_table_ = {orig: update for update, orig in enumerate(available_dw_)}
pairwise_tc_avg = dw.avg_proximity(x_train[available_dw_], x_train[available_dw_])
if len(available_dw_) != 0 and len(available_dw_) % batch < len(available_dw_):
#Density weight scores calculated in two lists to find the difference between the score of the "best"
#compound from the background and the "best" hidden labelled compound.
if decf:
xi = [dw.weight(dw.hyper_distance(clf_dw.decision_function(x_train[a])), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
else:
xi = [dw.weight(dw.entropy(clf_dw.predict_proba(x_train[a])[:, 0]), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
foo = sorted(zip(available_dw_, xi), key=lambda x_: x_[1], reverse=True)
adds = [ele[0] for ele in foo[:batch]]
dw_train += adds
smiles_added = [y_train['smiles'][idx] for idx in adds]
for s in smiles_added:
rankings[s].append((len(dw_train) - 2) / batch)
elif len(available_dw_) != 0 and len(available_dw_) % batch == len(available_dw_):
smiles_added = [y_train['smiles'][idx] for idx in available_dw_]
for s in smiles_added:
rankings[s].append(((len(dw_train) - 2) / batch) + 1)
dw_train += available_dw_
else:
pass
n.append(len(dw_train))
final = {k: Counter(v) for k, v in rankings.iteritems()}
positions = [j + 1 for j in range(max([x for val in rankings.values() for x in val]))]
data_ = []
for cpd, ctr in final.iteritems():
data_.append(np.array([ctr[pos] for pos in positions]))
data_in_ = np.vstack(tuple(data_)).T
row = positions
plt.rcParams['font.sans-serif'] = ['Arial']
fig = pyplot.figure()
#Plots a dendrogram above the heatmap.
axdendro = fig.add_axes([0.06, 0.68, 0.8, 0.27])
Y = sch.linkage(np.vstack(tuple([fptr.reconstruct_fp(s, fptype='FP2') for s in smiles_acc])), method='single', metric='jaccard')
Z = sch.dendrogram(Y, orientation='top')
axdendro.set_xticks([])
axdendro.set_yticks([])
#Plotting the heat map. 'pcolor' outputs a mappable object that is used as a mandatory argument to 'colorbar().'
#add axes arguments are: distance from left, distance from bottom, width, height.
ax = fig.add_axes([0.06, 0.05, 0.8, 0.6])
#Grab the order of the leaves of the dendrogram so the heatmap can be reordered to match.
index = Z['leaves']
D = data_in_.T[index]
hmap = ax.pcolor(D.T, cmap='gist_heat')
horiz = np.arange(data_in_.shape[1]) + 0.5
vert = np.arange(data_in_.shape[0]) + 0.5
pyplot.ylim([0, vert[-1] + 0.5])
pyplot.xlim([0, horiz[-1] + 0.5])
pyplot.ylabel('Position Selected', size=16)
ax.set_xticks(horiz, minor=False)
ax.set_yticks(vert, minor=False)
names = []
for s in classes['smiles']:
name_entry = chem.calc_name(s)
names.append(unicode(name_entry, "utf-8"))
col = [names[m] + ' (%s)' % str(classes['label'][m]) for m in index]
ax.set_xticklabels(col, minor=False, rotation=90, ha='center', size=11)
ax.set_yticklabels(row, minor=False, size=11)
#Plots the colorbar on separate axes so that the dendrogram can be aligned to the heatmap alone.
axcolor = fig.add_axes([0.89, 0.05, 0.02, 0.6])
cbar = pyplot.colorbar(hmap, cax=axcolor)
axcolor.set_ylabel('Selection Frequency', size=16, rotation=270)
#Eliminates white lines in Inkscape due to viewer bug; makes colorbar render with overlapping segments.
cbar.solids.set_edgecolor("face")
pyplot.savefig(filename + "C_%s_decisionf_%s.svg" % (str(C), str(decf)))
pyplot.show()
def dw_exp_val(matrix, classes, filename, excl, initial=2, iterations=100, beta=1.0, C=1.0, gamma=0.005, degree=2, kernel='rbf', batch=1, decf=False, seed=None, simfp=fptr.integer_sim):
"""This function takes as input the positive and negative samples from a known isozyme plus additional data collected
experimentally (added in an outside script) using active learning. A 'random' curve is constructed by splitting the
whole set, then excluding the newest batch of data from training, and finally calculating the accuracy at incrementally
increasing training set sizes. To assess 'improvement' due to AL, the 'dw' curve is constructed in the same way
using training data with an equal number of compounds (to the ones excluded in making the random curve) excluded
from training."""
rand_res = []
dw_res = []
k_dict = {'rbf': 'rbf', 'poly': 'poly', 'tanimoto': kf.tanimoto}
# Iterates n times.
for iteration in range(iterations):
#If you set the random_state kwarg, it will make the test set uniform across al iterations.
x_train, x_test, y_train, y_test = cv.train_test_split(matrix, classes, test_size=0.4, random_state=seed)
#Exclude experimental compounds from the random curve, and random compounds for the dw curve.
rand_excl = [i for i, smi in enumerate(y_train['smiles']) if smi in excl]
dw_excl = random.sample(range(x_train.shape[0]), len(rand_excl))
i = list(set(range(x_train.shape[0])) - set(rand_excl))
j = list(set(range(x_train.shape[0])) - set(dw_excl))
#Change the second argument to start with a different number of samples. The while loop ensures that the initial
#training sample is instantiated with at least one example from each class.
rand_train = random.sample(i, initial)
while set(y_train['label'][rand_train]) != {-1, 1}:
del rand_train[-1]
for index in random.sample(i, 1):
rand_train.append(index)
#Initialize the training set for the DW curve points randomly chosen from the allowed dw indices.
dw_train = random.sample(j, initial)
while set(y_train['label'][dw_train]) != {-1, 1}:
del dw_train[-1]
for index in random.sample(j, 1):
dw_train.append(index)
#Results storage.
n = []
rand_scores = []
dw_scores = []
#Each data point in each iteration is created here.
while len(rand_train) < x_train.shape[0] - len(excl):
clf_rand = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
clf_dw = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
n.append(len(rand_train))
#Fit, predict and generate accuracy scores.
clf_rand.fit(x_train[rand_train], y_train['label'][rand_train])
clf_dw.fit(x_train[dw_train], y_train['label'][dw_train])
r = clf_rand.predict(x_test)
d = clf_dw.predict(x_test)
rand_scores.append(acc(y_test['label'], r))
dw_scores.append(acc(y_test['label'], d))
#Update the available points that can be chosen for random.
available_rand_ = list(set(i) - set(rand_train))
if len(available_rand_) != 0 and len(available_rand_) % batch < len(available_rand_):
for index in random.sample(available_rand_, batch):
rand_train.append(index)
elif len(available_rand_) != 0 and len(available_rand_) % batch == len(available_rand_):
rand_train += available_rand_
else:
pass
#Update the available points that can be chosen for DW, and create index table to maintain identity of each
#example as they are depleted.
available_dw_ = list(set(j) - set(dw_train))
index_table_ = {orig: update for update, orig in enumerate(available_dw_)}
pairwise_tc_avg = dw.avg_proximity(x_train[available_dw_], x_train[available_dw_], f=simfp)
if len(available_dw_) != 0 and len(available_dw_) % batch < len(available_dw_):
if decf:
xi = [dw.weight(dw.hyper_distance(clf_dw.decision_function(x_train[a])), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
else:
xi = [dw.weight(dw.entropy(clf_dw.predict_proba(x_train[a])[:, 0]), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
foo = sorted(zip(available_dw_, xi), key=lambda x: x[1], reverse=True)
dw_train += [ele[0] for ele in foo[:batch]]
elif len(available_dw_) != 0 and len(available_dw_) % batch == len(available_dw_):
dw_train += available_dw_
else:
pass
clf_rand_last = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree).fit(x_train[rand_train], y_train['label'][rand_train])
clf_dw_last = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree).fit(x_train[dw_train], y_train['label'][dw_train])
n.append(len(rand_train))
r_last = clf_rand_last.predict(x_test)
d_last = clf_dw_last.predict(x_test)
rand_scores.append(acc(y_test['label'], r_last))
dw_scores.append(acc(y_test['label'], d_last))
rand_res.append(np.array(rand_scores))
dw_res.append(np.array(dw_scores))
rand_avg = np.sum(np.vstack(tuple(rand_res)), 0) / iterations
dw_avg = np.sum(np.vstack(tuple(dw_res)), 0) / iterations
rand_err = 1.96 * np.std(np.vstack(tuple(rand_res)), 0) / math.sqrt(iterations)
dw_err = 1.96 * np.std(np.vstack(tuple(dw_res)), 0) / math.sqrt(iterations)
xdesc = 'Number of Training Samples'
ydesc = 'Accuracy Score'
plt.rcParams['font.sans-serif'] = ['Arial']
pyplot.errorbar(n, rand_avg, fmt='s-', yerr=rand_err, color='darkred', markersize=9, lw=2,
label='Random Selection')
pyplot.errorbar(n, dw_avg, fmt='v-', yerr=dw_err, color='darkblue', markersize=9, lw=2,
label='Density Weighted')
pyplot.tick_params(labelsize=14)
leg_title = "Final Random Accuracy = %s\nFinal DW Accuracy = %s\nC = %s" % (str(round(rand_avg[-1], 3) * 100) + '%', str(round(dw_avg[-1], 3) * 100) + '%', str(C))
pyplot.legend(loc=4, title=leg_title)
pyplot.xlabel(xdesc, size=18, labelpad=14)
pyplot.ylabel(ydesc, size=18, labelpad=14)
pyplot.savefig(filename + "C_%s_decisionf_%s.svg" % (str(C), str(decf)))
pyplot.show()
def dw_exp_ins(matrix, classes, filename, smiles_acc, excl, initial=2, iterations=100, beta=1.0, C=1.0, gamma=0.005, degree=2, kernel='rbf', batch=1, decf=False, seed=None, simfp=fptr.integer_sim):
"""This function takes as input the positive and negative samples from a known isozyme plus additional data collected
experimentally (added in an outside script) using active learning. A 'random' curve is constructed by splitting the
whole set, then excluding the newest batch of data from training, and finally calculating the accuracy at incrementally
increasing training set sizes. To assess 'improvement' due to AL, the 'dw' curve is constructed in the same way
using training data with an equal number of compounds (to the ones excluded in making the random curve) excluded
from training."""
rand_res = []
dw_res = []
rankings = {k: [] for k in smiles_acc}
k_dict = {'rbf': 'rbf', 'poly': 'poly', 'tanimoto': kf.tanimoto}
# Iterates n times.
for iteration in range(iterations):
#If you set the random_state kwarg, it will make the test set uniform across al iterations.
x_train, x_test, y_train, y_test = cv.train_test_split(matrix, classes, test_size=0.4, random_state=seed)
#Exclude experimental compounds from the random curve, and random compounds for the dw curve.
rand_excl = [i for i, smi in enumerate(y_train['smiles']) if smi in excl]
dw_excl = random.sample(range(x_train.shape[0]), len(rand_excl))
j = list(set(range(x_train.shape[0])) - set(dw_excl))
#Initialize the training set for the DW curve points randomly chosen from the allowed dw indices.
dw_train = random.sample(j, initial)
while set(y_train['label'][dw_train]) != {-1, 1}:
del dw_train[-1]
for index in random.sample(j, 1):
dw_train.append(index)
#Results storage.
n = []
#Each data point in each iteration is created here.
while len(dw_train) < x_train.shape[0] - len(excl):
clf_dw = SVC(C=C, kernel=k_dict[kernel], gamma=gamma, degree=degree, probability=True)
n.append(len(dw_train))
#Fit, predict and generate accuracy scores.
clf_dw.fit(x_train[dw_train], y_train['label'][dw_train])
#Update the available points that can be chosen for DW, and create index table to maintain identity of each
#example as they are depleted.
available_dw_ = list(set(j) - set(dw_train))
index_table_ = {orig: update for update, orig in enumerate(available_dw_)}
pairwise_tc_avg = dw.avg_proximity(x_train[available_dw_], x_train[available_dw_], f=simfp)
if len(available_dw_) != 0 and len(available_dw_) % batch < len(available_dw_):
if decf:
xi = [dw.weight(dw.hyper_distance(clf_dw.decision_function(x_train[a])), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
else:
xi = [dw.weight(dw.entropy(clf_dw.predict_proba(x_train[a])[:, 0]), pairwise_tc_avg[index_table_[a]], beta=beta) for a in available_dw_]
foo = sorted(zip(available_dw_, xi), key=lambda x: x[1], reverse=True)
adds = [ele[0] for ele in foo[:batch]]
dw_train += adds
smiles_added = [y_train['smiles'][idx] for idx in adds]
for s in smiles_added:
rankings[s].append((len(dw_train) - 2) / batch)
elif len(available_dw_) != 0 and len(available_dw_) % batch == len(available_dw_):
smiles_added = [y_train['smiles'][idx] for idx in available_dw_]
for s in smiles_added:
rankings[s].append(((len(dw_train) - 2) / batch) + 1)
dw_train += available_dw_
else:
pass
n.append(len(dw_train))
smiles_added = [y_train['smiles'][idx] for idx in available_dw_]
for s in smiles_added:
rankings[s].append(((len(dw_train) - 2) / batch) + 1)
final = {k: Counter(v) for k, v in rankings.iteritems()}
positions = [j + 1 for j in range(max([x for val in rankings.values() for x in val]))]
data_ = []
for cpd, ctr in final.iteritems():
data_.append(np.array([ctr[pos] for pos in positions]))
data_in_ = np.vstack(tuple(data_)).T
row = positions
plt.rcParams['font.sans-serif'] = ['Arial']
fig = pyplot.figure()
# Plots a dendrogram above the heatmap.
axdendro = fig.add_axes([0.06, 0.68, 0.8, 0.27])
Y = sch.linkage(np.vstack(tuple([fptr.reconstruct_fp(s, fptype='FP2') for s in smiles_acc])), method='single',
metric='jaccard')
Z = sch.dendrogram(Y, orientation='top')
axdendro.set_xticks([])
axdendro.set_yticks([])
#Plotting the heat map. 'pcolor' outputs a mappable object that is used as a mandatory argument to 'colorbar().'
#add axes arguments are: distance from left, distance from bottom, width, height.
ax = fig.add_axes([0.06, 0.05, 0.8, 0.6])
#Grab the order of the leaves of the dendrogram so the heatmap can be reordered to match.
index = Z['leaves']
D = data_in_.T[index]
hmap = ax.pcolor(D.T, cmap='gist_heat')
horiz = np.arange(data_in_.shape[1]) + 0.5
vert = np.arange(data_in_.shape[0]) + 0.5
pyplot.ylim([0, vert[-1] + 0.5])
pyplot.xlim([0, horiz[-1] + 0.5])
pyplot.ylabel('Position Selected', size=16)
ax.set_xticks(horiz, minor=False)
ax.set_yticks(vert, minor=False)
names = []
for s in classes['smiles']:
name_entry = chem.calc_name(s)
names.append(unicode(name_entry, "utf-8"))
col = [names[m] + ' (%s)' % str(classes['label'][m]) for m in index]
ax.set_xticklabels(col, minor=False, rotation=90, ha='center', size=11)
ax.set_yticklabels(row, minor=False, size=11)
#Plots the colorbar on separate axes so that the dendrogram can be aligned to the heatmap alone.
axcolor = fig.add_axes([0.89, 0.05, 0.02, 0.6])
cbar = pyplot.colorbar(hmap, cax=axcolor)
axcolor.set_ylabel('Selection Frequency', size=16, rotation=270)
#Eliminates white lines in Inkscape due to viewer bug; makes colorbar render with overlapping segments.
cbar.solids.set_edgecolor("face")
pyplot.savefig(filename + "C_%s_decisionf_%s.svg" % (str(C), str(decf)))
pyplot.show()
| 45.076172
| 198
| 0.699164
| 3,728
| 23,079
| 4.156384
| 0.116416
| 0.041884
| 0.021684
| 0.012391
| 0.930236
| 0.930236
| 0.925976
| 0.921459
| 0.910616
| 0.908228
| 0
| 0.016546
| 0.172494
| 23,079
| 511
| 199
| 45.164384
| 0.794795
| 0.238009
| 0
| 0.840841
| 0
| 0
| 0.050224
| 0.004946
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012012
| false
| 0.018018
| 0.042042
| 0
| 0.054054
| 0.003003
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
ecc5936699f134e688be3e4ca1123e486a6610be
| 82
|
py
|
Python
|
app.py
|
faraz07-AI/mydocs
|
8f06bc514ddfd8759f6337a61d0ef558f4b52ae5
|
[
"MIT"
] | null | null | null |
app.py
|
faraz07-AI/mydocs
|
8f06bc514ddfd8759f6337a61d0ef558f4b52ae5
|
[
"MIT"
] | null | null | null |
app.py
|
faraz07-AI/mydocs
|
8f06bc514ddfd8759f6337a61d0ef558f4b52ae5
|
[
"MIT"
] | null | null | null |
import streamlit
from predict_page import show_predict_page
show_predict_page()
| 27.333333
| 43
| 0.865854
| 12
| 82
| 5.5
| 0.5
| 0.5
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.109756
| 82
| 3
| 44
| 27.333333
| 0.90411
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
01a7e81cbd3a06aa8303facc964cb707271af572
| 3,056
|
py
|
Python
|
tests/unit/exchange/conftest.py
|
weilbith/relay
|
ab1fc05cbb0ce664409a055f18a67255917c6959
|
[
"MIT"
] | 7
|
2017-07-21T09:13:56.000Z
|
2019-03-06T05:38:45.000Z
|
tests/unit/exchange/conftest.py
|
weilbith/relay
|
ab1fc05cbb0ce664409a055f18a67255917c6959
|
[
"MIT"
] | 223
|
2019-06-28T13:49:09.000Z
|
2021-10-20T18:04:59.000Z
|
tests/unit/exchange/conftest.py
|
weilbith/relay
|
ab1fc05cbb0ce664409a055f18a67255917c6959
|
[
"MIT"
] | 5
|
2019-04-07T14:31:02.000Z
|
2022-03-08T10:25:42.000Z
|
import pytest
from eth_utils import to_checksum_address
from relay.constants import NULL_ADDRESS
from relay.exchange.order import Order, SignableOrder
@pytest.fixture()
def invalid_signature_order(addresses):
A, B, C, D = addresses
return Order(
exchange_address=A,
maker_address=B,
taker_address=NULL_ADDRESS,
maker_token=C,
taker_token=D,
fee_recipient=NULL_ADDRESS,
maker_token_amount=100,
taker_token_amount=200,
maker_fee=0,
taker_fee=0,
expiration_timestamp_in_sec=123,
salt=123,
v=27,
r=(18).to_bytes(32, byteorder="big"),
s=(2748).to_bytes(32, byteorder="big"),
)
@pytest.fixture()
def invalid_exchange_order(addresses, test_account):
A, B, C, D = addresses
maker = test_account.address
order = SignableOrder(
exchange_address="0x379162d7682cb8bb6435c47E0b8b562eafe66971",
maker_address=to_checksum_address(maker),
taker_address=NULL_ADDRESS,
maker_token=C,
taker_token=D,
fee_recipient=NULL_ADDRESS,
maker_token_amount=100,
taker_token_amount=200,
maker_fee=0,
taker_fee=0,
expiration_timestamp_in_sec=123,
salt=123,
)
order.sign(test_account.private_key)
return order
@pytest.fixture()
def invalid_taker_order(addresses, test_account):
A, B, C, D = addresses
maker = test_account.address
order = SignableOrder(
exchange_address=A,
maker_address=to_checksum_address(maker),
taker_address=B,
maker_token=C,
taker_token=D,
fee_recipient=NULL_ADDRESS,
maker_token_amount=100,
taker_token_amount=200,
maker_fee=0,
taker_fee=0,
expiration_timestamp_in_sec=123,
salt=123,
)
order.sign(test_account.private_key)
return order
@pytest.fixture()
def expired_order(addresses, test_account):
A, B, C, D = addresses
maker = test_account.address
order = SignableOrder(
exchange_address=A,
maker_address=to_checksum_address(maker),
taker_address=C,
maker_token=C,
taker_token=D,
fee_recipient=NULL_ADDRESS,
maker_token_amount=100,
taker_token_amount=200,
maker_fee=0,
taker_fee=0,
expiration_timestamp_in_sec=123,
salt=123,
)
order.sign(test_account.private_key)
return order
@pytest.fixture()
def valid_order(addresses, test_account):
A, B, C, D = addresses
maker = test_account.address
order = SignableOrder(
exchange_address=A,
maker_address=to_checksum_address(maker),
taker_address=NULL_ADDRESS,
maker_token=C,
taker_token=D,
fee_recipient=NULL_ADDRESS,
maker_token_amount=100,
taker_token_amount=200,
maker_fee=0,
taker_fee=0,
expiration_timestamp_in_sec=1517161470000,
salt=123,
)
order.sign(test_account.private_key)
return order
| 26.119658
| 70
| 0.656086
| 377
| 3,056
| 4.997347
| 0.153846
| 0.076433
| 0.067941
| 0.089172
| 0.835987
| 0.791932
| 0.791932
| 0.791932
| 0.791932
| 0.791932
| 0
| 0.053097
| 0.260471
| 3,056
| 116
| 71
| 26.344828
| 0.780531
| 0
| 0
| 0.778846
| 0
| 0
| 0.015707
| 0.013743
| 0
| 0
| 0.013743
| 0
| 0
| 1
| 0.048077
| false
| 0
| 0.038462
| 0
| 0.134615
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
bf0dc800eb258f1454a9b8b0d0f82079006fee56
| 3,592
|
py
|
Python
|
backend/uclapi/roombookings/migrations/0011_rooma_roomb.py
|
balping/uclapi
|
57cb77a58a2f8fc5bb523b459fa074380f4d8dcc
|
[
"MIT"
] | null | null | null |
backend/uclapi/roombookings/migrations/0011_rooma_roomb.py
|
balping/uclapi
|
57cb77a58a2f8fc5bb523b459fa074380f4d8dcc
|
[
"MIT"
] | null | null | null |
backend/uclapi/roombookings/migrations/0011_rooma_roomb.py
|
balping/uclapi
|
57cb77a58a2f8fc5bb523b459fa074380f4d8dcc
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-21 12:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('roombookings', '0010_delete_pagetoken'),
]
operations = [
migrations.CreateModel(
name='RoomA',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('setid', models.CharField(blank=True, max_length=40, null=True)),
('siteid', models.CharField(blank=True, max_length=40, null=True)),
('sitename', models.CharField(blank=True, max_length=320, null=True)),
('address1', models.CharField(blank=True, max_length=320, null=True)),
('address2', models.CharField(blank=True, max_length=320, null=True)),
('address3', models.CharField(blank=True, max_length=320, null=True)),
('address4', models.CharField(blank=True, max_length=320, null=True)),
('roomid', models.CharField(max_length=40)),
('roomname', models.CharField(blank=True, max_length=320, null=True)),
('roomdeptid', models.CharField(blank=True, max_length=40, null=True)),
('bookabletype', models.CharField(blank=True, max_length=40, null=True)),
('roomclass', models.CharField(blank=True, max_length=40, null=True)),
('zone', models.CharField(blank=True, max_length=40, null=True)),
('webview', models.CharField(blank=True, max_length=4, null=True)),
('automated', models.CharField(blank=True, max_length=4, null=True)),
('capacity', models.FloatField(blank=True, null=True)),
('category', models.CharField(blank=True, max_length=40, null=True)),
],
),
migrations.CreateModel(
name='RoomB',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('setid', models.CharField(blank=True, max_length=40, null=True)),
('siteid', models.CharField(blank=True, max_length=40, null=True)),
('sitename', models.CharField(blank=True, max_length=320, null=True)),
('address1', models.CharField(blank=True, max_length=320, null=True)),
('address2', models.CharField(blank=True, max_length=320, null=True)),
('address3', models.CharField(blank=True, max_length=320, null=True)),
('address4', models.CharField(blank=True, max_length=320, null=True)),
('roomid', models.CharField(max_length=40)),
('roomname', models.CharField(blank=True, max_length=320, null=True)),
('roomdeptid', models.CharField(blank=True, max_length=40, null=True)),
('bookabletype', models.CharField(blank=True, max_length=40, null=True)),
('roomclass', models.CharField(blank=True, max_length=40, null=True)),
('zone', models.CharField(blank=True, max_length=40, null=True)),
('webview', models.CharField(blank=True, max_length=4, null=True)),
('automated', models.CharField(blank=True, max_length=4, null=True)),
('capacity', models.FloatField(blank=True, null=True)),
('category', models.CharField(blank=True, max_length=40, null=True)),
],
),
]
| 57.935484
| 114
| 0.595768
| 400
| 3,592
| 5.2375
| 0.18
| 0.229117
| 0.286396
| 0.343675
| 0.877327
| 0.877327
| 0.877327
| 0.877327
| 0.877327
| 0.877327
| 0
| 0.037792
| 0.248608
| 3,592
| 61
| 115
| 58.885246
| 0.738422
| 0.019209
| 0
| 0.814815
| 1
| 0
| 0.089489
| 0.005966
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.037037
| 0
| 0.092593
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
1720922c4cd4f6e1b3e6d4cbca103b3ff56dc646
| 86
|
py
|
Python
|
finny/boot/__init__.py
|
hurrycane/finny
|
aff6e1c480426976cfee02b3c1d3e6ae9c196f81
|
[
"MIT"
] | null | null | null |
finny/boot/__init__.py
|
hurrycane/finny
|
aff6e1c480426976cfee02b3c1d3e6ae9c196f81
|
[
"MIT"
] | null | null | null |
finny/boot/__init__.py
|
hurrycane/finny
|
aff6e1c480426976cfee02b3c1d3e6ae9c196f81
|
[
"MIT"
] | null | null | null |
from .boot_helper import load_runner
from .boot_helper import load_environment_config
| 28.666667
| 48
| 0.883721
| 13
| 86
| 5.461538
| 0.615385
| 0.225352
| 0.394366
| 0.56338
| 0.676056
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.093023
| 86
| 2
| 49
| 43
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
17395005889ef603468c481cdff84f7368ede294
| 99,502
|
py
|
Python
|
src/body.py
|
SSenpo/senpo
|
85a5c0b7f2817bcacea8a8150839a3b49436f096
|
[
"MIT"
] | null | null | null |
src/body.py
|
SSenpo/senpo
|
85a5c0b7f2817bcacea8a8150839a3b49436f096
|
[
"MIT"
] | null | null | null |
src/body.py
|
SSenpo/senpo
|
85a5c0b7f2817bcacea8a8150839a3b49436f096
|
[
"MIT"
] | 2
|
2021-11-08T08:47:50.000Z
|
2021-11-08T19:49:51.000Z
|
import telebot as tb
from telebot import types
import config
import time
import sqlite3
import datetime
def main():
# Подключаемся к боту
bot = tb.TeleBot(config.TOKEN)
# Подключаем базу
conn = sqlite3.connect('db/database', check_same_thread=False)
# Создаем курсор для работы с таблицами
cursor = conn.cursor()
stop_text = ['нет', 'выход', 'выйти', 'меню', '/menu', '/region', '/start', 'сдать', 'снять']
# Чекаем на наличие @юзернейма
def check_username(message):
if message.from_user.username is None:
t = 'Я заметил, что у тебя нету (@ username)! Пожалуйста, добавь его в настройках своего аккаунта. ' \
'Без этого пользователи бота не смогут с тобой взаимодействовать :('
bot.send_message(message.chat.id, t)
return 0
else:
return message
# Главное меню
def main_menu(message, t):
keyboard_main = types.ReplyKeyboardMarkup(resize_keyboard=True)
button_menu = ['Сдать', 'Меню', 'Снять', 'Посмотреть мои обьявления']
keyboard_main.add(button_menu[0], button_menu[1], button_menu[2])
keyboard_main.add(button_menu[3])
bot.send_message(message.chat.id, t, parse_mode='html', reply_markup=keyboard_main)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Сдать товар в аренду', callback_data='1')
key2 = types.InlineKeyboardButton('Арендовать товар', callback_data='2')
key3 = types.InlineKeyboardButton('Посмотреть все мои объявления',
callback_data='3')
key4 = types.InlineKeyboardButton('Посмотреть все объявления о сдаче',
callback_data='11')
key5 = types.InlineKeyboardButton(
'Посмотреть все объявления о поиске', callback_data='77')
# key6 = types.InlineKeyboardButton('Создать объявление о поиске', callback_data='search')
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
# markup.row(key6)
msg = bot.send_message(message.chat.id,
'Выбери, что мы будем делать сегодня:', parse_mode='html', reply_markup=markup)
return msg
def how_many_obj(category, u_id):
cursor.execute(
'SELECT COUNT(category) FROM obj WHERE category = ? '
'AND region = (SELECT user_region FROM user WHERE user_id = ?)',
(category, u_id,))
how_many = ((str(cursor.fetchone())).split(',')[0]).strip('(')
print(how_many)
if how_many == '0':
return ' '
else:
how_many = ' (' + how_many + ')'
return how_many
# ------------------------------Функция для регистрации пользователя------------------------------------------------
def db_table_val(user_id: int, user_name: str, user_region: str, user_registration: int, chat_id: int,
d: str):
cursor.execute('INSERT INTO user (user_id, user_name, user_region, user_registration, '
'chat_id, datetime) VALUES (?, ?, ?, ?, ?, ?)',
(user_id, user_name, user_region, user_registration, chat_id, d))
conn.commit()
# --------------------------------------ОБРАБОТЧИК КОМАНДЫ СТАРТ----------------------------------------------------
@bot.message_handler(commands=['start'])
def welcome(message):
# ------------------------ПРОВЕРКА НА НАЛИЧИЕ В БД ПОЛЬЗОВАТЕЛЯ------------------------
if check_username(message) == 0:
pass
else:
print(message)
u_id = message.from_user.id
info = cursor.execute('SELECT * FROM user WHERE user_id=?', (u_id,))
if info.fetchone() is None:
msg = bot.send_message(message.chat.id,
'Добро пожаловать!\n' +
'Укажи, пожалуйста, свой город.')
if msg.text:
bot.register_next_step_handler(msg, check_city)
else:
u_name = message.from_user.first_name
t = 'Чем займемся сегодня, {}?'.format(u_name)
main_menu(message, t)
# ----------------------APPLY() - О СОГЛАСИИ УВЕДОМЛЕНИЙ--------------------------------
def apply(message):
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton(
'Только в моём районе.',
callback_data='Yes')
key2 = types.InlineKeyboardButton('Выбрать несколько районов.',
callback_data='Yes+')
key3 = types.InlineKeyboardButton('Я не хочу получать уведомления',
callback_data='No')
markup.row(key1)
markup.row(key2)
markup.row(key3)
key = bot.send_message(message.chat.id,
'География понятна! Каждый день я помогаю соседям найти необходимые вещи. ' +
'Если ты готов сдавать что-то в аренду, я могу сообщить,' +
'когда твоим соседям что-нибудь понадобится. ' +
'Можно?) '.format(message.from_user, bot.get_me()), parse_mode='html',
reply_markup=markup)
return key
# ------------------ПОЛНАЯ РЕГИСТРАЦИЯ ПОЛЬЗОВАТЕЛЯ В БД ПОСЛЕ ТОГО КАК ОН ВВЕДЕТ РЕГИОН------------------------
def region(message):
u_id = message.from_user.id
chat_id = message.chat.id
u_name = "@" + message.from_user.username
u_region = message.text
get_reg = ["Академический", "Алексеевский", "Алтуфьевский", "Арбат", "Аэропорт",
"Бабушкинский", "Басманный", "Беговой", "Бескудниковский", "Бибирево",
"Бирюлёво восточное", "Бирюлёво западное", "Богородское", "Братеево",
"Бутово северное", "Бутово южное", "Бутырский", "Вешняки",
"Внуково", "Войковский", "Восточный", "Выхино-жулебино", "Гагаринский",
"Головинский", "Гольяново", "Ганиловский", "Дегунино восточное", "Дегунино западное",
"Дмитровский", "Донской", "Дорогомилово", "Замоскворечье",
"Зюзино", "Зябликово", "Ивановское", "Измайлово восточное", "Измайлово",
"Измайлово северное", "Капотня", "Коньково", "Коптево", "Косино-ухтомский",
"Котловка", "Красносельский", "Крылатское", "Крюково", "Кузьминки",
"Кунцево", "Куркино", "Левобережный", "Лефортово", "Лианозово", "Ломоносовский",
"Лосиноостровский", "Люблино", "Марфино", "Марьина роща", "Марьино",
"Матушкино", "Медведково северное", "Медведково южное", "Метрогородок",
"Мещанский", "Митино", "Можайский", "Молжаниновский", "Москворечье-сабурово",
"Нагатино-садовники", "Нагатинский затон", "Нагорный", "Некрасовка",
"Нижегородский", "Ново-переделкино", "Новогиреево", "Новокосино",
"Обручевский", "Орехово-борисово северное", "Орехово-борисово южное",
"Останкинский", "Отрадное", "Очаково-матвеевское", "Перово", "Печатники",
"Покровское-стрешнево", "Преображенское", "Пресненский", "Проспект вернадского",
"Раменки", "Ростокино", "Рязанский", "Савёлки", "Савёловский", "Свиблово",
"Северный", "Силино", "Сокол", "Соколиная гора", "Сокольники", "Солнцево",
"Старое крюково", "Строгино", "Таганский", "Тверской", "Текстильщики", "Тёплый стан",
"Тимирязевский", "Тропарёво-никулино", "Тушино северное", "Тушино южное",
"Филёвский парк", "Фили-давыдково", "Хамовники", "Ховрино", "Хорошёво-мневники",
"Хорошёвский", "Царицыно", "Черёмушки", "Чертаново", "Щукино", "Южнопортовый",
"Якиманка", "Ярославский", "Ясенево"]
for x in get_reg:
if u_region.lower() == x.lower():
date = (str(datetime.datetime.now().today()))[:16]
db_table_val(user_id=u_id, user_name=u_name, user_region=x, user_registration=3, chat_id=chat_id,
d=date)
apply(message)
break
else:
t = 'Не нашёл твой регион, попробуй еще раз. Вот список доступных районов:\n\n{}'.format('\n'.join(get_reg))
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, region)
def check_city(message):
city = ['москва', 'москвп', 'масква', 'ммасква', 'мск', 'москоу', 'moscow', 'mocscow', 'msc']
city_korolev = ['королев', 'королёв', 'король', 'каролёв', 'каролев']
if message.text.lower() in city:
msg = bot.send_message(message.chat.id,
'Укажи, пожалуйста, свой район, чтобы я мог подключить' +
'тебя к дружной сети соседей :)')
return bot.register_next_step_handler(msg, region)
if message.text.lower() in city_korolev:
u_id = message.from_user.id
chat_id = message.chat.id
u_name = "@" + message.from_user.username
u_region = 'Королёв'
date = (str(datetime.datetime.now().today()))[:16]
db_table_val(user_id=u_id, user_name=u_name, user_region=u_region, user_registration=2, chat_id=chat_id,
d=date)
cursor.execute("UPDATE 'user' SET 'search_message' = user_region WHERE user_id = ?", (u_id,))
conn.commit()
t = 'Супер! Регистрация завершена, я буду присылать тебе уведомления о поиске в твоем районе, а пока...'
return main_menu(message, t)
else:
with open("city.txt", "a") as file:
file.write('-' + message.text + '\n')
file.close()
bot.send_message(message.chat.id, 'К сожалению, Соседи пока захватывают только Москву.\n'
'Я запомнил твой город, чтобы мы скорее могли встретиться!\n'
'\nА пока следи за нашими обновлениями в Instagram:\n'
'https://instagram.com/sosedi.sharing')
# ------------------------ОБРАБОТЧИК КОМАНДЫ МЕНЮ--------------------------------------------
@bot.message_handler(commands=['menu'])
def get_menu(message):
if check_username(message) == 0:
pass
else:
t = 'Возвращаемся к меню...'
main_menu(message, t)
# ------------------------ОБРАБОТЧИК КОМАНДЫ СМЕНИТЬ РЕГИОН----------------------------------
@bot.message_handler(commands=['region'])
def change_region(message):
if check_username(message) == 0:
pass
else:
t = 'Хочешь поменять свой район? Введи название района, например : Северный'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, change_user_region)
def change_user_region(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_region = message.text
u_id = message.from_user.id
get_reg = ["Академический", "Алексеевский", "Алтуфьевский", "Арбат", "Аэропорт",
"Бабушкинский", "Басманный", "Беговой", "Бескудниковский", "Бибирево",
"Бирюлёво восточное", "Бирюлёво западное", "Богородское", "Братеево",
"Бутово северное", "Бутово южное", "Бутырский", "Вешняки",
"Внуково", "Войковский", "Восточный", "Выхино-жулебино", "Гагаринский",
"Головинский", "Гольяново", "Ганиловский", "Дегунино восточное", "Дегунино западное",
"Дмитровский", "Донской", "Дорогомилово", "Замоскворечье",
"Зюзино", "Зябликово", "Ивановское", "Измайлово восточное", "Измайлово",
"Измайлово северное", "Капотня", "Коньково", "Коптево", "Косино-ухтомский",
"Котловка", "Красносельский", "Крылатское", "Крюково", "Кузьминки",
"Кунцево", "Куркино", "Левобережный", "Лефортово", "Лианозово", "Ломоносовский",
"Лосиноостровский", "Люблино", "Марфино", "Марьина роща", "Марьино",
"Матушкино", "Медведково северное", "Медведково южное", "Метрогородок",
"Мещанский", "Митино", "Можайский", "Молжаниновский", "Москворечье-сабурово",
"Нагатино-садовники", "Нагатинский затон", "Нагорный", "Некрасовка",
"Нижегородский", "Ново-переделкино", "Новогиреево", "Новокосино",
"Обручевский", "Орехово-борисово северное", "Орехово-борисово южное",
"Останкинский", "Отрадное", "Очаково-матвеевское", "Перово", "Печатники",
"Покровское-стрешнево", "Преображенское", "Пресненский", "Проспект вернадского",
"Раменки", "Ростокино", "Рязанский", "Савёлки", "Савёловский", "Свиблово",
"Северный", "Силино", "Сокол", "Соколиная гора", "Сокольники", "Солнцево",
"Старое крюково", "Строгино", "Таганский", "Тверской", "Текстильщики", "Тёплый стан",
"Тимирязевский", "Тропарёво-никулино", "Тушино северное", "Тушино южное",
"Филёвский парк", "Фили-давыдково", "Хамовники", "Ховрино", "Хорошёво-мневники",
"Хорошёвский", "Царицыно", "Черёмушки", "Чертаново", "Щукино", "Южнопортовый",
"Якиманка", "Ярославский", "Ясенево"]
for x in get_reg:
if u_region.lower() == x.lower():
cursor.execute('UPDATE user SET user_region = ? WHERE user_id = ?', (x, u_id,))
conn.commit()
cursor.execute('UPDATE obj SET region = ? WHERE u_id = ?', (x, u_id,))
conn.commit()
cursor.execute('UPDATE search_obj SET region = ? WHERE u_id = ?', (x, u_id,))
conn.commit()
t = 'Я поменял твой район и отредактировал его в твоих обьявлениях! Теперь твой район - {}'.format(x)
main_menu(message, t)
break
else:
t = 'Не нашёл такой район.'
main_menu(message, t)
# -------------------------ОБРАБОТЧИК ВСЕХ КОЛЛ ОТВЕТОВ ОТ ПОЛЬЗОВАТЕЛЯ-----------------------
@bot.callback_query_handler(func=lambda call: True)
def apply_get(call):
message = call.message
if call.data == 'No':
t = 'Как скажешь! Никаких уведомлений :)'
app_num = 3
u_id = call.from_user.id
cursor.execute("UPDATE 'user' SET 'user_registration' = ? WHERE user_id = ?",
(app_num, u_id,))
conn.commit()
cursor.execute("UPDATE 'user' SET 'search_message' = user_region WHERE user_id = ?", (u_id,))
conn.commit()
bot.edit_message_reply_markup(message.chat.id, message_id=message.message_id,
reply_markup=None) # удаляем кнопки у последнего сообщения
main_menu(message, t)
if call.data == 'Yes':
app_num = 2
u_id = call.from_user.id
cursor.execute("UPDATE 'user' SET 'user_registration' = ? WHERE user_id = ?",
(app_num, u_id,))
conn.commit()
cursor.execute("UPDATE 'user' SET 'search_message' = user_region WHERE user_id = ?", (u_id,))
conn.commit()
bot.edit_message_reply_markup(message.chat.id, message_id=message.message_id,
reply_markup=None) # удаляем кнопки у последнего сообщения
t = 'Супер! Договорились, я буду присылать тебе уведомления только о поиске в твоем районе.'
main_menu(message, t)
if call.data == 'Yes+':
app_num = 1
u_id = call.from_user.id
cursor.execute("UPDATE 'user' SET 'user_registration' = ? WHERE user_id = ?",
(app_num, u_id,))
conn.commit()
bot.edit_message_reply_markup(message.chat.id, message_id=message.message_id,
reply_markup=None) # удаляем кнопки у последнего сообщения
t = 'Отлично! Напиши районы, о поиске вещей в которых ты бы хотел получать уведомления.\n' \
'Например: Арбат, Царицыно, Внуково'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_message_init)
# --------MENU--------
if call.data == 'menu':
t = 'Главное меню'
main_menu(message, t)
# ---------СДАЕМ---------
if call.data == '1':
t = 'Здорово, что ты готов сдать что-то в аренду! Я помогу тебе составить объявление. ' \
'Давай начнем с категории товара, который ты бы хотел сдать в аренду. Выбери подходящее:'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Фото и видео',
callback_data='1-1')
key2 = types.InlineKeyboardButton('Техника для дома',
callback_data='1-2')
key3 = types.InlineKeyboardButton('Игры и консоли',
callback_data='1-3')
key4 = types.InlineKeyboardButton(
'Туризм и путешествия',
callback_data='1-4')
key5 = types.InlineKeyboardButton('Декор и мебель',
callback_data='1-5')
key6 = types.InlineKeyboardButton('Детские товары',
callback_data='1-6')
key7 = types.InlineKeyboardButton('Для мероприятий',
callback_data='1-7')
key8 = types.InlineKeyboardButton('Инструменты',
callback_data='1-8')
key9 = types.InlineKeyboardButton('Товары для спорта',
callback_data='1-9')
key10 = types.InlineKeyboardButton('Музыка и хобби',
callback_data='1-10')
key11 = types.InlineKeyboardButton('Прочее', callback_data='1-11')
key12 = types.InlineKeyboardButton('Выйти в МЕНЮ', callback_data='menu')
markup.row(key12)
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
markup.row(key6)
markup.row(key7)
markup.row(key8)
markup.row(key9)
markup.row(key10)
markup.row(key11)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
# --------АРЕНДУЕМ-------
if call.data == '2':
u_id = call.from_user.id
t = 'Понял тебя, арендуем! Уже вспоминанию все объявления твоих соседей! ' \
'Выбери категорию, в которой находится нужный тебе предмет.'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Фото и видео {}'.format(how_many_obj('Фото и видео', u_id)),
callback_data='2-1')
key2 = types.InlineKeyboardButton('Техника для дома {}'.format(how_many_obj('Техника для дома', u_id)),
callback_data='2-2')
key3 = types.InlineKeyboardButton('Игры и консоли {}'.format(how_many_obj('Игры и консоли', u_id)),
callback_data='2-3')
key4 = types.InlineKeyboardButton(
'Туризм и путешествия {}'.format(how_many_obj('Туризм и путешествия', u_id)),
callback_data='2-4')
key5 = types.InlineKeyboardButton('Декор и мебель {}'.format(how_many_obj('Декор и мебель', u_id)),
callback_data='2-5')
key6 = types.InlineKeyboardButton('Детские товары {}'.format(how_many_obj('Детские товары', u_id)),
callback_data='2-6')
key7 = types.InlineKeyboardButton('Для мероприятий {}'.format(how_many_obj('Для мероприятий', u_id)),
callback_data='2-7')
key8 = types.InlineKeyboardButton('Инструменты {}'.format(how_many_obj('Инструменты', u_id)),
callback_data='2-8')
key9 = types.InlineKeyboardButton('Товары для спорта {}'.format(how_many_obj('Товары для спорта', u_id)),
callback_data='2-9')
key10 = types.InlineKeyboardButton('Музыка и хобби {}'.format(how_many_obj('Музыка и хобби', u_id)),
callback_data='2-10')
key11 = types.InlineKeyboardButton('Прочее {}'.format(how_many_obj('Прочее', u_id)), callback_data='2-11')
key12 = types.InlineKeyboardButton('Выйти в МЕНЮ', callback_data='menu')
key13 = types.InlineKeyboardButton('Создать объявление о поиске', callback_data='search')
markup.row(key12)
markup.row(key13)
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
markup.row(key6)
markup.row(key7)
markup.row(key8)
markup.row(key9)
markup.row(key10)
markup.row(key11)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
# --------АРЕНДУЕМ ПОИСК-----------------------
if call.data == '2-1':
category = 'Фото и видео'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-2':
category = 'Техника для дома'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-3':
category = 'Игры и консоли'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-4':
category = 'Туризм и путешествия'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-5':
category = 'Декор и мебель'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-6':
category = 'Детские товары'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-7':
category = 'Для мероприятий'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-8':
category = 'Инструменты'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-9':
category = 'Товары для спорта'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-10':
category = 'Музыка и хобби'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
if call.data == '2-11':
category = 'Прочее'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
t = 'А что именно из ({}) ты бы хотел арендовать? Используй слово или короткую фразу.'.format(category)
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_cat1, category)
# ---------------------------------------------------------------------------------------------------
if call.data == '2-1+':
t = 'Круто! Тогда смело пиши владельцу :) Он тебя уже ждет!'
main_menu(message, t)
if call.data == '2-1-':
t = 'Не подходит? Тогда давай я спрошу всех соседей? У кого-то 100% есть!'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
if call.data == '2-1---':
t = 'Чтобы я точно передал всем твою просьбу - давай создадим объявление. \n' \
'Напиши еще раз название, что ты ищешь: '
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name)
if call.data == '2-1-++':
t = 'Тогда возвращаю тебе меню...'
main_menu(message, t)
if call.data == '2-1-0':
t = 'Выбери, что хочешь изменить ->'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Название', callback_data='2-1-0-1')
key2 = types.InlineKeyboardButton('Описание', callback_data='2-1-0-2')
markup.row(key1)
markup.row(key2)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
if call.data == '2-1-0-1':
t = 'Введи новое название'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name_edit)
if call.data == '2-1-0-2':
t = 'Введи новое описание'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_text)
if call.data == '2-1-1':
send_push(call)
t = 'Соседская поисковая машина запущена! Мне понадобится немного времени, ' \
'но я сообщу сразу, как только найду подходящие для тебя варианты)'
main_menu(message, t)
# --------ПОСМОТРЕТЬ ВСЕ МОИ ОБЬЯВЛЕНИЯ---------
if call.data == '3':
t = 'Какие обьявления смотрим?'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Что я сдаю?', callback_data='3-1-1')
key2 = types.InlineKeyboardButton('Что я ищу в аренду?', callback_data='3-1-2')
markup.row(key1)
markup.row(key2)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
if call.data == '3-1-1':
u_id = call.from_user.id
cursor.execute('DELETE FROM obj WHERE u_id = ? AND photo IS NULL OR money_cat1 IS NULL OR cat_1 IS NULL',
(u_id,))
conn.commit()
cursor.execute('DELETE FROM search_obj WHERE u_id = ? AND obj_comment IS NULL', (u_id,))
conn.commit()
cursor.execute("SELECT * FROM 'obj' WHERE u_id = ?",
(u_id,))
result = cursor.fetchall()
if result:
bot.send_message(message.chat.id,
"Вот все твои действующие объявления: ",
parse_mode='html')
for x in result:
bot.send_photo(message.chat.id, x[6])
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Удалить', callback_data='delete1')
markup.row(key1)
bot.send_message(message.chat.id,
"Категория:{}\n\nНазвание:{}\n\nЦена:{}р\n\nОписание:{}"
"\n\nВладелец:{}".format(x[7], x[2], x[3], x[4], x[5]),
parse_mode='html', reply_markup=markup)
else:
t = 'Что-то не припомню, чтобы мы с тобой создавали вместе объявление :( Хочешь попробовать?'
main_menu(message, t)
if call.data == '3-1-2':
u_id = call.from_user.id
cursor.execute('DELETE FROM obj WHERE u_id = ? AND photo IS NULL OR money_cat1 IS NULL OR cat_1 IS NULL',
(u_id,))
conn.commit()
cursor.execute('DELETE FROM search_obj WHERE u_id = ? AND obj_comment IS NULL', (u_id,))
conn.commit()
cursor.execute("SELECT * FROM 'search_obj' WHERE u_id = ?",
(u_id,))
result = cursor.fetchall()
if result:
bot.send_message(message.chat.id,
"Вот все активные запросы на поиск, которые ты создал: ",
parse_mode='html')
for x in result:
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Удалить', callback_data='delete2')
markup.row(key1)
bot.send_message(message.chat.id,
"Всем привет!\n{} - срочно ищет кое-что :)\n\n"
"Название: {}\n\nОписание: {}\n\n"
.format(x[4], x[2], x[3]),
reply_markup=markup)
else:
t = 'Что-то не припомню, чтобы мы с тобой создавали запрос. Хочешь попробовать?'
main_menu(message, t)
# --===---ПОСМОТРЕТЬ ВСЕ ОБЬЯВЛЕНИЯ О СДАЧЕ В КАТЕГОРИИ-----------
if call.data == '11':
u_id = call.from_user.id
t = 'Выбери категорию:'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Фото и видео {}'.format(how_many_obj('Фото и видео', u_id)),
callback_data='11-1')
key2 = types.InlineKeyboardButton('Техника для дома {}'.format(how_many_obj('Техника для дома', u_id)),
callback_data='11-2')
key3 = types.InlineKeyboardButton('Игры и консоли {}'.format(how_many_obj('Игры и консоли', u_id)),
callback_data='11-3')
key4 = types.InlineKeyboardButton(
'Туризм и путешествия {}'.format(how_many_obj('Туризм и путешествия', u_id)),
callback_data='11-4')
key5 = types.InlineKeyboardButton('Декор и мебель {}'.format(how_many_obj('Декор и мебель', u_id)),
callback_data='11-5')
key6 = types.InlineKeyboardButton('Детские товары {}'.format(how_many_obj('Детские товары', u_id)),
callback_data='11-6')
key7 = types.InlineKeyboardButton('Для мероприятий {}'.format(how_many_obj('Для мероприятий', u_id)),
callback_data='11-7')
key8 = types.InlineKeyboardButton('Инструменты {}'.format(how_many_obj('Инструменты', u_id)),
callback_data='11-8')
key9 = types.InlineKeyboardButton('Товары для спорта {}'.format(how_many_obj('Товары для спорта', u_id)),
callback_data='11-9')
key10 = types.InlineKeyboardButton('Музыка и хобби {}'.format(how_many_obj('Музыка и хобби', u_id)),
callback_data='11-10')
key11 = types.InlineKeyboardButton('Прочее {}'.format(how_many_obj('Прочее', u_id)),
callback_data='11-11')
key12 = types.InlineKeyboardButton('Выйти в МЕНЮ', callback_data='menu')
markup.row(key12)
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
markup.row(key6)
markup.row(key7)
markup.row(key8)
markup.row(key9)
markup.row(key10)
markup.row(key11)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
if call.data == '11-1':
category = 'Фото и видео'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-2':
print(1)
category = 'Техника для дома'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
print(2)
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
print(3)
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-3':
category = 'Игры и консоли'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-4':
category = 'Туризм и путешествия'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-5':
category = 'Декор и мебель'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-6':
category = 'Детские товары'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-7':
category = 'Для мероприятий'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-8':
category = 'Инструменты'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-9':
category = 'Товары для спорта'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-10':
category = 'Музыка и хобби'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
if call.data == '11-11':
category = 'Прочее'
u_id = call.from_user.id
if how_many_obj(category, u_id) == ' ':
t = 'В категории({}) нету объявлений, давай создадим запрос на поиск?'.format(category)
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
# bot.send_message(message.chat.id, t, reply_markup=markup)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t,
reply_markup=markup)
else:
# t = 'Ищем в категории {}, все верно?'.format(category)
# msg = bot.send_message(message.chat.id, t)
# bot.register_next_step_handler(msg, look_obj, category)
return look_obj(call, category)
# ----------ПОСМОТРЕТЬ ВСЕ ОБЪЯВЛЕНИЯ О ПОИСКЕ В АРЕНДУ------------
if call.data == '77':
t = 'Вот что сейчас ищут...'
u_id = call.from_user.id
cursor.execute("SELECT user_region FROM 'user' WHERE user_id = ?", (u_id,))
user_region = cursor.fetchone()
cursor.execute("SELECT * FROM 'search_obj' WHERE obj_comment IS NOT NULL AND region = ?",
(user_region[0],))
result = cursor.fetchall()
if result:
bot.send_message(message.chat.id, t)
for x in result:
bot.send_message(message.chat.id,
"{} - срочно ищет кое-что :)\n\n"
"Название: {}\n\nОписание: {}\n\n"
.format(x[4], x[2], x[3]))
else:
t = 'В твоём районе нет активных запросов на поиск.'
main_menu(message, t)
# -----СДАТЬ В КАТЕГОРИИ -----
if call.data == '1-1':
t = 'Супер! А что именно из категории (Фото и видео) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Фото и видео'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-2':
t = 'Супер! А что именно из категории (Техника для дома) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Техника для дома'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-3':
t = 'Супер! А что именно из категории (Игры и консоли) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Игры и консоли'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-4':
t = 'Супер! А что именно из категории (Туризм и путешествия) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Туризм и путешествия'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-5':
t = 'Супер! А что именно из категории (Декор и мебель) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Декор и мебель'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-6':
t = 'Супер! А что именно из категории (Детские товары) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Детские товары'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-7':
t = 'Супер! А что именно из категории (Для мероприятий) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Для мероприятий'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-8':
t = 'Супер! А что именно из категории (Инструменты) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Инструменты'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-9':
t = 'Супер! А что именно из категории (Товары для спорта) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Товары для спорта'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-10':
t = 'Супер! А что именно из категории (Музыка и хобби) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Музыка и хобби'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
if call.data == '1-11':
t = 'Супер! А что именно из категории (Прочее) ты готов сдать в аренду? ' \
'Укажи название, нескольких слов будет достаточно :)'
z = 'Прочее'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, init_name_obj, z)
# -----ПОДТВЕРДИТЬ ТОЛЬКО ЧТО СОЗДАННОЕ ОБЬЯВЛЕНИЕ(КАТ_1)------
if call.data == '01':
t = 'Супер! Объявление добавлено.\n‼️ Важно: перед тем, как сдать товар сфотографируй паспорт того, ' \
'кому сдаёшь. А если вещь дорога для тебя, то подумай, что можешь взять в залог.\nПодробнее: https://telegra.ph/Osnovy-bezopasnoj-sdelki-12-13'
main_menu(message, t)
# ----РЕДАКТИРОВАТЬ ТОЛЬКО ЧТО СОЗДАННОЕ ОБЬЯВЛЕНИЕ(КАТ_1)---------------
if call.data == '01-1':
t = 'Выбери, что ты хочешь изменить ->'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Название', callback_data='01-1-1')
key2 = types.InlineKeyboardButton('Цена', callback_data='01-1-2')
key3 = types.InlineKeyboardButton('Описание', callback_data='01-1-3')
key5 = types.InlineKeyboardButton('Фото', callback_data='01-1-5')
key4 = types.InlineKeyboardButton('Удалить', callback_data='01-1-4')
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key5)
markup.row(key4)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
if call.data == '01-1-4':
u_id = call.from_user.id
cursor.execute('DELETE FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(u_id,))
conn.commit()
t = 'Я удалил твоё последнее объявление.\n'
main_menu(message, t)
if call.data == '01-1-1':
t = 'Введи НОВОЕ название объявления'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, update_name_obj)
if call.data == '01-1-2':
t = 'Введи НОВУЮ цену объявления'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, update_money_obj)
if call.data == '01-1-3':
t = 'Введи НОВОЕ описание объявления'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, update_text_obj)
if call.data == '01-1-5':
t = 'Отправь НОВУЮ фотографию для объявления'
msg = bot.send_message(message.chat.id, t, parse_mode='html')
bot.register_next_step_handler(msg, update_photo_obj)
# --------УДАЛИТЬ ОБЬЯВЛЕНИЕ----------------------------------------
if call.data == 'delete1':
t = 'Введи название своего обьявления, которое ты хочешь удалить.'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, delete_obj)
if call.data == 'delete2':
t = 'Введи название своего обьявления, которое ты хочешь удалить.'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, delete_search_obj)
# --------сОЗДАТЬ ОБЪЯВЛЕНИЕ О ПОИСКЕ В АРЕНДУ-------------
if call.data == 'search':
t = 'Хочешь создать объявление о поиске в аренду?'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
bot.edit_message_text(chat_id=message.chat.id, message_id=message.message_id, text=t, reply_markup=markup)
# -------------------------ФУНКЦИЯ ПОЛУЧЕНИЯ УВЕДОМЛЕНИЙ В НЕСКОЛЬКИХ РАЙОНАХ-------------------------------
def search_message_init(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_reg = message.text
u_region = [str(x) for x in u_reg.split(', ')]
u_id = message.from_user.id
get_reg = ["Академический", "Алексеевский", "Алтуфьевский", "Арбат", "Аэропорт",
"Бабушкинский", "Басманный", "Беговой", "Бескудниковский", "Бибирево",
"Бирюлёво восточное", "Бирюлёво западное", "Богородское", "Братеево",
"Бутово северное", "Бутово южное", "Бутырский", "Вешняки",
"Внуково", "Войковский", "Восточный", "Выхино-жулебино", "Гагаринский",
"Головинский", "Гольяново", "Ганиловский", "Дегунино восточное", "Дегунино западное",
"Дмитровский", "Донской", "Дорогомилово", "Замоскворечье",
"Зюзино", "Зябликово", "Ивановское", "Измайлово восточное", "Измайлово",
"Измайлово северное", "Капотня", "Коньково", "Коптево", "Косино-ухтомский",
"Котловка", "Красносельский", "Крылатское", "Крюково", "Кузьминки",
"Кунцево", "Куркино", "Левобережный", "Лефортово", "Лианозово", "Ломоносовский",
"Лосиноостровский", "Люблино", "Марфино", "Марьина роща", "Марьино",
"Матушкино", "Медведково северное", "Медведково южное", "Метрогородок",
"Мещанский", "Митино", "Можайский", "Молжаниновский", "Москворечье-сабурово",
"Нагатино-садовники", "Нагатинский затон", "Нагорный", "Некрасовка",
"Нижегородский", "Ново-переделкино", "Новогиреево", "Новокосино",
"Обручевский", "Орехово-борисово северное", "Орехово-борисово южное",
"Останкинский", "Отрадное", "Очаково-матвеевское", "Перово", "Печатники",
"Покровское-стрешнево", "Преображенское", "Пресненский", "Проспект вернадского",
"Раменки", "Ростокино", "Рязанский", "Савёлки", "Савёловский", "Свиблово",
"Северный", "Силино", "Сокол", "Соколиная гора", "Сокольники", "Солнцево",
"Старое крюково", "Строгино", "Таганский", "Тверской", "Текстильщики", "Тёплый стан",
"Тимирязевский", "Тропарёво-никулино", "Тушино северное", "Тушино южное",
"Филёвский парк", "Фили-давыдково", "Хамовники", "Ховрино", "Хорошёво-мневники",
"Хорошёвский", "Царицыно", "Черёмушки", "Чертаново", "Щукино", "Южнопортовый",
"Якиманка", "Ярославский", "Ясенево"]
cursor.execute('SELECT user_region FROM user WHERE user_id = ?', (u_id,))
result = cursor.fetchone()
u_region.append(result[0])
if set(u_region).issubset(get_reg) == 1:
result = ", ".join(list(set(get_reg).intersection(set(u_region))))
cursor.execute('UPDATE user SET search_message = ? WHERE user_id = ?', (result, u_id,))
conn.commit()
t = 'Понял тебя. Теперь буду сообщать тебе о поиске в этих районах: {}'.format(result)
main_menu(message, t)
else:
t = 'Не нашёл все районы, пожалуйста, попробуй еще раз.\n' \
'Ввод должен быть таким: Арбат, Царицыно, Внуково\n\n' \
'Вот список доступных районов:\n\n{}' \
.format('\n'.join(get_reg))
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_message_init)
# -----------------ФУНКЦИЯ ДЛЯ ПРОСМОТРА ВСЕХ ОБ. ПО КАТЕГОРИЯМ И РЕГИОНУ ПОЛЬЗОВАТЕЛЯ----------------------
def look_obj(message, category):
# if message.text.lower() in stop_text:
# t = 'Возвращаю меню...'
# return main_menu(message, t)
# if message[2] == 'from_user':
# u_id =
u_id = message.from_user.id
cursor.execute("SELECT user_region FROM user WHERE user_id = ?", (u_id,))
u_region = cursor.fetchone()
cat = '{}'.format(category)
cursor.execute("SELECT * FROM 'obj' WHERE "
"cat_1 IS NOT NULL AND name_cat1_obj IS NOT NULL AND photo IS NOT NULL "
"AND category = ? AND region = ?", (cat, u_region[0],))
result = cursor.fetchall()
if result:
bot.send_message(message.from_user.id,
"Вот все действующие объявления: ",
parse_mode='html')
for x in result:
bot.send_photo(message.from_user.id, x[6])
bot.send_message(message.from_user.id,
"Категория: {}\n\nНазвание: {}\n\nЦена: {}р\n\nОписание :{}"
"\n\nВладелец:{}".format(x[7], x[2], x[3], x[4], x[5]),
parse_mode='html')
t = 'Нашел ли ты нужное или все не то?\n‼️ Важно: аккуратно относись к вещам, которые берёшь в аренду.' \
'Мы советуем делать фотографии дефектов перед арендой, чтобы потом не было конфликтов.\nПодробнее: https://telegra.ph/Osnovy-bezopasnoj-sdelki-12-13'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Подходит!', callback_data='2-1+')
key2 = types.InlineKeyboardButton('Я не нашёл, что искал', callback_data='2-1-')
markup.row(key1)
markup.row(key2)
bot.send_message(message.from_user.id, t, reply_markup=markup)
else:
t = 'Похоже, еще никто не создал объявление :( Создай своё с помощью кнопки меню: "Арендовать товар"'
main_menu(message, t)
# ------------------------------ФУНКЦИИ ДЛЯ УДАЛЕНИЯ ОБЬЯВЛЕНИЙ-------------------------------------
def delete_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_id = message.from_user.id
u_text = message.text
cursor.execute('SELECT name_cat1_obj FROM obj WHERE u_id = ?', (u_id,))
result = cursor.fetchall()
for x in result:
a = x[0]
if u_text.lower() == a.lower():
cursor.execute('DELETE FROM obj WHERE u_id = ? AND name_cat1_obj = ?', (u_id, a,))
conn.commit()
t = 'Я удалил обьявление ({})'.format(a)
bot.send_message(message.chat.id, t)
break
else:
t = 'Я не нашел в списке твоих обьявлений такое название.'
bot.send_message(message.chat.id, t)
def delete_search_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_id = message.from_user.id
u_text = message.text
cursor.execute('SELECT obj_name FROM search_obj WHERE u_id = ?', (u_id,))
result = cursor.fetchall()
for x in result:
a = x[0]
if u_text.lower() == a.lower():
cursor.execute('DELETE FROM search_obj WHERE u_id = ? AND obj_name = ?', (u_id, a,))
conn.commit()
t = 'Я удалил обьявление {}'.format(a)
bot.send_message(message.chat.id, t)
break
else:
t = 'Я не нашел в списке твоих обьявлений такое название.'
bot.send_message(message.chat.id, t)
# --------------------------------------ФУНКЦИЯ ДЛЯ УВЕДОМЛЕНИЯ---------------------------------------------
def send_push(message):
u1_id = message.from_user.id
cursor.execute('SELECT user_region FROM user WHERE user_id = ?',
(u1_id,))
u1_region = cursor.fetchall()
cursor.execute('SELECT chat_id FROM user WHERE user_registration = ? OR user_registration = ?',
(1, 2))
u2_id = cursor.fetchall()
if u2_id:
for x in u2_id:
cursor.execute('SELECT search_message FROM user WHERE user_id = ?',
(x[0],))
region_lst = cursor.fetchall()
if u1_region[0][0] in region_lst[0][0]:
cursor.execute('SELECT * FROM search_obj WHERE id = (SELECT MAX(id) FROM search_obj '
'WHERE u_id = ?)', (u1_id,))
result = cursor.fetchone()
bot.send_message(x[0],
"Всем привет!\n{} - срочно ищет кое-что :)\n\n"
"Название: {}\n\nОписание: {}\n\n"
.format(result[4], result[2], result[3]))
else:
return 0
# ----------------------------------------ФУНКЦИИ ВЕТКИ СЬЕМ------------------------------------------------
def search_cat1(message, category):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
all_search = ['все', 'всё', 'все обьявления', 'все объявления', 'обьявления', 'обьявление', 'объявления',
'объявление', 'объявление все', 'посмотреть все', 'посмотреть всё', 'all']
if message.text.lower() in all_search:
return look_obj(message, category)
u_text = message.text
u_id = message.from_user.id
cat = '{}'.format(category)
cursor.execute("SELECT user_region FROM user WHERE user_id = ?", (u_id,))
u_region = cursor.fetchone()
cursor.execute("SELECT * FROM 'obj' WHERE "
"cat_1 IS NOT NULL AND name_cat1_obj IS NOT NULL AND photo IS NOT NULL "
"AND category = ? AND region = ?", (cat, u_region[0],))
result = cursor.fetchall()
if len(u_text) > 2 and u_text.isdigit() == 0:
r = 0
for x in result:
a = x[2]
if u_text.lower() in a.lower():
bot.send_message(message.chat.id, 'Смотри, что я нашел!')
bot.send_photo(message.chat.id, x[6])
bot.send_message(message.chat.id, 'Название: {}\n\nЦена: {}р\n\nОписание: {}\n\nВладелец: {}'
.format(x[2], x[3], x[4], x[5]))
r = r + 1
if r != 0:
t = 'Нашел ли ты нужное или все не то?\n‼️ Важно: аккуратно относись к вещам, которые берёшь в аренду.' \
'Мы советуем делать фотографии дефектов перед арендой, чтобы потом не было конфликтов.\nПодробнее: https://telegra.ph/Osnovy-bezopasnoj-sdelki-12-13'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Подходит!', callback_data='2-1+')
key2 = types.InlineKeyboardButton('Я не нашёл, что искал', callback_data='2-1-')
markup.row(key1)
markup.row(key2)
bot.send_message(message.chat.id, t, reply_markup=markup)
if r == 0:
t = 'Таких объявлений нет, давай создадим запрос?'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Давай', callback_data='2-1---')
key2 = types.InlineKeyboardButton('Нет, спасибо', callback_data='2-1-++')
markup.row(key1)
markup.row(key2)
bot.send_message(message.chat.id, t, reply_markup=markup)
else:
msg = bot.send_message(message.chat.id, 'Ошибка! Попробуй написать по другому:')
bot.register_next_step_handler(msg, search_cat1, category)
def search_obj_name(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_text = message.text
u_id = message.from_user.id
u_name = '@' + message.from_user.username
date = (str(datetime.datetime.now().today()))[:16]
if len(u_text) > 30 or u_text.isdigit() == 1:
t = 'Слишком длинно для названия! Попробуй написать кратко :)'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name)
if len(u_text) > 2 and u_text.isdigit() == 0:
cursor.execute('SELECT user_region FROM user WHERE user_id = ?', (u_id,))
user_region = cursor.fetchone()[0]
cursor.execute('INSERT INTO search_obj (u_id, obj_name, u_name, region, datetime) VALUES (?, ?, ?, ?, ?)',
(u_id, u_text, u_name, user_region, date))
conn.commit()
t = 'Отлично, добавь комментарий к твоему объявлению.\nНапример, можешь написать цену и ' \
'срок, на который тебе нужна аренда.'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_text)
else:
t = 'Некорректный ввод! Попробуй написать по другому :)'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name)
def search_obj_text(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_text = message.text
u_id = message.from_user.id
if 2 < len(u_text) < 300 and u_text.isdigit() == 0:
cursor.execute('UPDATE search_obj SET obj_comment = ? WHERE id = (SELECT MAX(id) FROM search_obj WHERE '
'u_id = ?)',
(u_text, u_id,))
conn.commit()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Всё верно, запускай машину!', callback_data='2-1-1')
key2 = types.InlineKeyboardButton('Редактировать', callback_data='2-1-0')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM search_obj WHERE id = (SELECT MAX(id) FROM search_obj WHERE u_id = ?)',
(u_id,))
result = cursor.fetchone()
reply = bot.send_message(message.chat.id,
"Всем привет!\n{} - срочно ищет кое-что :)\n\n"
"Название: {}\n\nОписание: {}\n\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[4], result[2], result[3]),
reply_markup=markup)
return reply
else:
t = 'Не корректный ввод! Попробуй написать по другому :)'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_text)
def search_obj_name_edit(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_text = message.text
u_id = message.from_user.id
if len(u_text) > 30 or u_text.isdigit() == 1:
t = 'Слишком длинно для названия! Попробуй написать кратко :)'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name_edit)
if len(u_text) > 2 and u_text.isdigit() == 0:
cursor.execute('UPDATE search_obj SET obj_name = ? WHERE id = (SELECT MAX(id) FROM '
'search_obj WHERE u_id = ?)',
(u_text, u_id,))
conn.commit()
cursor.execute('SELECT * FROM search_obj WHERE id = (SELECT MAX(id) FROM search_obj WHERE u_id = ?)',
(u_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Всё верно, запускай машину!', callback_data='2-1-1')
key2 = types.InlineKeyboardButton('Редактировать', callback_data='2-1-0')
markup.row(key1)
markup.row(key2)
reply = bot.send_message(message.chat.id,
"Всем привет!\n{} - срочно ищет кое-что :)\n\n"
"Название: {}\n\nОписание: {}\n\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[4], result[2], result[3]),
reply_markup=markup)
return reply
else:
t = 'Некорректный ввод! Попробуй написать по другому :)'
msg = bot.send_message(message.chat.id, t)
bot.register_next_step_handler(msg, search_obj_name_edit)
# ----------------------------------------ФУНКЦИИ ВЕТКИ СДАТЬ-----------------------------------------------
# ----------------------------------------РЕДАКТИРОВАНИЕ ОБЬЯВЛЕНИЯ-----------------------------------------
def update_name_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
name_cat1_obj = message.text
u_obj_id = message.from_user.id
if name_cat1_obj.isdigit() == 0:
cursor.execute('UPDATE obj SET name_cat1_obj = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(name_cat1_obj, u_obj_id,))
conn.commit()
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Редактировать', callback_data='01-1')
key2 = types.InlineKeyboardButton('Всё ОК!', callback_data='01')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)', (u_obj_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
reply = bot.send_message(message.chat.id,
"Название: {}\nЦена: {}р\nОписание: {}\nВладелец: {}\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[2], result[3], result[4], result[5]),
reply_markup=markup)
return reply
else:
msg = bot.send_message(message.chat.id, 'Название не может состоять из цифр. Укажи другое название:')
bot.register_next_step_handler(msg, update_name_obj)
def update_money_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
money_cat1 = message.text
u_obj_id = message.from_user.id
if money_cat1.isdigit() == 1:
cursor.execute('UPDATE obj SET money_cat1 = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(money_cat1, u_obj_id,))
conn.commit()
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Редактировать', callback_data='01-1')
key2 = types.InlineKeyboardButton('Всё ОК!', callback_data='01')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)', (u_obj_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
reply = bot.send_message(message.chat.id,
"Название: {}\nЦена: {}р\nОписание: {}\nВладелец: {}\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[2], result[3], result[4], result[5]),
reply_markup=markup)
return reply
else:
msg = bot.send_message(message.chat.id, 'Укажи цену правильно, например: 100 ')
bot.register_next_step_handler(msg, update_money_obj)
def update_text_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
cat_1 = message.text
u_obj_id = message.from_user.id
if len(cat_1) > 10 and cat_1.isdigit() == 0:
cursor.execute('UPDATE obj SET cat_1 = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(cat_1, u_obj_id,))
conn.commit()
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Редактировать', callback_data='01-1')
key2 = types.InlineKeyboardButton('Всё ОК!', callback_data='01')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)', (u_obj_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
reply = bot.send_message(message.chat.id,
"Название: {}\nЦена: {}р\nОписание: {}\nВладелец: {}\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[2], result[3], result[4], result[5]),
parse_mode='html', reply_markup=markup)
return reply
else:
msg = bot.send_message(message.chat.id, 'Пожалуйста, введи нормальное описание ;)')
bot.register_next_step_handler(msg, update_text_obj)
def update_photo_obj(message):
if message.content_type == 'photo':
photo = message.photo[0].file_id
u_obj_id = message.from_user.id
cursor.execute('UPDATE obj SET photo = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(photo, u_obj_id,))
conn.commit()
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Редактировать', callback_data='01-1')
key2 = types.InlineKeyboardButton('Всё ОК!', callback_data='01')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)', (u_obj_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, проверим еще раз! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
bot.send_photo(message.chat.id, result[6])
reply = bot.send_message(message.chat.id,
"Название: {}\nЦена: {}р\nОписание: {}\nВладелец: {}\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?"
.format(result[2], result[3], result[4], result[5]),
parse_mode='html', reply_markup=markup)
return reply
else:
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
msg = bot.send_message(message.chat.id, 'Ошибка! Отправь фото со сжатием, 1шт.')
bot.register_next_step_handler(msg, update_photo_obj)
# ----------------------------------------СОЗДАНИЕ ОБЬЯВЛЕНИЯ---------------------------------------------------
def init_name_obj(message, z):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
category = '{}'.format(z)
user_name = '@' + message.from_user.username
u_text = message.text
u_obj_id = message.from_user.id
date = (str(datetime.datetime.now().today()))[:16]
cursor.execute('SELECT user_region FROM user WHERE user_id = ?', (u_obj_id,))
user_region = cursor.fetchone()
if u_text.isdigit() == 0 and len(u_text) > 2:
cursor.execute('INSERT INTO obj (u_id, name_cat1_obj, user_name, category, region, datetime) '
'VALUES (?, ?, ?, ?, ?, ?)',
(u_obj_id, u_text, user_name, category, user_region[0], date))
conn.commit()
msg = bot.send_message(message.chat.id, 'Понял тебя. Давай теперь определимся с ценой. '
'Какую сумму за сутки аренды ты бы хотел получить?',
parse_mode='html')
bot.register_next_step_handler(msg, init_money_obj)
else:
msg = bot.send_message(message.chat.id, 'Название не верного формата. Укажи другое название:')
bot.register_next_step_handler(msg, init_name_obj, z)
def init_money_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_obj_money = message.text
u_obj_id = message.from_user.id
if u_obj_money.isdigit():
cursor.execute('UPDATE obj SET money_cat1 = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(u_obj_money, u_obj_id,))
conn.commit()
msg = bot.send_message(message.chat.id, 'Записано! Добавь, пожалуйста, еще описание предмета, '
'чтобы у соседей не возникало лишних вопросов и чтобы '
'твой предмет выделялся из множества объявлений. '
'Достаточно нескольких предложений)',
parse_mode='html')
bot.register_next_step_handler(msg, init_photo_obj)
else:
msg = bot.send_message(message.chat.id, 'Укажи цену правильно, например: 100 ')
bot.register_next_step_handler(msg, init_money_obj)
def init_photo_obj(message):
if message.text.lower() in stop_text:
t = 'Возвращаю меню...'
return main_menu(message, t)
u_obj = message.text
u_obj_id = message.from_user.id
if len(u_obj) > 10 and u_obj.isdigit() == 0:
cursor.execute('UPDATE obj SET cat_1 = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(u_obj, u_obj_id,))
conn.commit()
msg = bot.send_message(message.chat.id, 'Почти готово, прикрепи фотографию своего предмета. '
'Это почти как Тиндер - без фотки никуда)',
parse_mode='html')
bot.register_next_step_handler(msg, init_obj)
else:
msg = bot.send_message(message.chat.id, 'Пожалуйста, введи нормальное описание ;)')
bot.register_next_step_handler(msg, init_photo_obj)
def init_obj(message):
if message.content_type == 'photo':
u_obj_photo = message.photo[0].file_id
u_obj_id = message.from_user.id
cursor.execute('UPDATE obj SET photo = ? WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)',
(u_obj_photo, u_obj_id,))
conn.commit()
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Редактировать', callback_data='01-1')
key2 = types.InlineKeyboardButton('Всё ОК!', callback_data='01')
markup.row(key1)
markup.row(key2)
cursor.execute('SELECT * FROM obj WHERE id = (SELECT MAX(id) FROM obj WHERE u_id = ?)', (u_obj_id,))
result = cursor.fetchone()
bot.send_message(message.chat.id, "Итак, сосед, мы справились! Смотри какое "
"объявление у нас получилось: ",
parse_mode='html')
bot.send_photo(message.chat.id, result[6])
reply = bot.send_message(message.chat.id,
"Категория: {}\n\nНазвание: {}\nЦена:{}р\nОписание: {}\nВладелец: {}\n"
"Все ли я понял правильно или хочешь "
"что-то исправить в объявлении?".format(result[7], result[2], result[3], result[4],
result[5]),
parse_mode='html', reply_markup=markup)
return reply
else:
print(message)
msg = bot.send_message(message.chat.id, 'Ошибка! Отправь фото со сжатием, 1шт.')
bot.register_next_step_handler(msg, init_obj)
# ---------------------------------------Функия подсчета кол-ва обьявлений в категории------------------------------
# ------------------------------------------------------------------------------------------------------------------
# ----------------------------------------ОБРАБОТКА ТЕКСТОВЫХ СООБЩЕНИЙ/МЕНЮ----------------------------------------
@bot.message_handler(content_types=['text'])
def process_start_command(message):
if message.text == 'Сдать':
t = 'Здорово, что ты готов сдать что-то в аренду! Я помогу тебе составить объявление. ' \
'Давай начнем с категории товара, который ты бы хотел сдать в аренду. Выбери подходящее:'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Фото и видео',
callback_data='1-1')
key2 = types.InlineKeyboardButton('Техника для дома',
callback_data='1-2')
key3 = types.InlineKeyboardButton('Игры и консоли',
callback_data='1-3')
key4 = types.InlineKeyboardButton(
'Туризм и путешествия',
callback_data='1-4')
key5 = types.InlineKeyboardButton('Декор и мебель',
callback_data='1-5')
key6 = types.InlineKeyboardButton('Детские товары',
callback_data='1-6')
key7 = types.InlineKeyboardButton('Для мероприятий',
callback_data='1-7')
key8 = types.InlineKeyboardButton('Инструменты',
callback_data='1-8')
key9 = types.InlineKeyboardButton('Товары для спорта',
callback_data='1-9')
key10 = types.InlineKeyboardButton('Музыка и хобби',
callback_data='1-10')
key11 = types.InlineKeyboardButton('Прочее', callback_data='1-11')
key12 = types.InlineKeyboardButton('Выйти в МЕНЮ', callback_data='menu')
markup.row(key12)
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
markup.row(key6)
markup.row(key7)
markup.row(key8)
markup.row(key9)
markup.row(key10)
markup.row(key11)
bot.send_message(message.chat.id, t, parse_mode='html', reply_markup=markup)
if message.text == 'Снять':
u_id = message.from_user.id
t = 'Понял тебя, арендуем! Уже вспоминанию все объявления твоих соседей! ' \
'Выбери категорию, в которой находится нужный тебе предмет.'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Фото и видео {}'.format(how_many_obj('Фото и видео', u_id)),
callback_data='2-1')
key2 = types.InlineKeyboardButton('Техника для дома {}'.format(how_many_obj('Техника для дома', u_id)),
callback_data='2-2')
key3 = types.InlineKeyboardButton('Игры и консоли {}'.format(how_many_obj('Игры и консоли', u_id)),
callback_data='2-3')
key4 = types.InlineKeyboardButton(
'Туризм и путешествия {}'.format(how_many_obj('Туризм и путешествия', u_id)),
callback_data='2-4')
key5 = types.InlineKeyboardButton('Декор и мебель {}'.format(how_many_obj('Декор и мебель', u_id)),
callback_data='2-5')
key6 = types.InlineKeyboardButton('Детские товары {}'.format(how_many_obj('Детские товары', u_id)),
callback_data='2-6')
key7 = types.InlineKeyboardButton('Для мероприятий {}'.format(how_many_obj('Для мероприятий', u_id)),
callback_data='2-7')
key8 = types.InlineKeyboardButton('Инструменты {}'.format(how_many_obj('Инструменты', u_id)),
callback_data='2-8')
key9 = types.InlineKeyboardButton('Товары для спорта {}'.format(how_many_obj('Товары для спорта', u_id)),
callback_data='2-9')
key10 = types.InlineKeyboardButton('Музыка и хобби {}'.format(how_many_obj('Музыка и хобби', u_id)),
callback_data='2-10')
key11 = types.InlineKeyboardButton('Прочее {}'.format(how_many_obj('Прочее', u_id)), callback_data='2-11')
key13 = types.InlineKeyboardButton('Создать объявление о поиске', callback_data='search')
key12 = types.InlineKeyboardButton('Выйти в МЕНЮ', callback_data='menu')
markup.row(key12)
markup.row(key13)
markup.row(key1)
markup.row(key2)
markup.row(key3)
markup.row(key4)
markup.row(key5)
markup.row(key6)
markup.row(key7)
markup.row(key8)
markup.row(key9)
markup.row(key10)
markup.row(key11)
bot.send_message(message.chat.id, t, parse_mode='html', reply_markup=markup)
if message.text == 'Посмотреть мои обьявления':
t = 'Какие обьявления смотрим?'
markup = types.InlineKeyboardMarkup()
key1 = types.InlineKeyboardButton('Что я сдаю?', callback_data='3-1-1')
key2 = types.InlineKeyboardButton('Что я ищу в аренду?', callback_data='3-1-2')
markup.row(key1)
markup.row(key2)
bot.send_message(message.chat.id, t, reply_markup=markup)
if message.text == 'Меню':
t = 'Главное Меню'
main_menu(message, t)
# ------------------------------------------------------------------------------------------------------------------
while True:
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)
time.sleep(15)
| 56.535227
| 169
| 0.537788
| 10,793
| 99,502
| 4.80719
| 0.074956
| 0.023475
| 0.040841
| 0.051403
| 0.864583
| 0.848412
| 0.832241
| 0.808862
| 0.80468
| 0.787873
| 0
| 0.015341
| 0.333119
| 99,502
| 1,759
| 170
| 56.567368
| 0.766427
| 0.062602
| 0
| 0.744246
| 0
| 0.007673
| 0.252938
| 0.001556
| 0
| 0
| 0
| 0
| 0
| 1
| 0.019821
| false
| 0.001918
| 0.003836
| 0
| 0.051151
| 0.004476
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
174250b11e371c55987cd04f0e92a645240dbb0a
| 2,349
|
py
|
Python
|
python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | null | null | null |
python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | null | null | null |
python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py
|
teddywest32/intellij-community
|
e0268d7a1da1d318b441001448cdd3e8929b2f29
|
[
"Apache-2.0"
] | 1
|
2020-11-27T10:36:50.000Z
|
2020-11-27T10:36:50.000Z
|
a = <warning descr="Python version 3.0, 3.1, 3.2 do not support a 'U' prefix">u</warning>"String"
# python 3.3
a = <warning descr="Python version 3.0, 3.1, 3.2 do not support a 'U' prefix">u</warning>""
a = r""
a = <warning descr="Python version 2.4, 2.5 do not support a 'B' prefix">b</warning>""
a = <error descr="Python version 2.7 does not support a 'RB' prefix"><warning descr="Python version 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2 do not support a 'RB' prefix">rb</warning></error>""
a = <warning descr="Python version 2.4, 2.5, 3.0 do not support a 'BR' prefix">br</warning>""
# python 3.2, 3.1
a = r""
a = <warning descr="Python version 2.4, 2.5 do not support a 'B' prefix">b</warning>""
a = <warning descr="Python version 2.4, 2.5, 3.0 do not support a 'BR' prefix">br</warning>""
# python 3.0
a = r""
a = <warning descr="Python version 2.4, 2.5 do not support a 'B' prefix">b</warning>""
# python 2.7, 2.6
a = <warning descr="Python version 3.0, 3.1, 3.2 do not support a 'U' prefix">u</warning>""
a = r""
a = <warning descr="Python version 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 do not support a 'UR' prefix">ur</warning>""
a = <warning descr="Python version 2.4, 2.5 do not support a 'B' prefix">b</warning>""
a = <warning descr="Python version 2.4, 2.5, 3.0 do not support a 'BR' prefix">br</warning>""
# python 2.5
a = <warning descr="Python version 3.0, 3.1, 3.2 do not support a 'U' prefix">u</warning>""
a = r""
a = <warning descr="Python version 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 do not support a 'UR' prefix">ur</warning>""
# combined
b = <warning descr="Python version 3.0, 3.1, 3.2 do not support a 'U' prefix">u</warning>"" <warning descr="Python version 2.4, 2.5 do not support a 'B' prefix">b</warning>""
# never was available
a = <error descr="Python version 2.7 does not support a 'RR' prefix"><warning descr="Python version 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 do not support a 'RR' prefix">rr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BB' prefix"><warning descr="Python version 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 do not support a 'BB' prefix">bb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UU' prefix"><warning descr="Python version 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 do not support a 'UU' prefix">uu</warning></error>""
| 55.928571
| 201
| 0.641124
| 498
| 2,349
| 3.024096
| 0.066265
| 0.167995
| 0.2749
| 0.315405
| 0.941567
| 0.915007
| 0.915007
| 0.915007
| 0.915007
| 0.915007
| 0
| 0.095238
| 0.159642
| 2,349
| 42
| 202
| 55.928571
| 0.66768
| 0.039591
| 0
| 0.73913
| 0
| 0.608696
| 0.624722
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 12
|
bd5b3b144aedbc0af0b75256a418961a64752d56
| 169,643
|
py
|
Python
|
Invoicing_classes.py
|
alexeltsar/Invoicing-Project
|
d0e1402dcce41995a36eae229474405590e433b5
|
[
"Apache-2.0"
] | null | null | null |
Invoicing_classes.py
|
alexeltsar/Invoicing-Project
|
d0e1402dcce41995a36eae229474405590e433b5
|
[
"Apache-2.0"
] | null | null | null |
Invoicing_classes.py
|
alexeltsar/Invoicing-Project
|
d0e1402dcce41995a36eae229474405590e433b5
|
[
"Apache-2.0"
] | null | null | null |
import sys, re
import PyQt5
from PyQt5.QtWidgets import QApplication, QLineEdit, QMainWindow, QMessageBox, QDialog, QPushButton, QLabel, QTableWidget, QTableWidgetItem, QVBoxLayout, QHeaderView, QSpinBox, QDoubleSpinBox, QGraphicsView, QTableWidgetItem
from PyQt5 import uic
from PyQt5.QtCore import pyqtSlot, QDate, Qt
from PyQt5.QtGui import QIcon, QPixmap, QFont, QImage
import shutil, os
from reportlab.pdfgen import canvas
from reportlab.lib import colors
from reportlab.lib.utils import ImageReader #For logo
import matplotlib.pyplot as plt
import numpy as np
import datetime
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import urllib.request
import sqlite3
import os.path
now = datetime.datetime.now()
day = now.day
month = now.month
year = now.year
current_datetime = '%s/%s/%s' % (day, month, year)
mesos = ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juliol', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre']
mesos_minus = ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octubre', 'novembre', 'desembre']
clear = lambda: os.system('cls')
dir_principal = os.getcwd()
carpeta_data = dir_principal + '\Data'
carpeta_factures = dir_principal + '\Factures'
carpeta_abonos = dir_principal + '\Abonos'
carpeta_albaranes = dir_principal + '\Albaranes'
current_month_factures = carpeta_factures + '\%s_%s' % (mesos[int(month)-1], year)
if not os.path.exists(carpeta_data): os.makedirs(carpeta_data)
if not os.path.exists(carpeta_factures): os.makedirs(carpeta_factures)
if not os.path.exists(carpeta_abonos): os.makedirs(carpeta_abonos)
#####################################################################
# #
# FUNCTIONS #
# #
#####################################################################
#DRIVE
def fitxer_drive(name):
count = False
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
if file1['title'] == name:
file = drive.CreateFile({'id': file1['id']})
count = True
if count == False:
file = drive.CreateFile({'title': name})
file.SetContentFile(name)
file.Upload()
def carpeta_drive(folder_name):
count = False
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
if file1['title'] == folder_name: #La carpeta ja està creada
Factures_id = file1['id']
count = True
if count == False: #Crear la carpeta
# Create folder.
folder_metadata = {
'title' : folder_name,
# The mimetype defines this new file as a folder, so don't change this.
'mimeType' : 'application/vnd.google-apps.folder'
}
folder = drive.CreateFile(folder_metadata)
folder.Upload()
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
if file1['title'] == folder_name:
Factures_id = file1['id']
return Factures_id
def file_to_folder(folder_id, filename):
file = drive.CreateFile({"parents": [{"kind": "drive#fileLink", "id": folder_id}]})
file.SetContentFile(filename)
file.Upload()
def delete_file_in_folder(folder_id, filename):
file_list = drive.ListFile({'q': "'%s' in parents and trashed=false" % folder_id}).GetList()
for file1 in file_list:
if file1['title'] == filename: #L'arxiu ja està creat
file1.Delete()
def internet_on():
try:
urllib.request.urlopen('http://216.58.192.142', timeout=1)
return True
except urllib.request.URLError as err:
return False
def upload_to_drive_database(name):
global drive
os.chdir(carpeta_data)
##################################### LOG IN GOOGLE DRIVE #############################################
int_connexion = internet_on()
if int_connexion == True:
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
########################################################################################################
#Pujar base de dades clients
if int_connexion == True:
folder_id = carpeta_drive('Data') #Pujar a google drive la factura
filename = '%s.db' % name
delete_file_in_folder(folder_id,filename)
file_to_folder(folder_id, filename)
def upload_to_drive_factura(dirr, NAME, NAME_2, num_fact, data, NOMCOM, num_client, filename_ventes, filename_facturacio_clients, filename_facturacio_total, filename_factures_emeses):
global drive
mes = mesos[int(data[3:5])-1]
ano = str(data[6:]).zfill(4)
current_month_factures = dirr + '\%s_%s' % (mes, ano)
##################################### LOG IN GOOGLE DRIVE #############################################
int_connexion = internet_on()
if int_connexion == True:
previous_directory = os.getcwd()
os.chdir(carpeta_data)
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
os.chdir(previous_directory)
########################################################################################################
#Guardar la factura al drive
os.chdir(current_month_factures)
if int_connexion == True:
folder_id = carpeta_drive('%s_%s_%s' % (NAME, mes, str(year))) #Pujar a google drive la factura
filename = '%s_%s_%s_%s.pdf' % (NAME_2, str(num_fact).zfill(4), NOMCOM, str(num_client).zfill(4))
delete_file_in_folder(folder_id,filename)
file_to_folder(folder_id, filename)
folder_id = carpeta_drive('Data') #Pujar bases de dades
os.chdir(carpeta_data)
#Ventes
delete_file_in_folder(folder_id,filename_ventes)
file_to_folder(folder_id, filename_ventes)
#Facturació clients
delete_file_in_folder(folder_id,filename_facturacio_clients)
file_to_folder(folder_id, filename_facturacio_clients)
#Facturació total
delete_file_in_folder(folder_id,filename_facturacio_total)
file_to_folder(folder_id, filename_facturacio_total)
#Factures emeses
delete_file_in_folder(folder_id,filename_factures_emeses)
file_to_folder(folder_id, filename_factures_emeses)
#FACTURES
def assignar_numero_factura(table, year):
tablas = [
"""
CREATE TABLE IF NOT EXISTS numero_factura(
any TEXT NOT NULL,
num TEXT NOT NULL
);
"""
]
create_database('CompanyName', tablas)
tablas = [
"""
CREATE TABLE IF NOT EXISTS numero_abono(
any TEXT NOT NULL,
num TEXT NOT NULL
);
"""
]
create_database('CompanyName', tablas)
tablas = [
"""
CREATE TABLE IF NOT EXISTS numero_albaran(
any TEXT NOT NULL,
num TEXT NOT NULL
);
"""
]
create_database('CompanyName', tablas)
database = sqlite3.connect('CompanyName.db')
cursor = database.cursor()
sentencia = "SELECT * FROM %s WHERE any LIKE %s" % (table, year)
cursor.execute(sentencia)
lines = cursor.fetchall()
if len(lines) == 0:
sentencia = "INSERT INTO '%s'(any, num) VALUES (?,?)" % (table)
cursor.execute(sentencia, [year, 1])
database.commit()
return 1
else:
num_fact = int(lines[0][1]) + 1
sentencia = "DELETE FROM '%s' WHERE any LIKE ?;" % table
cursor.execute(sentencia, [ "%{}%".format(year)])
database.commit()
sentencia = "INSERT INTO '%s'(any, num) VALUES (?,?)" % (table)
cursor.execute(sentencia, [year, num_fact])
database.commit()
return num_fact
def factura(dirr, NAME, num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, date, form_pag, dim, array_ref, array_concept, array_U, array_PU, array_BI, SUMA, IVA, TOTAL):
global c
CompanyName = 'COMPANY NAME'
CompanyDirection = 'C/ street, nº fºfª'
PC = 'CP'
CITY = 'CITY'
EMAIL = 'companyemail'
FISCAL_NAME = 'Fiscal Name'
ID = 'ID_number'
FISCAL_DIRECTION = 'Fiscal direction'
FISCAL_CITY = 'Fiscal city'
FISCAL_PC = 'Fiscal P.C.'
mes = mesos[int(date[3:5])-1]
ano = str(date[6:]).zfill(4)
current_month_factures = dirr + '\%s_%s' % (mes, ano)
if not os.path.exists(current_month_factures): os.makedirs(current_month_factures)
os.chdir(current_month_factures)
c = canvas.Canvas("%s_%s_%s_%s.pdf" % (NAME, str(num_fact).zfill(4), NOMCOM, str(num_client).zfill(4)))
x_CompanyName = 40
x_customer = 350
x_doc = 350
y_CompanyName = 690
y_customer = 810
y_doc = 680
y_title = 780
c.setFont('Helvetica', 20)
#Title (may be substituted by a logo)
logo = ImageReader(carpeta_data + '\logo.png')
c.drawImage(logo, x_CompanyName + 50, y_CompanyName + 50, width=50, height=50, mask='auto')
c.setFont('Helvetica', 10)
#CompanyName data
c.drawString(x_CompanyName, y_CompanyName, CompanyName)
c.drawString(x_CompanyName, y_CompanyName - 15, CompanyDirection)
c.drawString(x_CompanyName, y_CompanyName - 15*2, PC + '' + CITY)
c.drawString(x_CompanyName, y_CompanyName - 15*3, 'EMAIL: %s' % EMAIL)
#c.drawString(x_CompanyName, y_CompanyName - 15*4, 'TELF: 640087843-678230059')
#Customer data
c.drawString(x_customer, y_customer, 'CUSTOMER')
c.line(x_customer, y_customer - 5, x_customer + 35, y_customer - 5)
c.drawString(x_customer, y_customer - 5 - 15, str(num_client).zfill(4) + ' ' + NOMCOM)
c.drawString(x_customer, y_customer - 5 - 15*2, NOMFIS)
c.drawString(x_customer, y_customer - 5 - 15*3, DIR)
c.drawString(x_customer, y_customer - 5 - 15*4, POBLACIO)
c.drawString(x_customer, y_customer - 5 - 15*5, 'NIF: ' + NIF)
c.drawString(x_customer, y_customer - 5 -15*6, 'TEL: ' + TEL)
#Document data
c.drawString(x_doc, y_doc, 'DOCUMENT')
c.line(x_doc, y_doc-5, x_doc + 60, y_doc-5)
c.drawString(x_doc, y_doc-5-15*1, '%s: ' % NAME + str(num_fact).zfill(4))
c.drawString(x_doc, y_doc-5-15*2, 'DATE: ' + date)
c.drawString(x_doc, y_doc-5-15*3, 'WAY TO PAY: ' + form_pag)
#Make the table
x_ref = 50
x_concepte = 90
x_U = 400
x_PU = 450
x_BI = 500
y_ref = 580
y_concepte = 580
y_U = 580
y_PU = 580
y_BI = 580
x_final_tabla = 550
y_final_tabla = 200
c.drawString(x_ref, y_ref, 'REF')
c.drawString(x_concepte+5, y_concepte, 'CONCEPT')
c.drawString(x_U+5, y_U, 'Units')
c.drawString(x_PU+10, y_PU, 'U.P.')
c.drawString(x_BI + 5, y_BI, 'T.B.')
c.line(x_ref-10, y_ref-5, x_final_tabla, y_BI-5) #linea sota el encabezado
c.line(x_ref-10, y_ref-5, x_ref-10, y_final_tabla) #linea vertical inicial
c.line(x_concepte-10, y_ref-5, x_concepte-10, y_final_tabla) #linea vertical despres de ref
c.line(x_U-3, y_U-5, x_U-3, y_final_tabla) #linea vertical dsps de concepte
c.line(x_PU-5, y_PU-5, x_PU-5, y_final_tabla) #linea dsps de unitats
c.line(x_BI-7, y_BI-5, x_BI-7, y_final_tabla) #linea vertical dsps de P.U.
c.line(x_final_tabla, y_ref-5, x_final_tabla, y_final_tabla) #ultima linea vertical
#c.line(x_ref-10, y_final_tabla+20, x_final_tabla, y_final_tabla+20) #penultima linea horitzontal
c.line(x_ref-10, y_final_tabla, x_final_tabla, y_final_tabla ) #ultima linea horitzontal
# Taula de resultats finals
x_0 = x_ref-10
y_0 = y_final_tabla - 30
x_f = x_final_tabla
y_f = y_0 - 25
c.line(x_0, y_0, x_f, y_0) #primera linea horitzontal
c.line(x_0, y_f, x_f, y_f) #ultima linea horitzontal
x_1 = (x_f-x_0)/3
x_2 = 2*x_1
c.line(x_0, y_0, x_0, y_f) #linia vertical inicial
c.line(x_1,y_0, x_1, y_f) #primera linea vertical
c.line(x_2,y_0,x_2,y_f) #ultima linea vertical
c.line(x_f,y_0,x_f,y_f) #linea vertical final
#Introduir referencies, conceptes, unitats, preu unitats, base imponible, suma total, iva i suma final
y_new = y_ref-20
sep = 15
for i in range(0, dim):
c.drawString(x_ref, y_new -sep*i, array_ref[i])
c.drawString(x_concepte + 5, y_new -sep*i, array_concept[i])
c.drawString(x_U + 15, y_new -sep*i, str(array_U[i]))
c.drawString(x_PU + 5, y_new -sep*i, str(array_PU[i]))
c.drawString(x_BI + 5, y_new -sep*i, str(array_BI[i]))
#c.drawString(x_BI + 5, y_final_tabla + 7, str(SUMA))
c.drawString(x_0 + 20, y_0-15, 'T.B.: ' + str(SUMA))
c.drawString(x_1 + 50, y_0 - 15, 'V.A.T. 21%: ' + str(IVA))
c.setFont('Helvetica-Bold', 10)
c.drawString(x_2 + 50, y_0 - 15, 'TOTAL: ' + str(TOTAL) + '\u20ac')
x_dades_personals = x_0
y_dades_personals = y_f - 100
c.setFont('Helvetica', 8)
c.drawString(x_dades_personals, y_dades_personals, '%s, %s, %s, %s, %s' % (FISCAL_NAME, ID, FISCAL_DIRECTION, FISCAL_PC, FISCAL_CITY))
c.save()
def factura_de_albaranes(dirr, NAME, num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, date, form_pag, array_num, array_data, array_bi, array_iva, array_total, SUMA, IVA, TOTAL):
global c
CompanyName = 'COMPANY NAME'
CompanyDirection = 'C/ street, nº fºfª'
PC = 'CP'
CITY = 'CITY'
EMAIL = 'companyemail'
FISCAL_NAME = 'Fiscal Name'
ID = 'ID_number'
FISCAL_DIRECTION = 'Fiscal direction'
FISCAL_CITY = 'Fiscal city'
FISCAL_PC = 'Fiscal P.C.'
mes = mesos[int(date[3:5])-1]
ano = str(date[6:]).zfill(4)
current_month_factures = dirr + '\%s_%s' % (mes, ano)
if not os.path.exists(current_month_factures): os.makedirs(current_month_factures)
os.chdir(current_month_factures)
c = canvas.Canvas("%s_%s_%s_%s.pdf" % (NAME, str(num_fact).zfill(4), NOMCOM, str(num_client).zfill(4)))
x_CompanyName = 40
x_customer = 350
x_doc = 350
y_CompanyName = 690
y_customer = 810
y_doc = 680
y_title = 780
c.setFont('Helvetica', 20)
#Title (may be substituted by a logo)
logo = ImageReader(carpeta_data + '\logo.png')
c.drawImage(logo, x_amilcar + 50, y_amilcar + 50, width=50, height=50, mask='auto')
c.setFont('Helvetica', 10)
#CompanyName data
c.drawString(x_CompanyName, y_CompanyName, CompanyName)
c.drawString(x_CompanyName, y_CompanyName - 15, CompanyDirection)
c.drawString(x_CompanyName, y_CompanyName - 15*2, PC + '' + CITY)
c.drawString(x_CompanyName, y_CompanyName - 15*3, 'EMAIL: %s' % EMAIL)
#c.drawString(x_CompanyName, y_CompanyName - 15*4, 'TELF: 640087843-678230059')
#Customer data
c.drawString(x_customer, y_customer, 'CUSTOMER')
c.line(x_customer, y_customer - 5, x_customer + 35, y_customer - 5)
c.drawString(x_customer, y_customer - 5 - 15, str(num_client).zfill(4) + ' ' + NOMCOM)
c.drawString(x_customer, y_customer - 5 - 15*2, NOMFIS)
c.drawString(x_customer, y_customer - 5 - 15*3, DIR)
c.drawString(x_customer, y_customer - 5 - 15*4, POBLACIO)
c.drawString(x_customer, y_customer - 5 - 15*5, 'NIF: ' + NIF)
c.drawString(x_customer, y_customer - 5 -15*6, 'TEL: ' + TEL)
#Document data
c.drawString(x_doc, y_doc, 'DOCUMENT')
c.line(x_doc, y_doc-5, x_doc + 60, y_doc-5)
c.drawString(x_doc, y_doc-5-15*1, '%s: ' % NAME + str(num_fact).zfill(4))
c.drawString(x_doc, y_doc-5-15*2, 'DATE: ' + date)
c.drawString(x_doc, y_doc-5-15*3, 'WAY TO PAY: ' + form_pag)
#Make the table
x_ref = 50
x_concepte = 90
x_U = 400
x_PU = 450
x_BI = 500
y_ref = 580
y_concepte = 580
y_U = 580
y_PU = 580
y_BI = 580
x_final_tabla = 550
y_final_tabla = 200
c.drawString(x_ref, y_ref, 'Nº')
c.drawString(x_concepte+5, y_concepte, 'DATE')
c.drawString(x_U+5, y_U, 'T.B.')
c.drawString(x_PU+10, y_PU, 'V.A.T.')
c.drawString(x_BI + 5, y_BI, 'TOTAL')
c.line(x_ref-10, y_ref-5, x_final_tabla, y_BI-5) #linea sota el encabezado
c.line(x_ref-10, y_ref-5, x_ref-10, y_final_tabla) #linea vertical inicial
c.line(x_concepte-10, y_ref-5, x_concepte-10, y_final_tabla) #linea vertical despres de ref
c.line(x_U-3, y_U-5, x_U-3, y_final_tabla) #linea vertical dsps de concepte
c.line(x_PU-5, y_PU-5, x_PU-5, y_final_tabla) #linea dsps de unitats
c.line(x_BI-7, y_BI-5, x_BI-7, y_final_tabla) #linea vertical dsps de P.U.
c.line(x_final_tabla, y_ref-5, x_final_tabla, y_final_tabla) #ultima linea vertical
#c.line(x_ref-10, y_final_tabla+20, x_final_tabla, y_final_tabla+20) #penultima linea horitzontal
c.line(x_ref-10, y_final_tabla, x_final_tabla, y_final_tabla ) #ultima linea horitzontal
# Taula de resultats finals
x_0 = x_ref-10
y_0 = y_final_tabla - 30
x_f = x_final_tabla
y_f = y_0 - 25
c.line(x_0, y_0, x_f, y_0) #primera linea horitzontal
c.line(x_0, y_f, x_f, y_f) #ultima linea horitzontal
x_1 = (x_f-x_0)/3
x_2 = 2*x_1
c.line(x_0, y_0, x_0, y_f) #linia vertical inicial
c.line(x_1,y_0, x_1, y_f) #primera linea vertical
c.line(x_2,y_0,x_2,y_f) #ultima linea vertical
c.line(x_f,y_0,x_f,y_f) #linea vertical final
#Introduir referencies, conceptes, unitats, preu unitats, base imponible, suma total, iva i suma final
y_new = y_ref-20
sep = 15
for i in range(len(array_bi)):
c.drawString(x_ref, y_new -sep*i, array_num[i])
c.drawString(x_concepte + 5, y_new -sep*i, array_data[i])
c.drawString(x_U + 15, y_new -sep*i, str(array_bi[i]))
c.drawString(x_PU + 5, y_new -sep*i, str(array_iva[i]))
c.drawString(x_BI + 5, y_new -sep*i, str(array_total[i]))
#c.drawString(x_BI + 5, y_final_tabla + 7, str(SUMA))
c.drawString(x_0 + 20, y_0-15, 'TOTAL T.B..: ' + str(SUMA))
c.drawString(x_1 + 50, y_0 - 15, 'TOTAL V.A.T.: ' + str(IVA))
c.setFont('Helvetica-Bold', 10)
c.drawString(x_2 + 50, y_0 - 15, 'FINAL TOTAL: ' + str(TOTAL) + '\u20ac')
x_dades_personals = x_0
y_dades_personals = y_f - 100
c.setFont('Helvetica', 8)
c.drawString(x_dades_personals, y_dades_personals, '%s, %s, %s, %s, %s' % (FISCAL_NAME, ID, FISCAL_DIRECTION, FISCAL_PC, FISCAL_CITY))
c.save()
#BASEES DE DADES
def create_database_client(name):
#Create a database
database = sqlite3.connect("%s.db" % name)
#Create a data table in the database
cursor = database.cursor()
tablas = [
"""
CREATE TABLE IF NOT EXISTS data(
num_client TEXT NOT NULL,
nom_comercial TEXT NOT NULL,
nom_fiscal TEXT NOT NULL,
adreça TEXT NOT NULL,
poblacio TEXT NOT NULL,
nif TEXT NOT NULL,
telf TEXT NOT NULL,
forma_pago TEXT NOT NULL
);
"""
]
for tabla in tablas:
cursor.execute(tabla);
def fill_database(name, numclient, nomcom, nomfis, adreça, poblacio, nif, telf, formapago):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "INSERT INTO data(num_client, nom_comercial, nom_fiscal, adreça, poblacio, nif, telf, forma_pago) VALUES (?,?,?,?,?,?,?,?)"
cursor.execute(sentencia, [numclient, nomcom, nomfis, adreça, poblacio, nif, telf, formapago])
database.commit()
def read_database(name, table, name_2, order):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "SELECT * FROM '%s' ORDER BY %s %s;" % (table, name_2, order)
cursor.execute(sentencia)
lines = cursor.fetchall()
cursor.close()
return lines
def select_from_database(name, busqueda, name_2):
os.chdir(carpeta_data)
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "SELECT * FROM data WHERE nom_comercial LIKE ? ORDER BY %s ASC;" % name_2
cursor.execute(sentencia, [ "%{}%".format(busqueda)])
matches = cursor.fetchall()
if len(matches) != 0:
return matches, True
else:
sentencia = "SELECT * FROM data WHERE num_client LIKE ?;"
cursor.execute(sentencia, [ "%{}%".format(busqueda)])
matches = cursor.fetchall()
if len(matches) != 0:
return matches, True
else:
return matches, False
def select_from_database_general(name, table, busqueda, name_2, order, order_2):
os.chdir(carpeta_data)
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "SELECT * FROM '%s' WHERE %s LIKE ? ORDER BY %s %s;" % (table, name_2, order, order_2)
cursor.execute(sentencia, ["%{}%".format(busqueda)])
matches = cursor.fetchall()
return matches
def delete_from_database(name, name_2, num):
os.chdir(carpeta_data)
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "DELETE FROM data WHERE %s LIKE ?;" % name_2
cursor.execute(sentencia, [ "%{}%".format(num)])
database.commit()
def delete_from_database_general(name, table, name_2, num):
os.chdir(carpeta_data)
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "DELETE FROM '%s' WHERE %s LIKE ?;" % (table, name_2)
cursor.execute(sentencia, [ "%{}%".format(num)])
database.commit()
def create_database_ventes(name, table):
database = sqlite3.connect("%s.db" % name)
cursor = database.cursor()
tablas = [
"""
CREATE TABLE IF NOT EXISTS '%s'(
ref TEXT NOT NULL,
gener REAL NOT NULL,
febrer REAL NOT NULL,
març REAL NOT NULL,
abril REAL NOT NULL,
maig REAL NOT NULL,
juny REAL NOT NULL,
juliol REAL NOT NULL,
agost REAL NOT NULL,
setembre REAL NOT NULL,
octubre REAL NOT NULL,
novembre REAL NOT NULL,
desembre REAL NOT NULL
);
""" % table
]
for tabla in tablas:
cursor.execute(tabla);
def create_database_cataleg(name):
#Create a database
database = sqlite3.connect("%s.db" % name)
#Create a data table in the database
cursor = database.cursor()
tablas = [
"""
CREATE TABLE IF NOT EXISTS data(
ref TEXT NOT NULL,
prod TEXT NOT NULL,
preu REAL NOT NULL
);
"""
]
for tabla in tablas:
cursor.execute(tabla);
def fill_database_cataleg(name, ref, prod, preu):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "INSERT INTO data(ref, prod, preu) VALUES (?,?,?)"
cursor.execute(sentencia, [ref, prod, preu])
database.commit()
def fill_database_ventes(name, tabla, ref, month, ventes, zfill_ref):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
llista = [str(ref).zfill(zfill_ref), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
#Tenir en compte les unitats venudes prèviament
sentencia = "SELECT * FROM '%s' WHERE ref LIKE ?;" % tabla
cursor.execute(sentencia, ["%{}%".format(ref)])
matches = cursor.fetchall()
if len(matches) != 0:
llista = []
for i in range(len(matches[0])):
llista.append(matches[0][i])
nou = llista[month] + ventes
llista[month] = nou
#Eliminar la fila actual
sentencia = "DELETE FROM '%s' WHERE ref LIKE ?;" % tabla
cursor.execute(sentencia, [ "%{}%".format(ref)])
#Escriure les ventes actualitzades
sentencia = "INSERT INTO '%s'(ref, gener, febrer, març, abril, maig, juny, juliol, agost, setembre, octubre, novembre, desembre) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" % tabla
cursor.execute(sentencia, llista)
else:
#Escriure les ventes actualitzades
llista[month] = ventes
sentencia = "INSERT INTO '%s'(ref, gener, febrer, març, abril, maig, juny, juliol, agost, setembre, octubre, novembre, desembre) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" % tabla
cursor.execute(sentencia, llista)
database.commit()
def create_database_preus(name):
database = sqlite3.connect("%s.db" % name)
cursor = database.cursor()
tablas = [
"""
CREATE TABLE IF NOT EXISTS data(
num_client TEXT NOT NULL,
ref TEXT NOT NULL,
preu REAL NOT NULL
);
"""
]
for tabla in tablas:
cursor.execute(tabla);
def fill_database_preus(name, num, ref, prod, preu):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
lines = select_from_database_preus(name, num, ref)
if len(lines) != 0:
return False
else:
sentencia = "INSERT INTO data(num_client, ref, prod, preu) VALUES (?,?,?,?)"
cursor.execute(sentencia, [num, ref, prod, preu])
database.commit()
return True
def modificar_database_preus(name, num, ref, prod, preu):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
lines = select_from_database_preus(name, num, ref)
if len(lines) == 0:
return False
else:
sentencia = "DELETE FROM data WHERE num_client LIKE ? AND ref LIKE ?;"
cursor.execute(sentencia, [ "%{}%".format(num), "%{}%".format(ref)])
sentencia = "INSERT INTO data(num_client, ref, prod, preu) VALUES (?,?,?,?)"
cursor.execute(sentencia, [num, ref, prod, preu])
database.commit()
return True
def select_from_database_preus(name, num, ref):
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "SELECT * FROM data WHERE num_client LIKE ? AND ref LIKE ?;"
cursor.execute(sentencia, ["%{}%".format(num), "%{}%".format(ref)])
matches = cursor.fetchall()
return matches
def create_database_factures(name):
#Create a database
database = sqlite3.connect("%s.db" % name)
#Create a data table in the database
cursor = database.cursor()
tablas = [
"""
CREATE TABLE IF NOT EXISTS data(
dia TEXT NOT NULL,
mes TEXT NOT NULL,
any TEXT NOT NULL,
nom TEXT NOT NULL,
base_imp REAL NOT NULL,
iva REAL NOT NULL,
total REAL NOT NULL
);
"""
]
for tabla in tablas:
cursor.execute(tabla);
def fill_database_factures(name, dia, mes, any, nom, base, iva, total):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "INSERT INTO data(dia, mes, any, nom, base_imp, iva, total) VALUES (?,?,?,?,?,?,?)"
cursor.execute(sentencia, [dia, mes, any, nom, base, iva, total])
database.commit()
def delete_database_factures(name, dia, mes, any, base, iva, total):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "DELETE FROM data WHERE dia LIKE ? AND mes LIKE ? AND any LIKE ? AND base_imp LIKE ? AND iva LIKE ? AND total LIKE ? ;"
cursor.execute(sentencia, [ "%{}%".format(dia), "%{}%".format(mes), "%{}%".format(any), "%{}%".format(base), "%{}%".format(iva), "%{}%".format(total)])
database.commit()
def read_database_factures(name, order):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "SELECT * FROM data ORDER BY any, mes, dia %s" % order
cursor.execute(sentencia)
lines = cursor.fetchall()
return lines
def select_from_database_factures(name, dia, mes, ano):
database = sqlite3.connect('%s.db' % name)
cursor=database.cursor()
sentencia = "SELECT * FROM data WHERE dia LIKE ? AND mes LIKE ? AND any LIKE ? ;"
cursor.execute(sentencia, ["%{}%".format(dia), "%{}%".format(mes), "%{}%".format(ano)])
matches = cursor.fetchall()
return matches
def check_table_exists(name, table):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "SELECT name FROM sqlite_master WHERE type='table' AND name = '%s' ;" % table
cursor.execute(sentencia)
lines = cursor.fetchall()
if len(lines) == 0:
return False
else:
return True
def create_database(name, tablas):
#Create a database
database = sqlite3.connect("%s.db" % name)
#Create a data table in the database
cursor = database.cursor()
for tabla in tablas:
cursor.execute(tabla);
def fill_table_stock(name, items_list):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "DELETE FROM stock WHERE REF LIKE ?;"
cursor.execute(sentencia, ["%{}%".format(items_list[0])])
sentencia = "INSERT INTO stock(REF, NAME, QUANTITY, UNIT_PRICE, TOTAL_PRICE) VALUES (?,?,?,?,?)"
cursor.execute(sentencia, items_list)
database.commit()
def fill_database_general(name, table, interrogants, values):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "INSERT INTO %s VALUES %s" % (table, interrogants)
cursor.execute(sentencia, values)
database.commit()
#DATE
def change_date_format(date):
return datetime.datetime.strptime(date, "%Y-%m-%d").strftime("%d-%m-%Y")
#####################################################################
# #
# CLASSES #
# #
#####################################################################
#CLIENTS
class Nou_client(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('NouClient.ui', self)
os.chdir(dir_principal)
self.nomcom.textChanged.connect(self.validar_nom_com) #Executa la funció validar_nom_com al clicar sobre el camp
self.nomfis.textChanged.connect(self.validar_nom_fis)
self.direccio.textChanged.connect(self.validar_direccio)
self.poblacio.textChanged.connect(self.validar_poblacio)
self.nif.textChanged.connect(self.validar_nif)
self.telf.textChanged.connect(self.validar_telf)
self.formapago.textChanged.connect(self.validar_forma_pago)
self.accept_botton.clicked.connect(self.validar_dades)
self.pujar_drive.clicked.connect(self.upload_database)
def assignar_numero_client(self, name):
database = sqlite3.connect('%s.db' % name)
cursor = database.cursor()
sentencia = "SELECT * FROM data;"
cursor.execute(sentencia)
clients = cursor.fetchall()
num = len(clients) + 1
return num
def validar_nom_com(self):
nom_com = self.nomcom.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'.-]+$", nom_com, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom_com == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nomcom.setStyleSheet('border: 1px solid yellow;')
return False, nom_com
elif not validar:#Si no es valid bordes vermells
self.nomcom.setStyleSheet('border: 1px solid red;')
return False, nom_com
else:
self.nomcom.setStyleSheet('border: 1px solid green;')
return True, nom_com
def validar_nom_fis(self):
nom_fis = self.nomfis.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'.-]+$", nom_fis, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom_fis == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nomfis.setStyleSheet('border: 1px solid yellow;')
return False, nom_fis
elif not validar:#Si no es valid bordes vermells
self.nomfis.setStyleSheet('border: 1px solid red;')
return False, nom_fis
else:
self.nomfis.setStyleSheet('border: 1px solid green;')
return True, nom_fis
def validar_direccio(self):
direccio = self.direccio.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'/,ªº.-]+$", direccio, re.I) #Permetre lletres a-z, espais, accents, numeros
if direccio == '': #Si esta buit bordes grocs
self.direccio.setStyleSheet('border: 1px solid yellow;')
return False, direccio
elif not validar:#Si no es valid bordes vermells
self.direccio.setStyleSheet('border: 1px solid red;')
return False, direccio
else:
self.direccio.setStyleSheet('border: 1px solid green;')
return True, direccio
def validar_poblacio(self):
poblacio = self.poblacio.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789',.-]+$", poblacio, re.I) #Permetre lletres a-z, espais, accents, numeros
if poblacio == '': #Si esta buit bordes grocs
self.poblacio.setStyleSheet('border: 1px solid yellow;')
return False, poblacio
elif not validar:#Si no es valid bordes vermells
self.poblacio.setStyleSheet('border: 1px solid red;')
return False, poblacio
else:
self.poblacio.setStyleSheet('border: 1px solid green;')
return True, poblacio
def validar_nif(self):
nif = self.nif.text()
validar = re.match('^[a-zñç0123456789]+$', nif, re.I) #Permetre lletres a-z, numeros
if nif == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, nif
elif not validar:#Si no es valid bordes vermells
self.nif.setStyleSheet('border: 1px solid red;')
return False, nif
else:
self.nif.setStyleSheet('border: 1px solid green;')
return True, nif
def validar_telf(self):
telf = self.telf.text()
validar = re.match('^[0123456789]+$', telf, re.I) #Permetre numeros
if telf == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, telf
elif not validar:#Si no es valid bordes vermells
self.telf.setStyleSheet('border: 1px solid red;')
return False, telf
else:
self.telf.setStyleSheet('border: 1px solid green;')
return True, telf
def validar_forma_pago(self):
forma_pago = self.formapago.text()
validar = re.match('^[a-zñç.-]+$', forma_pago, re.I) #Permetre lletres a-z #re.I ignora majuscules i minuscules
if forma_pago == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, forma_pago
elif not validar:#Si no es valid bordes vermells
self.formapago.setStyleSheet('border: 1px solid red;')
return False, forma_pago
else:
self.formapago.setStyleSheet('border: 1px solid green;')
return True, forma_pago
def validar_dades(self):
bool_1, NOMCOM = self.validar_nom_com()
bool_2, NOMFIS = self.validar_nom_fis()
bool_3, DIR = self.validar_direccio()
bool_4, POBLACIO = self.validar_poblacio()
bool_5, NIF = self.validar_nif()
bool_6, TEL = self.validar_telf()
bool_7, forma_pago = self.validar_forma_pago()
if bool_1 and bool_2 and bool_3 and bool_4 and bool_5 and bool_6 and bool_7:
os.chdir(carpeta_data)
create_database_client('clients') #Just if the database doesn't exist
num_client = self.assignar_numero_client('clients')
fill_database('clients', str(num_client).zfill(4), str(NOMCOM), str(NOMFIS), str(DIR), str(POBLACIO), str(NIF), str(TEL), str(forma_pago))
if self.pujar_drive_check.isChecked():
upload_to_drive_database('clients')
QMessageBox.information(self, 'Dades correctes' , 'El client ha estat registrat a la base de dades amb número de client %s' % str(num_client).zfill(4), QMessageBox.Discard)
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Dades incorrectes' , 'Comprova que tots els camps estan omplerts correctament', QMessageBox.Discard)
def upload_database(self):
upload_to_drive_database('clients')
QMessageBox.information(self, 'Information', 'Dades pujades correctament')
def reinit_dialog(self):
self.nomcom.setText('')
self.nomfis.setText('')
self.direccio.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.nomcom.setStyleSheet('')
self.nomfis.setStyleSheet('')
self.direccio.setStyleSheet('')
self.poblacio.setStyleSheet('')
self.nif.setStyleSheet('')
self.telf.setStyleSheet('')
self.formapago.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.pujar_drive_check.setChecked(True)
else:
event.ignore()
class Modificar_client(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('ModClient.ui', self)
self.numclient.textChanged.connect(self.validar_num_client)
self.searchbotton.clicked.connect(self.search)
self.nomcom.textChanged.connect(self.validar_nom_com) #Executa la funció validar_nom_com al clicar sobre el camp
self.nomfis.textChanged.connect(self.validar_nom_fis)
self.direccio.textChanged.connect(self.validar_direccio)
self.poblacio.textChanged.connect(self.validar_poblacio)
self.nif.textChanged.connect(self.validar_nif)
self.telf.textChanged.connect(self.validar_telf)
self.formapago.textChanged.connect(self.validar_forma_pago)
self.accept_botton.clicked.connect(self.validar_dades)
self.pujar_drive.clicked.connect(self.upload_database)
def search(self):
os.chdir(carpeta_data)
control, num = self.validar_num_client()
if control == True:
if os.path.exists('clients.db'):
client = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(client) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
self.reinit_dialog()
else:
self.nomcom.setText(client[0][1])
self.nomfis.setText(client[0][2])
self.direccio.setText(client[0][3])
self.poblacio.setText(client[0][4])
self.nif.setText(client[0][5])
self.telf.setText(client[0][6])
self.formapago.setText(client[0][7])
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
else:
QMessageBox.warning(self, 'Warning', 'Número de client no vàlid!')
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_nom_com(self):
nom_com = self.nomcom.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'.-]+$", nom_com, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom_com == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nomcom.setStyleSheet('border: 1px solid yellow;')
return False, nom_com
elif not validar:#Si no es valid bordes vermells
self.nomcom.setStyleSheet('border: 1px solid red;')
return False, nom_com
else:
self.nomcom.setStyleSheet('border: 1px solid green;')
return True, nom_com
def validar_nom_fis(self):
nom_fis = self.nomfis.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'.-]+$", nom_fis, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom_fis == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nomfis.setStyleSheet('border: 1px solid yellow;')
return False, nom_fis
elif not validar:#Si no es valid bordes vermells
self.nomfis.setStyleSheet('border: 1px solid red;')
return False, nom_fis
else:
self.nomfis.setStyleSheet('border: 1px solid green;')
return True, nom_fis
def validar_direccio(self):
direccio = self.direccio.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789'/,ªº.-]+$", direccio, re.I) #Permetre lletres a-z, espais, accents, numeros
if direccio == '': #Si esta buit bordes grocs
self.direccio.setStyleSheet('border: 1px solid yellow;')
return False, direccio
elif not validar:#Si no es valid bordes vermells
self.direccio.setStyleSheet('border: 1px solid red;')
return False, direccio
else:
self.direccio.setStyleSheet('border: 1px solid green;')
return True, direccio
def validar_poblacio(self):
poblacio = self.poblacio.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789',.-]+$", poblacio, re.I) #Permetre lletres a-z, espais, accents, numeros
if poblacio == '': #Si esta buit bordes grocs
self.poblacio.setStyleSheet('border: 1px solid yellow;')
return False, poblacio
elif not validar:#Si no es valid bordes vermells
self.poblacio.setStyleSheet('border: 1px solid red;')
return False, poblacio
else:
self.poblacio.setStyleSheet('border: 1px solid green;')
return True, poblacio
def validar_nif(self):
nif = self.nif.text()
validar = re.match('^[a-zñç0123456789]+$', nif, re.I) #Permetre lletres a-z, numeros
if nif == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, nif
elif not validar:#Si no es valid bordes vermells
self.nif.setStyleSheet('border: 1px solid red;')
return False, nif
else:
self.nif.setStyleSheet('border: 1px solid green;')
return True, nif
def validar_telf(self):
telf = self.telf.text()
validar = re.match('^[0123456789]+$', telf, re.I) #Permetre numeros
if telf == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, telf
elif not validar:#Si no es valid bordes vermells
self.telf.setStyleSheet('border: 1px solid red;')
return False, telf
else:
self.telf.setStyleSheet('border: 1px solid green;')
return True, telf
def validar_forma_pago(self):
forma_pago = self.formapago.text()
validar = re.match('^[a-zñç.]+$', forma_pago, re.I) #Permetre lletres a-z #re.I ignora majuscules i minuscules
if forma_pago == '': #Si esta buit bordes grocs
self.nif.setStyleSheet('border: 1px solid yellow;')
return False, forma_pago
elif not validar:#Si no es valid bordes vermells
self.formapago.setStyleSheet('border: 1px solid red;')
return False, forma_pago
else:
self.formapago.setStyleSheet('border: 1px solid green;')
return True, forma_pago
def validar_dades(self):
bool_1, NOMCOM = self.validar_nom_com()
bool_2, NOMFIS = self.validar_nom_fis()
bool_3, DIR = self.validar_direccio()
bool_4, POBLACIO = self.validar_poblacio()
bool_5, NIF = self.validar_nif()
bool_6, TEL = self.validar_telf()
bool_7, forma_pago = self.validar_forma_pago()
bool_8, num_client = self.validar_num_client()
if bool_1 and bool_2 and bool_3 and bool_4 and bool_5 and bool_6 and bool_7 and bool_8 :
os.chdir(carpeta_data)
delete_from_database('clients', 'num_client', str(num_client).zfill(4))
fill_database('clients', str(num_client).zfill(4), str(NOMCOM), str(NOMFIS), str(DIR), str(POBLACIO), str(NIF), str(TEL), str(forma_pago))
if self.pujar_drive_check.isChecked():
upload_to_drive_database('clients')
QMessageBox.information(self, 'Information' , 'Client modificat', QMessageBox.Discard)
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Warning!' , 'Dades incorrectes, comprova si el número de client està registrat', QMessageBox.Discard)
def upload_database(self):
upload_to_drive_database('clients')
QMessageBox.information(self, 'Information', 'Dades pujades correctament')
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.numclient.setStyleSheet('')
self.nomcom.setStyleSheet('')
self.nomfis.setStyleSheet('')
self.direccio.setStyleSheet('')
self.poblacio.setStyleSheet('')
self.nif.setStyleSheet('')
self.telf.setStyleSheet('')
self.formapago.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.pujar_drive_check.setChecked(True)
else:
event.ignore()
class Registre_clients(QDialog):
def __init__(self):
QDialog.__init__(self)
uic.loadUi('RegistreClients.ui', self)
self.show_table()
def show_table(self):
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
lines = read_database('clients', 'data', 'num_client', 'ASC')
self.table.setRowCount(len(lines))
self.table.setColumnCount(8)
self.table.setHorizontalHeaderLabels(['Nº CLIENT', 'NOM COMERCIAL', 'NOM FISCAL', 'ADREÇA', 'POBLACIÓ', 'NIF', 'TEL', 'FORMA PAGO'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(8):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
for i in range(len(lines)):
llista.append(lines[i][0])
for j in range(8):
if j == 0:
self.table.setItem(i,j, QTableWidgetItem(lines[i][0])) #num_client
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #nom_com
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2])) #nom_fis
elif j == 3:
self.table.setItem(i,j, QTableWidgetItem(lines[i][3])) #adreça
elif j == 4:
self.table.setItem(i,j, QTableWidgetItem(lines[i][4])) #poblacio
elif j == 5:
self.table.setItem(i,j, QTableWidgetItem(lines[i][5])) #nif
elif j == 6:
self.table.setItem(i,j, QTableWidgetItem(lines[i][6])) #tel
else:
self.table.setItem(i,j, QTableWidgetItem(lines[i][7])) #forma pago
self.table.setVerticalHeaderLabels(llista)
header = self.table.horizontalHeader()
for i in range(8):
header.setSectionResizeMode(i, QHeaderView.ResizeToContents)
for j in range(len(lines)):
self.table.verticalHeaderItem(j).setFont(font)
class Buscar_client(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('BuscarClient.ui', self)
self.buscador.textChanged.connect(self.validar_buscador)
self.accepted.connect(self.accept)
self.rejected.connect(self.reinit_dialog)
def validar_buscador(self):
entrada = self.buscador.text()
validar = re.match("^[a-z\sáéíóúàèìòùäëïöüñç0123456789']+$", entrada, re.I)
if entrada == '': #Si esta buit bordes grocs
self.buscador.setStyleSheet('border: 1px solid yellow;')
return False, entrada
elif not validar:#Si no es valid bordes vermells
self.buscador.setStyleSheet('border: 1px solid red;')
return False, entrada
else:
self.buscador.setStyleSheet('border: 1px solid green;')
return True, entrada
def accept(self):
os.chdir(carpeta_data)
bool1, entrada = self.validar_buscador()
CONTROL = False
if bool1 == True:
if os.path.exists('clients.db'):
matches, CONTROL = select_from_database('clients', entrada, 'num_client')
if CONTROL == True:
self.table.setRowCount(len(matches))
self.table.setColumnCount(8)
self.table.setHorizontalHeaderLabels(['Nº CLIENT', 'NOM COMERCIAL', 'NOM FISCAL', 'ADREÇA', 'POBLACIÓ', 'NIF', 'TEL', 'FORMA PAGO'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(8):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
for i in range(len(matches)):
llista.append('')
for j in range(8):
if j == 0:
self.table.setItem(i,j, QTableWidgetItem(matches[i][0])) #num_client
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(matches[i][1])) #nom_com
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(matches[i][2])) #nom_fis
elif j == 3:
self.table.setItem(i,j, QTableWidgetItem(matches[i][3])) #adreça
elif j == 4:
self.table.setItem(i,j, QTableWidgetItem(matches[i][4])) #poblacio
elif j == 5:
self.table.setItem(i,j, QTableWidgetItem(matches[i][5])) #nif
elif j == 6:
self.table.setItem(i,j, QTableWidgetItem(matches[i][6])) #tel
else:
self.table.setItem(i,j, QTableWidgetItem(matches[i][7])) #forma pago
self.table.setVerticalHeaderLabels(llista)
header = self.table.horizontalHeader()
for i in range(8):
header.setSectionResizeMode(i, QHeaderView.ResizeToContents)
else:
QMessageBox.warning(self, 'Warning!' , 'Cap coincidència', QMessageBox.Discard)
else:
QMessageBox.warning(self, 'Dades incorrectes', 'Encara no has registrat cap client!', QMessageBox.Discard)
else:
QMessageBox.warning(self, 'Dades incorrectes', 'Algun caràcter introduït al marcador no és vàlid', QMessageBox.Discard)
def reinit_dialog(self):
self.buscador.setText('')
self.table.setRowCount(0)
self.table.setColumnCount(0)
self.buscador.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
#PRODUCTES
class Nou_producte(QDialog):
def __init__(self):
QDialog.__init__(self)
uic.loadUi('NouProducte.ui', self)
self.ref_modificar.textChanged.connect(self.validar_ref_mod)
self.ref_eliminar.textChanged.connect(self.validar_ref_elim)
self.nom.textChanged.connect(self.validar_nom_prod)
self.veure_nom_mod.clicked.connect(self.veure_nom_modificar)
self.veure_nom_elim.clicked.connect(self.veure_nom_eliminar)
self.registrar.clicked.connect(self.registrar_producte)
self.modificar.clicked.connect(self.modificar_producte)
self.eliminar.clicked.connect(self.eliminar_producte)
self.pujar_drive.clicked.connect(self.upload_database)
def validar_nom_prod(self):
nom = self.nom.text()
validar = re.match('^[a-z\sáéíóúàèìòùäëïöüñç0123456789.-]+$', nom, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nom.setStyleSheet('border: 1px solid yellow;')
return False, nom
else:
self.nom.setStyleSheet('border: 1px solid green;')
return True, nom
'''
elif not validar:#Si no es valid bordes vermells
self.nom.setStyleSheet('border: 1px solid red;')
return False, nom
'''
def validar_ref_mod(self):
ref = self.ref_modificar.text()
validar = re.match('^[0123456789]+$', ref)
if ref == '': #Si esta buit bordes grocs
self.ref_modificar.setStyleSheet('border: 1px solid yellow;')
return False, ref
elif not validar:#Si no es valid bordes vermells
self.ref_modificar.setStyleSheet('border: 1px solid red;')
return False, ref
else:
self.ref_modificar.setStyleSheet('border: 1px solid green;')
return True, ref
def validar_ref_elim(self):
ref = self.ref_eliminar.text()
validar = re.match('^[0123456789]+$', ref)
if ref == '': #Si esta buit bordes grocs
self.ref_eliminar.setStyleSheet('border: 1px solid yellow;')
return False, ref
elif not validar:#Si no es valid bordes vermells
self.ref_eliminar.setStyleSheet('border: 1px solid red;')
return False, ref
else:
self.ref_eliminar.setStyleSheet('border: 1px solid green;')
return True, ref
def veure_nom_modificar(self):
os.chdir(carpeta_data)
control, ref = self.validar_ref_mod()
if not os.path.exists('cataleg.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Referència no vàlida!')
else:
prod = select_from_database_general('cataleg', 'data', ref, 'ref', 'ref', 'ASC')
if len(prod) != 0:
self.nom_modificar.setText(prod[0][1])
self.preu_mod_prod.setValue(prod[0][2])
else:
QMessageBox.warning(self, 'Warning!', 'Referència no registrada')
def veure_nom_eliminar(self):
os.chdir(carpeta_data)
control, ref = self.validar_ref_elim()
if not os.path.exists('cataleg.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Referència no vàlida!')
else:
prod = select_from_database_general('cataleg', 'data', ref, 'ref', 'ref', 'ASC')
if len(prod) != 0:
self.nom_eliminar.setText(prod[0][1])
self.preu_elim_prod.setValue(prod[0][2])
else:
QMessageBox.warning(self, 'Warning!', 'Referència no registrada')
def eliminar_producte(self):
os.chdir(carpeta_data)
control, ref = self.validar_ref_elim()
if not os.path.exists('cataleg.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Referència no vàlida!')
else:
delete_from_database('cataleg', 'ref', ref)
if self.pujar_drive_check.isChecked():
upload_to_drive_database('cataleg')
QMessageBox.information(self, 'Information', 'Producte eliminat correctament!')
self.reinit_dialog()
def modificar_producte(self):
os.chdir(carpeta_data)
control, ref = self.validar_ref_mod()
prod = self.nom_modificar.text()
preu = self.preu_mod_prod.value()
if self.nom_modificar.text() == '':
os.chdir(carpeta_data)
control, ref = self.validar_ref_mod()
if not os.path.exists('cataleg.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Referència no vàlida!')
else:
prod = select_from_database_general('cataleg', 'data', ref, 'ref', 'ref', 'ASC')
if len(prod) != 0:
prod = prod[0][1]
else:
QMessageBox.warning(self, 'Warning!', 'Referència no registrada')
if not os.path.exists('cataleg.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Referència no vàlida!')
elif preu == 0:
QMessageBox.warning(self, 'Warning!', 'El preu de compra no pot ser 0!')
else:
delete_from_database('cataleg', 'ref', ref)
fill_database_cataleg('cataleg', str(ref).zfill(3), prod, preu)
if self.pujar_drive_check.isChecked():
upload_to_drive_database('cataleg')
QMessageBox.information(self, 'Information', 'Producte modificat correctament!')
self.reinit_dialog()
def registrar_producte(self):
os.chdir(carpeta_data)
create_database_cataleg('cataleg')
lines = read_database('cataleg', 'data', 'ref', 'ASC')
control_nom, prod = self.validar_nom_prod()
ref = int(lines[len(lines)-1][0]) + 1
preu = self.preu_nou_prod.value()
control = True
for i in range(len(lines)):
if lines[i][1] == prod:
control = False
control_ref = lines[i][0]
if control == False:
QMessageBox.warning(self, 'Warning!', 'Aquest producte ja esta registrat amb número de referència %s' % control_ref)
elif preu == 0:
QMessageBox.warning(self, 'Warning!', 'El preu del producte no pot ser 0!')
elif control_nom == False:
QMessageBox.warning(self, 'Warning!', 'El nom del producte no pot estar buit!')
else:
fill_database_cataleg('cataleg', str(ref).zfill(3), prod, preu)
if self.pujar_drive_check.isChecked():
upload_to_drive_database('cataleg')
QMessageBox.information(self, 'Information', 'Producte ja registrat amb número de referència %s' % ref)
self.reinit_dialog()
def upload_database(self):
upload_to_drive_database('cataleg')
QMessageBox.information(self, 'Information', 'Dades pujades correctament')
def reinit_dialog(self):
self.nom.setText('')
self.ref_modificar.setText('')
self.ref_eliminar.setText('')
self.nom_modificar.setText('')
self.nom_eliminar.setText('')
self.preu_mod_prod.setValue(0)
self.preu_nou_prod.setValue(0)
self.preu_elim_prod.setValue(0)
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.ref_modificar.setStyleSheet('')
self.ref_eliminar.setStyleSheet('')
self.pujar_drive_check.setChecked(True)
else:
event.ignore()
class Introduir_preu_producte(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('IntroduirPreu.ui', self)
self.referencia.textChanged.connect(self.validar_ref)
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.validar_dades)
self.guardar.clicked.connect(self.guardar_preu)
self.modificar.clicked.connect(self.modificar_preu)
self.pujar_drive.clicked.connect(self.upload_database)
def validar_ref(self):
ref = self.referencia.text()
validar = re.match('^[0123456789]+$', ref)
if ref == '': #Si esta buit bordes grocs
self.referencia.setStyleSheet('border: 1px solid yellow;')
return False, ref
elif not validar:#Si no es valid bordes vermells
self.referencia.setStyleSheet('border: 1px solid red;')
return False, ref
else:
self.referencia.setStyleSheet('border: 1px solid green;')
return True, ref
def validar_dades(self):
control, ref = self.validar_ref()
os.chdir(carpeta_data)
if os.path.exists('cataleg.db') and control == True:
lines = select_from_database_general('cataleg', 'data', ref, 'ref', 'ref', 'ASC')
if len(lines) != 0:
nom_ref = lines[0][1]
self.nom.setText(nom_ref)
else:
QMessageBox.warning(self, 'Warning!', 'Referència incorrecta o no registrada al catàleg!')
elif control == False:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!')
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap producte!')
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def guardar_preu(self):
control, num_client = self.validar_num_client()
control_2, ref = self.validar_ref()
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
lines = select_from_database_general('clients', 'data', num_client, 'num_client', 'num_client', 'ASC')
if control == True and control_2 == True and len(lines) != 0:
preu_ref = self.preu.value()
prod = self.nom.text()
if preu_ref > 0:
create_database_preus('preus')
control = fill_database_preus('preus', num_client, ref, prod, preu_ref)
if control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per aquest producte i client ja existeix a la base de dades! Si vols modificar-lo, clica el botó \"Modificar preu\"')
else:
if self.pujar_drive_check.isChecked():
upload_to_drive_database('preus')
QMessageBox.information(self, 'Information', 'Dades guardades correctament')
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Warning!', 'Selecciona un preu diferent de 0 per al producte!')
else:
QMessageBox.warning(self, 'Warning!', 'Número de client no registrat!')
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has reistrat cap client!')
def upload_database(self):
upload_to_drive_database('preus')
QMessageBox.Information(self, 'Information', 'Dades pujades correctament')
def modificar_preu(self):
control, num_client = self.validar_num_client()
control_2, ref = self.validar_ref()
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
lines = select_from_database_general('clients', 'data', num_client, 'num_client', 'num_client', 'ASC')
if control == True and control_2 == True and len(lines) != 0:
preu_ref = self.preu.value()
prod = self.nom.text()
if preu_ref > 0:
create_database_preus('preus')
control = modificar_database_preus('preus', num_client, ref, prod, preu_ref)
if control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per aquest producte i client no existeix a la base de dades, per introduir un preu nou clica el botó \"Guardar preu\".')
else:
if self.pujar_drive_check.isChecked():
upload_to_drive_database('preus')
QMessageBox.information(self, 'Information', 'Dades modificades correctament')
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Warning!', 'Selecciona un preu diferent de 0 per al producte!')
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!')
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
def reinit_dialog(self):
self.referencia.setText('')
self.numclient.setText('')
self.nom.setText('')
self.preu.setValue(0.)
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.referencia.setStyleSheet('')
self.numclient.setStyleSheet('')
self.pujar_drive_check.setChecked(True)
else:
event.ignore()
class Cataleg(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Cataleg.ui', self)
self.show.clicked.connect(self.createTable)
def createTable(self):
os.chdir(carpeta_data)
if os.path.exists('cataleg.db'):
if self.order.currentText() == 'Ordre alfabètic':
lines = read_database('cataleg', 'data', 'prod', 'ASC')
elif self.order.currentText() == 'Referència asc':
lines = read_database('cataleg', 'data', 'ref', 'ASC')
else:
lines = read_database('cataleg', 'data', 'ref', 'DESC')
self.table.setRowCount(len(lines))
self.table.setColumnCount(3)
header = self.table.horizontalHeader()
header.setSectionResizeMode(1, QHeaderView.Stretch)
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
self.table.setHorizontalHeaderLabels(['REF', 'PRODUCTE', 'PREU DE COMPRA'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(3):
self.table.horizontalHeaderItem(i).setFont(font)
for i in range(len(lines)):
for j in range(3):
self.table.setItem(i,j, QTableWidgetItem(str(lines[i][j])))
llista = []
for i in range(len(lines)):
llista.append('')
self.table.setVerticalHeaderLabels(llista)
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap producte!')
def reinit_dialog(self):
self.table.clearContents()
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Veure_preus(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('VeurePreus.ui', self)
self.show_table()
self.numclient.textChanged.connect(self.validar_num_client)
self.referencia.textChanged.connect(self.validar_ref)
self.seleccionar.clicked.connect(self.show_price_ref)
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_ref(self):
ref = self.referencia.text()
validar = re.match('^[0123456789]+$', ref)
if ref == '': #Si esta buit bordes grocs
self.referencia.setStyleSheet('border: 1px solid yellow;')
return False, ref
elif not validar:#Si no es valid bordes vermells
self.referencia.setStyleSheet('border: 1px solid red;')
return False, ref
else:
self.referencia.setStyleSheet('border: 1px solid green;')
return True, ref
def show_table(self):
os.chdir(carpeta_data)
if os.path.exists('cataleg.db') and os.path.exists('preus.db'):
referencies = read_database('cataleg', 'data', 'ref', 'ASC')
clients = read_database('clients', 'data', 'num_client', 'ASC')
preus = read_database('preus', 'data', 'ref', 'ASC')
self.table.setRowCount(len(clients))
self.table.setColumnCount(len(referencies) + 1)
horitzontal_labels = ['NUM. CLIENT / REF']
vertical_labels = []
for i in range(len(referencies)): horitzontal_labels.append(str(i+1).zfill(3))
for i in range(len(clients)):
vertical_labels.append(clients[i][0])
for j in range(len(referencies)+1):
if j == 0:
self.table.setItem(i,j, QTableWidgetItem(clients[i][0]))
else:
current_price_customer = select_from_database_preus('preus', str(i+1).zfill(4), str(j).zfill(3))
if len(current_price_customer) == 0:
self.table.setItem(i,j, QTableWidgetItem('NULL'))
else:
self.table.setItem(i,j, QTableWidgetItem(str(current_price_customer[0][3])))
self.table.setHorizontalHeaderLabels(horitzontal_labels)
self.table.setVerticalHeaderLabels(vertical_labels)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(len(referencies)+1):
self.table.horizontalHeaderItem(i).setFont(font)
for i in range(len(clients)):
self.table.verticalHeaderItem(i).setFont(font)
else:
#QMessageBox.warning(self, 'Warning!', 'No existeixen les bases de dades del catàleg o preus! ')
pass
def show_price_ref(self):
control, num_client = self.validar_num_client()
control_ref, ref = self.validar_ref()
os.chdir(carpeta_data)
if os.path.exists('preus.db'):
price_ref_customer = select_from_database_preus('preus', str(num_client).zfill(4), str(ref).zfill(3))
if control == True and control_ref == True and len(price_ref_customer) != 0:
self.preu.setText(str(price_ref_customer[0][3]))
elif control == True and control_ref == True and len(price_ref_customer) == 0:
self.preu.setText('NULL')
else:
QMessageBox.warning(self, 'Warning!', 'Número de client o referència incorrecte')
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap preu!')
def reinit_dialog(self):
self.numclient.setText('')
self.referencia.setText('')
self.preu.setText('')
self.referencia.setStyleSheet('')
self.numclient.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
#FACTURACIÓ
class Factura(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Factura.ui', self)
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def show_table(self, num_client):
os.chdir(carpeta_data)
if not os.path.exists('preus.db'):
QMessageBox.warning(self, 'Warning!', 'No has registrat cap preu!')
else:
if self.comboBox.currentText() == 'Referència ascendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'ASC')
elif self.comboBox.currentText() == 'Referència descendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'DESC')
elif self.comboBox.currentText() == 'Alfabètic':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'prod', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Aquest client no té cap preu registrat!')
else:
self.table.setRowCount(len(lines))
self.table.setColumnCount(4)
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(4):
if j == 0: #UNITS
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #REF
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2]))
elif j == 3:#PRICE
sp = QDoubleSpinBox()
sp.setDecimals(3)
sp.setValue(float(lines[i][3]))
sp.setMaximum(float(lines[i][3]))
sp.setMinimum(float(lines[i][3]))
self.table.setCellWidget(i,j, sp)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.Stretch)
self.table.setHorizontalHeaderLabels(['UNITATS', 'REF', 'PRODUCTE', 'PREU'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(4):
self.table.horizontalHeaderItem(i).setFont(font)
def search(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.show_table(num)
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_client(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def fer_factura(self):
control, num_client = self.validar_client()
if control == True:
data = self.calendar.selectedDate().toString("dd/MM/yyyy")
dia = str(data[0:2]).zfill(2)
mes = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
nom_mes = mesos[int(data[3:5])-1]
ref = []
prod = []
units = []
preu = []
base_imponible = []
create_database_ventes('ventes', str(ano))
create_database_ventes('facturacio_ref', str(ano))
lines = self.table.rowCount()
for i in range(lines):
current_units = self.table.cellWidget(i,0).value()
current_ref = self.table.item(i,1).text()
current_prod = self.table.item(i,2).text().strip('\n')
if current_units != 0 :
ref.append(current_ref)
prod.append(current_prod)
units.append(current_units)
#Obtenir el preu a partir de la base de dades
if os.path.exists('preus.db'):
control_2 = True
lines = select_from_database_preus('preus', num_client, current_ref)
if len(lines) != 0:
current_price = lines[0][3]
preu.append(current_price)
base = round(current_units*current_price, 2)
base_imponible.append(base)
#Guardar les ventes a la base de dades
fill_database_ventes('ventes', str(ano), int(current_ref), int(data[3:5]), current_units, 3)
fill_database_ventes('facturacio_ref', str(ano), int(current_ref), int(data[3:5]), base, 3)
else :
control = False
ref_control = current_ref
break
else:
control_2 = False
if len(prod) == 0:
QMessageBox.warning(self, 'Warning!', 'No has seleccionat cap producte!', QMessageBox.Discard)
elif np.any(np.array(preu) == 0):
QMessageBox.warning(self, 'Warning!', 'No has indicat el preu d\'algun dels productes seleccionats!', QMessageBox.Discard)
elif control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per a la referència %s i pel número de client %s no està guardat a la base de dades' % (ref_control, num_client))
elif control_2 == False:
QMessageBox.warning(self, 'Warning', 'No hi ha preus reistrats per cap client!')
else:
#Calcular import total
suma = 0
for i in range(len(base_imponible)):
suma = suma + base_imponible[i]
suma = round(suma, 2)
iva = round(0.21 * suma, 2)
total = round(suma + iva, 2)
#Fer factura i pujar al drive
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
dim = len(prod)
num_fact = assignar_numero_factura('numero_factura', ano)
factura(carpeta_factures, 'FACTURA', num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, dim, ref, prod, units, preu, base_imponible, suma, iva, total) #Plantilla de la factura per al client seleccionat
os.chdir(carpeta_data)
#Factura a la base de dades (nom comercial, B.I., I.V.A., total)
create_database_factures('factures_emeses')
fill_database_factures('factures_emeses', dia, mes, ano, str(num_fact).zfill(4), suma, 21, total)
#Facturació per client base de dades
create_database_ventes('facturacio_clients', ano)
fill_database_ventes('facturacio_clients', ano, int(num_client), int(data[3:5]), suma, 4)
#Facturació total base de dades
create_database_ventes('facturacio_total', 'data')
fill_database_ventes('facturacio_total', 'data', int(data[6:]), int(data[3:5]), suma, 3)
upload_to_drive_factura(carpeta_factures, 'Factures', 'FACTURA', num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Factura realitzada correctament!')
self.reinit_dialog()
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.table.clearContents()
self.numclient.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Substituir_factura(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('SubstituirFactura.ui', self)
self.numclient.textChanged.connect(self.validar_num_client)
self.numfact.textChanged.connect(self.validar_num_factura)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def show_table(self, num_client):
os.chdir(carpeta_data)
if not os.path.exists('preus.db'):
QMessageBox.warning(self, 'Warning!', 'No has registrat cap preu!')
else:
if self.comboBox.currentText() == 'Referència ascendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'ASC')
elif self.comboBox.currentText() == 'Referència descendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'DESC')
elif self.comboBox.currentText() == 'Alfabètic':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'prod', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Aquest client no té cap preu registrat!')
else:
self.table.setRowCount(len(lines))
self.table.setColumnCount(4)
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(4):
if j == 0: #UNITS
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #REF
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2]))
elif j == 3:#PRICE
sp = QDoubleSpinBox()
sp.setDecimals(3)
sp.setValue(float(lines[i][3]))
sp.setMaximum(float(lines[i][3]))
sp.setMinimum(float(lines[i][3]))
self.table.setCellWidget(i,j, sp)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.Stretch)
self.table.setHorizontalHeaderLabels(['UNITATS', 'REF', 'PRODUCTE', 'PREU'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(4):
self.table.horizontalHeaderItem(i).setFont(font)
def search(self):
control_client, num = self.validar_num_client()
control_factura, num_fact = self.validar_num_factura()
if control_client == True and control_factura == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.show_table(num)
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client o no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_num_factura(self):
os.chdir(carpeta_factures)
num_fact = self.numfact.text()
validar = re.match('^[0123456789]+$', num_fact)
if num_fact == '': #Si esta buit bordes grocs
self.numfact.setStyleSheet('border: 1px solid yellow;')
return False, num_fact
elif not validar:#Si no es valid bordes vermells
self.numfact.setStyleSheet('border: 1px solid red;')
return False, num_fact
else:
self.numfact.setStyleSheet('border: 1px solid green;')
return True, num_fact
def validar_client(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def fer_factura(self):
control_client, num_client = self.validar_client()
data = self.calendar.selectedDate().toString("dd/MM/yyyy")
num_fact = self.numfact.text()
dia = str(data[0:2]).zfill(2)
mes_numero = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
name_fact = 'FACTURA_%s' % num_fact
mes = mesos[int(data[3:5])-1]
año = data[6:]
if not os.path.exists(carpeta_factures + '\%s_%s' % (mes, año)):
QMessageBox.warning(self, 'Warning!', 'No has realitzat cap factura pel mes i any de la data seleccionada!')
else:
os.chdir(carpeta_factures + '\%s_%s' % (mes, año))
list_files = os.listdir()
control_factura = False
for file in list_files:
if file[0:12] == name_fact:
control_factura = True
os.remove(file)
break
else:
control_factura = False
if control_factura == False:
QMessageBox.warning(self, 'Warning!', 'Aquest número de factura no existeix!')
elif control_client == True:
ref = []
prod = []
units = []
preu = []
base_imponible = []
lines = self.table.rowCount()
for i in range(lines):
current_units = self.table.cellWidget(i,0).value()
current_ref = self.table.item(i,1).text()
current_prod = self.table.item(i,2).text().strip('\n')
if current_units != 0 :
ref.append(current_ref)
prod.append(current_prod)
units.append(current_units)
#Obtenir el preu a partir de la base de dades
os.chdir(carpeta_data)
lines = select_from_database_preus('preus', num_client, current_ref)
if len(lines) != 0:
current_price = lines[0][3]
preu.append(current_price)
base_imponible.append(round(current_units*current_price, 2))
control = True
else :
control = False
ref_control = current_ref
break
if len(prod)== 0:
QMessageBox.warning(self, 'Warning!', 'No has seleccionat cap producte!', QMessageBox.Discard)
elif np.any(np.array(preu) == 0):
QMessageBox.warning(self, 'Warning!', 'No has indicat el preu d\'algun dels productes seleccionats!', QMessageBox.Discard)
elif control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per a la referència %s i pel número de client %s no està guardat a la base de dades' % (ref_control, num_client))
else:
#Calcular import total
suma = 0
for i in range(len(base_imponible)):
suma = suma + base_imponible[i]
suma = round(suma, 2)
iva = round(0.21 * suma, 2)
total = round(suma + iva, 2)
#Fer factura i pujar al drive
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
dim = len(prod)
factura(carpeta_factures, 'FACTURA', num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, dim, ref, prod, units, preu, base_imponible, suma, iva, total) #Plantilla de la factura per al client seleccionat
#Factura a la base de dades (nom comercial, B.I., I.V.A., total)
os.chdir(carpeta_data)
create_database_factures('factures_emeses')
delete_from_database('factures_emeses', 'nom', str(num_fact).zfill(4))
fill_database_factures('factures_emeses', dia, mes_numero, ano, str(num_fact).zfill(4), suma, 21, total)
upload_to_drive_factura(carpeta_factures, 'Factures', 'FACTURA', num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Factura modificada correctament!')
self.reinit_dialog()
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.numfact.setText('')
self.table.clearContents()
self.numclient.setStyleSheet('')
self.numfact.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Abonos(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Abono.ui', self)
self.setWindowTitle('Abonos')
self.facturar.setText('Realitzar abono')
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def show_table(self, num_client):
os.chdir(carpeta_data)
if not os.path.exists('preus.db'):
QMessageBox.warning(self, 'Warning!', 'No has registrat cap preu!')
else:
if self.comboBox.currentText() == 'Referència ascendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'ASC')
elif self.comboBox.currentText() == 'Referència descendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'DESC')
elif self.comboBox.currentText() == 'Alfabètic':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'prod', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Aquest client no té cap preu registrat!')
else:
self.table.setRowCount(len(lines))
self.table.setColumnCount(4)
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(4):
if j == 0: #UNITS
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #REF
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2]))
elif j == 3:#PRICE
sp = QDoubleSpinBox()
sp.setDecimals(3)
sp.setValue(float(lines[i][3]))
sp.setMaximum(float(lines[i][3]))
sp.setMinimum(float(lines[i][3]))
self.table.setCellWidget(i,j, sp)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.Stretch)
self.table.setHorizontalHeaderLabels(['UNITATS', 'REF', 'PRODUCTE', 'PREU'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(4):
self.table.horizontalHeaderItem(i).setFont(font)
def search(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.show_table(num)
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client o encara no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_client(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def fer_factura(self):
control, num_client = self.validar_client()
if control == True:
data = self.calendar.selectedDate().toString("dd/MM/yyyy")
dia = str(data[0:2]).zfill(2)
mes = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
nom_mes = mesos[int(data[3:5])-1]
ref = []
prod = []
units = []
preu = []
base_imponible = []
create_database_ventes('ventes', data[6:])
create_database_ventes('facturacio_ref', data[6:])
lines = self.table.rowCount()
for i in range(lines):
current_units = self.table.cellWidget(i,0).value()
current_ref = self.table.item(i,1).text()
current_prod = self.table.item(i,2).text().strip('\n')
if current_units != 0 :
ref.append(current_ref)
prod.append(current_prod)
units.append(current_units)
#Obtenir el preu a partir de la base de dades
lines = select_from_database_preus('preus', num_client, current_ref)
if len(lines) != 0:
current_price = -lines[0][3]
preu.append(current_price)
base = round(current_units*current_price, 2)
base_imponible.append(base)
#Guardar les ventes a la base de dades
fill_database_ventes('ventes', data[6:], int(current_ref), int(data[3:5]), -current_units, 3)
fill_database_ventes('facturacio_ref', str(ano), int(current_ref), int(data[3:5]), base, 3)
else :
control = False
ref_control = current_ref
break
if len(prod) == 0:
QMessageBox.warning(self, 'Warning!', 'No has seleccionat cap producte!', QMessageBox.Discard)
elif np.any(np.array(preu) == 0):
QMessageBox.warning(self, 'Warning!', 'No has indicat el preu d\'algun dels productes seleccionats!', QMessageBox.Discard)
elif control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per a la referència %s i pel número de client %s no està guardat a la base de dades' % (ref_control, num_client))
elif not os.path.exists('factures_emeses.db'):
QMessageBox.warning(self, 'Warning!', 'No pots fer un abono si no has realitzat encara cap factura!')
else:
#Calcular import total
suma = 0
for i in range(len(base_imponible)):
suma = suma + base_imponible[i]
suma = round(suma, 2)
iva = round(0.21 * suma, 2)
total = round(suma + iva, 2)
#Fer factura i pujar al drive
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
dim = len(prod)
num_fact = assignar_numero_factura('numero_abono', ano)
if self.tipo_abono.currentText() == 'Factura':
tipo = 'ABONO_FACTURA'
os.chdir(carpeta_data)
#SUMA JA ÉS NEATIVA!!!
#Factura a la base de dades (nom comercial, B.I., I.V.A., total)
delete_database_factures('factures_emeses', dia, mes, ano, -suma, 21, -total)
#Facturació per client base de dades
fill_database_ventes('facturacio_clients', data[6:], int(num_client), int(data[3:5]), suma, 4)
#Facturació total base de dades
fill_database_ventes('facturacio_total', 'data', int(data[6:]), int(data[3:5]), suma, 3)
else:
tipo = 'ABONO_ALBARAN'
fill_database_general('CompanyName', 'albaranes(num_client, num_albaran, data, base_imp, iva, total)', '(?,?,?,?,?,?)', [str(num_client).zfill(4), str(num_fact).zfill(4), '%s-%s-%s' % (ano, mes, dia), suma, iva, total])
factura(carpeta_abonos, tipo, num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, dim, ref, prod, units, preu, base_imponible, suma, iva, total) #Plantilla de la factura per al client seleccionat
upload_to_drive_factura(carpeta_abonos, 'Abonos', tipo, num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Abono realitzat correctament!')
self.reinit_dialog()
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.table.clearContents()
self.numclient.setStyleSheet('')
self.nomcom.setStyleSheet('')
self.direccio.setStyleSheet('')
self.nomfis.setStyleSheet('')
self.poblacio.setStyleSheet('')
self.nif.setStyleSheet('')
self.telf.setStyleSheet('')
self.formapago.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Albaran(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Factura.ui', self)
self.setWindowTitle('Albaran')
self.facturar.setText('Realitzar albaran')
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def show_table(self, num_client):
os.chdir(carpeta_data)
if not os.path.exists('preus.db'):
QMessageBox.warning(self, 'Warning!', 'No has registrat cap preu!')
else:
if self.comboBox.currentText() == 'Referència ascendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'ASC')
elif self.comboBox.currentText() == 'Referència descendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'DESC')
elif self.comboBox.currentText() == 'Alfabètic':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'prod', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Aquest client no té cap preu registrat!')
else:
self.table.setRowCount(len(lines))
self.table.setColumnCount(4)
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(4):
if j == 0: #UNITS
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #REF
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2]))
elif j == 3:#PRICE
sp = QDoubleSpinBox()
sp.setDecimals(3)
sp.setValue(float(lines[i][3]))
sp.setMaximum(float(lines[i][3]))
sp.setMinimum(float(lines[i][3]))
self.table.setCellWidget(i,j, sp)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.Stretch)
self.table.setHorizontalHeaderLabels(['UNITATS', 'REF', 'PRODUCTE', 'PREU'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(4):
self.table.horizontalHeaderItem(i).setFont(font)
def search(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.show_table(num)
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_client(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def fer_factura(self):
control, num_client = self.validar_client()
if control == True:
data = self.calendar.selectedDate().toString("dd/MM/yyyy")
dia = str(data[0:2]).zfill(2)
mes = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
nom_mes = mesos[int(data[3:5])-1]
ref = []
prod = []
units = []
preu = []
base_imponible = []
create_database_ventes('ventes', str(ano))
create_database_ventes('facturacio_ref', str(ano))
lines = self.table.rowCount()
for i in range(lines):
current_units = self.table.cellWidget(i,0).value()
current_ref = self.table.item(i,1).text()
current_prod = self.table.item(i,2).text().strip('\n')
if current_units != 0 :
ref.append(current_ref)
prod.append(current_prod)
units.append(current_units)
#Obtenir el preu a partir de la base de dades
if os.path.exists('preus.db'):
control_2 = True
lines = select_from_database_preus('preus', num_client, current_ref)
if len(lines) != 0:
current_price = lines[0][3]
preu.append(current_price)
base = round(current_units*current_price, 2)
base_imponible.append(base)
#Guardar les ventes a la base de dades
fill_database_ventes('ventes', str(ano), int(current_ref), int(data[3:5]), current_units, 3)
fill_database_ventes('facturacio_ref', str(ano), int(current_ref), int(data[3:5]), base, 3)
else :
control = False
ref_control = current_ref
break
else:
control_2 = False
if len(prod) == 0:
QMessageBox.warning(self, 'Warning!', 'No has seleccionat cap producte!', QMessageBox.Discard)
elif np.any(np.array(preu) == 0):
QMessageBox.warning(self, 'Warning!', 'No has indicat el preu d\'algun dels productes seleccionats!', QMessageBox.Discard)
elif control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per a la referència %s i pel número de client %s no està guardat a la base de dades' % (ref_control, num_client))
elif control_2 == False:
QMessageBox.warning(self, 'Warning', 'No hi ha preus reistrats per cap client!')
else:
#Calcular import total
suma = 0
for i in range(len(base_imponible)):
suma = suma + base_imponible[i]
suma = round(suma, 2)
iva = round(0.21 * suma, 2)
total = round(suma + iva, 2)
#Fer factura i pujar al drive
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
dim = len(prod)
num_fact = assignar_numero_factura('numero_albaran', ano)
factura(carpeta_albaranes, 'ALBARAN', num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, dim, ref, prod, units, preu, base_imponible, suma, iva, total) #Plantilla de la factura per al client seleccionat
#Albaran a la base de dades (nom comercial, B.I., I.V.A., total)
os.chdir(carpeta_data)
tablas = [
"""
CREATE TABLE IF NOT EXISTS albaranes(
num_client TEXT NOT NULL,
num_albaran TEXT NOT NULL,
data TEXT NOT NULL,
base_imp REAL NOT NULL,
iva REAL NOT NULL,
total REAL NOT NULL
);
"""
]
#Albaran a la base de dades
create_database('CompanyName', tablas)
fill_database_general('CompanyName', 'albaranes(num_client, num_albaran, data, base_imp, iva, total)', '(?,?,?,?,?,?)', [str(num_client).zfill(4), str(num_fact).zfill(4), '%s-%s-%s' % (ano, mes, dia), suma, iva, total])
upload_to_drive_factura(carpeta_albaranes, 'Albaranes', 'ALBARAN', num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Albaran realitzat correctament!')
self.reinit_dialog()
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.table.clearContents()
self.numclient.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Substituir_albaran(QDialog): #Creating!
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('SubstituirFactura.ui', self)
self.setWindowTitle('Substituir albaran')
self.facturar.setText('Substituir')
self.label_num_fact.setText('Número albaran')
self.numclient.textChanged.connect(self.validar_num_client)
self.numfact.textChanged.connect(self.validar_num_factura)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def show_table(self, num_client):
os.chdir(carpeta_data)
if not os.path.exists('preus.db'):
QMessageBox.warning(self, 'Warning!', 'No has registrat cap preu!')
else:
if self.comboBox.currentText() == 'Referència ascendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'ASC')
elif self.comboBox.currentText() == 'Referència descendent':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'ref', 'DESC')
elif self.comboBox.currentText() == 'Alfabètic':
lines = select_from_database_general('preus', 'data', str(num_client).zfill(4), 'num_client', 'prod', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Aquest client no té cap preu registrat!')
else:
self.table.setRowCount(len(lines))
self.table.setColumnCount(4)
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(4):
if j == 0: #UNITS
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(lines[i][1])) #REF
elif j == 2:
self.table.setItem(i,j, QTableWidgetItem(lines[i][2]))
elif j == 3:#PRICE
sp = QDoubleSpinBox()
sp.setDecimals(3)
sp.setValue(float(lines[i][3]))
sp.setMaximum(float(lines[i][3]))
sp.setMinimum(float(lines[i][3]))
self.table.setCellWidget(i,j, sp)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.Stretch)
self.table.setHorizontalHeaderLabels(['UNITATS', 'REF', 'PRODUCTE', 'PREU'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(4):
self.table.horizontalHeaderItem(i).setFont(font)
def search(self):
control_client, num = self.validar_num_client()
control_factura, num_fact = self.validar_num_factura()
if control_client == True and control_factura == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.show_table(num)
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client o no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def validar_num_factura(self):
os.chdir(carpeta_albaranes)
num_fact = self.numfact.text()
validar = re.match('^[0123456789]+$', num_fact)
if num_fact == '': #Si esta buit bordes grocs
self.numfact.setStyleSheet('border: 1px solid yellow;')
return False, num_fact
elif not validar:#Si no es valid bordes vermells
self.numfact.setStyleSheet('border: 1px solid red;')
return False, num_fact
else:
self.numfact.setStyleSheet('border: 1px solid green;')
return True, num_fact
def validar_client(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def fer_factura(self):
control_client, num_client = self.validar_client()
data = self.calendar.selectedDate().toString("dd/MM/yyyy")
num_fact = self.numfact.text()
dia = str(data[0:2]).zfill(2)
mes_numero = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
name_fact = 'ALBARAN_%s' % num_fact
mes = mesos[int(data[3:5])-1]
año = data[6:]
if not os.path.exists(carpeta_albaranes + '\%s_%s' % (mes, año)):
QMessageBox.warning(self, 'Warning!', 'No has realitzat cap albaran pel mes i any de la data seleccionada!')
else:
os.chdir(carpeta_albaranes + '\%s_%s' % (mes, año))
list_files = os.listdir()
control_factura = False
for file in list_files:
if file[0:12] == name_fact:
control_factura = True
os.remove(file)
break
else:
control_factura = False
if control_factura == False:
QMessageBox.warning(self, 'Warning!', 'Aquest número d\'albaran no existeix!')
elif control_client == True:
ref = []
prod = []
units = []
preu = []
base_imponible = []
lines = self.table.rowCount()
for i in range(lines):
current_units = self.table.cellWidget(i,0).value()
current_ref = self.table.item(i,1).text()
current_prod = self.table.item(i,2).text().strip('\n')
if current_units != 0 :
ref.append(current_ref)
prod.append(current_prod)
units.append(current_units)
#Obtenir el preu a partir de la base de dades
os.chdir(carpeta_data)
lines = select_from_database_preus('preus', num_client, current_ref)
if len(lines) != 0:
current_price = lines[0][3]
preu.append(current_price)
base_imponible.append(round(current_units*current_price, 2))
control = True
else :
control = False
ref_control = current_ref
break
if len(prod)== 0:
QMessageBox.warning(self, 'Warning!', 'No has seleccionat cap producte!', QMessageBox.Discard)
elif np.any(np.array(preu) == 0):
QMessageBox.warning(self, 'Warning!', 'No has indicat el preu d\'algun dels productes seleccionats!', QMessageBox.Discard)
elif control == False:
QMessageBox.warning(self, 'Warning!', 'El preu per a la referència %s i pel número de client %s no està guardat a la base de dades' % (ref_control, num_client))
else:
#Calcular import total
suma = 0
for i in range(len(base_imponible)):
suma = suma + base_imponible[i]
suma = round(suma, 2)
iva = round(0.21 * suma, 2)
total = round(suma + iva, 2)
#Fer factura i pujar al drive
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
dim = len(prod)
factura(carpeta_albaranes, 'ALBARAN', num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, dim, ref, prod, units, preu, base_imponible, suma, iva, total) #Plantilla de la factura per al client seleccionat
#Factura a la base de dades (nom comercial, B.I., I.V.A., total)
os.chdir(carpeta_data)
#Factures emeses
create_database_factures('factures_emeses')
delete_from_database('factures_emeses', 'nom', str(num_fact).zfill(4))
fill_database_factures('factures_emeses', dia, mes_numero, ano, str(num_fact).zfill(4), suma, 21, total)
#Albaranes
delete_from_database_general('CompanyName', 'albaranes', 'num_albaran', str(num_fact).zfill(4))
fill_database_general('CompanyName', 'albaranes(num_client, num_albaran, data, base_imp, iva, total)', '(?,?,?,?,?,?)', [str(num_client).zfill(4), num_fact, '%s-%s-%s' % (ano, mes_numero, dia), suma, iva, total])
upload_to_drive_factura(carpeta_albaranes, 'Albaranes', 'ALBARAN', num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Albaran modificat correctament!')
self.reinit_dialog()
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.numfact.setText('')
self.table.clearContents()
self.numclient.setStyleSheet('')
self.numfact.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Factura_albaranes(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('FacturaAlbaran.ui', self)
current_date = QDate.currentDate()
self.data_factura.setDate(current_date)
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.search)
self.facturar.clicked.connect(self.fer_factura)
def search(self):
control, num = self.validar_num_client()
if control == True:
os.chdir(carpeta_data)
if os.path.exists('clients.db') and os.path.exists('preus.db'):
dades = select_from_database_general('clients', 'data', num, 'num_client', 'num_client', 'ASC')
if len(dades) == 0:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!', QMessageBox.Discard)
return False, 0
else:
self.nomcom.setText(dades[0][1])
self.nomfis.setText(dades[0][2])
self.direccio.setText(dades[0][3])
self.poblacio.setText(dades[0][4])
self.nif.setText(dades[0][5])
self.telf.setText(dades[0][6])
self.formapago.setText(dades[0][7])
return True, num
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client no has registrat cap preu!')
return False, 0
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False, 0
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def fer_factura(self):
control, num_client = self.search()
if control == True:
data_inicial = self.calendar.selectedDate().toString("yyyy-MM-dd")
data_final = self.calendar_2.selectedDate().toString("yyyy-MM-dd")
#eConnect to the database
database = sqlite3.connect('CompanyName.db')
cursor = database.cursor()
#Get the albaranes done between the delected dates
sentencia = "SELECT * FROM albaranes WHERE num_client LIKE '%s' AND data BETWEEN '%s' AND '%s' ORDER BY data ASC" % (num_client, data_inicial, data_final)
cursor.execute(sentencia)
lines = cursor.fetchall()
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'Cap albaran realitzat per aquest client entre aquestes dates!')
else:
array_num_albaran = []
array_data = []
array_bi = []
array_iva = []
array_total = []
for i in range(len(lines)):
array_num_albaran.append(lines[i][1]) #Numero d'albaran
array_data.append(change_date_format(lines[i][2])) #Data
array_bi.append(lines[i][3]) #Base imponible
array_iva.append(lines[i][4]) #IVA
array_total.append(lines[i][5]) #Total
suma_bi = np.sum(array_bi)
suma_iva = np.sum(array_iva)
suma_total = np.sum(array_total)
self.data_inicial.setDate(self.calendar.selectedDate())
self.data_final.setDate(self.calendar_2.selectedDate())
self.num_albaranes.setValue(len(lines))
self.bi.setText(str(suma_bi))
self.iva.setText(str(suma_iva))
self.total.setText(str(suma_total))
NOMCOM = self.nomcom.text()
NOMFIS = self.nomfis.text()
DIR = self.direccio.text()
NIF = self.nif.text()
POBLACIO = self.poblacio.text()
TEL = self.telf.text()
forma_pago = self.formapago.text()
data = self.data_factura.date().toString("dd/MM/yyyy")
dia = str(data[0:2]).zfill(2)
mes = str(data[3:5]).zfill(2)
ano = str(data[6:]).zfill(4)
num_fact = assignar_numero_factura('numero_factura', ano)
factura_de_albaranes(carpeta_factures, 'FACTURA', num_client, NOMCOM, NOMFIS, DIR, NIF, TEL, POBLACIO, num_fact, data, forma_pago, array_num_albaran, array_data, array_bi, array_iva, array_total, suma_bi, suma_iva, suma_total)
os.chdir(carpeta_data)
#Factura a la base de dades (nom comercial, B.I., I.V.A., total)
create_database_factures('factures_emeses')
fill_database_factures('factures_emeses', dia, mes, ano, str(num_fact).zfill(4), suma_bi, 21, suma_total)
#Facturació per client base de dades
create_database_ventes('facturacio_clients', ano)
fill_database_ventes('facturacio_clients', ano, int(num_client), int(data[3:5]), suma_bi, 4)
#Facturació total base de dades
create_database_ventes('facturacio_total', 'data')
fill_database_ventes('facturacio_total', 'data', int(data[6:]), int(data[3:5]), suma_bi, 3)
upload_to_drive_factura(carpeta_factures, 'Factures', 'FACTURA', num_fact, data, NOMCOM, num_client, 'ventes.db', 'facturacio_clients.db', 'facturacio_total.db', 'factures_emeses.db')
QMessageBox.information(self, 'Information', 'Factura realitzada correctament!')
def reinit_dialog(self):
self.numclient.setText('')
self.nomcom.setText('')
self.direccio.setText('')
self.nomfis.setText('')
self.poblacio.setText('')
self.nif.setText('')
self.telf.setText('')
self.formapago.setText('')
self.numclient.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Introduir_factures_rebudes(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('IntroduirFacturesRebudes.ui', self)
self.data.setDate(QDate.currentDate())
self.nom.textChanged.connect(self.validar_nom)
self.introduir.clicked.connect(self.guardar)
self.eliminar.clicked.connect(self.delete)
self.pujar_drive.clicked.connect(self.upload_database)
def validar_nom(self):
nom = self.nom.text()
validar = re.match('^[a-z\sáéíóúàèìòùäëïöüñç0123456789.-]+$', nom, re.I) #Permetre lletres a-z, espais, accents, numeros
if nom == '': #Si esta buit bordes grocs #re.I ignora majuscules i minuscules
self.nom.setStyleSheet('border: 1px solid yellow;')
return False, nom
elif not validar:#Si no es valid bordes vermells
self.nom.setStyleSheet('border: 1px solid red;')
return False, nom
else:
self.nom.setStyleSheet('border: 1px solid green;')
return True, nom
def guardar(self):
control, nom = self.validar_nom()
if control == True:
dia = str(self.data.date().day())
mes = str(self.data.date().month())
ano = str(self.data.date().year())
total = self.importe.value()
IVA = self.iva.value()
if total != 0 and IVA != 0:
base_imponible = round(total/(100+IVA) * 100, 2)
os.chdir(carpeta_data)
create_database_factures('factures_rebudes')
fill_database_factures('factures_rebudes', dia, mes, ano, nom, base_imponible, IVA, total)
if self.pujar_drive_check.isChecked():
upload_to_drive_database('factures_rebudes')
QMessageBox.information(self, 'Information', 'Dades enregistrades correctament')
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Warning!', 'L\' import i l\'I.V.A. no poden ser 0')
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes')
def delete(self):
control, nom = self.validar_nom()
if control == True:
dia = str(self.data.date().day())
mes = str(self.data.date().month())
ano = str(self.data.date().year())
total = self.importe.value()
IVA = self.iva.value()
if total != 0 and IVA != 0:
base_imponible = round(total/(100+IVA) * 100, 2)
os.chdir(carpeta_data)
create_database_factures('factures_rebudes')
delete_database_factures('factures_rebudes', dia, mes, ano, base_imponible, IVA, total)
if self.pujar_drive_check.isChecked():
upload_to_drive_database('factures_rebudes')
QMessageBox.information(self, 'Information', 'Dades enregistrades correctament')
self.reinit_dialog()
else:
QMessageBox.warning(self, 'Warning!', 'L\' import i l\'I.V.A. no poden ser 0')
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes')
def upload_database(self):
upload_to_drive_database('factures_rebudes')
QMessageBox.information(self, 'Information', 'Dades pujades correctament')
def reinit_dialog(self):
self.data.setDate(QDate.currentDate())
self.nom.setText('')
self.iva.setValue(0.)
self.importe.setValue(0.)
self.nom.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.pujar_drive_check.setChecked(True)
else:
event.ignore()
class Factures_rebudes(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('FacturesRebudes.ui', self)
current_date = QDate.currentDate()
day = current_date.day()
self.data_final.setDate(current_date)
self.data_inicial.setDate(current_date.addDays(-day+1))
self.seleccionar.clicked.connect(self.show_table)
def show_table(self):
dia_inicial = int(self.data_inicial.date().day())
mes_inicial = int(self.data_inicial.date().month())
ano_inicial = int(self.data_inicial.date().year())
dia_final = int(self.data_final.date().day())
mes_final = int(self.data_final.date().month())
ano_final = int(self.data_final.date().year())
os.chdir(carpeta_data)
if not os.path.exists('factures_rebudes.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix cap factura rebuda!')
else:
lines = read_database_factures('factures_rebudes', 'ASC')
matches = []
for i in range(len(lines)):
if ano_inicial < ano_final :
if int(lines[i][2]) < ano_final and int(lines[i][2]) > ano_inicial: #Si esta en mig es veuran complets
matches.append(lines[i])
elif int(lines[i][2]) == ano_inicial: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) > mes_inicial :
matches.append(lines[i])
elif int(lines[i][2]) == mes_inicial and int(lines[i][0]) >= dia_inicial: #Comprovar el dia
matches.append(lines[i])
elif int(lines[i][2]) == ano_final: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final: #Comprovar el dia
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial != mes_final:
if int(lines[i][1]) > mes_inicial and int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial == mes_final:
if int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
self.table.setRowCount(len(matches))
self.table.setColumnCount(6)
self.table.setHorizontalHeaderLabels(['DATA', 'ESTABLIMENT', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(6):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
suma_bi = 0
suma_iva = 0
suma_total = 0
#display in the table
for i in range(len(matches)):
llista.append('')
suma_bi += matches[i][4]
suma_total += matches[i][6]
for j in range(6):
if j == 0:
data = str(matches[i][0]).zfill(2) + '/' + str(matches[i][1]).zfill(2) + '/' + str(matches[i][2])
item = QTableWidgetItem(data)
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
elif j == 4:
iva = matches[i][5] / 100
iva_euros = round(iva * matches[i][4], 2)
suma_iva += iva_euros
item = QTableWidgetItem(str(iva_euros))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
elif j == 5:
item = QTableWidgetItem(str(matches[i][6]))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
else:
item = QTableWidgetItem(str(matches[i][j+2]))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
self.table.setVerticalHeaderLabels(llista)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.Stretch)
header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
header.setSectionResizeMode(3, QHeaderView.ResizeToContents)
header.setSectionResizeMode(4, QHeaderView.ResizeToContents)
header.setSectionResizeMode(5, QHeaderView.ResizeToContents)
self.bi_tot.setText(str(round(suma_bi, 2)) + ' \u20ac')
self.iva_tot.setText(str(round(suma_iva, 2)) + ' \u20ac')
self.total_tot.setText(str(round(suma_total, 2)) + ' \u20ac')
self.bi_tot.setStyleSheet('border: 1px solid red;')
self.iva_tot.setStyleSheet('border: 1px solid red;')
self.total_tot.setStyleSheet('border: 1px solid red;')
def reinit_dialog(self):
self.table.clearContents()
self.bi_tot.setText('')
self.iva_tot.setText('')
self.total_tot.setText('')
self.bi_tot.setStyleSheet('')
self.iva_tot.setStyleSheet('')
self.total_tot.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Factures_emeses(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('FacturesRebudes.ui', self)
self.setWindowTitle('Factures emeses')
current_date = QDate.currentDate()
day = current_date.day()
self.data_final.setDate(current_date)
self.data_inicial.setDate(current_date.addDays(-day+1))
self.seleccionar.clicked.connect(self.show_table)
def show_table(self):
dia_inicial = int(self.data_inicial.date().day())
mes_inicial = int(self.data_inicial.date().month())
ano_inicial = int(self.data_inicial.date().year())
dia_final = int(self.data_final.date().day())
mes_final = int(self.data_final.date().month())
ano_final = int(self.data_final.date().year())
os.chdir(carpeta_data)
if not os.path.exists('factures_emeses.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix cap factura emesa')
else:
lines = read_database_factures('factures_emeses', 'ASC')
matches = []
for i in range(len(lines)):
if ano_inicial < ano_final :
if int(lines[i][2]) < ano_final and int(lines[i][2]) > ano_inicial: #Si esta en mig es veuran complets
matches.append(lines[i])
elif int(lines[i][2]) == ano_inicial: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) > mes_inicial :
matches.append(lines[i])
elif int(lines[i][2]) == mes_inicial and int(lines[i][0]) >= dia_inicial: #Comprovar el dia
matches.append(lines[i])
elif int(lines[i][2]) == ano_final: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final: #Comprovar el dia
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial != mes_final:
if int(lines[i][1]) > mes_inicial and int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial == mes_final:
if int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
self.table.setRowCount(len(matches))
self.table.setColumnCount(6)
self.table.setHorizontalHeaderLabels(['DATA', 'NUM FACTURA', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(6):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
suma_bi = 0
suma_iva = 0
suma_total = 0
#display in the table
for i in range(len(matches)):
llista.append('')
suma_bi += matches[i][4]
suma_total += matches[i][6]
for j in range(6):
if j == 0:
data = str(matches[i][0]).zfill(2) + '/' + str(matches[i][1]).zfill(2) + '/' + str(matches[i][2])
item = QTableWidgetItem(data)
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
j = 2
elif j == 4:
iva = matches[i][5] / 100
iva_euros = round(iva * matches[i][4], 2)
suma_iva += iva_euros
item = QTableWidgetItem(str(iva_euros))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
elif j == 5:
item = QTableWidgetItem(str(matches[i][6]))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
else:
item = QTableWidgetItem(str(matches[i][j+2]))
item.setTextAlignment(Qt.AlignHCenter)
self.table.setItem(i,j, item)
self.table.setVerticalHeaderLabels(llista)
header = self.table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.Stretch)
header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
header.setSectionResizeMode(3, QHeaderView.ResizeToContents)
header.setSectionResizeMode(4, QHeaderView.ResizeToContents)
header.setSectionResizeMode(5, QHeaderView.ResizeToContents)
self.bi_tot.setText(str(round(suma_bi, 2)) + ' \u20ac')
self.iva_tot.setText(str(round(suma_iva, 2)) + ' \u20ac')
self.total_tot.setText(str(round(suma_total, 2)) + ' \u20ac')
self.bi_tot.setStyleSheet('border: 1px solid green;')
self.iva_tot.setStyleSheet('border: 1px solid green;')
self.total_tot.setStyleSheet('border: 1px solid green;')
def reinit_dialog(self):
self.table.clearContents()
self.bi_tot.setText('')
self.iva_tot.setText('')
self.total_tot.setText('')
self.bi_tot.setStyleSheet('')
self.iva_tot.setStyleSheet('')
self.total_tot.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Marge(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Marge.ui', self)
current_date = QDate.currentDate()
day = current_date.day()
self.data_final.setDate(current_date)
self.data_inicial.setDate(current_date.addDays(-day+1))
self.dif_bi.textChanged.connect(self.validar_diferencia_bi)
self.dif_iva.textChanged.connect(self.validar_diferencia_iva)
self.dif_tot.textChanged.connect(self.validar_diferencia_tot)
self.beneficis_stock.textChanged.connect(self.validar_beneficis_stock)
self.bi_tot_1.setStyleSheet('border: 1px solid red;')
self.iva_tot_1.setStyleSheet('border: 1px solid red;')
self.total_tot_1.setStyleSheet('border: 1px solid red;')
self.bi_tot_2.setStyleSheet('border: 1px solid green;')
self.iva_tot_2.setStyleSheet('border: 1px solid green;')
self.total_tot_2.setStyleSheet('border: 1px solid green;')
self.stock.setStyleSheet('border: 1px solid green')
self.seleccionar.clicked.connect(self.show_table)
def validar_beneficis_stock(self):
x = self.beneficis_stock.text()
if float(x[0:len(x)-2].replace(',', '.')) < 0: #Si es negatiu son perdues
self.beneficis_stock.setStyleSheet('border: 1px solid red;')
elif float(x[0:len(x)-2].replace(',', '.')) == 0:
self.beneficis_stock.setStyleSheet('border: 1px solid yellow;')
else:
self.beneficis_stock.setStyleSheet('border: 1px solid green;')
def validar_diferencia_bi(self):
x = self.dif_bi.text()
x = float(x[0:len(x)-2].replace(',', '.'))
if x < 0: #Si es negatiu son perdues
self.dif_bi.setStyleSheet('border: 1px solid red;')
elif x == 0:
self.dif_bi.setStyleSheet('border: 1px solid yellow;')
else:
self.dif_bi.setStyleSheet('border: 1px solid green;')
def validar_diferencia_iva(self):
x = self.dif_iva.text()
if float(x[0:len(x)-2].replace(',', '.')) < 0: #Si es negatiu son perdues
self.dif_iva.setStyleSheet('border: 1px solid red;')
elif float(x[0:len(x)-2].replace(',', '.')) == 0:
self.dif_iva.setStyleSheet('border: 1px solid yellow;')
else:
self.dif_iva.setStyleSheet('border: 1px solid green;')
def validar_diferencia_tot(self):
x = self.dif_tot.text()
if float(x[0:len(x)-2].replace(',', '.')) < 0: #Si es negatiu son perdues
self.dif_tot.setStyleSheet('border: 1px solid red;')
elif float(x[0:len(x)-2].replace(',', '.')) == 0:
self.dif_tot.setStyleSheet('border: 1px solid yellow;')
else:
self.dif_tot.setStyleSheet('border: 1px solid green;')
def factures_taula(self, nom, headerlabel_array, table, bi, y, total):
dia_inicial = int(self.data_inicial.date().day())
mes_inicial = int(self.data_inicial.date().month())
ano_inicial = int(self.data_inicial.date().year())
dia_final = int(self.data_final.date().day())
mes_final = int(self.data_final.date().month())
ano_final = int(self.data_final.date().year())
os.chdir(carpeta_data)
lines = read_database_factures('%s' % nom, 'ASC')
matches = []
for i in range(len(lines)):
if ano_inicial < ano_final :
if int(lines[i][2]) < ano_final and int(lines[i][2]) > ano_inicial: #Si esta en mig es veuran complets
matches.append(lines[i])
elif int(lines[i][2]) == ano_inicial: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) > mes_inicial :
matches.append(lines[i])
elif int(lines[i][2]) == mes_inicial and int(lines[i][0]) >= dia_inicial: #Comprovar el dia
matches.append(lines[i])
elif int(lines[i][2]) == ano_final: #Si l'any es el mateix comprovar el mes
if int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final: #Comprovar el dia
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial != mes_final:
if int(lines[i][1]) > mes_inicial and int(lines[i][1]) < mes_final:
matches.append(lines[i])
elif int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial:
matches.append(lines[i])
elif int(lines[i][1]) == mes_final and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
elif ano_inicial == ano_final and mes_inicial == mes_final:
if int(lines[i][1]) == mes_inicial and int(lines[i][0]) >= dia_inicial and int(lines[i][0]) <= dia_final:
matches.append(lines[i])
table.setRowCount(len(matches))
table.setColumnCount(6)
table.setHorizontalHeaderLabels(headerlabel_array)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(6):
table.horizontalHeaderItem(i).setFont(font)
llista = []
suma_bi_reb = 0
suma_iva_reb = 0
suma_total_reb = 0
#display in the table
for i in range(len(matches)):
llista.append('')
suma_bi_reb += matches[i][4]
suma_total_reb += matches[i][6]
for j in range(6):
if j == 0:
data = str(matches[i][0]).zfill(2) + '/' + str(matches[i][1]).zfill(2) + '/' + str(matches[i][2])
item = QTableWidgetItem(data)
item.setTextAlignment(Qt.AlignHCenter)
table.setItem(i,j, item)
j = 2
elif j == 4:
iva = matches[i][5] / 100
iva_euros = round(iva * matches[i][4], 2)
suma_iva_reb += iva_euros
item = QTableWidgetItem(str(iva_euros))
item.setTextAlignment(Qt.AlignHCenter)
table.setItem(i,j, item)
elif j == 5:
item = QTableWidgetItem(str(matches[i][6]))
item.setTextAlignment(Qt.AlignHCenter)
table.setItem(i,j, item)
else:
item = QTableWidgetItem(str(matches[i][j+2]))
item.setTextAlignment(Qt.AlignHCenter)
table.setItem(i,j, item)
table.setVerticalHeaderLabels(llista)
header = table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QHeaderView.ResizeToContents)
header.setSectionResizeMode(3, QHeaderView.ResizeToContents)
header.setSectionResizeMode(4, QHeaderView.ResizeToContents)
header.setSectionResizeMode(5, QHeaderView.ResizeToContents)
bi.setText(str(round(suma_bi_reb, 2)) + ' \u20ac')
y.setText(str(round(suma_iva_reb, 2)) + ' \u20ac')
total.setText(str(round(suma_total_reb, 2)) + ' \u20ac')
return suma_bi_reb, suma_iva_reb, suma_total_reb
def show_table(self):
os.chdir(carpeta_data)
if not os.path.exists('factures_rebudes.db') and not os.path.exists('factures_emeses.db'):
QMessageBox.warning(self, 'Warning!', 'No existeix cap factura emesa o rebuda')
elif os.path.exists('factures_rebudes.db') and not os.path.exists('factures_emeses.db'):
QMessageBox.warning(self, 'Warning!', 'Només existeixen factures rebudes')
self.factures_taula('factures_rebudes', ['DATA', 'ESTABLIMENT', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'], self.table_1, self.bi_tot_1, self.iva_tot_1, self.total_tot_1)
elif os.path.exists('factures_emeses.db') and not os.path.exists('factures_rebudes.db'):
QMessageBox.warning(self, 'Warning!', 'Només existeixen factures emeses')
self.factures_taula('factures_emeses', ['DATA', 'NUM FACTURA', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'], self.table_2, self.bi_tot_2, self.iva_tot_2, self.total_tot_2)
else:
suma_bi_reb, suma_iva_reb, suma_total_reb = self.factures_taula('factures_rebudes', ['DATA', 'ESTABLIMENT', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'], self.table_1, self.bi_tot_1, self.iva_tot_1, self.total_tot_1)
suma_bi_eme, suma_iva_eme, suma_total_eme = self.factures_taula('factures_emeses', ['DATA', 'NUM FACTURA', 'BASE IMPONIBLE', 'IVA %', 'IVA \u20ac', 'TOTAL'], self.table_2, self.bi_tot_2, self.iva_tot_2, self.total_tot_2)
#Calcular diferencies i beneficis
diferencia_bi = suma_bi_eme - suma_bi_reb
diferencia_iva = suma_iva_eme - suma_iva_reb
diferencia_tot = suma_total_eme - suma_total_reb
self.dif_bi.setText(str(round(diferencia_bi, 2)) + ' \u20ac')
self.dif_iva.setText(str(round(diferencia_iva, 2)) + ' \u20ac')
self.dif_tot.setText(str(round(diferencia_tot, 2)) + ' \u20ac')
tableExists = check_table_exists('CompanyName', 'stock')
if os.path.exists('CompanyName.db') and tableExists == True:
lines = read_database('CompanyName', 'stock', 'REF', 'ASC')
total_stock_price = 0
for i in range(len(lines)):
total_stock_price += lines[i][4]
self.stock.setText(str(round(total_stock_price, 2)) + ' \u20ac')
self.beneficis_stock.setText(str(round(diferencia_bi+total_stock_price, 2)) + ' \u20ac')
else:
self.beneficis_stock.setText(str(round(diferencia_bi, 2)) + ' \u20ac')
def reinit_dialog(self):
self.table_1.clearContents()
self.table_2.clearContents()
self.bi_tot_1.setText('0,0' + ' \u20ac')
self.iva_tot_1.setText('0,0' + ' \u20ac')
self.total_tot_1.setText('0,0' + ' \u20ac')
self.bi_tot_2.setText('0,0' + ' \u20ac')
self.iva_tot_2.setText('0,0' + ' \u20ac')
self.total_tot_2.setText('0,0' + ' \u20ac')
self.dif_bi.setText('0,0' + ' \u20ac')
self.dif_iva.setText('0,0' + ' \u20ac')
self.dif_tot.setText('0,0' + ' \u20ac')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
#VENTES
class Facturacio_clients(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Facturacio_clients.ui', self)
self.seleccionar.clicked.connect(self.show_table)
self.numclient.textChanged.connect(self.validar_num_client)
self.result.textChanged.connect(self.change_color_result)
self.total.textChanged.connect(self.change_color_total)
self.percentatge_variacio.textChanged.connect(self.change_color_estadistiques)
self.veure.clicked.connect(self.facturacio_client)
self.veure_total.clicked.connect(self.show_total)
self.estadistica.clicked.connect(self.show_statistics)
def change_color_total(self):
if self.total.text() != '':
self.total.setStyleSheet('border: 1px solid orange;')
def change_color_result(self):
if self.result.text() != '':
self.result.setStyleSheet('border: 1px solid orange;')
def change_color_estadistiques(self):
x = self.percentatge_variacio.text()
if x != '':
if float(x[0:len(x)-1]) < 0:
self.percentatge_variacio.setStyleSheet('border: 1px solid red;')
self.percentatge_fact.setStyleSheet('border: 1px solid red;')
self.posicio.setStyleSheet('border: 1px solid red;')
elif float(x[0:len(x)-1]) > 0:
self.percentatge_variacio.setStyleSheet('border: 1px solid green;')
self.percentatge_fact.setStyleSheet('border: 1px solid green;')
self.posicio.setStyleSheet('border: 1px solid green;')
def show_table(self):
ano = self.any.value()
mess = self.mes.value()
ordre = self.order.currentText()
os.chdir(carpeta_data)
control = check_table_exists('facturacio_clients', str(ano))
if control == True:
if ordre == 'Número client ascendent':
lines = read_database('facturacio_clients', str(ano), 'ref', 'ASC')
elif ordre == 'Número client descendent':
lines = read_database('facturacio_clients', str(ano), 'ref', 'DESC')
elif ordre == 'Facturació mensual ascendent' :
lines = read_database('facturacio_clients', str(ano), mesos_minus[mess-1], 'ASC')
else:
lines = read_database('facturacio_clients', str(ano), mesos_minus[mess-1], 'DESC')
self.table.setRowCount(len(lines))
self.table.setColumnCount(13)
self.table.setHorizontalHeaderLabels(['CLIENT', 'GENER', 'FEBRER', 'MARÇ', 'ABRIL', 'MAIG', 'JUNY', 'JULIOL', 'AGOST', 'SETEMBRE', 'OCTUBRE', 'NOVEMBRE', 'DESEMBRE'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(13):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
for i in range(len(lines)):
llista.append(lines[i][0])
for j in range(13):
fact = float(lines[i][j])
self.table.setItem(i,j, QTableWidgetItem(str(round(fact, 2))))
self.table.setVerticalHeaderLabels(llista)
for i in range(len(lines)):
self.table.verticalHeaderItem(i).setFont(font)
else:
QMessageBox.warning(self, 'Warning!', 'Cap venta realitzada per l\'any seleccionat')
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, num_client
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, num_client
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def facturacio_client(self):
mes = self.mes.value()
ano = self.any.value()
os.chdir(carpeta_data)
control = check_table_exists('facturacio_clients', ano)
if control == True:
control, num_client = self.validar_num_client()
if control == True:
lines = select_from_database_general('facturacio_clients', ano, num_client, 'ref', 'ref', 'ASC')
if len(lines) != 0:
facturacio = round(lines[0][mes], 2)
self.result.setText(str(facturacio) + '\u20ac')
return facturacio
else:
QMessageBox.warning(self, 'Warning', 'Aquest client encara no ha realitzat cap compra!')
return False
else:
QMessageBox.warning(self, 'Warning!', 'Dades incorrectes!', QMessageBox.Discard)
return False
else:
QMessageBox.warning(self, 'Warning!', 'Cap venta realitzada per l\'any seleccionat')
return False
def show_total(self):
os.chdir(carpeta_data)
if os.path.exists('facturacio_total.db'):
mes = self.mes.value()
ano = self.any.value()
lines = select_from_database_general('facturacio_total', 'data', ano, 'ref', 'ref', 'ASC')
fact_total = round(lines[0][mes], 2)
if len(lines) != 0:
self.total.setText(str(fact_total) + '\u20ac')
return fact_total
else:
QMessageBox.warning(self, 'Warning', 'Cap venta realitzada l\'any seleccionat!')
return False
else:
QMessageBox.warning(self, 'Warning!', 'Cap venta realitzada l\'any seleccionat')
return False
def show_statistics(self):
mes = self.mes.value()
ano = self.any.value()
fact_client = self.facturacio_client()
total = self.show_total()
if fact_client == False or total == False:
pass
else:
#Percentatge de facturació del client respecte el total
percent = round((float(fact_client)/float(total))*100, 2)
self.percentatge_fact.setText(str(percent) + '%')
#Variació respecte el mes anterior
num_client = self.numclient.text()
lines = select_from_database_general('facturacio_clients', ano, num_client, 'ref', 'ref', 'ASC')
if mes != 1: #Si es gener no ho podem comparar amb el mes anterior del mateix any
anterior = float(lines[0][mes-1])
variacio = round((float(fact_client) - anterior)/float(fact_client) * 100, 2)
self.percentatge_variacio.setText(str(variacio) + '%')
else:
self.percentatge_variacio.setText('NULL')
#Posició ranking facturació
lines = read_database('facturacio_clients', ano, mesos_minus[mes-1], 'DESC')
position = 0
for i in range(len(lines)):
if lines[i][0] == num_client:
position = i+1
self.posicio.setText(str(position))
def reinit_dialog(self):
self.numclient.setText('')
self.result.setText('')
self.total.setText('')
self.percentatge_fact.setText('')
self.percentatge_variacio.setText('')
self.posicio.setText('')
self.any.setValue(2018)
self.mes.setValue(1)
self.table.clearContents()
self.percentatge_variacio.setStyleSheet('')
self.percentatge_fact.setStyleSheet('')
self.posicio.setStyleSheet('')
self.result.setStyleSheet('')
self.numclient.setStyleSheet('')
self.total.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Ranking_facturacio(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('RankingFacturacio.ui', self)
self.seleccionar.clicked.connect(self.show_table)
def show_table(self):
ano = self.any.value()
mes = self.mes.value()
os.chdir(carpeta_data)
if os.path.exists('facturacio_clients.db'):
tableExists = check_table_exists('facturacio_clients', ano)
if tableExists == True:
lines = read_database('facturacio_clients', ano, mesos_minus[mes-1], 'DESC')
self.table.setRowCount(len(lines))
self.table.setColumnCount(10)
self.table.setHorizontalHeaderLabels(['POSICIÓ', 'FACTURACIÓ', 'CLIENT', 'NOM COMERCIAL', 'NOM FISCAL', 'ADREÇA', 'POBLACIÓ', 'NIF', 'TEL', 'FORMA PAGO'])
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(10):
self.table.horizontalHeaderItem(i).setFont(font)
llista = []
for i in range(len(lines)):
llista.append('')
dades_client = select_from_database_general('clients', 'data', lines[i][0], 'num_client', 'num_client', 'ASC')
for j in range(10):
if j == 0:
self.table.setItem(i,j, QTableWidgetItem(str(i+1)))
elif j == 1:
self.table.setItem(i,j, QTableWidgetItem(str(lines[i][mes])))
else:
self.table.setItem(i,j, QTableWidgetItem(dades_client[0][j-2]))
self.table.setVerticalHeaderLabels(llista)
header = self.table.horizontalHeader()
for i in range(10):
header.setSectionResizeMode(i, QHeaderView.ResizeToContents)
else:
QMessageBox.warning(self, 'Warning', 'Cap venta realitzada l\'any seleccionat!')
else:
QMessageBox.warning(self, 'Warning', 'Cap venta realitzada!')
def reinit_dialog(self):
self.table.clearContents()
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
class Grafics(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Grafics.ui', self)
self.numclient.textChanged.connect(self.validar_num_client)
self.seleccionar.clicked.connect(self.veure_grafic)
def validar_num_client(self):
num_client = self.numclient.text()
validar = re.match('^[0123456789]+$', num_client)
if num_client == '': #Si esta buit bordes grocs
self.numclient.setStyleSheet('border: 1px solid yellow;')
return False, 0
elif not validar:#Si no es valid bordes vermells
self.numclient.setStyleSheet('border: 1px solid red;')
return False, 0
else:
self.numclient.setStyleSheet('border: 1px solid green;')
return True, num_client
def fer_grafic_facturacio_total(self):
os.chdir(carpeta_data)
if os.path.exists('facturacio_total.db'):
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = []
mesos = ['Gen', 'Feb', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ag', 'Set', 'Oct', 'Nov', 'Des']
if self.comboBox.currentText() == 'Tots els anys':
lines = read_database('facturacio_total', 'data', 'ref', 'ASC')
plt.figure()
for i in range(len(lines)):
y.append(lines[i][1:])
#Calcular mitja
mitja = []
for i in range(len(y)):
suma = 0
for j in range(len(y[i])):
suma += y[i][j]
mitja.append(suma/12)
mitja_total = 0
for i in range(len(mitja)):
mitja_total += mitja[i]
mitja_total = mitja_total/len(mitja)
mitja_arr = np.linspace(mitja_total, mitja_total, 12)
for i in range(len(lines)):
plt.plot(x, y[i], '-o', label = lines[i][0])
plt.plot(x, mitja_arr, '--', label = 'Mitjana total= %.2f \u20ac' % mitja_total)
#Customize plot
plt.title('Facturació total')
plt.ylabel('Facturació \u20ac')
plt.xticks(x, mesos)
plt.legend()
#plt.show()
plt.savefig('facturacio_total.png')
if self.refresh.isChecked():
plt.gcf().clear()
else:
year = self.ano.value()
lines = select_from_database_general('facturacio_total', 'data', str(year), 'ref', 'ref', 'ASC')
if len(lines) == 0:
QMessageBox.warning(self, 'Warning!', 'No existeix facturació per l\'any seleccionat')
else:
suma = 0
zeros = 0
for i in range(12):
suma += float(lines[0][i])
if float(lines[0][i]) == 0: zeros += 1
mitja = suma/(12-zeros)
mitja_arr = []
for i in range(12):
mitja_arr.append(mitja)
plt.plot(x, lines[0][1:], '-o', label = lines[0][0])
plt.plot(x, mitja_arr, '--', label='Mitjana %s: %.2f \u20ac' % (year, mitja))
#Customize plot
plt.title('Facturació total')
plt.ylabel('Facturació \u20ac')
plt.xticks(x, mesos)
plt.legend()
#plt.show()
plt.savefig('facturacio_total.png')
if self.refresh.isChecked():
plt.gcf().clear()
else:
QMessageBox.warning(self, 'Warning!', 'No existeix facturació!')
def fer_grafic_facturacio_clients(self):
os.chdir(carpeta_data)
if os.path.exists('facturacio_clients.db'):
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = []
mesos = ['Gen', 'Feb', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ag', 'Set', 'Oct', 'Nov', 'Des']
if self.seleccio_clients.currentText() == 'Tots els clients':
year = self.spinBox_any.value()
lines = read_database('facturacio_clients', str(year), 'ref', 'ASC')
plt.figure(figsize=(8, 6))
for i in range(len(lines)):
y.append(lines[i][1:])
#Calcular mitja
mitja = []
mitja_arr = []
for i in range(len(y)):
suma = 0
for j in range(len(y[i])):
suma += y[i][j]
mitja.append(suma/12)
mitja_total = 0
for i in range(len(mitja)):
mitja_total += mitja[i]
for i in range(len(x)):
mitja_arr.append(mitja_total/len(mitja))
for i in range(len(lines)):
plt.plot(x, y[i], '-o', label = lines[i][0])
plt.plot(x, mitja_arr, '--', label = 'Mitjana total')
#Customize plot
plt.title('Facturació total')
plt.ylabel('Facturació \u20ac')
plt.xticks(x, mesos)
plt.legend(loc='upper left')
plt.savefig('facturacio_clients.png')
if self.refresh.isChecked():
plt.gcf().clear()
else:
year = self.spinBox_any.value()
control, num_client = self.validar_num_client()
control_2 = False
if control == True:
if check_table_exists('clients', 'data'):
lines = select_from_database_general('clients', 'data', str(num_client).zfill(4), 'num_client', 'num_client', 'ASC')
if len(lines) != 0:
control_2 = True
else:
QMessageBox.warning(self, 'Warning!', 'Client no registrat!')
control_2 = False
else:
QMessageBox.warning(self, 'Warning!', 'Encara no has registrat cap client!')
else:
QMessageBox.warning(self, 'Warning!', 'Número de client no vàlid!')
if control_2 == True:
lines = select_from_database_general('facturacio_clients', str(year), str(num_client).zfill(4), 'ref', 'ref', 'ASC')
if len(lines) != 0:
suma = 0
for i in range(len(x)):
suma += float(lines[0][i])
mitja = suma/12
mitja_arr = []
for i in range(len(x)):
mitja_arr.append(mitja)
plt.plot(x, lines[0][1:], '-o', label = lines[0][0])
plt.plot(x, mitja_arr, '--', label='Mitjana %s' % num_client)
#Customize plot
plt.title('Facturació total')
plt.ylabel('Facturació \u20ac')
plt.xticks(x, mesos)
plt.legend()
plt.savefig('facturacio_clients.png')
if self.refresh.isChecked():
plt.gcf().clear()
else:
QMessageBox.warning(self, 'Warning!', 'Aquest client no ha facturat res!')
else:
QMessageBox.warning(self, 'Warning!', 'No existeix facturació!')
def veure_grafic(self):
os.chdir(carpeta_data)
self.reinit_dialog()
if self.checkBox.isChecked() and self.check_clients.isChecked():
QMessageBox.warning(self, 'Warning!', 'Només pots seleccionar un dels dos gràfics!')
elif self.checkBox.isChecked():
self.fer_grafic_facturacio_total()
filename = 'facturacio_total.png'
image = QImage(filename)
self.imageLabel.setPixmap(QPixmap.fromImage(image))
elif self.check_clients.isChecked():
self.fer_grafic_facturacio_clients()
filename = 'facturacio_clients.png'
image = QImage(filename)
self.imageLabel.setPixmap(QPixmap.fromImage(image))
else:
QMessageBox.warning(self, 'Warning!', 'Has de marcar alguna de les dues opcions!')
def reinit_dialog(self):
os.chdir(carpeta_data)
if os.path.exists('facturacio_total.png') and os.path.exists('facturacio_clients.png'):
os.remove('facturacio_total.png')
os.remove('facturacio_clients.png')
elif os.path.exists('facturacio_total.png'):
os.remove('facturacio_total.png')
elif os.path.exists('facturacio_clients.png'):
os.remove('facturacio_clients.png')
self.imageLabel.clear()
if self.refresh.isChecked():
plt.gcf().clear()
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
self.numclient.setText('')
self.numclient.setStyleSheet('')
else:
event.ignore()
class Registre_ventes(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('RegistreVentes.ui', self)
self.okbutton.clicked.connect(self.show_table)
self.facturacio.textChanged.connect(self.canviar_color_fact)
self.unitats.textChanged.connect(self.canviar_color_units)
def canviar_color_fact(self):
self.facturacio.setStyleSheet('border: 1px solid green;')
def canviar_color_units(self):
self.unitats.setStyleSheet('border: 1px solid green;')
def show_table(self):
month = self.mes.value()
ano = self.any.value()
os.chdir(carpeta_data)
mes = mesos[int(month)-1]
os.chdir(carpeta_data)
control = check_table_exists('ventes', ano)
control_2 = check_table_exists('facturacio_ref', ano)
if control == False or control_2 == False:
QMessageBox.warning(self, 'Warning!', 'No hi ha ventes realitzades aquest any!', QMessageBox.Discard)
else:
if self.comboBox_unitats.currentText() == 'Unitats ascendent':
sales = read_database('ventes', str(ano), mesos_minus[month-1], 'ASC')
elif self.comboBox_unitats.currentText() == 'Unitats descendent':
sales = read_database('ventes', str(ano), mesos_minus[month-1], 'DESC')
if self.comboBox_facturacio.currentText() == 'Facturació ascendent':
lines = read_database('facturacio_ref', str(ano), mesos_minus[month-1], 'ASC')
elif self.comboBox_facturacio.currentText() == 'Facturació descendent':
lines = read_database('facturacio_ref', str(ano), mesos_minus[month-1], 'DESC')
unitats_totals = 0
facturacio_total = 0
for i in range(len(sales)):
unitats_totals += sales[i][month]
for i in range(len(lines)):
facturacio_total += lines[i][month]
if len(sales) != 0 and len(lines) != 0:
#Display the table
self.table.setRowCount(len(sales))
self.table.setColumnCount(13)
self.table.setHorizontalHeaderLabels(['REF', 'GENER', 'FEBRER', 'MARÇ', 'ABRIL', 'MAIG', 'JUNY', 'JULIOL', 'AGOST', 'SETEMBRE', 'OCTUBRE', 'NOVEMBRE', 'DESEMBRE'])
llista = []
for i in range(len(sales)):
llista.append(sales[i][0])
for j in range(13):
self.table.setItem(i,j, QTableWidgetItem(str(sales[i][j])))
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
for i in range(13):
self.table.horizontalHeaderItem(i).setFont(font)
for i in range(len(sales)):
self.table.verticalHeaderItem(i).setFont(font)
#Display the table 2
self.table_2.setRowCount(len(lines))
self.table_2.setColumnCount(13)
self.table_2.setHorizontalHeaderLabels(['REF', 'GENER', 'FEBRER', 'MARÇ', 'ABRIL', 'MAIG', 'JUNY', 'JULIOL', 'AGOST', 'SETEMBRE', 'OCTUBRE', 'NOVEMBRE', 'DESEMBRE'])
llista = []
for i in range(len(lines)):
llista.append(lines[i][0])
for j in range(13):
self.table_2.setItem(i,j, QTableWidgetItem(str(lines[i][j])))
self.table_2.setVerticalHeaderLabels(llista)
for i in range(13):
self.table_2.horizontalHeaderItem(i).setFont(font)
for i in range(len(lines)):
self.table_2.verticalHeaderItem(i).setFont(font)
#Display facturacio total and unitats totals
self.facturacio.setText(str(facturacio_total) + ' \u20ac')
self.unitats.setText(str(unitats_totals) + ' u.')
else:
QMessageBox.warning(self, 'Warning!', 'No hi ha ventes realitzades aquest mes!', QMessageBox.Discard)
def reinit_dialog(self):
self.table.clearContents()
self.table_2.clearContents()
self.facturacio.setText('')
self.unitats.setText('')
self.facturacio.setStyleSheet('')
self.unitats.setStyleSheet('')
def closeEvent(self, event):
result = QMessageBox.question(self, 'Sortint...','Segur que vols sortir?', QMessageBox.Yes | QMessageBox.No)
if result == QMessageBox.Yes:
event.accept()
self.reinit_dialog()
else:
event.ignore()
#STOCK
class Stock(QDialog):
def __init__(self):
QDialog.__init__(self)
os.chdir(carpeta_data)
uic.loadUi('Stock.ui', self)
self.show_table()
self.guardar.clicked.connect(self.save_stock)
self.visualitzar.clicked.connect(self.show_table)
def show_table(self):
if os.path.exists('cataleg.db'):
if self.order.currentText() == 'Referència ascendent':
lines = read_database('cataleg', 'data', 'ref', 'ASC') #[ref, prod, preu]
elif self.order.currentText() == 'Referència descendent':
lines = read_database('cataleg', 'data', 'ref', 'DESC')
elif self.order.currentText() == 'Alfabètic ascendent':
lines = read_database('cataleg', 'data', 'prod', 'ASC')
elif self.order.currentText() == 'Alfabètic descendent':
lines = read_database('cataleg', 'data', 'prod', 'DESC')
#Comprovar si hi ha o no stock existent
tablas = [
"""
CREATE TABLE IF NOT EXISTS stock(
REF TEXT NOT NULL,
NAME TEXT NOT NULL,
QUANTITY REAL NOT NULL,
UNIT_PRICE REAL NOT NULL,
TOTAL_PRICE REAL NOT NULL
);
"""
]
create_database('CompanyName', tablas)
stock_lines = read_database('CompanyName', 'stock', 'REF', 'ASC')
self.table.setRowCount(len(lines))
self.table.setColumnCount(5)
if len(stock_lines) == 0: #No previous stock
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(5):
if j == 0: #REF
self.table.setItem(i,j, QTableWidgetItem(lines[i][0]))
elif j == 1: #NAME
self.table.setItem(i,j, QTableWidgetItem(lines[i][1]))
elif j == 2: #QUANTITY
sp = QSpinBox()
sp.setMaximum(9999)
self.table.setCellWidget(i,j, sp)
elif j == 3: #UNIT PRICE
self.table.setItem(i,j, QTableWidgetItem(str(lines[i][2])))
elif j == 4: #TOTAL PRICE
total_price = lines[i][2] * self.table.cellWidget(i,2).value()
self.table.setItem(i,j, QTableWidgetItem(str(total_price)))
else:
llista = []
for i in range(len(lines)):
llista.append('')
for j in range(5):
if j == 0: #REF
self.table.setItem(i,j, QTableWidgetItem(lines[i][0]))
elif j == 1: #NAME
self.table.setItem(i,j, QTableWidgetItem(lines[i][1]))
elif j == 2: #QUANTITY
item = select_from_database_general('CompanyName', 'stock', lines[i][0], 'REF', 'REF', 'ASC')
if len(item) != 0:
quantity = item[0][2]
else:
quantity = 0
sp = QSpinBox()
sp.setMaximum(9999)
sp.setValue(quantity)
self.table.setCellWidget(i,j, sp)
elif j == 3: #UNIT PRICE
self.table.setItem(i,j, QTableWidgetItem(str(lines[i][2])))
elif j == 4: #TOTAL PRICE
total_price = lines[i][2] * self.table.cellWidget(i,2).value()
self.table.setItem(i,j, QTableWidgetItem(str(total_price)))
self.table.setHorizontalHeaderLabels(['REF', 'PRODUCTE', 'QUANTITAT', 'PREU UNITAT', 'PREU TOTAL'])
self.table.setVerticalHeaderLabels(llista)
font = QFont()
font.setFamily('Segoe UI Black')
font.setPointSize(9)
header = self.table.horizontalHeader()
for i in range(5):
self.table.horizontalHeaderItem(i).setFont(font)
header.setSectionResizeMode(i, QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QHeaderView.Stretch)
#Stock total value
tableExists = check_table_exists('CompanyName', 'stock')
lines = read_database('CompanyName', 'stock', 'REF', 'ASC')
total_stock_price = 0
for i in range(len(lines)):
total_stock_price += lines[i][4]
self.stock.setText(str(round(total_stock_price, 2)) + ' \u20ac')
else:
QMessageBox.warning(self, 'Warning!', 'No existeix catàleg!')
def save_stock(self):
lines = self.table.rowCount()
for i in range(lines):
current_quantity = self.table.cellWidget(i,2).value()
if current_quantity != 0:
current_ref = self.table.item(i,0).text()
current_name = self.table.item(i,1).text()
current_unit_price = float(self.table.item(i,3).text())
current_total_price = float(self.table.item(i,4).text())
fill_table_stock('CompanyName', [current_ref, current_name, current_quantity, current_unit_price, current_total_price])
QMessageBox.information(self, 'Information', 'Dades guardades correctament!')
| 31.573237
| 238
| 0.659391
| 22,539
| 169,643
| 4.827765
| 0.033986
| 0.021257
| 0.027699
| 0.033994
| 0.880226
| 0.853915
| 0.829028
| 0.795934
| 0.767923
| 0.747071
| 0
| 0.016823
| 0.197963
| 169,643
| 5,373
| 239
| 31.573237
| 0.782919
| 0.050889
| 0
| 0.784569
| 0
| 0.004618
| 0.144264
| 0.006339
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05542
| false
| 0.000543
| 0.006248
| 0.000272
| 0.114643
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
bdddc5c2db1f67404d5f427a90c97ff420234f3a
| 1,079
|
py
|
Python
|
tests/py/syntax_def/test_syntax.py
|
bcrotty/PowerShell
|
4f0c64060a91425a4cc1007e95ea2d9848c1b88a
|
[
"MIT"
] | null | null | null |
tests/py/syntax_def/test_syntax.py
|
bcrotty/PowerShell
|
4f0c64060a91425a4cc1007e95ea2d9848c1b88a
|
[
"MIT"
] | null | null | null |
tests/py/syntax_def/test_syntax.py
|
bcrotty/PowerShell
|
4f0c64060a91425a4cc1007e95ea2d9848c1b88a
|
[
"MIT"
] | null | null | null |
from PowerShell.tests.py import PowerShellSyntaxTest
class Test_DoubleQuoted_HereDocStrings(PowerShellSyntaxTest):
def testIsScopeCorrectIfDelimiterAtBOL(self):
self.append("""@"
hello
"@
""")
sname = self.getFinestScopeNameAtRowCol(1, 1)
self.assertEqual(sname, 'string.quoted.double.heredoc.powershell')
def testIsScopeCorrectIfDelimiterNotAtBOL(self):
self.append("""$foo = @"
hello
"@
""")
sname = self.getFinestScopeNameAtRowCol(1, 1)
self.assertEqual(sname, 'string.quoted.double.heredoc.powershell')
class Test_SingleQuoted_HereDocStrings(PowerShellSyntaxTest):
def testIsScopeCorrectIfDelimiterAtBOL(self):
self.append("""@'
hello
'@
""")
sname = self.getFinestScopeNameAtRowCol(1, 1)
self.assertEqual(sname, 'string.quoted.single.heredoc.powershell')
def testIsScopeCorrectIfDelimiterNotAtBOL(self):
self.append("""$foo = @'
hello
'@
""")
sname = self.getFinestScopeNameAtRowCol(1, 1)
self.assertEqual(sname, 'string.quoted.single.heredoc.powershell')
| 28.394737
| 74
| 0.70899
| 94
| 1,079
| 8.095745
| 0.287234
| 0.04205
| 0.073587
| 0.21025
| 0.883049
| 0.883049
| 0.883049
| 0.883049
| 0.883049
| 0.883049
| 0
| 0.008879
| 0.164968
| 1,079
| 37
| 75
| 29.162162
| 0.835738
| 0
| 0
| 0.774194
| 0
| 0
| 0.202039
| 0.144578
| 0
| 0
| 0
| 0
| 0.129032
| 1
| 0.129032
| false
| 0
| 0.032258
| 0
| 0.225806
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
bdf95c9fe1375a40a72b2f7495c62e1968dd4d57
| 5,706
|
py
|
Python
|
eval/generate_config.py
|
MaggieQi/concord-bft
|
8db0cfbec988e691ce592901124bee6617d64be4
|
[
"Apache-2.0"
] | null | null | null |
eval/generate_config.py
|
MaggieQi/concord-bft
|
8db0cfbec988e691ce592901124bee6617d64be4
|
[
"Apache-2.0"
] | null | null | null |
eval/generate_config.py
|
MaggieQi/concord-bft
|
8db0cfbec988e691ce592901124bee6617d64be4
|
[
"Apache-2.0"
] | 1
|
2021-05-18T02:12:33.000Z
|
2021-05-18T02:12:33.000Z
|
import sys
from optparse import OptionParser
import json
parser = OptionParser(usage="Usage: generate_config.py <options> num_replica_servers num_replica_threads num_client_servers num_client_threads")
parser.add_option("-d", "--commit_duration", default=50, type="int", help="Pompe consensus commit duration.")
parser.add_option("-i", "--number_operations", default=2800, type="int", help="Number of operations each client sends.")
parser.add_option("-r", "--replica_batchsize", default=1, type="int", help="Server max batch size.")
parser.add_option("-c", "--client_batchsize", default=1, type="int", help="Client max batch size.")
parser.add_option("-f", "--fresh_install", default=False, action='store_true', help="Reinstall dependencies and concord-bft code.")
parser.add_option("-a", "--protocol", default="pompe", type="string", help="run protocol concord or pompe.")
parser.add_option('-p', "--file_prefix", default="test", type="string", help="configure file path prefix.")
parser.add_option('-e', "--env", default="geo", type="string", help="local or geo.")
parser.add_option("-t", "--threads", default=8, type="int", help="Working threads in the replica.")
local_server_list = "10.0.2.7,10.0.2.8,10.0.2.9,10.0.2.10,10.0.2.11,10.0.2.12,10.0.2.13,10.0.2.14,10.0.2.15,10.0.2.16,10.0.2.17,10.0.2.18,10.0.2.19,10.0.2.20,10.0.2.21,10.0.2.22,10.0.2.23,10.0.2.24,10.0.2.25,10.0.2.26,10.0.2.27,10.0.2.28,10.0.2.29,10.0.2.30,10.0.2.31,10.0.2.32,10.0.2.33,10.0.2.34,10.0.2.35,10.0.2.36,10.0.2.37"
local_client_list = "10.0.2.37,10.0.2.36,10.0.2.35,10.0.2.34,10.0.2.33,10.0.2.32,10.0.2.31,10.0.2.30,10.0.2.29,10.0.2.28,10.0.2.27,10.0.2.26,10.0.2.25,10.0.2.24,10.0.2.23,10.0.2.22,10.0.2.21,10.0.2.20,10.0.2.19,10.0.2.18,10.0.2.17,10.0.2.16,10.0.2.15,10.0.2.14,10.0.2.13,10.0.2.12,10.0.2.11"
geo_server_list = "10.0.2.7,10.0.3.6,10.0.4.6,10.0.2.8,10.0.3.7,10.0.4.7,10.0.2.9,10.0.3.8,10.0.4.8,10.0.2.10,10.0.3.9,10.0.4.9,10.0.2.11,10.0.3.10,10.0.4.10,10.0.2.12,10.0.3.11,10.0.4.11,10.0.2.13,10.0.3.12,10.0.4.12,10.0.2.14,10.0.3.13,10.0.4.13,10.0.2.15,10.0.3.14,10.0.4.14,10.0.2.16,10.0.3.15,10.0.4.15,10.0.2.17,10.0.3.16,10.0.4.16,10.0.2.18,10.0.3.17,10.0.4.17,10.0.2.19,10.0.3.18,10.0.4.18,10.0.2.20,10.0.3.19,10.0.4.19,10.0.2.21,10.0.3.20,10.0.4.20,10.0.2.22,10.0.3.21,10.0.4.21,10.0.2.23,10.0.3.22,10.0.4.22,10.0.2.24,10.0.3.23,10.0.4.23,10.0.2.25,10.0.3.24,10.0.4.24,10.0.2.26,10.0.3.25,10.0.4.25,10.0.2.27,10.0.3.26,10.0.4.26,10.0.2.28,10.0.3.27,10.0.4.27,10.0.2.29,10.0.3.28,10.0.4.28,10.0.2.30,10.0.3.29,10.0.4.29,10.0.2.31,10.0.3.30,10.0.4.30,10.0.2.32,10.0.3.31,10.0.4.31,10.0.2.33,10.0.3.32,10.0.4.32,10.0.2.34,10.0.3.33,10.0.4.33,10.0.2.35,10.0.3.34,10.0.4.34,10.0.2.36,10.0.3.35,10.0.4.35,10.0.2.37,10.0.3.36,10.0.4.36,10.0.2.38,10.0.3.37,10.0.4.37,10.0.2.39,10.0.3.38,10.0.4.38,10.0.2.6"
geo_client_list = "10.0.2.7,10.0.3.6,10.0.4.6,10.0.2.8,10.0.3.7,10.0.4.7,10.0.2.9,10.0.3.8,10.0.4.8,10.0.2.10,10.0.3.9,10.0.4.9,10.0.2.11,10.0.3.10,10.0.4.10,10.0.2.12,10.0.3.12,10.0.4.11,10.0.2.13,10.0.3.12,10.0.4.12,10.0.2.14,10.0.3.13,10.0.4.13,10.0.2.15,10.0.3.14,10.0.4.14,10.0.2.16,10.0.3.15,10.0.4.15,10.0.2.17,10.0.3.16,10.0.4.16,10.0.2.18,10.0.3.17,10.0.4.17,10.0.2.19,10.0.3.18,10.0.4.18,10.0.2.20,10.0.3.19,10.0.4.19,10.0.2.21,10.0.3.20,10.0.4.20,10.0.2.22,10.0.3.21,10.0.4.21,10.0.2.23,10.0.3.22,10.0.4.22,10.0.2.24,10.0.3.23,10.0.4.23,10.0.2.25,10.0.3.24,10.0.4.24,10.0.2.26,10.0.3.25,10.0.4.25,10.0.2.27,10.0.3.26,10.0.4.26,10.0.2.28,10.0.3.27,10.0.4.27,10.0.2.29,10.0.3.28,10.0.4.28,10.0.2.30,10.0.3.29,10.0.4.29,10.0.2.31,10.0.3.30,10.0.4.30,10.0.2.32,10.0.3.31,10.0.4.31,10.0.2.33,10.0.3.32,10.0.4.32,10.0.2.34,10.0.3.33,10.0.4.33,10.0.2.35,10.0.3.34,10.0.4.34,10.0.2.36,10.0.3.35,10.0.4.35,10.0.2.37,10.0.3.36,10.0.4.36,10.0.2.38,10.0.3.37,10.0.4.37,10.0.2.39,10.0.3.38,10.0.4.38"
def generate_machinelist(l):
mlist = ''
rlist = ''
for i, m in enumerate(l.split(",")):
mlist += ' \"%d\": \"%s\",\n' % (i, m)
rlist += ' \"%d\": 1,\n' % i
return mlist[0:-2], rlist[0:-2]
def generate_config(num_replica_servers, num_replica_threads, num_client_servers, num_client_threads, options):
global local_server_list, local_client_list, geo_server_list, geo_client_list
server_machines, server_resources = generate_machinelist(geo_server_list if options.env == "geo" else local_server_list)
client_machines, client_resources = generate_machinelist(geo_client_list if options.env == "geo" else local_client_list)
content = '''{
"num_servers": %s,
"servers": {
%s
},
"server_resources": {
%s
},
"num_replicas": %s,
"num_clients": %s,
"clients": {
%s
},
"client_resources": {
%s
},
"num_client_threads": %s,
"do_fresh_install": %s,
"system" : "%s",
"exp_name": "arch_throughput",
"network": "tcp",
"commit_duration": %d,
"number_operations": %d,
"replica_batchsize": %d,
"client_batchsize": %d,
"env": "%s",
"threads": %d
}
''' % (num_replica_servers, server_machines, server_resources, num_replica_threads, num_client_servers, client_machines, client_resources, num_client_threads, json.dumps(options.fresh_install), options.protocol, options.commit_duration, options.number_operations, options.replica_batchsize, options.client_batchsize, options.env, options.threads)
f = open("%s_servers_%s_clients_%s_%s.json" % (options.file_prefix, num_replica_threads, num_client_threads, options.protocol), 'w')
f.write(content)
f.close()
if __name__ == '__main__':
if len(sys.argv) < 5:
parser.print_help()
exit(1)
(options, args) = parser.parse_args()
generate_config(args[0], args[1], args[2], args[3], options)
| 76.08
| 1,007
| 0.648265
| 1,450
| 5,706
| 2.469655
| 0.107586
| 0.215303
| 0.139626
| 0.02234
| 0.531137
| 0.519408
| 0.472494
| 0.370288
| 0.363586
| 0.363586
| 0
| 0.292906
| 0.080967
| 5,706
| 74
| 1,008
| 77.108108
| 0.389969
| 0
| 0
| 0.060606
| 1
| 0.060606
| 0.646337
| 0.454434
| 0
| 0
| 0
| 0
| 0
| 1
| 0.030303
| false
| 0
| 0.045455
| 0
| 0.090909
| 0.015152
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
da236afc17afda2f1d7125156edba087b5c5424f
| 3,550
|
py
|
Python
|
envi/tests/msp430/icmp.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 716
|
2015-01-01T14:41:11.000Z
|
2022-03-28T06:51:50.000Z
|
envi/tests/msp430/icmp.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 266
|
2015-01-01T15:07:27.000Z
|
2022-03-30T15:19:26.000Z
|
envi/tests/msp430/icmp.py
|
rnui2k/vivisect
|
b7b00f2d03defef28b4b8c912e3a8016e956c5f7
|
[
"ECL-2.0",
"Apache-2.0"
] | 159
|
2015-01-01T16:19:44.000Z
|
2022-03-21T21:55:34.000Z
|
from envi.archs.msp430.regs import *
checks = [
# CMP
(
'CMP r14, r15 (src == dst)',
{ 'regs': [(REG_R14, 0xaaaa), (REG_R15, 0xaaaa)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0xaaaa), (REG_R15, 0xaaaa)], 'flags': [(SR_N, 0), (SR_Z, 1), (SR_C, 1), (SR_V, 0)], 'code': "0f9e", 'data': "" }
),
(
'CMP r14, r15 (src < dst)',
{ 'regs': [(REG_R14, 0x3333), (REG_R15, 0x4444)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x3333), (REG_R15, 0x4444)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 1), (SR_V, 0)], 'code': "0f9e", 'data': "" },
),
(
'CMP r14, r15 (src < dst) result overflow',
{ 'regs': [(REG_R14, 0x1), (REG_R15, 0x8000)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x1), (REG_R15, 0x8000)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 1), (SR_V, 1)], 'code': "0f9e", 'data': "" }
),
(
'CMP r14, r15 (src > dst) result carry',
{ 'regs': [(REG_R14, 0xffff), (REG_R15, 0x3333)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0xffff), (REG_R15, 0x3333)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" }
),
(
'CMP r14, r15 (src > dst) result negative + carry + overflow',
{ 'regs': [(REG_R14, 0xffff), (REG_R15, 0x7fff)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0xffff), (REG_R15, 0x7fff)], 'flags': [(SR_N, 1), (SR_Z, 0), (SR_C, 0), (SR_V, 1)], 'code': "0f9e", 'data': "" }
),
# CMP.b
(
'CMP.b r14, r15 (src == dst)',
{ 'regs': [(REG_R14, 0x11aa), (REG_R15, 0x12aa)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x11aa), (REG_R15, 0x12aa)], 'flags': [(SR_N, 0), (SR_Z, 1), (SR_C, 1), (SR_V, 0)], 'code': "4f9e", 'data': "" }
),
(
'CMP.b r14, r15 (src < dst)',
{ 'regs': [(REG_R14, 0x1133), (REG_R15, 0x0044)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x1133), (REG_R15, 0x0044)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 1), (SR_V, 0)], 'code': "4f9e", 'data': "" },
),
(
'CMP.b r14, r15 (src < dst) result overflow',
{ 'regs': [(REG_R14, 0x1101), (REG_R15, 0x0080)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x1101), (REG_R15, 0x0080)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 1), (SR_V, 1)], 'code': "4f9e", 'data': "" }
),
(
'CMP.b r14, r15 (src > dst) result carry',
{ 'regs': [(REG_R14, 0x00ff), (REG_R15, 0x1133)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x00ff), (REG_R15, 0x1133)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" }
),
(
'CMP.b r14, r15 (src > dst) result negative + carry + overflow',
{ 'regs': [(REG_R14, 0x00ff), (REG_R15, 0x117f)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "4f9e", 'data': "" },
{ 'regs': [(REG_R14, 0x00ff), (REG_R15, 0x117f)], 'flags': [(SR_N, 1), (SR_Z, 0), (SR_C, 0), (SR_V, 1)], 'code': "4f9e", 'data': "" }
),
]
| 61.206897
| 142
| 0.460563
| 541
| 3,550
| 2.80037
| 0.083179
| 0.09901
| 0.132013
| 0.106931
| 0.974257
| 0.974257
| 0.968977
| 0.961716
| 0.951815
| 0.904951
| 0
| 0.140694
| 0.237183
| 3,550
| 57
| 143
| 62.280702
| 0.418759
| 0.002535
| 0
| 0.188679
| 0
| 0
| 0.226116
| 0
| 0
| 0
| 0.066139
| 0
| 0
| 1
| 0
| false
| 0
| 0.018868
| 0
| 0.018868
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
da36abbe911f290ae0398962d2a3359f8398661a
| 23,533
|
py
|
Python
|
back_end/tests/post_routes/test_api_create_region_from_embedding.py
|
gerlichlab/HiCognition
|
dff022025b7c83732b9510ff5ca8232d30aa5304
|
[
"MIT"
] | null | null | null |
back_end/tests/post_routes/test_api_create_region_from_embedding.py
|
gerlichlab/HiCognition
|
dff022025b7c83732b9510ff5ca8232d30aa5304
|
[
"MIT"
] | 5
|
2022-03-31T11:54:12.000Z
|
2022-03-31T12:04:29.000Z
|
back_end/tests/post_routes/test_api_create_region_from_embedding.py
|
gerlichlab/HiCognition
|
dff022025b7c83732b9510ff5ca8232d30aa5304
|
[
"MIT"
] | null | null | null |
"""Module with tests realted to creating new regions from local neighborhoods in embeddings."""
import os
import unittest
from unittest.mock import patch
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal
from hicognition.test_helpers import LoginTestCase, TempDirTestCase
# add path to import app
# import sys
# sys.path.append("./")
from app import db
from app.models import Collection, Dataset, Intervals, EmbeddingIntervalData
class TestCreateRegionFrom2DEmbedding(LoginTestCase, TempDirTestCase):
"""Tests creating a new region from a cluster_id associated with
an embeddingIntervalData entry"""
def setUp(self):
super().setUp()
# add owned collection
self.owned_feature_dataset = Dataset(id=1, user_id=1, filetype="cooler")
# add unowned collection
self.unowned_feature_dataset = Dataset(id=2, user_id=2, filetype="cooler")
# add owned bedfile
self.dummy_regions = pd.DataFrame(
{
"chrom": ["chr1"] * 6,
"start": [0, 100, 200, 300, 400, 500],
"end": [100, 200, 300, 400, 500, 600],
}
)
self.dummy_regions.to_csv(
os.path.join(TempDirTestCase.TEMP_PATH, "region.csv"),
sep="\t",
header=None,
index=False,
)
self.owned_bedfile = Dataset(
id=3,
filetype="bedfile",
user_id=1,
file_path=os.path.join(TempDirTestCase.TEMP_PATH, "region.csv"),
assembly=1,
cellCycleStage="G2",
perturbation="none",
valueType="Peak",
method="ChipSeq",
sizeType="Point",
protein="CTCF",
directionality="+",
)
# add unowned bedfile
self.unowned_bedfile = Dataset(id=4, filetype="bedfile", user_id=2)
# add intervals for owned bedfile
self.owned_intervals = Intervals(
id=1, dataset_id=self.owned_bedfile.id, windowsize=200000
)
# add intervals for unowned bedfile
self.unowned_intervals = Intervals(
id=2, dataset_id=self.unowned_bedfile.id, windowsize=200000
)
# add embeddingIntervalData with unowned dataset
self.embedding_data_dataset_unowned = EmbeddingIntervalData(
id=1,
binsize=10000,
dataset_id=self.unowned_feature_dataset.id,
intervals_id=self.owned_intervals.id,
)
# add embeddingIntervalData with unowned intervals
self.embedding_data_intervals_unowned = EmbeddingIntervalData(
id=2,
binsize=10000,
dataset_id=self.owned_feature_dataset.id,
intervals_id=self.unowned_intervals.id,
)
# add owned embeddingIntervalData without thumbnails/feature_id and cluster_did
self.embedding_data_intervals_wo_thumbnail_data = EmbeddingIntervalData(
id=4,
binsize=10000,
dataset_id=self.owned_feature_dataset.id,
intervals_id=self.owned_intervals.id,
)
# add embeddingIntervalData with owned intervals and collection and associated data
self.test_data = np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])
data_path = os.path.join(TempDirTestCase.TEMP_PATH, "test.npy")
np.save(data_path, self.test_data)
# create thumbnails
thumbnails = [
np.array([[5, 6], [7, 7]]),
np.array([[1, 2], [3, 4]]),
np.array([[1.5, 10], [7.0, 3.4]]),
]
self.thumbnail_data = np.stack(thumbnails)
thumbnail_path = os.path.join(TempDirTestCase.TEMP_PATH, "test_thumbnails.npy")
np.save(thumbnail_path, self.thumbnail_data)
# create clusters
self.cluster_data = np.array([1.0, 2.0, 3.0, 1.0, 1.0, 2.0])
cluster_path = os.path.join(TempDirTestCase.TEMP_PATH, "test_clusters.npy")
np.save(cluster_path, self.cluster_data)
# create data
self.embedding_data_owned = EmbeddingIntervalData(
id=3,
binsize=10000,
file_path=data_path,
dataset_id=self.owned_feature_dataset.id,
intervals_id=self.owned_intervals.id,
thumbnail_path=thumbnail_path,
cluster_id_path=cluster_path,
)
def test_no_auth(self):
"""No authentication provided, response should be 401"""
# protected route
response = self.client.post(
"/api/embeddingIntervalData/1/0/create/", content_type="multipart/form-data"
)
self.assertEqual(response.status_code, 401)
def test_embedding_interval_data_does_not_exist(self):
"""Test 404 is returned if embeddingIntervalData does not exist."""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# make request
response = self.client.post(
"/api/embeddingIntervalData/500/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 404)
def test_dataset_not_owned(self):
"""dataset underlying embeddingIntervalData is not owned"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_bedfile,
self.unowned_feature_dataset,
self.owned_intervals,
self.embedding_data_dataset_unowned,
]
)
db.session.commit()
# make request for forbidden collection
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_dataset_unowned.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 403)
def test_intervals_not_owned(self):
"""Intervals dataset underlying embeddingIntervalData are not owned"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_dataset,
self.unowned_bedfile,
self.unowned_intervals,
self.embedding_data_intervals_unowned,
]
)
db.session.commit()
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_unowned.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 403)
def test_form_not_present(self):
"""Test whether 400 is returned when there is not form data sent"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_dataset,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 400)
def test_form_invalid(self):
"""Test whether 400 is returned when does not contain correct keys"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_dataset,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# construct form
data = {"datasetName": "asdf"}
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 400)
def test_cluster_ids_do_not_exist(self):
"""Test whether 404 is returned if clusterID field is None"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_dataset,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# construct form
data = {"name": "asdf"}
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 404)
@patch("app.models.User.launch_task")
def test_new_region_correctly_created(self, mock_launch):
"""Test whether new region is correctly created"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_dataset,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_owned,
]
)
db.session.commit()
# construct form
data = {"name": "asdf"}
# make request with owned interval
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_owned.id}/1/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 200)
# test whether region was created successfully
self.assertEqual(len(Dataset.query.all()), 3)
new_dataset = Dataset.query.all()[2]
self.assertEqual(new_dataset.dataset_name, "asdf")
self.assertEqual(new_dataset.filetype, "bedfile")
self.assertEqual(new_dataset.assembly, 1)
self.assertEqual(new_dataset.cellCycleStage, "G2")
self.assertEqual(new_dataset.perturbation, "none")
self.assertEqual(new_dataset.valueType, "Peak")
self.assertEqual(new_dataset.method, "ChipSeq")
self.assertEqual(new_dataset.sizeType, "Point")
self.assertEqual(new_dataset.protein, "CTCF")
self.assertEqual(new_dataset.directionality, "+")
# test whether subset is correct
created_subset = pd.read_csv(new_dataset.file_path, sep="\t", header=None)
expected_subset = self.dummy_regions.iloc[[0, 3, 4], :].reset_index(drop=True)
expected_subset.columns = [0, 1, 2]
assert_frame_equal(created_subset, expected_subset)
class TestCreateRegionFrom1DEmbedding(LoginTestCase, TempDirTestCase):
"""Tests creating a new region from a cluster_id associated with
an embeddingIntervalData entry when its a 1d-embedding"""
def setUp(self):
super().setUp()
# add owned collection
self.owned_feature_collection = Collection(id=1, user_id=1, kind="1d-features")
# add unowned collection
self.unowned_feature_collection = Collection(
id=2, user_id=2, kind="1d-features"
)
# add owned bedfile
self.dummy_regions = pd.DataFrame(
{
"chrom": ["chr1"] * 6,
"start": [0, 100, 200, 300, 400, 500],
"end": [100, 200, 300, 400, 500, 600],
}
)
self.dummy_regions.to_csv(
os.path.join(TempDirTestCase.TEMP_PATH, "region.csv"),
sep="\t",
header=None,
index=False,
)
self.owned_bedfile = Dataset(
id=3,
filetype="bedfile",
user_id=1,
file_path=os.path.join(TempDirTestCase.TEMP_PATH, "region.csv"),
assembly=1,
cellCycleStage="G2",
perturbation="none",
valueType="Peak",
method="ChipSeq",
sizeType="Point",
protein="CTCF",
directionality="+",
)
# add unowned bedfile
self.unowned_bedfile = Dataset(id=4, filetype="bedfile", user_id=2)
# add intervals for owned bedfile
self.owned_intervals = Intervals(
id=1, dataset_id=self.owned_bedfile.id, windowsize=200000
)
# add intervals for unowned bedfile
self.unowned_intervals = Intervals(
id=2, dataset_id=self.unowned_bedfile.id, windowsize=200000
)
# add embeddingIntervalData with unowned dataset
self.embedding_data_collection_unowned = EmbeddingIntervalData(
id=1,
binsize=10000,
value_type="1d-embedding",
collection_id=self.unowned_feature_collection.id,
intervals_id=self.owned_intervals.id,
)
# add embeddingIntervalData with unowned intervals
self.embedding_data_intervals_unowned = EmbeddingIntervalData(
id=2,
binsize=10000,
value_type="1d-embedding",
collection_id=self.owned_feature_collection.id,
intervals_id=self.unowned_intervals.id,
)
# add owned embeddingIntervalData without thumbnails/feature_id and cluster_did
self.embedding_data_intervals_wo_thumbnail_data = EmbeddingIntervalData(
id=4,
binsize=10000,
value_type="1d-embedding",
collection_id=self.owned_feature_collection.id,
intervals_id=self.owned_intervals.id,
)
# add embeddingIntervalData with owned intervals and collection and associated data
self.test_data = np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])
data_path = os.path.join(TempDirTestCase.TEMP_PATH, "test.npy")
np.save(data_path, self.test_data)
# create thumbnails
thumbnails = [
np.array([[5, 6], [7, 7]]),
np.array([[1, 2], [3, 4]]),
np.array([[1.5, 10], [7.0, 3.4]]),
]
self.thumbnail_data = np.stack(thumbnails)
thumbnail_path = os.path.join(TempDirTestCase.TEMP_PATH, "test_thumbnails.npy")
np.save(thumbnail_path, self.thumbnail_data)
# create clusters
self.cluster_data = np.array([1.0, 2.0, 3.0, 1.0, 1.0, 2.0])
cluster_path = os.path.join(TempDirTestCase.TEMP_PATH, "test_clusters.npy")
np.save(cluster_path, self.cluster_data)
# create data
self.embedding_data_owned = EmbeddingIntervalData(
id=3,
binsize=10000,
file_path=data_path,
value_type="1d-embedding",
collection_id=self.owned_feature_collection.id,
intervals_id=self.owned_intervals.id,
thumbnail_path=thumbnail_path,
cluster_id_path=cluster_path,
)
def test_embedding_interval_data_does_not_exist(self):
"""Test 404 is returned if embeddingIntervalData does not exist."""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# make request
response = self.client.post(
"/api/embeddingIntervalData/500/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 404)
def test_collection_not_owned(self):
"""collection underlying embeddingIntervalData is not owned"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_bedfile,
self.unowned_feature_collection,
self.owned_intervals,
self.embedding_data_collection_unowned,
]
)
db.session.commit()
# make request for forbidden collection
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_collection_unowned.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 403)
def test_intervals_not_owned(self):
"""Intervals dataset underlying embeddingIntervalData are not owned"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_collection,
self.unowned_bedfile,
self.unowned_intervals,
self.embedding_data_intervals_unowned,
]
)
db.session.commit()
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_unowned.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 403)
def test_form_not_present(self):
"""Test whether 400 is returned when there is not form data sent"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_collection,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 400)
def test_form_invalid(self):
"""Test whether 400 is returned when does not contain correct keys"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_collection,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# construct form
data = {"datasetName": "asdf"}
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 400)
def test_cluster_ids_do_not_exist(self):
"""Test whether 404 is returned if clusterID field is None"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_collection,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_intervals_wo_thumbnail_data,
]
)
db.session.commit()
# construct form
data = {"name": "asdf"}
# make request with forbidden intervall
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_intervals_wo_thumbnail_data.id}/0/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 404)
@patch("app.models.User.launch_task")
def test_new_region_correctly_created(self, mock_launch):
"""Test whether new region is correctly created"""
# authenticate
token = self.add_and_authenticate("test", "asdf")
# create token header
token_headers = self.get_token_header(token)
# add data
db.session.add_all(
[
self.owned_feature_collection,
self.owned_bedfile,
self.owned_intervals,
self.embedding_data_owned,
]
)
db.session.commit()
# construct form
data = {"name": "asdf"}
# make request with owned interval
response = self.client.post(
f"/api/embeddingIntervalData/{self.embedding_data_owned.id}/1/create/",
data=data,
headers=token_headers,
content_type="multipart/form-data",
)
self.assertEqual(response.status_code, 200)
# test whether region was created successfully
self.assertEqual(len(Dataset.query.all()), 2)
new_dataset = Dataset.query.all()[1]
self.assertEqual(new_dataset.dataset_name, "asdf")
self.assertEqual(new_dataset.filetype, "bedfile")
self.assertEqual(new_dataset.assembly, 1)
self.assertEqual(new_dataset.cellCycleStage, "G2")
self.assertEqual(new_dataset.perturbation, "none")
self.assertEqual(new_dataset.valueType, "Peak")
self.assertEqual(new_dataset.method, "ChipSeq")
self.assertEqual(new_dataset.sizeType, "Point")
self.assertEqual(new_dataset.protein, "CTCF")
self.assertEqual(new_dataset.directionality, "+")
# test whether subset is correct
created_subset = pd.read_csv(new_dataset.file_path, sep="\t", header=None)
expected_subset = self.dummy_regions.iloc[[0, 3, 4], :].reset_index(drop=True)
expected_subset.columns = [0, 1, 2]
assert_frame_equal(created_subset, expected_subset)
if __name__ == "__main__":
res = unittest.main(verbosity=3, exit=False)
| 39.156406
| 105
| 0.60855
| 2,557
| 23,533
| 5.385217
| 0.084474
| 0.03268
| 0.039506
| 0.037763
| 0.94154
| 0.930283
| 0.910966
| 0.910966
| 0.910966
| 0.90748
| 0
| 0.022792
| 0.295245
| 23,533
| 600
| 106
| 39.221667
| 0.807477
| 0.145583
| 0
| 0.755411
| 0
| 0
| 0.102034
| 0.057996
| 0
| 0
| 0
| 0
| 0.08658
| 1
| 0.036797
| false
| 0
| 0.019481
| 0
| 0.060606
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e535d8f26d50df7142e571fac929b7beb060e006
| 2,363
|
py
|
Python
|
test_fena/v1_13/test_effects.py
|
Aquafina-water-bottle/Fena
|
00a2b1dbc6f8abd968c46c637d6ad30d5fcde919
|
[
"MIT"
] | 2
|
2017-07-04T02:27:11.000Z
|
2017-07-08T10:39:54.000Z
|
test_fena/v1_13/test_effects.py
|
Aquafina-water-bottle/Fena
|
00a2b1dbc6f8abd968c46c637d6ad30d5fcde919
|
[
"MIT"
] | 6
|
2018-07-07T11:58:15.000Z
|
2018-07-07T13:01:49.000Z
|
test_fena/v1_13/test_effects.py
|
Aquafina-water-bottle/Fena
|
00a2b1dbc6f8abd968c46c637d6ad30d5fcde919
|
[
"MIT"
] | 1
|
2017-07-24T23:52:43.000Z
|
2017-07-24T23:52:43.000Z
|
from test_fena.test_common import test_cmd
def test_effects():
test_cmd("effect @a - *", "effect clear @a")
test_cmd("effect @a - saturation", "effect clear @a minecraft:saturation")
test_cmd("effect @a + saturation", "effect give @a minecraft:saturation 2 0 true")
test_cmd("effect @a + saturation 1000000", "effect give @a minecraft:saturation 1000000 0 true")
test_cmd("effect @a + saturation 1000000 0", "effect give @a minecraft:saturation 1000000 0 true")
test_cmd("effect @a + saturation 1000000 1", "effect give @a minecraft:saturation 1000000 1 true")
test_cmd("effect @a + saturation 1000000 1 true", "effect give @a minecraft:saturation 1000000 1 true")
test_cmd("effect @a + saturation 1000000 1 false", "effect give @a minecraft:saturation 1000000 1 false")
test_cmd("effect @a - minecraft:*", expect_error=True)
test_cmd("effect @a - minecraft:saturation", "effect clear @a minecraft:saturation")
test_cmd("effect @a + minecraft:saturation", "effect give @a minecraft:saturation 2 0 true")
test_cmd("effect @a + minecraft:saturation 1000000", "effect give @a minecraft:saturation 1000000 0 true")
test_cmd("effect @a + minecraft:saturation 1000000 0", "effect give @a minecraft:saturation 1000000 0 true")
test_cmd("effect @a + minecraft:saturation 1000000 1", "effect give @a minecraft:saturation 1000000 1 true")
test_cmd("effect @a + minecraft:saturation 1000000 1", "effect give @a minecraft:saturation 1000000 1 true")
test_cmd("effect @a + minecraft:saturation 1000000 1 true", "effect give @a minecraft:saturation 1000000 1 true")
test_cmd("effect @a + minecraft:saturation 1000000 1 false", "effect give @a minecraft:saturation 1000000 1 false")
test_cmd("effect @a - saturation extra_arg", expect_error=True)
test_cmd("effect @a - not_an_effect", expect_error=True)
test_cmd("effect @a + saturation -25", expect_error=True)
test_cmd("effect @a + saturation 25 -1", expect_error=True)
test_cmd("effect @a + saturation 1000000 1 not_bool", expect_error=True)
test_cmd("effect @a = invalid_operator", expect_error=True)
| 81.482759
| 119
| 0.657639
| 307
| 2,363
| 4.934853
| 0.09772
| 0.110891
| 0.19736
| 0.212541
| 0.912871
| 0.90033
| 0.891089
| 0.821782
| 0.790759
| 0.730693
| 0
| 0.105993
| 0.23741
| 2,363
| 28
| 120
| 84.392857
| 0.734739
| 0
| 0
| 0.08
| 0
| 0
| 0.626746
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04
| true
| 0
| 0.04
| 0
| 0.08
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
e54c269ea060c6831d7eb5564ecec2f8f89074b9
| 22,883
|
py
|
Python
|
sdk/python/pulumi_datadog/synthetics_global_variable.py
|
pulumi/pulumi-datadog
|
dbc3e51b438de20aca4207bf894dbaa5a2db4bca
|
[
"ECL-2.0",
"Apache-2.0"
] | 10
|
2019-09-17T20:41:19.000Z
|
2022-01-07T15:42:07.000Z
|
sdk/python/pulumi_datadog/synthetics_global_variable.py
|
pulumi/pulumi-datadog
|
dbc3e51b438de20aca4207bf894dbaa5a2db4bca
|
[
"ECL-2.0",
"Apache-2.0"
] | 86
|
2019-07-08T11:47:05.000Z
|
2022-03-28T21:02:19.000Z
|
sdk/python/pulumi_datadog/synthetics_global_variable.py
|
pulumi/pulumi-datadog
|
dbc3e51b438de20aca4207bf894dbaa5a2db4bca
|
[
"ECL-2.0",
"Apache-2.0"
] | 4
|
2019-10-05T10:34:15.000Z
|
2021-08-08T04:14:19.000Z
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *
__all__ = ['SyntheticsGlobalVariableArgs', 'SyntheticsGlobalVariable']
@pulumi.input_type
class SyntheticsGlobalVariableArgs:
def __init__(__self__, *,
name: pulumi.Input[str],
value: pulumi.Input[str],
description: Optional[pulumi.Input[str]] = None,
parse_test_id: Optional[pulumi.Input[str]] = None,
parse_test_options: Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']] = None,
restricted_roles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
secure: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
The set of arguments for constructing a SyntheticsGlobalVariable resource.
:param pulumi.Input[str] name: Synthetics global variable name.
:param pulumi.Input[str] value: The value of the global variable.
:param pulumi.Input[str] description: Description of the global variable.
:param pulumi.Input[str] parse_test_id: Id of the Synthetics test to use for a variable from test.
:param pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs'] parse_test_options: ID of the Synthetics test to use a source of the global variable value.
:param pulumi.Input[Sequence[pulumi.Input[str]]] restricted_roles: A list of role identifiers to associate with the Synthetics global variable.
:param pulumi.Input[bool] secure: If set to true, the value of the global variable is hidden. Defaults to `false`.
:param pulumi.Input[Sequence[pulumi.Input[str]]] tags: A list of tags to associate with your synthetics global variable.
"""
pulumi.set(__self__, "name", name)
pulumi.set(__self__, "value", value)
if description is not None:
pulumi.set(__self__, "description", description)
if parse_test_id is not None:
pulumi.set(__self__, "parse_test_id", parse_test_id)
if parse_test_options is not None:
pulumi.set(__self__, "parse_test_options", parse_test_options)
if restricted_roles is not None:
pulumi.set(__self__, "restricted_roles", restricted_roles)
if secure is not None:
pulumi.set(__self__, "secure", secure)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter
def name(self) -> pulumi.Input[str]:
"""
Synthetics global variable name.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: pulumi.Input[str]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def value(self) -> pulumi.Input[str]:
"""
The value of the global variable.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: pulumi.Input[str]):
pulumi.set(self, "value", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Description of the global variable.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="parseTestId")
def parse_test_id(self) -> Optional[pulumi.Input[str]]:
"""
Id of the Synthetics test to use for a variable from test.
"""
return pulumi.get(self, "parse_test_id")
@parse_test_id.setter
def parse_test_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "parse_test_id", value)
@property
@pulumi.getter(name="parseTestOptions")
def parse_test_options(self) -> Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']]:
"""
ID of the Synthetics test to use a source of the global variable value.
"""
return pulumi.get(self, "parse_test_options")
@parse_test_options.setter
def parse_test_options(self, value: Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']]):
pulumi.set(self, "parse_test_options", value)
@property
@pulumi.getter(name="restrictedRoles")
def restricted_roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
A list of role identifiers to associate with the Synthetics global variable.
"""
return pulumi.get(self, "restricted_roles")
@restricted_roles.setter
def restricted_roles(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "restricted_roles", value)
@property
@pulumi.getter
def secure(self) -> Optional[pulumi.Input[bool]]:
"""
If set to true, the value of the global variable is hidden. Defaults to `false`.
"""
return pulumi.get(self, "secure")
@secure.setter
def secure(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "secure", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
A list of tags to associate with your synthetics global variable.
"""
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "tags", value)
@pulumi.input_type
class _SyntheticsGlobalVariableState:
def __init__(__self__, *,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
parse_test_id: Optional[pulumi.Input[str]] = None,
parse_test_options: Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']] = None,
restricted_roles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
secure: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
value: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering SyntheticsGlobalVariable resources.
:param pulumi.Input[str] description: Description of the global variable.
:param pulumi.Input[str] name: Synthetics global variable name.
:param pulumi.Input[str] parse_test_id: Id of the Synthetics test to use for a variable from test.
:param pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs'] parse_test_options: ID of the Synthetics test to use a source of the global variable value.
:param pulumi.Input[Sequence[pulumi.Input[str]]] restricted_roles: A list of role identifiers to associate with the Synthetics global variable.
:param pulumi.Input[bool] secure: If set to true, the value of the global variable is hidden. Defaults to `false`.
:param pulumi.Input[Sequence[pulumi.Input[str]]] tags: A list of tags to associate with your synthetics global variable.
:param pulumi.Input[str] value: The value of the global variable.
"""
if description is not None:
pulumi.set(__self__, "description", description)
if name is not None:
pulumi.set(__self__, "name", name)
if parse_test_id is not None:
pulumi.set(__self__, "parse_test_id", parse_test_id)
if parse_test_options is not None:
pulumi.set(__self__, "parse_test_options", parse_test_options)
if restricted_roles is not None:
pulumi.set(__self__, "restricted_roles", restricted_roles)
if secure is not None:
pulumi.set(__self__, "secure", secure)
if tags is not None:
pulumi.set(__self__, "tags", tags)
if value is not None:
pulumi.set(__self__, "value", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Description of the global variable.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Synthetics global variable name.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="parseTestId")
def parse_test_id(self) -> Optional[pulumi.Input[str]]:
"""
Id of the Synthetics test to use for a variable from test.
"""
return pulumi.get(self, "parse_test_id")
@parse_test_id.setter
def parse_test_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "parse_test_id", value)
@property
@pulumi.getter(name="parseTestOptions")
def parse_test_options(self) -> Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']]:
"""
ID of the Synthetics test to use a source of the global variable value.
"""
return pulumi.get(self, "parse_test_options")
@parse_test_options.setter
def parse_test_options(self, value: Optional[pulumi.Input['SyntheticsGlobalVariableParseTestOptionsArgs']]):
pulumi.set(self, "parse_test_options", value)
@property
@pulumi.getter(name="restrictedRoles")
def restricted_roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
A list of role identifiers to associate with the Synthetics global variable.
"""
return pulumi.get(self, "restricted_roles")
@restricted_roles.setter
def restricted_roles(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "restricted_roles", value)
@property
@pulumi.getter
def secure(self) -> Optional[pulumi.Input[bool]]:
"""
If set to true, the value of the global variable is hidden. Defaults to `false`.
"""
return pulumi.get(self, "secure")
@secure.setter
def secure(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "secure", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
A list of tags to associate with your synthetics global variable.
"""
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "tags", value)
@property
@pulumi.getter
def value(self) -> Optional[pulumi.Input[str]]:
"""
The value of the global variable.
"""
return pulumi.get(self, "value")
@value.setter
def value(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "value", value)
class SyntheticsGlobalVariable(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
parse_test_id: Optional[pulumi.Input[str]] = None,
parse_test_options: Optional[pulumi.Input[pulumi.InputType['SyntheticsGlobalVariableParseTestOptionsArgs']]] = None,
restricted_roles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
secure: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
value: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Provides a Datadog synthetics global variable resource. This can be used to create and manage Datadog synthetics global variables.
## Example Usage
```python
import pulumi
import pulumi_datadog as datadog
test_variable = datadog.SyntheticsGlobalVariable("testVariable",
description="Description of the variable",
name="EXAMPLE_VARIABLE",
tags=[
"foo:bar",
"env:test",
],
value="variable-value")
```
## Import
# Synthetics global variables can be imported using their string ID, e.g.
```sh
$ pulumi import datadog:index/syntheticsGlobalVariable:SyntheticsGlobalVariable fizz abcde123-fghi-456-jkl-mnopqrstuv
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Description of the global variable.
:param pulumi.Input[str] name: Synthetics global variable name.
:param pulumi.Input[str] parse_test_id: Id of the Synthetics test to use for a variable from test.
:param pulumi.Input[pulumi.InputType['SyntheticsGlobalVariableParseTestOptionsArgs']] parse_test_options: ID of the Synthetics test to use a source of the global variable value.
:param pulumi.Input[Sequence[pulumi.Input[str]]] restricted_roles: A list of role identifiers to associate with the Synthetics global variable.
:param pulumi.Input[bool] secure: If set to true, the value of the global variable is hidden. Defaults to `false`.
:param pulumi.Input[Sequence[pulumi.Input[str]]] tags: A list of tags to associate with your synthetics global variable.
:param pulumi.Input[str] value: The value of the global variable.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: SyntheticsGlobalVariableArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Provides a Datadog synthetics global variable resource. This can be used to create and manage Datadog synthetics global variables.
## Example Usage
```python
import pulumi
import pulumi_datadog as datadog
test_variable = datadog.SyntheticsGlobalVariable("testVariable",
description="Description of the variable",
name="EXAMPLE_VARIABLE",
tags=[
"foo:bar",
"env:test",
],
value="variable-value")
```
## Import
# Synthetics global variables can be imported using their string ID, e.g.
```sh
$ pulumi import datadog:index/syntheticsGlobalVariable:SyntheticsGlobalVariable fizz abcde123-fghi-456-jkl-mnopqrstuv
```
:param str resource_name: The name of the resource.
:param SyntheticsGlobalVariableArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(SyntheticsGlobalVariableArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
parse_test_id: Optional[pulumi.Input[str]] = None,
parse_test_options: Optional[pulumi.Input[pulumi.InputType['SyntheticsGlobalVariableParseTestOptionsArgs']]] = None,
restricted_roles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
secure: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
value: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = SyntheticsGlobalVariableArgs.__new__(SyntheticsGlobalVariableArgs)
__props__.__dict__["description"] = description
if name is None and not opts.urn:
raise TypeError("Missing required property 'name'")
__props__.__dict__["name"] = name
__props__.__dict__["parse_test_id"] = parse_test_id
__props__.__dict__["parse_test_options"] = parse_test_options
__props__.__dict__["restricted_roles"] = restricted_roles
__props__.__dict__["secure"] = secure
__props__.__dict__["tags"] = tags
if value is None and not opts.urn:
raise TypeError("Missing required property 'value'")
__props__.__dict__["value"] = value
super(SyntheticsGlobalVariable, __self__).__init__(
'datadog:index/syntheticsGlobalVariable:SyntheticsGlobalVariable',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
parse_test_id: Optional[pulumi.Input[str]] = None,
parse_test_options: Optional[pulumi.Input[pulumi.InputType['SyntheticsGlobalVariableParseTestOptionsArgs']]] = None,
restricted_roles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
secure: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
value: Optional[pulumi.Input[str]] = None) -> 'SyntheticsGlobalVariable':
"""
Get an existing SyntheticsGlobalVariable resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Description of the global variable.
:param pulumi.Input[str] name: Synthetics global variable name.
:param pulumi.Input[str] parse_test_id: Id of the Synthetics test to use for a variable from test.
:param pulumi.Input[pulumi.InputType['SyntheticsGlobalVariableParseTestOptionsArgs']] parse_test_options: ID of the Synthetics test to use a source of the global variable value.
:param pulumi.Input[Sequence[pulumi.Input[str]]] restricted_roles: A list of role identifiers to associate with the Synthetics global variable.
:param pulumi.Input[bool] secure: If set to true, the value of the global variable is hidden. Defaults to `false`.
:param pulumi.Input[Sequence[pulumi.Input[str]]] tags: A list of tags to associate with your synthetics global variable.
:param pulumi.Input[str] value: The value of the global variable.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _SyntheticsGlobalVariableState.__new__(_SyntheticsGlobalVariableState)
__props__.__dict__["description"] = description
__props__.__dict__["name"] = name
__props__.__dict__["parse_test_id"] = parse_test_id
__props__.__dict__["parse_test_options"] = parse_test_options
__props__.__dict__["restricted_roles"] = restricted_roles
__props__.__dict__["secure"] = secure
__props__.__dict__["tags"] = tags
__props__.__dict__["value"] = value
return SyntheticsGlobalVariable(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
"""
Description of the global variable.
"""
return pulumi.get(self, "description")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Synthetics global variable name.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="parseTestId")
def parse_test_id(self) -> pulumi.Output[Optional[str]]:
"""
Id of the Synthetics test to use for a variable from test.
"""
return pulumi.get(self, "parse_test_id")
@property
@pulumi.getter(name="parseTestOptions")
def parse_test_options(self) -> pulumi.Output[Optional['outputs.SyntheticsGlobalVariableParseTestOptions']]:
"""
ID of the Synthetics test to use a source of the global variable value.
"""
return pulumi.get(self, "parse_test_options")
@property
@pulumi.getter(name="restrictedRoles")
def restricted_roles(self) -> pulumi.Output[Optional[Sequence[str]]]:
"""
A list of role identifiers to associate with the Synthetics global variable.
"""
return pulumi.get(self, "restricted_roles")
@property
@pulumi.getter
def secure(self) -> pulumi.Output[Optional[bool]]:
"""
If set to true, the value of the global variable is hidden. Defaults to `false`.
"""
return pulumi.get(self, "secure")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Sequence[str]]]:
"""
A list of tags to associate with your synthetics global variable.
"""
return pulumi.get(self, "tags")
@property
@pulumi.getter
def value(self) -> pulumi.Output[str]:
"""
The value of the global variable.
"""
return pulumi.get(self, "value")
| 43.257089
| 185
| 0.650177
| 2,601
| 22,883
| 5.528258
| 0.06882
| 0.102511
| 0.077891
| 0.0459
| 0.855484
| 0.83455
| 0.824049
| 0.808123
| 0.802907
| 0.791502
| 0
| 0.000755
| 0.247782
| 22,883
| 528
| 186
| 43.339015
| 0.834602
| 0.31093
| 0
| 0.767918
| 1
| 0
| 0.112147
| 0.04026
| 0
| 0
| 0
| 0
| 0
| 1
| 0.16041
| false
| 0.003413
| 0.023891
| 0
| 0.279863
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
e567c7935ff0569fc5502d165da2ccb9cc066874
| 272
|
py
|
Python
|
forte/data/__init__.py
|
huzecong/forte
|
beae4e923c9a6873b582588972e6ec9919079271
|
[
"Apache-2.0"
] | null | null | null |
forte/data/__init__.py
|
huzecong/forte
|
beae4e923c9a6873b582588972e6ec9919079271
|
[
"Apache-2.0"
] | null | null | null |
forte/data/__init__.py
|
huzecong/forte
|
beae4e923c9a6873b582588972e6ec9919079271
|
[
"Apache-2.0"
] | null | null | null |
from forte.data import ontology
from forte.data import readers
from forte.data.base_pack import *
from forte.data.data_pack import *
from forte.data.datasets import *
from forte.data.io_utils import *
from forte.data.multi_pack import *
from forte.data.container import *
| 30.222222
| 35
| 0.808824
| 44
| 272
| 4.909091
| 0.295455
| 0.333333
| 0.481481
| 0.439815
| 0.319444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.117647
| 272
| 8
| 36
| 34
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
e591e6f274fa4315d5534406a4d22ab1abe7e7cc
| 2,069
|
py
|
Python
|
035_BodyPix/saved_model_to_coreml.py
|
IgiArdiyanto/PINTO_model_zoo
|
9247b56a7dff37f28a8a7822a7ef4dd9adf7234d
|
[
"MIT"
] | 1,529
|
2019-12-11T13:36:23.000Z
|
2022-03-31T18:38:27.000Z
|
035_BodyPix/saved_model_to_coreml.py
|
IgiArdiyanto/PINTO_model_zoo
|
9247b56a7dff37f28a8a7822a7ef4dd9adf7234d
|
[
"MIT"
] | 200
|
2020-01-06T09:24:42.000Z
|
2022-03-31T17:29:08.000Z
|
035_BodyPix/saved_model_to_coreml.py
|
IgiArdiyanto/PINTO_model_zoo
|
9247b56a7dff37f28a8a7822a7ef4dd9adf7234d
|
[
"MIT"
] | 288
|
2020-02-21T14:56:02.000Z
|
2022-03-30T03:00:35.000Z
|
import coremltools as ct
def model_convert(model_name, stride_num, H, W):
saved_model_path = f'{model_name}/{stride_num}/saved_model_{H}x{W}'
input = ct.TensorType(name='sub_2', shape=(1, H, W, 3))
mlmodel = ct.convert(saved_model_path, inputs=[input], source='tensorflow')
mlmodel.save(f'{saved_model_path}/model_coreml_float32.mlmodel')
model_name = 'mobilenet050'
stride_num = 'stride8'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
model_name = 'mobilenet050'
stride_num = 'stride16'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
model_name = 'mobilenet050'
stride_num = 'stride8'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
#=====================================================
model_name = 'mobilenet075'
stride_num = 'stride8'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
model_name = 'mobilenet075'
stride_num = 'stride16'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
#=====================================================
model_name = 'mobilenet100'
stride_num = 'stride8'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
model_name = 'mobilenet100'
stride_num = 'stride16'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
#=====================================================
model_name = 'resnet50'
stride_num = 'stride16'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
model_name = 'resnet50'
stride_num = 'stride32'
H = 240
W = 320
model_convert(model_name, stride_num, H, W)
H = 480
W = 640
model_convert(model_name, stride_num, H, W)
| 21.778947
| 79
| 0.667956
| 327
| 2,069
| 3.957187
| 0.125382
| 0.2017
| 0.231839
| 0.278207
| 0.829985
| 0.829985
| 0.829985
| 0.829985
| 0.805255
| 0.805255
| 0
| 0.085489
| 0.140648
| 2,069
| 95
| 80
| 21.778947
| 0.642295
| 0.076849
| 0
| 0.910256
| 0
| 0
| 0.14413
| 0.048218
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012821
| false
| 0
| 0.012821
| 0
| 0.025641
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
e5cc42d568d9975ef3960914fd49633f8fd72345
| 637
|
py
|
Python
|
tests/test_shapes.py
|
biotite-dev/bioview
|
7466900d6d659cb9d69a481870f68136a23cacb2
|
[
"BSD-3-Clause"
] | 1
|
2020-04-04T09:16:13.000Z
|
2020-04-04T09:16:13.000Z
|
tests/test_shapes.py
|
biotite-dev/bioview
|
7466900d6d659cb9d69a481870f68136a23cacb2
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_shapes.py
|
biotite-dev/bioview
|
7466900d6d659cb9d69a481870f68136a23cacb2
|
[
"BSD-3-Clause"
] | null | null | null |
import pytest
from ammolite import reset, draw_arrows
def test_draw_arrow_uniform():
"""
Draw arrows using the same radius for all arrows.
The radius is taken is example property here,
to test if uniform values are properly arrayfied.
"""
reset()
draw_arrows([(0,0,0), (1,0,1)], [(1,0,0), (1,0,1)], radius=0.1)
def test_draw_arrow_individual():
"""
Draw arrows using the same radius for all arrows.
The radius is taken is example property here,
to test if uniform values are properly arrayfied.
"""
reset()
draw_arrows([(0,0,0), (1,0,1)], [(1,0,0), (1,0,1)], radius=[0.1, 0.2])
| 28.954545
| 74
| 0.645212
| 106
| 637
| 3.792453
| 0.301887
| 0.049751
| 0.037313
| 0.039801
| 0.761194
| 0.761194
| 0.761194
| 0.761194
| 0.761194
| 0.761194
| 0
| 0.06
| 0.215071
| 637
| 22
| 74
| 28.954545
| 0.744
| 0.456829
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e5e0f635960571b7e5ba40725ff066565089dc45
| 94
|
py
|
Python
|
sequeender/py/sequeender/__init__.py
|
songmeixu/sequeender
|
1fc66f298e1eabc81c93cc7a0a90085d2baec5c7
|
[
"MIT"
] | null | null | null |
sequeender/py/sequeender/__init__.py
|
songmeixu/sequeender
|
1fc66f298e1eabc81c93cc7a0a90085d2baec5c7
|
[
"MIT"
] | 163
|
2020-07-20T21:24:08.000Z
|
2021-08-02T21:32:57.000Z
|
sequeender/py/sequeender/__init__.py
|
songmeixu/sequeender
|
1fc66f298e1eabc81c93cc7a0a90085d2baec5c7
|
[
"MIT"
] | null | null | null |
from _k2 import Arc
from .array import *
from .fsa import *
from .fsa_util import str_to_fsa
| 15.666667
| 32
| 0.765957
| 17
| 94
| 4
| 0.529412
| 0.294118
| 0.382353
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012987
| 0.180851
| 94
| 5
| 33
| 18.8
| 0.87013
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
f912190eecac4797f9fbea7b5083fd312b4f120a
| 13,680
|
py
|
Python
|
tests/test_building_houses.py
|
YSabarad/monopyly
|
0460f2452c83846b6b9e3b234be411e12a86d69c
|
[
"MIT"
] | 4
|
2015-11-04T21:18:40.000Z
|
2020-12-26T21:15:23.000Z
|
tests/test_building_houses.py
|
YSabarad/monopyly
|
0460f2452c83846b6b9e3b234be411e12a86d69c
|
[
"MIT"
] | 2
|
2021-08-09T18:19:58.000Z
|
2021-08-10T14:44:54.000Z
|
tests/test_building_houses.py
|
YSabarad/monopyly
|
0460f2452c83846b6b9e3b234be411e12a86d69c
|
[
"MIT"
] | 6
|
2015-08-01T17:54:17.000Z
|
2022-02-28T00:00:21.000Z
|
from monopyly import *
from testing_utils import *
class PlayerWhoBuildsHouses(DefaultPlayerAI):
'''
A player who builds houses.
'''
def __init__(self, build_instructions=None):
if not build_instructions:
build_instructions = []
self.build_instructions = build_instructions
def build_houses(self, game_state, player_state):
return self.build_instructions
def test_simple_house_building():
'''
Builds two houses on each of the red set and one each on the brown set.
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 2),
(board.get_square_by_name(Square.Name.FLEET_STREET), 2),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 3),
(board.get_square_by_name(Square.Name.OLD_KENT_ROAD), 1),
(board.get_square_by_name(Square.Name.WHITECHAPEL_ROAD), 1)]))
# We give the player the red set and the brown set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
old_kent_road = game.give_property_to_player(player, Square.Name.OLD_KENT_ROAD)
whitechapel_road = game.give_property_to_player(player, Square.Name.WHITECHAPEL_ROAD)
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# The player should have built houses on the three properties...
assert strand.number_of_houses == 2
assert fleet_street.number_of_houses == 2
assert trafalgar_square.number_of_houses == 3
assert old_kent_road.number_of_houses == 1
assert whitechapel_road.number_of_houses == 1
# We check the player paid the right money, 7 * £150 + 2 * £50 = £1150
assert player.state.cash == 350
def test_building_on_incomplete_set():
'''
You cannot build houses unless you own the whole set.
'''
# The player will try to build a house on two properties
# of the red set, without owning the whole set.
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 1),
(board.get_square_by_name(Square.Name.FLEET_STREET), 1)]))
# We give the player two properties from the red set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# The player should not have any houses...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
# No money should have been taken...
assert player.state.cash == 1500
def test_building_not_enough_money():
'''
Builds two houses on each of the red set, but the player
does not have enough money
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 2),
(board.get_square_by_name(Square.Name.FLEET_STREET), 2),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 2)]))
# We give the player the red set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
# The player does not have enough money to build the houses...
player.state.cash = 800
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# No houses should have been built...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
assert trafalgar_square.number_of_houses == 0
# No money should have been taken...
assert player.state.cash == 800
def test_builds_then_mortgages():
'''
The player wants to build houses on the red set, but tries to
mortgage one of the properties to pay for it.
If they have enough money, the houses will be built anyway, but
the property will not be mortgaged.
If they do not have enough money, the houses will not be built.
'''
game = Game()
board = game.state.board
class PlayerWhoBuildsAndMortgages(DefaultPlayerAI):
def build_houses(self, game_state, player_state):
return [
(board.get_square_by_name(Square.Name.STRAND), 2),
(board.get_square_by_name(Square.Name.FLEET_STREET), 2),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 2)]
def mortgage_properties(self, game_state, player_state):
return [Square.Name.TRAFALGAR_SQUARE]
player = game.add_player(PlayerWhoBuildsAndMortgages())
# We give the player the red set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
# The player does not have enough money to build the
# houses without mortgaging...
player.state.cash = 800
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# No houses should have been built and the mortgage does not happen.
# No money should have been taken...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
assert trafalgar_square.number_of_houses == 0
assert trafalgar_square.is_mortgaged is False
assert player.state.cash == 800
# We try again. This time, the player does have enough money...
player.state.cash = 925
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# The houses should have been built, but Trafalgar Square
# will not be mortgaged...
assert strand.number_of_houses == 2
assert fleet_street.number_of_houses == 2
assert trafalgar_square.number_of_houses == 2
assert trafalgar_square.is_mortgaged is False
assert player.state.cash == 25
def test_build_more_than_five_houses():
'''
Builds six houses on each of the red set. This is not allowed.
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 6),
(board.get_square_by_name(Square.Name.FLEET_STREET), 6),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 6)]))
# We give the player the red set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
# We give the player enough money to buy 6 houses on each...
player.state.cash = 3000
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# No houses should have been built...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
assert trafalgar_square.number_of_houses == 0
# No money should have been taken...
assert player.state.cash == 3000
def test_building_a_negative_number_of_houses():
'''
You should not be allowed to build a negative number of houses.
This should not be a sneaky way of selling houses back at full price!
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.PARK_LANE), -2),
(board.get_square_by_name(Square.Name.MAYFAIR), -2)]))
# We give the player the dark-blue set, each with four houses...
park_lane = game.give_property_to_player(player, Square.Name.PARK_LANE)
mayfair = game.give_property_to_player(player, Square.Name.MAYFAIR)
park_lane.number_of_houses = 4
mayfair.number_of_houses = 4
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# No houses should have been built (or un-built)...
assert park_lane.number_of_houses == 4
assert mayfair.number_of_houses == 4
# The player should have the money they started with...
assert player.state.cash == 1500
def test_unbalanced_house_building():
'''
Unbalanced house building is not allowed.
'''
# The player is trying to build 4 houses on Trafalgar Square, but
# only two houses on the other red squares...
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 2),
(board.get_square_by_name(Square.Name.FLEET_STREET), 2),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 4),
(board.get_square_by_name(Square.Name.OLD_KENT_ROAD), 1),
(board.get_square_by_name(Square.Name.WHITECHAPEL_ROAD), 1)]))
# We give the player the red set and the brown set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
old_kent_road = game.give_property_to_player(player, Square.Name.OLD_KENT_ROAD)
whitechapel_road = game.give_property_to_player(player, Square.Name.WHITECHAPEL_ROAD)
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# No houses should have been built and no money taken...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
assert trafalgar_square.number_of_houses == 0
assert old_kent_road.number_of_houses == 0
assert whitechapel_road.number_of_houses == 0
assert player.state.cash == 1500
def test_building_on_unowned_properties():
'''
Attempts to build on properties owned by another player.
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.OLD_KENT_ROAD), 1),
(board.get_square_by_name(Square.Name.WHITECHAPEL_ROAD), 1)]))
owner = game.add_player(DefaultPlayerAI())
# We give the owner the brown set...
old_kent_road = game.give_property_to_player(owner, Square.Name.OLD_KENT_ROAD)
whitechapel_road = game.give_property_to_player(owner, Square.Name.WHITECHAPEL_ROAD)
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# The houses should not have been build, and no money taken...
assert old_kent_road.number_of_houses == 0
assert whitechapel_road.number_of_houses == 0
assert player.state.cash == 1500
def test_building_on_partially_mortgaged_set():
'''
Builds two houses on each of the red set and one each on the browns,
but Strand is mortgaged.
'''
game = Game()
board = game.state.board
player = game.add_player(PlayerWhoBuildsHouses([
(board.get_square_by_name(Square.Name.STRAND), 2),
(board.get_square_by_name(Square.Name.FLEET_STREET), 2),
(board.get_square_by_name(Square.Name.TRAFALGAR_SQUARE), 2),
(board.get_square_by_name(Square.Name.OLD_KENT_ROAD), 1),
(board.get_square_by_name(Square.Name.WHITECHAPEL_ROAD), 1)]))
# We give the player the red set and the brown set...
strand = game.give_property_to_player(player, Square.Name.STRAND)
fleet_street = game.give_property_to_player(player, Square.Name.FLEET_STREET)
trafalgar_square = game.give_property_to_player(player, Square.Name.TRAFALGAR_SQUARE)
old_kent_road = game.give_property_to_player(player, Square.Name.OLD_KENT_ROAD)
whitechapel_road = game.give_property_to_player(player, Square.Name.WHITECHAPEL_ROAD)
# Strand is mortgaged...
strand.is_mortgaged = True
game._update_sets()
# We need to play a turn to initiate house building. We play a
# neutral turn: Marylebone -> Free parking.
player.state.square = 15
game.dice = MockDice([(4, 1)])
game.play_one_turn(player)
# The whole building 'transaction' should have failed...
assert strand.number_of_houses == 0
assert fleet_street.number_of_houses == 0
assert trafalgar_square.number_of_houses == 0
assert old_kent_road.number_of_houses == 0
assert whitechapel_road.number_of_houses == 0
assert player.state.cash == 1500
| 38.863636
| 89
| 0.710965
| 1,984
| 13,680
| 4.675907
| 0.088206
| 0.065754
| 0.055837
| 0.051741
| 0.804786
| 0.788509
| 0.765549
| 0.750566
| 0.735475
| 0.704754
| 0
| 0.015095
| 0.196126
| 13,680
| 351
| 90
| 38.974359
| 0.828226
| 0.258845
| 0
| 0.721649
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.231959
| 1
| 0.06701
| false
| 0
| 0.010309
| 0.015464
| 0.103093
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
00810729ac008749e03755f728b47a63bd9c2638
| 161
|
py
|
Python
|
django_addon/models.py
|
stefanfoulis/django-addon
|
da3268616b281476c4220cb2ce2e3c56e29ed0d3
|
[
"BSD-3-Clause"
] | null | null | null |
django_addon/models.py
|
stefanfoulis/django-addon
|
da3268616b281476c4220cb2ce2e3c56e29ed0d3
|
[
"BSD-3-Clause"
] | 5
|
2018-05-28T14:05:21.000Z
|
2021-06-10T17:22:33.000Z
|
django_addon/models.py
|
stefanfoulis/django-addon
|
da3268616b281476c4220cb2ce2e3c56e29ed0d3
|
[
"BSD-3-Clause"
] | null | null | null |
#######################
# apply monkeypatches #
#######################
from .monkeypatches import hide_secrets_in_debug_mode
hide_secrets_in_debug_mode.patch()
| 26.833333
| 53
| 0.608696
| 16
| 161
| 5.625
| 0.625
| 0.244444
| 0.288889
| 0.4
| 0.488889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068323
| 161
| 5
| 54
| 32.2
| 0.6
| 0.118012
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
008f66dbf44f873fc9159555080555e8ebb75726
| 92
|
py
|
Python
|
datasets/__init__.py
|
mahekvora21/metal_sheet_defect_detection
|
0549c20e8f177ba42e3449cca3fe9a15adbca3d6
|
[
"RSA-MD"
] | null | null | null |
datasets/__init__.py
|
mahekvora21/metal_sheet_defect_detection
|
0549c20e8f177ba42e3449cca3fe9a15adbca3d6
|
[
"RSA-MD"
] | null | null | null |
datasets/__init__.py
|
mahekvora21/metal_sheet_defect_detection
|
0549c20e8f177ba42e3449cca3fe9a15adbca3d6
|
[
"RSA-MD"
] | null | null | null |
# from .cls_dataset_factory import make_cls_loader
from .dataset_factory import make_loader
| 30.666667
| 50
| 0.869565
| 14
| 92
| 5.285714
| 0.5
| 0.378378
| 0.540541
| 0.648649
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097826
| 92
| 2
| 51
| 46
| 0.891566
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
00b188a99cb0f1266d610236246595adf0b706b1
| 33,198
|
py
|
Python
|
sdk/python/pulumi_aws/fsx/ontap_storage_virtual_machine.py
|
chivandikwa/pulumi-aws
|
19c08bf9dcb90544450ffa4eec7bf6751058fde2
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_aws/fsx/ontap_storage_virtual_machine.py
|
chivandikwa/pulumi-aws
|
19c08bf9dcb90544450ffa4eec7bf6751058fde2
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_aws/fsx/ontap_storage_virtual_machine.py
|
chivandikwa/pulumi-aws
|
19c08bf9dcb90544450ffa4eec7bf6751058fde2
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *
__all__ = ['OntapStorageVirtualMachineArgs', 'OntapStorageVirtualMachine']
@pulumi.input_type
class OntapStorageVirtualMachineArgs:
def __init__(__self__, *,
file_system_id: pulumi.Input[str],
active_directory_configuration: Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']] = None,
name: Optional[pulumi.Input[str]] = None,
root_volume_security_style: Optional[pulumi.Input[str]] = None,
svm_admin_password: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
The set of arguments for constructing a OntapStorageVirtualMachine resource.
:param pulumi.Input[str] file_system_id: The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
:param pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs'] active_directory_configuration: Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
:param pulumi.Input[str] name: The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
:param pulumi.Input[str] root_volume_security_style: Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
"""
pulumi.set(__self__, "file_system_id", file_system_id)
if active_directory_configuration is not None:
pulumi.set(__self__, "active_directory_configuration", active_directory_configuration)
if name is not None:
pulumi.set(__self__, "name", name)
if root_volume_security_style is not None:
pulumi.set(__self__, "root_volume_security_style", root_volume_security_style)
if svm_admin_password is not None:
pulumi.set(__self__, "svm_admin_password", svm_admin_password)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter(name="fileSystemId")
def file_system_id(self) -> pulumi.Input[str]:
"""
The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
"""
return pulumi.get(self, "file_system_id")
@file_system_id.setter
def file_system_id(self, value: pulumi.Input[str]):
pulumi.set(self, "file_system_id", value)
@property
@pulumi.getter(name="activeDirectoryConfiguration")
def active_directory_configuration(self) -> Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]:
"""
Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
"""
return pulumi.get(self, "active_directory_configuration")
@active_directory_configuration.setter
def active_directory_configuration(self, value: Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]):
pulumi.set(self, "active_directory_configuration", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="rootVolumeSecurityStyle")
def root_volume_security_style(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
"""
return pulumi.get(self, "root_volume_security_style")
@root_volume_security_style.setter
def root_volume_security_style(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "root_volume_security_style", value)
@property
@pulumi.getter(name="svmAdminPassword")
def svm_admin_password(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "svm_admin_password")
@svm_admin_password.setter
def svm_admin_password(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "svm_admin_password", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
"""
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "tags", value)
@pulumi.input_type
class _OntapStorageVirtualMachineState:
def __init__(__self__, *,
active_directory_configuration: Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']] = None,
arn: Optional[pulumi.Input[str]] = None,
endpoints: Optional[pulumi.Input[Sequence[pulumi.Input['OntapStorageVirtualMachineEndpointArgs']]]] = None,
file_system_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
root_volume_security_style: Optional[pulumi.Input[str]] = None,
subtype: Optional[pulumi.Input[str]] = None,
svm_admin_password: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
tags_all: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
uuid: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering OntapStorageVirtualMachine resources.
:param pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs'] active_directory_configuration: Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
:param pulumi.Input[str] arn: Amazon Resource Name of the storage virtual machine.
:param pulumi.Input[Sequence[pulumi.Input['OntapStorageVirtualMachineEndpointArgs']]] endpoints: The endpoints that are used to access data or to manage the storage virtual machine using the NetApp ONTAP CLI, REST API, or NetApp SnapMirror. See Endpoints below.
:param pulumi.Input[str] file_system_id: The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
:param pulumi.Input[str] name: The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
:param pulumi.Input[str] root_volume_security_style: Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
:param pulumi.Input[str] subtype: Describes the SVM's subtype, e.g. `DEFAULT`
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags_all: A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
:param pulumi.Input[str] uuid: The SVM's UUID (universally unique identifier).
"""
if active_directory_configuration is not None:
pulumi.set(__self__, "active_directory_configuration", active_directory_configuration)
if arn is not None:
pulumi.set(__self__, "arn", arn)
if endpoints is not None:
pulumi.set(__self__, "endpoints", endpoints)
if file_system_id is not None:
pulumi.set(__self__, "file_system_id", file_system_id)
if name is not None:
pulumi.set(__self__, "name", name)
if root_volume_security_style is not None:
pulumi.set(__self__, "root_volume_security_style", root_volume_security_style)
if subtype is not None:
pulumi.set(__self__, "subtype", subtype)
if svm_admin_password is not None:
pulumi.set(__self__, "svm_admin_password", svm_admin_password)
if tags is not None:
pulumi.set(__self__, "tags", tags)
if tags_all is not None:
pulumi.set(__self__, "tags_all", tags_all)
if uuid is not None:
pulumi.set(__self__, "uuid", uuid)
@property
@pulumi.getter(name="activeDirectoryConfiguration")
def active_directory_configuration(self) -> Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]:
"""
Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
"""
return pulumi.get(self, "active_directory_configuration")
@active_directory_configuration.setter
def active_directory_configuration(self, value: Optional[pulumi.Input['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]):
pulumi.set(self, "active_directory_configuration", value)
@property
@pulumi.getter
def arn(self) -> Optional[pulumi.Input[str]]:
"""
Amazon Resource Name of the storage virtual machine.
"""
return pulumi.get(self, "arn")
@arn.setter
def arn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "arn", value)
@property
@pulumi.getter
def endpoints(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['OntapStorageVirtualMachineEndpointArgs']]]]:
"""
The endpoints that are used to access data or to manage the storage virtual machine using the NetApp ONTAP CLI, REST API, or NetApp SnapMirror. See Endpoints below.
"""
return pulumi.get(self, "endpoints")
@endpoints.setter
def endpoints(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['OntapStorageVirtualMachineEndpointArgs']]]]):
pulumi.set(self, "endpoints", value)
@property
@pulumi.getter(name="fileSystemId")
def file_system_id(self) -> Optional[pulumi.Input[str]]:
"""
The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
"""
return pulumi.get(self, "file_system_id")
@file_system_id.setter
def file_system_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "file_system_id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="rootVolumeSecurityStyle")
def root_volume_security_style(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
"""
return pulumi.get(self, "root_volume_security_style")
@root_volume_security_style.setter
def root_volume_security_style(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "root_volume_security_style", value)
@property
@pulumi.getter
def subtype(self) -> Optional[pulumi.Input[str]]:
"""
Describes the SVM's subtype, e.g. `DEFAULT`
"""
return pulumi.get(self, "subtype")
@subtype.setter
def subtype(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subtype", value)
@property
@pulumi.getter(name="svmAdminPassword")
def svm_admin_password(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "svm_admin_password")
@svm_admin_password.setter
def svm_admin_password(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "svm_admin_password", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
"""
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "tags", value)
@property
@pulumi.getter(name="tagsAll")
def tags_all(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
"""
return pulumi.get(self, "tags_all")
@tags_all.setter
def tags_all(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "tags_all", value)
@property
@pulumi.getter
def uuid(self) -> Optional[pulumi.Input[str]]:
"""
The SVM's UUID (universally unique identifier).
"""
return pulumi.get(self, "uuid")
@uuid.setter
def uuid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "uuid", value)
class OntapStorageVirtualMachine(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
active_directory_configuration: Optional[pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]] = None,
file_system_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
root_volume_security_style: Optional[pulumi.Input[str]] = None,
svm_admin_password: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
__props__=None):
"""
Manages a FSx Storage Virtual Machine.
See the [FSx ONTAP User Guide](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/managing-svms.html) for more information.
## Example Usage
### Basic Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.fsx.OntapStorageVirtualMachine("test", file_system_id=aws_fsx_ontap_file_system["test"]["id"])
```
### Using a Self-Managed Microsoft Active Directory
Additional information for using AWS Directory Service with ONTAP File Systems can be found in the [FSx ONTAP Guide](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/self-managed-AD.html).
```python
import pulumi
import pulumi_aws as aws
test = aws.fsx.OntapStorageVirtualMachine("test",
file_system_id=aws_fsx_ontap_file_system["test"]["id"],
active_directory_configuration=aws.fsx.OntapStorageVirtualMachineActiveDirectoryConfigurationArgs(
netbios_name="mysvm",
self_managed_active_directory_configuration=aws.fsx.OntapStorageVirtualMachineActiveDirectoryConfigurationSelfManagedActiveDirectoryConfigurationArgs(
dns_ips=[
"10.0.0.111",
"10.0.0.222",
],
domain_name="corp.example.com",
password="avoid-plaintext-passwords",
username="Admin",
),
))
```
## Import
FSx Storage Virtual Machine can be imported using the `id`, e.g.,
```sh
$ pulumi import aws:fsx/ontapStorageVirtualMachine:OntapStorageVirtualMachine example svm-12345678abcdef123
```
Certain resource arguments, like `svm_admin_password` and the `self_managed_active_directory` configuation block `password`, do not have a FSx API method for reading the information after creation. If these arguments are set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g., terraform resource "aws_fsx_ontap_storage_virtual_machine" "example" {
# ... other configuration ...
svm_admin_password = "avoid-plaintext-passwords"
# There is no FSx API for reading svm_admin_password
lifecycle {
ignore_changes = [svm_admin_password]
} }
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']] active_directory_configuration: Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
:param pulumi.Input[str] file_system_id: The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
:param pulumi.Input[str] name: The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
:param pulumi.Input[str] root_volume_security_style: Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: OntapStorageVirtualMachineArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a FSx Storage Virtual Machine.
See the [FSx ONTAP User Guide](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/managing-svms.html) for more information.
## Example Usage
### Basic Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.fsx.OntapStorageVirtualMachine("test", file_system_id=aws_fsx_ontap_file_system["test"]["id"])
```
### Using a Self-Managed Microsoft Active Directory
Additional information for using AWS Directory Service with ONTAP File Systems can be found in the [FSx ONTAP Guide](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/self-managed-AD.html).
```python
import pulumi
import pulumi_aws as aws
test = aws.fsx.OntapStorageVirtualMachine("test",
file_system_id=aws_fsx_ontap_file_system["test"]["id"],
active_directory_configuration=aws.fsx.OntapStorageVirtualMachineActiveDirectoryConfigurationArgs(
netbios_name="mysvm",
self_managed_active_directory_configuration=aws.fsx.OntapStorageVirtualMachineActiveDirectoryConfigurationSelfManagedActiveDirectoryConfigurationArgs(
dns_ips=[
"10.0.0.111",
"10.0.0.222",
],
domain_name="corp.example.com",
password="avoid-plaintext-passwords",
username="Admin",
),
))
```
## Import
FSx Storage Virtual Machine can be imported using the `id`, e.g.,
```sh
$ pulumi import aws:fsx/ontapStorageVirtualMachine:OntapStorageVirtualMachine example svm-12345678abcdef123
```
Certain resource arguments, like `svm_admin_password` and the `self_managed_active_directory` configuation block `password`, do not have a FSx API method for reading the information after creation. If these arguments are set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g., terraform resource "aws_fsx_ontap_storage_virtual_machine" "example" {
# ... other configuration ...
svm_admin_password = "avoid-plaintext-passwords"
# There is no FSx API for reading svm_admin_password
lifecycle {
ignore_changes = [svm_admin_password]
} }
:param str resource_name: The name of the resource.
:param OntapStorageVirtualMachineArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(OntapStorageVirtualMachineArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
active_directory_configuration: Optional[pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]] = None,
file_system_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
root_volume_security_style: Optional[pulumi.Input[str]] = None,
svm_admin_password: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = OntapStorageVirtualMachineArgs.__new__(OntapStorageVirtualMachineArgs)
__props__.__dict__["active_directory_configuration"] = active_directory_configuration
if file_system_id is None and not opts.urn:
raise TypeError("Missing required property 'file_system_id'")
__props__.__dict__["file_system_id"] = file_system_id
__props__.__dict__["name"] = name
__props__.__dict__["root_volume_security_style"] = root_volume_security_style
__props__.__dict__["svm_admin_password"] = svm_admin_password
__props__.__dict__["tags"] = tags
__props__.__dict__["arn"] = None
__props__.__dict__["endpoints"] = None
__props__.__dict__["subtype"] = None
__props__.__dict__["tags_all"] = None
__props__.__dict__["uuid"] = None
super(OntapStorageVirtualMachine, __self__).__init__(
'aws:fsx/ontapStorageVirtualMachine:OntapStorageVirtualMachine',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
active_directory_configuration: Optional[pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']]] = None,
arn: Optional[pulumi.Input[str]] = None,
endpoints: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineEndpointArgs']]]]] = None,
file_system_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
root_volume_security_style: Optional[pulumi.Input[str]] = None,
subtype: Optional[pulumi.Input[str]] = None,
svm_admin_password: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
tags_all: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
uuid: Optional[pulumi.Input[str]] = None) -> 'OntapStorageVirtualMachine':
"""
Get an existing OntapStorageVirtualMachine resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineActiveDirectoryConfigurationArgs']] active_directory_configuration: Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
:param pulumi.Input[str] arn: Amazon Resource Name of the storage virtual machine.
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OntapStorageVirtualMachineEndpointArgs']]]] endpoints: The endpoints that are used to access data or to manage the storage virtual machine using the NetApp ONTAP CLI, REST API, or NetApp SnapMirror. See Endpoints below.
:param pulumi.Input[str] file_system_id: The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
:param pulumi.Input[str] name: The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
:param pulumi.Input[str] root_volume_security_style: Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
:param pulumi.Input[str] subtype: Describes the SVM's subtype, e.g. `DEFAULT`
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags_all: A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
:param pulumi.Input[str] uuid: The SVM's UUID (universally unique identifier).
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _OntapStorageVirtualMachineState.__new__(_OntapStorageVirtualMachineState)
__props__.__dict__["active_directory_configuration"] = active_directory_configuration
__props__.__dict__["arn"] = arn
__props__.__dict__["endpoints"] = endpoints
__props__.__dict__["file_system_id"] = file_system_id
__props__.__dict__["name"] = name
__props__.__dict__["root_volume_security_style"] = root_volume_security_style
__props__.__dict__["subtype"] = subtype
__props__.__dict__["svm_admin_password"] = svm_admin_password
__props__.__dict__["tags"] = tags
__props__.__dict__["tags_all"] = tags_all
__props__.__dict__["uuid"] = uuid
return OntapStorageVirtualMachine(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="activeDirectoryConfiguration")
def active_directory_configuration(self) -> pulumi.Output[Optional['outputs.OntapStorageVirtualMachineActiveDirectoryConfiguration']]:
"""
Configuration block that Amazon FSx uses to join the FSx ONTAP Storage Virtual Machine(SVM) to your Microsoft Active Directory (AD) directory. Detailed below.
"""
return pulumi.get(self, "active_directory_configuration")
@property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
"""
Amazon Resource Name of the storage virtual machine.
"""
return pulumi.get(self, "arn")
@property
@pulumi.getter
def endpoints(self) -> pulumi.Output[Sequence['outputs.OntapStorageVirtualMachineEndpoint']]:
"""
The endpoints that are used to access data or to manage the storage virtual machine using the NetApp ONTAP CLI, REST API, or NetApp SnapMirror. See Endpoints below.
"""
return pulumi.get(self, "endpoints")
@property
@pulumi.getter(name="fileSystemId")
def file_system_id(self) -> pulumi.Output[str]:
"""
The ID of the Amazon FSx ONTAP File System that this SVM will be created on.
"""
return pulumi.get(self, "file_system_id")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
The name of the SVM. You can use a maximum of 47 alphanumeric characters, plus the underscore (_) special character.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="rootVolumeSecurityStyle")
def root_volume_security_style(self) -> pulumi.Output[Optional[str]]:
"""
Specifies the root volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. Default value is `UNIX`.
"""
return pulumi.get(self, "root_volume_security_style")
@property
@pulumi.getter
def subtype(self) -> pulumi.Output[str]:
"""
Describes the SVM's subtype, e.g. `DEFAULT`
"""
return pulumi.get(self, "subtype")
@property
@pulumi.getter(name="svmAdminPassword")
def svm_admin_password(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "svm_admin_password")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
"""
A map of tags to assign to the storage virtual machine. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
"""
return pulumi.get(self, "tags")
@property
@pulumi.getter(name="tagsAll")
def tags_all(self) -> pulumi.Output[Mapping[str, str]]:
"""
A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
"""
return pulumi.get(self, "tags_all")
@property
@pulumi.getter
def uuid(self) -> pulumi.Output[str]:
"""
The SVM's UUID (universally unique identifier).
"""
return pulumi.get(self, "uuid")
| 53.1168
| 634
| 0.686969
| 3,920
| 33,198
| 5.618367
| 0.072959
| 0.066428
| 0.055303
| 0.044951
| 0.883718
| 0.868325
| 0.849936
| 0.837268
| 0.819061
| 0.808799
| 0
| 0.002514
| 0.221128
| 33,198
| 624
| 635
| 53.201923
| 0.849248
| 0.443732
| 0
| 0.670846
| 1
| 0
| 0.143927
| 0.093811
| 0
| 0
| 0
| 0
| 0
| 1
| 0.163009
| false
| 0.08464
| 0.021944
| 0.009404
| 0.285266
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
dadf77fd53a852d52badf720170d7d36524c9082
| 8,769
|
py
|
Python
|
tests/test_wipe.py
|
atviriduomenys/spinta
|
77a10e201f8cdc63143fce7996fd0898acb1ff58
|
[
"MIT"
] | 2
|
2019-03-14T06:41:14.000Z
|
2019-03-26T11:48:14.000Z
|
tests/test_wipe.py
|
sirex/spinta
|
77a10e201f8cdc63143fce7996fd0898acb1ff58
|
[
"MIT"
] | 44
|
2019-04-05T15:52:45.000Z
|
2022-03-30T07:41:33.000Z
|
tests/test_wipe.py
|
sirex/spinta
|
77a10e201f8cdc63143fce7996fd0898acb1ff58
|
[
"MIT"
] | 1
|
2019-04-01T09:54:27.000Z
|
2019-04-01T09:54:27.000Z
|
from typing import List
from typing import Tuple
import pytest
from spinta.testing.client import TestClient
from spinta.testing.data import listdata
from spinta.testing.utils import get_error_codes
from spinta.utils.schema import NA
def _excluding(
name: str,
value: str,
data: List[Tuple[str, str]],
) -> List[Tuple[str, str]]:
return [
(_type, status)
for _type, status in data
if not (_type == name and status == value)
]
def test_wipe_all(app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_wipe'])
# Create some data in different models
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
]})
assert resp.status_code == 200, resp.json()
# Get data from all models
resp = app.get('/:all')
data = sorted([(r['_type'], r.get('status')) for r in resp.json()['_data']])
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe all data
resp = app.delete('/:wipe')
assert resp.status_code == 200, resp.json()
# Check what data again
resp = app.get('/:all')
assert resp.status_code == 200, resp.json()
assert len(resp.json()['_data']) == 0
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_model(model, app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_wipe'])
# Create some data in different models
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
]})
assert resp.status_code == 200, resp.json()
# Get data from all models
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe model data
resp = app.delete(f'/{model}/:wipe')
assert resp.status_code == 200, resp.json()
resp = app.delete(f'/_txn/:wipe')
assert resp.status_code == 200, resp.json()
# Check the data again
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == _excluding(model, 'ok', [
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
])
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_row(model: str, app: TestClient):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_wipe'])
# Create some data in different models
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'nb'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'nb'},
]})
_id_idx = {
'backends/mongo/report': 1,
'backends/postgres/report': 3,
}
_id = listdata(resp, '_id')[_id_idx[model]]
# Get data from all models
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'nb'),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'nb'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe model row data
with pytest.raises(NotImplementedError):
resp = app.delete(f'/{model}/{_id}/:wipe')
assert resp.status_code == 200, resp.json()
resp = app.delete(f'/_txn/:wipe')
assert resp.status_code == 200, resp.json()
# Check the data again.
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('backends/mongo/report', 'nb'),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'nb'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_check_scope(model, app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_delete'])
resp = app.delete(f'/{model}/:wipe')
assert resp.status_code == 403
def test_wipe_check_ns_scope(app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_delete'])
resp = app.delete(f'/:wipe')
assert resp.status_code == 403
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_in_batch(model, app):
app.authorize(['spinta_wipe'])
resp = app.post(f'/', json={
'_data': [
{'_op': 'wipe', '_type': model}
]
})
assert resp.status_code == 400
assert get_error_codes(resp.json()) == ['UnknownAction']
def test_wipe_all_access(app: TestClient):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_delete'])
# Create some data in different models.
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
]})
assert resp.status_code == 200, resp.json()
# Get data from all models.
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe all data
resp = app.delete('/:wipe')
assert resp.status_code == 403 # Forbidden
# Check the data again.
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_model_access(model, app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_delete'])
# Create some data in different models
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
]})
assert resp.status_code == 200, resp.json()
# Get data from all models
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe model data
resp = app.delete(f'/{model}/:wipe')
assert resp.status_code == 403, resp.json()
# Check what data again
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
@pytest.mark.models(
'backends/mongo/report',
'backends/postgres/report',
)
def test_wipe_row_access(model, app):
app.authorize(['spinta_insert', 'spinta_getall', 'spinta_delete'])
# Create some data in different models
resp = app.post('/', json={'_data': [
{'_op': 'insert', '_type': 'report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/mongo/report', 'status': 'ok'},
{'_op': 'insert', '_type': 'backends/postgres/report', 'status': 'ok'},
]})
ids = dict(listdata(resp, '_type', '_id'))
_id = ids[model]
# Get data from all models
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
# Wipe model row data
with pytest.raises(NotImplementedError):
resp = app.delete(f'/{model}/{_id}/:wipe')
assert resp.status_code == 403, resp.json()
# Check what data again
resp = app.get('/:all')
assert listdata(resp, '_type', 'status') == [
('_txn', NA),
('backends/mongo/report', 'ok'),
('backends/postgres/report', 'ok'),
('report', 'ok'),
]
| 30.768421
| 80
| 0.570304
| 1,019
| 8,769
| 4.750736
| 0.084396
| 0.054534
| 0.10597
| 0.066102
| 0.856021
| 0.850651
| 0.844454
| 0.839289
| 0.833505
| 0.826482
| 0
| 0.007514
| 0.226023
| 8,769
| 284
| 81
| 30.876761
| 0.705761
| 0.070019
| 0
| 0.700935
| 0
| 0
| 0.318366
| 0.149465
| 0
| 0
| 0
| 0
| 0.135514
| 1
| 0.046729
| false
| 0
| 0.03271
| 0.004673
| 0.084112
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
dae197006314289360e3ad1934cfe4e861d557c3
| 4,014
|
py
|
Python
|
housingdata/marketdata/migrations/0005_auto_20211102_1941.py
|
nsitapara/Realtor
|
f88fbff585921eadad767b142cdc84976780a9d3
|
[
"MIT"
] | null | null | null |
housingdata/marketdata/migrations/0005_auto_20211102_1941.py
|
nsitapara/Realtor
|
f88fbff585921eadad767b142cdc84976780a9d3
|
[
"MIT"
] | null | null | null |
housingdata/marketdata/migrations/0005_auto_20211102_1941.py
|
nsitapara/Realtor
|
f88fbff585921eadad767b142cdc84976780a9d3
|
[
"MIT"
] | null | null | null |
# Generated by Django 3.2.9 on 2021-11-03 02:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketdata', '0004_alter_housedatapoint_mls'),
]
operations = [
migrations.AlterField(
model_name='housedatapoint',
name='agents',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='city',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='county',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='data_source_name',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='is_new_listing',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='last_update',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='line',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='lot_size_units',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='neighborhood_name',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='office',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='postal_code',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='presentation_status',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='prop_status',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='prop_type',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='property_id',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='rdc_web_url',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='state',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='state_code',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='time_zone',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housedatapoint',
name='units',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='housingquerydata',
name='city',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='listofcities',
name='city',
field=models.TextField(),
),
]
| 32.370968
| 58
| 0.553563
| 350
| 4,014
| 6.228571
| 0.188571
| 0.201835
| 0.252294
| 0.292661
| 0.858257
| 0.845413
| 0.823853
| 0.823853
| 0.823853
| 0.823853
| 0
| 0.007076
| 0.331091
| 4,014
| 123
| 59
| 32.634146
| 0.804842
| 0.011211
| 0
| 0.752137
| 1
| 0
| 0.139652
| 0.00731
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.008547
| 0
| 0.034188
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
970ea426847d986640c8c90f9254087f14588394
| 8,763
|
py
|
Python
|
tuna/datasets.py
|
kernelmachine/tuna
|
7680efa522d0f97c80decb6555c721a413faba33
|
[
"Apache-2.0"
] | null | null | null |
tuna/datasets.py
|
kernelmachine/tuna
|
7680efa522d0f97c80decb6555c721a413faba33
|
[
"Apache-2.0"
] | null | null | null |
tuna/datasets.py
|
kernelmachine/tuna
|
7680efa522d0f97c80decb6555c721a413faba33
|
[
"Apache-2.0"
] | null | null | null |
DATASETS = {
"imdb": {
"train": "s3://suching-dev/final-datasets/imdb/train.jsonl",
"dev": "s3://suching-dev/final-datasets/imdb/dev.jsonl",
"test": "s3://suching-dev/final-datasets/imdb/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/imdb/unlabeled.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/imdb/valid_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/imdb/valid_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/imdb/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/imdb/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/imdb/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/imdb/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/imdb/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/imdb/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/imdb/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/imdb/vae.bgfreq.json"
}
},
"1b": {
"train": "s3://suching-dev/final-datasets/1b/train.jsonl",
"test": "s3://suching-dev/final-datasets/1b/test.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/1b/test_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/1b/test_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/1b/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/1b/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/1b/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/1b/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/1b/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/1b/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/1b/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/1b/vae.bgfreq.json"
}
},
"amazon": {
"train": "s3://suching-dev/final-datasets/amazon/train.jsonl",
"dev": "s3://suching-dev/final-datasets/amazon/dev.jsonl",
"test": "s3://suching-dev/final-datasets/amazon/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/amazon/unlabeled.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/amazon/valid_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/amazon/valid_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/amazon/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/amazon/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/amazon/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/amazon/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/amazon/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/amazon/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/amazon/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/amazon/vae.bgfreq.json"
}
},
"yahoo": {
"train": "s3://suching-dev/final-datasets/yahoo/train.jsonl",
"dev": "s3://suching-dev/final-datasets/yahoo/dev.jsonl",
"test": "s3://suching-dev/final-datasets/yahoo/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/yahoo/unlabeled.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/yahoo/valid_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/yahoo/valid_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/yahoo/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/yahoo/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/yahoo/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/yahoo/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/yahoo/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/yahoo/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/yahoo/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/yahoo/vae.bgfreq.json"
}
},
"hatespeech": {
"train": "s3://suching-dev/final-datasets/hatespeech/train.jsonl",
"dev": "s3://suching-dev/final-datasets/hatespeech/dev.jsonl",
"test": "s3://suching-dev/final-datasets/hatespeech/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/hatespeech/unlabeled.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/hatespeech/valid_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/hatespeech/valid_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/hatespeech/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/hatespeech/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/hatespeech/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/hatespeech/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/hatespeech/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/hatespeech/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/hatespeech/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/hatespeech/vae.bgfreq.json"
}
},
"ag-news": {
"train": "s3://suching-dev/final-datasets/ag-news/train.jsonl",
"dev": "s3://suching-dev/final-datasets/ag-news/dev.jsonl",
"test": "s3://suching-dev/final-datasets/ag-news/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/ag-news/unlabeled.jsonl",
"reference_counts": "s3://suching-dev/final-datasets/ag-news/valid_npmi_reference/train.npz",
"reference_vocabulary": "s3://suching-dev/final-datasets/ag-news/valid_npmi_reference/train.vocab.json",
"stopword_path": "s3://suching-dev/stopwords/snowball_stopwords.txt",
"glove": "s3://suching-dev/pretrained-models/glove/ag-news/vectors.txt",
"elmo": {
"frozen": "s3://allennlp/models/transformer-elmo-2019.01.10.tar.gz",
"fine-tuned": "s3://suching-dev/pretrained-models/elmo/ag-news/model.tar.gz",
"in-domain": "s3://suching-dev/pretrained-models/in-domain-elmo/ag-news/model.tar.gz"
},
"bert": {
"weights": "s3://suching-dev/pretrained-models/bert/ag-news/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/bert/ag-news/vocab.txt"
},
"vae": {
"model_archive": "s3://suching-dev/pretrained-models/vae_best_npmi/ag-news/model.tar.gz",
"vocab": "s3://suching-dev/pretrained-models/vae_best_npmi/ag-news/vae.txt",
"bg_freq": "s3://suching-dev/pretrained-models/vae_best_npmi/ag-news/vae.bgfreq.json"
}
}
}
| 60.020548
| 116
| 0.631861
| 1,102
| 8,763
| 4.937387
| 0.049909
| 0.145561
| 0.194082
| 0.194082
| 0.974453
| 0.964529
| 0.915089
| 0.89377
| 0.780555
| 0.753906
| 0
| 0.021516
| 0.177907
| 8,763
| 145
| 117
| 60.434483
| 0.733759
| 0
| 0
| 0.208333
| 0
| 0.076389
| 0.742896
| 0.639051
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
973a5e2b4028589484d75c1af577587d8b4a2d29
| 3,506
|
py
|
Python
|
assistant.py
|
yrzgithub/Voice-Assistant
|
e9d1c43da4078584ab986dfa0dda74441e56db34
|
[
"MIT"
] | null | null | null |
assistant.py
|
yrzgithub/Voice-Assistant
|
e9d1c43da4078584ab986dfa0dda74441e56db34
|
[
"MIT"
] | null | null | null |
assistant.py
|
yrzgithub/Voice-Assistant
|
e9d1c43da4078584ab986dfa0dda74441e56db34
|
[
"MIT"
] | null | null | null |
from pyttsx3 import init
from speech_recognition import Recognizer, Microphone
from pywhatkit import playonyt, search
from pyjokes import get_joke
from keyboard import wait
recog = Recognizer()
convertor = init()
voices = convertor.getProperty("voices")
convertor.setProperty("voice", voices[1].id) # female voice
def SayAndPrint(text):
print(text)
convertor.say(text)
convertor.runAndWait()
def action(command):
print(command)
if "play" in command:
command = command.replace("play ", "")
print(command)
SayAndPrint("Playing...")
playonyt(command)
elif "are you single" in command:
SayAndPrint("Sorry dear,I already have a boyfriend...It's you..")
elif "search" in command:
SayAndPrint("Searching...")
command = command.replace("search ", "")
print(command)
search(command)
elif "joke" in command:
SayAndPrint("ok..")
SayAndPrint(get_joke())
else:
SayAndPrint("Sorry! Come again...")
def assistant():
with Microphone() as s:
try:
recog.adjust_for_ambient_noise(source=s, duration=3)
SayAndPrint("Listening...")
voice = recog.listen(s, timeout=5)
command = recog.recognize_google(voice)
command = command.lower()
print(command)
if "ok dear" in command:
command = command.replace("ok dear ", "")
action(command)
except:
SayAndPrint("Sorry dear, Couldn't catch you at the moment...")
while True:
assistant()
SayAndPrint("press ctrl+a to listen again...")
wait("ctrl+a")
# optimized
from pyttsx3 import init
from speech_recognition import Recognizer, Microphone
from pywhatkit import playonyt, search
from pyjokes import get_joke
from keyboard import wait
speech_recognizer = Recognizer()
convertor = init()
voices = convertor.getProperty("voices")
convertor.setProperty("voice", voices[1].id) # female voice
def SayAndPrint(text):
print(text)
convertor.say(text)
convertor.runAndWait()
def action(command):
print(command)
if "play" in command:
command = command.replace("play ", "")
print(command)
SayAndPrint("Playing...")
playonyt(command)
elif "are you single" in command:
SayAndPrint("Sorry dear,I already have a boyfriend...It's you..")
elif "search" in command:
SayAndPrint("Searching...")
command = command.replace("search ", "")
print(command)
search(command)
elif "joke" in command:
SayAndPrint("ok..")
SayAndPrint(get_joke())
else:
SayAndPrint("Sorry! Come again...")
def assistant():
with Microphone() as s:
try:
recog.adjust_for_ambient_noise(source=s, duration=3)
SayAndPrint("Listening...")
voice = recog.listen(s, timeout=5)
command = recog.recognize_google(voice)
command = command.lower()
print(command)
if "boss" in command:
command = command.replace("ok dear ", "")
action(command)
except:
SayAndPrint("Sorry dear, Couldn't catch you at the moment...")
while True:
assistant()
SayAndPrint("press ctrl+a to listen again...")
wait("ctrl+a")
| 26.164179
| 75
| 0.591272
| 369
| 3,506
| 5.577236
| 0.238482
| 0.081633
| 0.061224
| 0.044704
| 0.980564
| 0.980564
| 0.980564
| 0.980564
| 0.980564
| 0.980564
| 0
| 0.003239
| 0.295493
| 3,506
| 133
| 76
| 26.360902
| 0.82996
| 0.009983
| 0
| 0.96
| 0
| 0
| 0.153962
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.06
| false
| 0
| 0.1
| 0
| 0.16
| 0.1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
9754445b054bb5843085836fcf5fc626bd79145b
| 7,074
|
py
|
Python
|
tests/monday_types/status_type_tests.py
|
harryrobbins/moncli
|
af3bc68fb73f24dc978197ae8a45aa665c09b431
|
[
"BSD-3-Clause"
] | 40
|
2019-11-22T19:52:18.000Z
|
2022-03-26T09:03:10.000Z
|
tests/monday_types/status_type_tests.py
|
harryrobbins/moncli
|
af3bc68fb73f24dc978197ae8a45aa665c09b431
|
[
"BSD-3-Clause"
] | 35
|
2019-09-24T22:27:43.000Z
|
2022-03-31T19:54:03.000Z
|
tests/monday_types/status_type_tests.py
|
harryrobbins/moncli
|
af3bc68fb73f24dc978197ae8a45aa665c09b431
|
[
"BSD-3-Clause"
] | 17
|
2020-04-10T18:55:10.000Z
|
2022-03-14T14:45:24.000Z
|
import json
from schematics.exceptions import ConversionError
from nose.tools import eq_,raises
from enum import Enum
from moncli import column_value as cv
from moncli.enums import ColumnType
from moncli.types import StatusType
# default class and data mapping declaration for common use
class Status(Enum):
ready = 'Ready'
in_progress = 'In Progress'
done = 'Done'
def test_should_succeed_when_to_native_returns_a_str_when_passing_in_a_statusvalue_value_with_api_data_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status')
format = status_type.to_native(column_value)
# Assert
eq_(format,'In Progress')
def test_should_succeed_when_to_native_returns_an_enum_class_when_passing_in_a_status_value_value_with_api_data_has_enum_type_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 2}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_native('Done')
# Assert
eq_(format,Status.done)
def test_should_succeed_when_to_native_returns_a_str_when_passing_in_a_int_value_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status')
status_type.to_native(column_value)
format = status_type.to_native(1)
# Assert
eq_(format,'In Progress')
def test_should_succeed_when_to_native_returns_a_str_when_passed_a_str_value_that_is_a_valid_label_index_int_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status')
status_type.to_native(column_value)
format = status_type.to_native("1")
# Assert
eq_(format,'In Progress')
def test_should_succeed_when_to_native_returns_a_str_when_passed_a_str_value_that_is_a_valid_label_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status')
status_type.to_native(column_value)
format = status_type.to_native('In Progress')
# Assert
eq_(format,'In Progress')
def test_should_suceed_when_to_native_return_enum_value_when_pass_str_and_status_type_has_enum_value_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 2}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_native('Done')
# Assert
eq_(format,Status.done)
def test_should_suceed_when_to_native_return_enum_value_when_pass_enum_value_and_status_type_has_enum_value_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 2}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_native(Status.done)
# Assert
eq_(format,Status.done)
@raises(ConversionError)
def test_should_succeed_when_to_native_raises_a_conversionerror_when_passed_either_an_invalid_int_or_str_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
status_type = StatusType(title='Status')
status_type.to_native(column_value)
# Act
status_type.to_native('Not Done')
@raises(ConversionError)
def test_should_succeed_when_to_native_raises_a_conversionerror_when_passed_invalid_value_with_enum_class_to_status_type():
# Arrange
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
# Act
status_type.to_native('Not Done')
def test_should_succeed_when_to_primitive_returns_empty_dict_when_passed_in_a_none_to_status_type():
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_primitive(None)
# Assert
eq_(format,{})
def test_should_succeed_when_to_primitive_returns_export_dict_when_passed_in_a_str_value_to_status_type():
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_primitive("Done")
# Assert
eq_(format,{'index': 2})
def test_should_succeed_when_to_primitive_returns_export_dict_when_passed_in_a_str_or_enum_class_value__to_status_type():
settings_str = json.dumps({'labels': {'0': 'Ready','1':'In Progress','2': 'Done'}})
column_value = cv.create_column_value(ColumnType.status, id='status', title='Status 1',value=json.dumps({'index': 1}),settings_str=settings_str)
# Act
status_type = StatusType(title='Status',as_enum=Status)
status_type.to_native(column_value)
format = status_type.to_primitive(Status.done)
# Assert
eq_(format,{'index': 2})
| 37.036649
| 148
| 0.734379
| 1,019
| 7,074
| 4.705594
| 0.081452
| 0.10219
| 0.05756
| 0.075078
| 0.895725
| 0.888425
| 0.867362
| 0.867362
| 0.853598
| 0.853598
| 0
| 0.010396
| 0.129771
| 7,074
| 191
| 149
| 37.036649
| 0.768519
| 0.034917
| 0
| 0.659574
| 0
| 0
| 0.112141
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.12766
| false
| 0.12766
| 0.074468
| 0
| 0.244681
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
976497a4bfca1d72f1be3a3ff270a2d87c9afe34
| 525
|
py
|
Python
|
eval_mosmed_timm-regnetx_002_GridDropout.py
|
BrunoKrinski/segtool
|
cb604b5f38104c43a76450136e37c3d1c4b6d275
|
[
"MIT"
] | null | null | null |
eval_mosmed_timm-regnetx_002_GridDropout.py
|
BrunoKrinski/segtool
|
cb604b5f38104c43a76450136e37c3d1c4b6d275
|
[
"MIT"
] | null | null | null |
eval_mosmed_timm-regnetx_002_GridDropout.py
|
BrunoKrinski/segtool
|
cb604b5f38104c43a76450136e37c3d1c4b6d275
|
[
"MIT"
] | null | null | null |
import os
ls=["python main.py --configs configs/eval_mosmed_unetplusplus_timm-regnetx_002_0_GridDropout.yml",
"python main.py --configs configs/eval_mosmed_unetplusplus_timm-regnetx_002_1_GridDropout.yml",
"python main.py --configs configs/eval_mosmed_unetplusplus_timm-regnetx_002_2_GridDropout.yml",
"python main.py --configs configs/eval_mosmed_unetplusplus_timm-regnetx_002_3_GridDropout.yml",
"python main.py --configs configs/eval_mosmed_unetplusplus_timm-regnetx_002_4_GridDropout.yml",
]
for l in ls:
os.system(l)
| 47.727273
| 99
| 0.841905
| 80
| 525
| 5.15
| 0.3
| 0.121359
| 0.145631
| 0.230583
| 0.88835
| 0.88835
| 0.88835
| 0.88835
| 0.88835
| 0.88835
| 0
| 0.040486
| 0.059048
| 525
| 11
| 100
| 47.727273
| 0.793522
| 0
| 0
| 0
| 0
| 0
| 0.874525
| 0.636882
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.111111
| 0
| 0.111111
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
9775713bfa1b0933bda9c9f307aed58430ae4837
| 287
|
py
|
Python
|
lg_media/src/lg_media/__init__.py
|
FuriousJulius/lg_ros_nodes
|
15a84c5022ab2f5b038d11a5589cd4a34010b1d6
|
[
"Apache-2.0"
] | 16
|
2015-10-10T11:55:37.000Z
|
2022-02-24T22:47:48.000Z
|
lg_media/src/lg_media/__init__.py
|
FuriousJulius/lg_ros_nodes
|
15a84c5022ab2f5b038d11a5589cd4a34010b1d6
|
[
"Apache-2.0"
] | 292
|
2015-09-29T21:59:53.000Z
|
2022-03-31T15:59:31.000Z
|
lg_media/src/lg_media/__init__.py
|
constantegonzalez/lg_ros_nodes
|
1c7b08c42e90205922602c86805285508d1b7971
|
[
"Apache-2.0"
] | 5
|
2017-05-03T06:22:43.000Z
|
2021-08-19T16:54:14.000Z
|
from .mplayer_pool import MplayerPool
from .mplayer_pool import ManagedMplayer
from .gstreamer_pool import GstreamerPool
from .gstreamer_pool import ManagedGstreamer
from .director_media_bridge import DirectorMediaBridge
from .mplayer_pool import DEFAULT_ARGS, SRV_QUERY, ROS_NODE_NAME
| 35.875
| 64
| 0.878049
| 37
| 287
| 6.513514
| 0.540541
| 0.207469
| 0.186722
| 0.261411
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094077
| 287
| 7
| 65
| 41
| 0.926923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
c144fd87360f271a2efb1d2859fa57f392e7d6be
| 181
|
py
|
Python
|
ukb/dataloaders/__init__.py
|
wi905252/ukb-cardiac-mri
|
3177dde898a65b1d7f385b78e4f134de3852bea5
|
[
"Apache-2.0"
] | 19
|
2018-05-30T22:13:17.000Z
|
2022-01-18T14:04:40.000Z
|
ukb/dataloaders/__init__.py
|
wi905252/ukb-cardiac-mri
|
3177dde898a65b1d7f385b78e4f134de3852bea5
|
[
"Apache-2.0"
] | 1
|
2019-08-07T07:29:07.000Z
|
2019-08-07T08:54:10.000Z
|
ukb/dataloaders/__init__.py
|
wi905252/ukb-cardiac-mri
|
3177dde898a65b1d7f385b78e4f134de3852bea5
|
[
"Apache-2.0"
] | 8
|
2019-07-03T23:19:43.000Z
|
2021-11-15T17:09:24.000Z
|
from .ukbb import UKBBCardiacMRI
from .ukbb import UKBBCardiacMRIMeta
from .ukbb import UKBBCardiacMRICache
from .ukbb import stratified_sample_dataset
from .cifar10 import CIFAR10
| 30.166667
| 43
| 0.861878
| 22
| 181
| 7
| 0.454545
| 0.207792
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024845
| 0.110497
| 181
| 5
| 44
| 36.2
| 0.931677
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
c15201965dd8363bd1762c1ce90f122fd9fa19de
| 45,480
|
py
|
Python
|
release/stubs.min/Grasshopper/Kernel/Graphs.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 182
|
2017-06-27T02:26:15.000Z
|
2022-03-30T18:53:43.000Z
|
release/stubs.min/Grasshopper/Kernel/Graphs.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 28
|
2017-06-27T13:38:23.000Z
|
2022-03-15T11:19:44.000Z
|
release/stubs.min/Grasshopper/Kernel/Graphs.py
|
htlcnn/ironpython-stubs
|
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
|
[
"MIT"
] | 67
|
2017-06-28T09:43:59.000Z
|
2022-03-20T21:17:10.000Z
|
# encoding: utf-8
# module Grasshopper.Kernel.Graphs calls itself Graphs
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# functions
def GH_GraphProxyObject(n_owner): # real signature unknown; restored from __doc__
""" GH_GraphProxyObject(n_owner: IGH_Graph) """
pass
# classes
class GH_AbstractGraph(object,IGH_Graph,GH_ISerializable):
# no doc
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearCaches(self):
""" ClearCaches(self: GH_AbstractGraph) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_AbstractGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_AbstractGraph) """
pass
def CurveToPointFArray(self,*args):
""" CurveToPointFArray(Crv: Curve,dest: RectangleF) -> Array[PointF] """
pass
def Draw_PostRenderGraph(self,g,cnt):
""" Draw_PostRenderGraph(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PostRenderGrid(self,g,cnt):
""" Draw_PostRenderGrid(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PostRenderGrip(self,g,cnt,index):
""" Draw_PostRenderGrip(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer,index: int) """
pass
def Draw_PostRenderTags(self,g,cnt):
""" Draw_PostRenderTags(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderGrid(self,g,cnt):
""" Draw_PreRenderGrid(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderGrip(self,g,cnt,index):
""" Draw_PreRenderGrip(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer,index: int) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderTags(self,g,cnt):
""" Draw_PreRenderTags(self: GH_AbstractGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Duplicate(self):
""" Duplicate(self: GH_AbstractGraph) -> IGH_Graph """
pass
def EmitProxyObject(self):
""" EmitProxyObject(self: GH_AbstractGraph) -> IGH_GraphProxyObject """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_AbstractGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def IntersectionEvaluate(self,*args):
""" IntersectionEvaluate(C: Curve,offset: float) -> float """
pass
def OnGraphChanged(self,bIntermediate):
""" OnGraphChanged(self: GH_AbstractGraph,bIntermediate: bool) """
pass
def PrepareForUse(self):
""" PrepareForUse(self: GH_AbstractGraph) """
pass
def Read(self,reader):
""" Read(self: GH_AbstractGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_AbstractGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_AbstractGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_AbstractGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*args): #cannot find CLR constructor
""" __new__(cls: type,nName: str,nDescription: str) """
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
Description=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Description(self: GH_AbstractGraph) -> str
"""
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_AbstractGraph) -> Guid
"""
Grips=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Grips(self: GH_AbstractGraph) -> List[GH_GraphGrip]
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_AbstractGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_AbstractGraph) -> bool
"""
Name=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Name(self: GH_AbstractGraph) -> str
"""
GH_Evaluator=None
GraphChanged=None
class GH_BezierGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_BezierGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearCaches(self):
""" ClearCaches(self: GH_BezierGraph) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_BezierGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_BezierGraph) """
pass
def Curve(self,*args):
""" Curve(self: GH_BezierGraph) -> Curve """
pass
def Draw_PreRenderGrip(self,g,cnt,index):
""" Draw_PreRenderGrip(self: GH_BezierGraph,g: Graphics,cnt: GH_GraphContainer,index: int) -> GH_GraphDrawInstruction """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_BezierGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_BezierGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_BezierGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_BezierGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_BezierGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_BezierGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_BezierGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_BezierGraph) -> bool
"""
class GH_ConicGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_ConicGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_ConicGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_ConicGraph) """
pass
def Curve(self,*args):
""" Curve(self: GH_ConicGraph) -> NurbsCurve """
pass
def DestroyCurve(self,*args):
""" DestroyCurve(self: GH_ConicGraph) """
pass
def FitConic(self,*args):
""" FitConic(self: GH_ConicGraph,S: Point3d) -> NurbsCurve """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_ConicGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def MakeConic(self,*args):
""" MakeConic(self: GH_ConicGraph,w: float) -> NurbsCurve """
pass
def Read(self,reader):
""" Read(self: GH_ConicGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_ConicGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_ConicGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_ConicGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_ConicGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_ConicGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_ConicGraph) -> bool
"""
class GH_DoubleSineGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_DoubleSineGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearCaches(self):
""" ClearCaches(self: GH_DoubleSineGraph) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_DoubleSineGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_DoubleSineGraph) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: GH_DoubleSineGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderGrip(self,g,cnt,index):
""" Draw_PreRenderGrip(self: GH_DoubleSineGraph,g: Graphics,cnt: GH_GraphContainer,index: int) -> GH_GraphDrawInstruction """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_DoubleSineGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def GraphAccuracy(self,*args):
""" GraphAccuracy(self: GH_DoubleSineGraph,reg: RectangleF) -> float """
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_DoubleSineGraph,reader: GH_IReader) -> bool """
pass
def RecFromPoints(self,*args):
""" RecFromPoints(self: GH_DoubleSineGraph,a: PointF,b: PointF) -> Rectangle """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_DoubleSineGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_DoubleSineGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_DoubleSineGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_DoubleSineGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_DoubleSineGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_DoubleSineGraph) -> bool
"""
m_eq0=None
m_eq1=None
m_path0=None
m_path1=None
class GH_GaussianGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_GaussianGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_GaussianGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_GaussianGraph) """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_GaussianGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_GaussianGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_GaussianGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_GaussianGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_GaussianGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_GaussianGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_GaussianGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_GaussianGraph) -> bool
"""
class GH_GraphContainer(object,GH_ISerializable,IGH_ResponsiveObject):
"""
GH_GraphContainer(n_graph: IGH_Graph)
GH_GraphContainer(n_graph: IGH_Graph,n_x0: float,n_x1: float,n_y0: float,n_y1: float)
"""
def ClearCaches(self):
""" ClearCaches(self: GH_GraphContainer) """
pass
def Duplicate(self):
""" Duplicate(self: GH_GraphContainer) -> GH_GraphContainer """
pass
def FromX(self,t):
""" FromX(self: GH_GraphContainer,t: float) -> float """
pass
def FromY(self,t):
""" FromY(self: GH_GraphContainer,t: float) -> float """
pass
def Internal_Render_Graph(self,*args):
""" Internal_Render_Graph(self: GH_GraphContainer,G: Graphics) """
pass
def Internal_Render_Grip(self,*args):
""" Internal_Render_Grip(self: GH_GraphContainer,g: Graphics,x: int,y: int) """
pass
def Internal_Render_Grips(self,*args):
""" Internal_Render_Grips(self: GH_GraphContainer,G: Graphics) """
pass
def Internal_Render_HorizontalConstraint(self,*args):
""" Internal_Render_HorizontalConstraint(self: GH_GraphContainer,g: Graphics,y: int) """
pass
def Internal_Render_InvalidIcon(self,*args):
""" Internal_Render_InvalidIcon(self: GH_GraphContainer,g: Graphics) """
pass
def Internal_Render_LockedIcon(self,*args):
""" Internal_Render_LockedIcon(self: GH_GraphContainer,g: Graphics) """
pass
def Internal_Render_TagGDIObjects(self,*args):
""" Internal_Render_TagGDIObjects(self: GH_GraphContainer,zoom: Single,bg_brush: SolidBrush,fg_brush: SolidBrush,fg_pen: Pen) -> (SolidBrush,SolidBrush,Pen) """
pass
def Internal_Render_TagX(self,*args):
""" Internal_Render_TagX(self: GH_GraphContainer,g: Graphics,graphrec: RectangleF,r_a: float,r_b: float) """
pass
def Internal_Render_TagY(self,*args):
""" Internal_Render_TagY(self: GH_GraphContainer,g: Graphics,graphrec: RectangleF,r_a: float,r_b: float) """
pass
def Internal_Render_TextTag(self,*args):
""" Internal_Render_TextTag(self: GH_GraphContainer,g: Graphics,graphrec: RectangleF,lowerright: bool,tag: str) """
pass
def Internal_Render_VerticalConstraint(self,*args):
""" Internal_Render_VerticalConstraint(self: GH_GraphContainer,g: Graphics,x: int) """
pass
def NearestGrip(self,*args):
""" NearestGrip(self: GH_GraphContainer,pt: PointF,max_search: float) -> int """
pass
def OnGraphChanged(self,bIntermediate):
""" OnGraphChanged(self: GH_GraphContainer,bIntermediate: bool) """
pass
def PrepareForUse(self):
""" PrepareForUse(self: GH_GraphContainer) """
pass
def Read(self,reader):
""" Read(self: GH_GraphContainer,reader: GH_IReader) -> bool """
pass
def RemapPointsToGraphRegion(self,pts):
""" RemapPointsToGraphRegion(self: GH_GraphContainer,pts: Array[PointF]) """
pass
def Render(self,G,bIncludeDomainTags,samples):
""" Render(self: GH_GraphContainer,G: Graphics,bIncludeDomainTags: bool,samples: List[float]) """
pass
@staticmethod
def Render_GraphBackground(G,region,bActive):
""" Render_GraphBackground(G: Graphics,region: RectangleF,bActive: bool) """
pass
@staticmethod
def Render_GraphGrid(G,region):
""" Render_GraphGrid(G: Graphics,region: RectangleF) """
pass
@staticmethod
def Render_GraphPen():
""" Render_GraphPen() -> Pen """
pass
@staticmethod
def Render_GuidePen():
""" Render_GuidePen() -> Pen """
pass
@staticmethod
def Render_HorizontalConstraint(g,rec,t):
""" Render_HorizontalConstraint(g: Graphics,rec: RectangleF,t: float) """
pass
@staticmethod
def Render_VerticalConstraint(g,rec,t):
""" Render_VerticalConstraint(g: Graphics,rec: RectangleF,t: float) """
pass
def RespondToKeyDown(self,sender,e):
""" RespondToKeyDown(self: GH_GraphContainer,sender: GH_Canvas,e: KeyEventArgs) -> GH_ObjectResponse """
pass
def RespondToKeyUp(self,sender,e):
""" RespondToKeyUp(self: GH_GraphContainer,sender: GH_Canvas,e: KeyEventArgs) -> GH_ObjectResponse """
pass
def RespondToMouseDoubleClick(self,sender,e):
""" RespondToMouseDoubleClick(self: GH_GraphContainer,sender: GH_Canvas,e: GH_CanvasMouseEvent) -> GH_ObjectResponse """
pass
def RespondToMouseDown(self,sender,e):
""" RespondToMouseDown(self: GH_GraphContainer,sender: GH_Canvas,e: GH_CanvasMouseEvent) -> GH_ObjectResponse """
pass
def RespondToMouseMove(self,sender,e):
""" RespondToMouseMove(self: GH_GraphContainer,sender: GH_Canvas,e: GH_CanvasMouseEvent) -> GH_ObjectResponse """
pass
def RespondToMouseUp(self,sender,e):
""" RespondToMouseUp(self: GH_GraphContainer,sender: GH_Canvas,e: GH_CanvasMouseEvent) -> GH_ObjectResponse """
pass
def SolveGraphPath(self,*args):
""" SolveGraphPath(self: GH_GraphContainer) -> GraphicsPath """
pass
def ToRegionBox(self,pt):
""" ToRegionBox(self: GH_GraphContainer,pt: PointF) -> PointF """
pass
def ToRegionBox_x(self,x):
""" ToRegionBox_x(self: GH_GraphContainer,x: float) -> Single """
pass
def ToRegionBox_y(self,y):
""" ToRegionBox_y(self: GH_GraphContainer,y: float) -> Single """
pass
def ToUnitBox(self,pt):
""" ToUnitBox(self: GH_GraphContainer,pt: PointF) -> PointF """
pass
def ToX(self,t_unit):
""" ToX(self: GH_GraphContainer,t_unit: float) -> float """
pass
def ToY(self,t_unit):
""" ToY(self: GH_GraphContainer,t_unit: float) -> float """
pass
def TryValueAt(self,t):
""" TryValueAt(self: GH_GraphContainer,t: float) -> float """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_GraphContainer,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_GraphContainer,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,n_graph,n_x0=None,n_x1=None,n_y0=None,n_y1=None):
"""
__new__(cls: type,n_graph: IGH_Graph)
__new__(cls: type,n_graph: IGH_Graph,n_x0: float,n_x1: float,n_y0: float,n_y1: float)
"""
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
Graph=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Graph(self: GH_GraphContainer) -> IGH_Graph
Set: Graph(self: GH_GraphContainer)=value
"""
LockGrips=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: LockGrips(self: GH_GraphContainer) -> bool
Set: LockGrips(self: GH_GraphContainer)=value
"""
Region=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Region(self: GH_GraphContainer) -> RectangleF
Set: Region(self: GH_GraphContainer)=value
"""
X0=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: X0(self: GH_GraphContainer) -> float
Set: X0(self: GH_GraphContainer)=value
"""
X1=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: X1(self: GH_GraphContainer) -> float
Set: X1(self: GH_GraphContainer)=value
"""
Y0=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Y0(self: GH_GraphContainer) -> float
Set: Y0(self: GH_GraphContainer)=value
"""
Y1=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Y1(self: GH_GraphContainer) -> float
Set: Y1(self: GH_GraphContainer)=value
"""
GraphChanged=None
GraphChangedEventHandler=None
m_graphpath=None
class GH_GraphDrawInstruction(Enum,IComparable,IFormattable,IConvertible):
""" enum GH_GraphDrawInstruction,values: none (0),skip (1) """
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self,*args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self,*args):
pass
def __gt__(self,*args):
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self,*args):
pass
def __lt__(self,*args):
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
none=None
skip=None
value__=None
class GH_GraphGrip(object):
"""
GH_GraphGrip()
GH_GraphGrip(nX: float,nY: float)
GH_GraphGrip(nX: float,nY: float,nConstraint: GH_GripConstraint)
GH_GraphGrip(nOther: GH_GraphGrip)
"""
def LimitToUnitDomain(self,bLimitX,bLimitY):
""" LimitToUnitDomain(self: GH_GraphGrip,bLimitX: bool,bLimitY: bool) """
pass
def OnGripChanged(self,bIntermediate):
""" OnGripChanged(self: GH_GraphGrip,bIntermediate: bool) """
pass
def SetIndex(self,nIndex):
""" SetIndex(self: GH_GraphGrip,nIndex: int) """
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
@staticmethod
def __new__(self,*__args):
"""
__new__(cls: type)
__new__(cls: type,nX: float,nY: float)
__new__(cls: type,nX: float,nY: float,nConstraint: GH_GripConstraint)
__new__(cls: type,nOther: GH_GraphGrip)
"""
pass
def __ne__(self,*args):
pass
Constraint=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Constraint(self: GH_GraphGrip) -> GH_GripConstraint
Set: Constraint(self: GH_GraphGrip)=value
"""
Index=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Index(self: GH_GraphGrip) -> int
"""
Point=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Point(self: GH_GraphGrip) -> PointF
"""
X=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: X(self: GH_GraphGrip) -> float
Set: X(self: GH_GraphGrip)=value
"""
Y=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Y(self: GH_GraphGrip) -> float
Set: Y(self: GH_GraphGrip)=value
"""
GripChanged=None
GripChangedEventHandler=None
m_c=None
m_i=None
m_x=None
m_y=None
class GH_GripConstraint(Enum,IComparable,IFormattable,IConvertible):
""" enum GH_GripConstraint,values: horizontal (1),none (0),vertical (2) """
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self,*args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self,*args):
pass
def __gt__(self,*args):
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self,*args):
pass
def __lt__(self,*args):
pass
def __ne__(self,*args):
pass
def __reduce_ex__(self,*args):
pass
def __str__(self,*args):
pass
horizontal=None
none=None
value__=None
vertical=None
class GH_LinearGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_LinearGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_LinearGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_LinearGraph) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: GH_LinearGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def EmitProxyObject(self):
""" EmitProxyObject(self: GH_LinearGraph) -> IGH_GraphProxyObject """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_LinearGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_LinearGraph,reader: GH_IReader) -> bool """
pass
def SetFromParameters(self,nA,nB):
""" SetFromParameters(self: GH_LinearGraph,nA: float,nB: float) """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_LinearGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_LinearGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_LinearGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_LinearGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_LinearGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_LinearGraph) -> bool
"""
GH_LinearGraphProxy=None
class GH_ParabolaGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_ParabolaGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_ParabolaGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_ParabolaGraph) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: GH_ParabolaGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_ParabolaGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_ParabolaGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_ParabolaGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_ParabolaGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_ParabolaGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_ParabolaGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_ParabolaGraph) -> bool
"""
class GH_PerlinGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_PerlinGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_PerlinGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_PerlinGraph) """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_PerlinGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Interpolate(self,*args):
""" Interpolate(self: GH_PerlinGraph,v0: float,v1: float,v2: float,v3: float,a: float) -> float """
pass
def Noise(self,*args):
""" Noise(self: GH_PerlinGraph,i: int) -> float """
pass
def Read(self,reader):
""" Read(self: GH_PerlinGraph,reader: GH_IReader) -> bool """
pass
def Smooth(self,*args):
""" Smooth(self: GH_PerlinGraph,x: float) -> float """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_PerlinGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_PerlinGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_PerlinGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_PerlinGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_PerlinGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_PerlinGraph) -> bool
"""
amplitude=None
decay=None
frequency=None
x_offset=None
y_offset=None
class GH_PowerGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_PowerGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_PowerGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_PowerGraph) """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_PowerGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_PowerGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_PowerGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_PowerGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_PowerGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_PowerGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_PowerGraph) -> bool
"""
class GH_SincGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_SincGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_SincGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_SincGraph) """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_SincGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_SincGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_SincGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_SincGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_SincGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_SincGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_SincGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_SincGraph) -> bool
"""
amplitude=None
frequency=None
X0=None
X1=None
x_shift=None
Y0=None
Y1=None
y_shift=None
class GH_SineEquation(object,GH_ISerializable):
""" GH_SineEquation() """
def Read(self,reader):
""" Read(self: GH_SineEquation,reader: GH_IReader) -> bool """
pass
def SetEquationFromGrips(self):
""" SetEquationFromGrips(self: GH_SineEquation) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_SineEquation,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_SineEquation,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
amplitude=None
frequency=None
offset=None
shift=None
X0=None
X1=None
Y0=None
Y1=None
class GH_SineGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_SineGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_SineGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_SineGraph) """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: GH_SineGraph,reg: RectangleF) -> Array[PointF] """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_SineGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_SineGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_SineGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_SineGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_SineGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_SineGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_SineGraph) -> bool
"""
m_eq=None
class GH_SquareRootGraph(GH_AbstractGraph,IGH_Graph,GH_ISerializable):
""" GH_SquareRootGraph() """
def AddGrip(self,*args):
""" AddGrip(self: GH_AbstractGraph,Grip: GH_GraphGrip) """
pass
def ClearGrips(self,*args):
""" ClearGrips(self: GH_AbstractGraph) """
pass
def CreateDerivedDuplicate(self,*args):
""" CreateDerivedDuplicate(self: GH_SquareRootGraph) -> GH_AbstractGraph """
pass
def CreateGrips(self,*args):
""" CreateGrips(self: GH_SquareRootGraph) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: GH_SquareRootGraph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def GHGraphToPointArray(self,*args):
"""
GHGraphToPointArray(reg: RectangleF,pix_accuracy: float,eval: GH_Evaluator) -> Array[PointF]
GHGraphToPointArray(self: GH_AbstractGraph,reg: RectangleF,pix_accuracy: float) -> Array[PointF]
"""
pass
def Internal_GripChanged(self,*args):
""" Internal_GripChanged(self: GH_AbstractGraph,grip: GH_GraphGrip,bIntermediate: bool) """
pass
def Read(self,reader):
""" Read(self: GH_SquareRootGraph,reader: GH_IReader) -> bool """
pass
def UpdateEquation(self,*args):
""" UpdateEquation(self: GH_SquareRootGraph) """
pass
def ValueAt(self,t):
""" ValueAt(self: GH_SquareRootGraph,t: float) -> float """
pass
def Write(self,writer):
""" Write(self: GH_SquareRootGraph,writer: GH_IWriter) -> bool """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: GH_SquareRootGraph) -> Guid
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: GH_SquareRootGraph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: GH_SquareRootGraph) -> bool
"""
class IGH_Graph(GH_ISerializable):
# no doc
def ClearCaches(self):
""" ClearCaches(self: IGH_Graph) """
pass
def Draw_PostRenderGraph(self,g,cnt):
""" Draw_PostRenderGraph(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PostRenderGrid(self,g,cnt):
""" Draw_PostRenderGrid(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PostRenderGrip(self,g,cnt,index):
""" Draw_PostRenderGrip(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer,index: int) """
pass
def Draw_PostRenderTags(self,g,cnt):
""" Draw_PostRenderTags(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) """
pass
def Draw_PreRenderGraph(self,g,cnt):
""" Draw_PreRenderGraph(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderGrid(self,g,cnt):
""" Draw_PreRenderGrid(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderGrip(self,g,cnt,index):
""" Draw_PreRenderGrip(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer,index: int) -> GH_GraphDrawInstruction """
pass
def Draw_PreRenderTags(self,g,cnt):
""" Draw_PreRenderTags(self: IGH_Graph,g: Graphics,cnt: GH_GraphContainer) -> GH_GraphDrawInstruction """
pass
def Duplicate(self):
""" Duplicate(self: IGH_Graph) -> IGH_Graph """
pass
def EmitProxyObject(self):
""" EmitProxyObject(self: IGH_Graph) -> IGH_GraphProxyObject """
pass
def GDI_GraphPath(self,reg):
""" GDI_GraphPath(self: IGH_Graph,reg: RectangleF) -> Array[PointF] """
pass
def OnGraphChanged(self,bIntermediate):
""" OnGraphChanged(self: IGH_Graph,bIntermediate: bool) """
pass
def PrepareForUse(self):
""" PrepareForUse(self: IGH_Graph) """
pass
def ValueAt(self,t):
""" ValueAt(self: IGH_Graph,t: float) -> float """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
Description=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Description(self: IGH_Graph) -> str
"""
GraphTypeID=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: GraphTypeID(self: IGH_Graph) -> Guid
"""
Grips=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Grips(self: IGH_Graph) -> List[GH_GraphGrip]
"""
Icon_16x16=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Icon_16x16(self: IGH_Graph) -> Image
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsValid(self: IGH_Graph) -> bool
"""
Name=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Name(self: IGH_Graph) -> str
"""
GraphChanged=None
GraphChangedEventHandler=None
class IGH_GraphProxyObject:
# no doc
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
| 31.495845
| 215
| 0.695712
| 5,485
| 45,480
| 5.46928
| 0.052325
| 0.053002
| 0.045602
| 0.045602
| 0.789226
| 0.757359
| 0.740658
| 0.705424
| 0.664956
| 0.645988
| 0
| 0.004377
| 0.156113
| 45,480
| 1,443
| 216
| 31.517672
| 0.777254
| 0.456706
| 0
| 0.837278
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.402367
| false
| 0.402367
| 0
| 0
| 0.58432
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 8
|
c1c3df28b85c74683dd8b54d3902662baea5f510
| 23
|
py
|
Python
|
login.py
|
wenher/test1
|
3db4c0fc85a8d087e80a75bf57f03f7a90d86903
|
[
"MIT"
] | null | null | null |
login.py
|
wenher/test1
|
3db4c0fc85a8d087e80a75bf57f03f7a90d86903
|
[
"MIT"
] | null | null | null |
login.py
|
wenher/test1
|
3db4c0fc85a8d087e80a75bf57f03f7a90d86903
|
[
"MIT"
] | null | null | null |
a = 1
b = 2
num = 3
| 3.285714
| 7
| 0.347826
| 6
| 23
| 1.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.272727
| 0.521739
| 23
| 6
| 8
| 3.833333
| 0.454545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
de072005df01e4c0ed057518a594762593353ce8
| 49
|
py
|
Python
|
python/src/chirpstack_api/nc/__init__.py
|
hoellejal/chirpstack-api
|
cadfed3f9f2f7947e31c45e3aa849ce4a4d55629
|
[
"MIT"
] | 55
|
2019-11-05T15:46:49.000Z
|
2022-03-23T14:31:33.000Z
|
python/src/chirpstack_api/nc/__init__.py
|
hoellejal/chirpstack-api
|
cadfed3f9f2f7947e31c45e3aa849ce4a4d55629
|
[
"MIT"
] | 39
|
2019-11-08T21:03:45.000Z
|
2022-03-01T12:40:36.000Z
|
python/src/chirpstack_api/nc/__init__.py
|
hoellejal/chirpstack-api
|
cadfed3f9f2f7947e31c45e3aa849ce4a4d55629
|
[
"MIT"
] | 101
|
2019-11-22T13:59:59.000Z
|
2022-03-14T09:52:46.000Z
|
from .nc_pb2_grpc import *
from .nc_pb2 import *
| 16.333333
| 26
| 0.755102
| 9
| 49
| 3.777778
| 0.555556
| 0.352941
| 0.529412
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04878
| 0.163265
| 49
| 2
| 27
| 24.5
| 0.780488
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
de0d095fbc1113249b9c6f86d9af58078bc376a6
| 246,845
|
py
|
Python
|
tool/cstar_perf/tool/static_vnode_tokens.py
|
cooldoger/cstar_perf
|
aceadd1d5a2331668647c53cca231ff9c1338eb4
|
[
"Apache-2.0"
] | 60
|
2015-01-01T03:01:40.000Z
|
2021-11-06T16:03:41.000Z
|
tool/cstar_perf/tool/static_vnode_tokens.py
|
cooldoger/cstar_perf
|
aceadd1d5a2331668647c53cca231ff9c1338eb4
|
[
"Apache-2.0"
] | 182
|
2015-01-04T20:02:54.000Z
|
2021-04-23T18:16:23.000Z
|
tool/cstar_perf/tool/static_vnode_tokens.py
|
datastax/cstar_perf
|
aceadd1d5a2331668647c53cca231ff9c1338eb4
|
[
"Apache-2.0"
] | 30
|
2015-03-11T14:37:38.000Z
|
2021-01-13T10:48:02.000Z
|
def get_token_group(partitioner="murmur3", group="static-random"):
return static_tokens[partitioner][group]
static_tokens = {
"murmur3": {
"static-random": [
"-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-1417918458648377457,-1437865264282801937,-1528957899674249742,-1532421237680415055,-1540441968969062574,-1572010881740353586,-1609475207664171197,-1769296612913295295,-1808427509963493918,-1846213939509713277,-1855127975471624116,-1932936102518991809,-194177010067139552,-1952824233669961721,-2168468618853198961,-2212811173632397422,-2224073043401917307,-2324126366734237452,-2333594840218514715,-2399207243138163479,-2468400764628181255,-2535151670914625344,-256572049336134077,-2807708543876815045,-2824235217461587214,-2862050507027826799,-3161378531057855291,-33354444488475910,-3414678289942729511,-3495784218411154482,-3498309815808227243,-3547701629156850550,-378574143863501072,-4085565831581058535,-4428900701724684480,-447925751549470690,-4484391549230244975,-4516127683125049368,-4520770367495045817,-4526455673979467044,-4789895439644164395,-4789939008522923682,-4791851219884036980,-479328201062052039,-5193708515461897497,-5259290934916184840,-5287100018888543991,-5434311813704112605,-5485234181114316569,-5531230855463284396,-5560445540509940445,-5573170948792478121,-5582835457588024126,-5590971545862520494,-5633057922737300203,-5653987746389399040,-5748552453115153721,-5789204859254779710,-58493423341241475,-5892789307037758994,-6138069628765147348,-6232174565472869987,-6258454253712869052,-6351054423933590212,-6452539623678517114,-6458550225775682960,-6530136652182001333,-6594290704404948144,-6626724893210212653,-6724660597464159485,-6733582555737793912,-683253233125245021,-6841734962714124989,-684923941206983018,-6991137209751225657,-7017601511188282369,-7045967603714801094,-7047820112313966295,-7118592887117829541,-7154027916738852126,-7203413107248770538,-721963781030433254,-7252106704486354294,-7299293149622522207,-7322204529042368967,-7359516805223044135,-7436562570874409293,-743665032201189314,-7456431369374526660,-7508374971750777118,-7604187469052017580,-7619815971787237746,-762478537565266951,-763039160668897702,-7639519061283395493,-7687399104077174947,-8047031735299971803,-8073527906801953224,-8140658990945760822,-8272362075808972489,-833359940464123242,-8346207404266052907,-8429785097011136681,-8450283389785914545,-8496821338871280399,-8610824821729181582,-8753699876501828244,-8936606387950325638,-8962104603791168874,-9039034678324394748,-9049200395961259459,-90912354054374957,-9139519280421250599,-9218090237793445577,-993292508310733358,1078413971171957957,1248383760297809762,1272857087861632642,1388899548943105009,145182080339842074,1473841409298313248,1596148396660125928,1860572072046861305,1887469759008167527,1888574768209110487,1943000144618783302,2003106197551290862,2010346674113809990,2158380534702843710,2187945304525703070,2219409718900620371,2248974176379646777,2257004732050933580,2281691900892557293,2350447051188191030,2431996411058927300,2521960790853751313,2578763542850666448,268580106975470266,271970015124526026,2729567531530773793,2761671927507893060,2792220549686476831,2857514219332672021,2880163934060595446,2980442735960721,3032843336599932622,313000243113586565,3140002907523799110,3219321358329561147,3224565228656120146,3333573227178927457,3367876339814508434,3423621598131584604,3682326506876367147,3873402299559710054,3911444089529273691,3983389303781520302,4016615062172288444,4086953216055836394,4122493600195583709,4146336803308481123,4221592225702172662,4425076215865530515,4469624565844897135,4754228129537925242,4790348565389467528,4867963783415200962,4895627214819184087,4897245474769479984,4946452353849304511,4999504194715592008,5020701832123928407,5046218046929323640,5132060203660259369,5200330496970511717,5222308561752736039,5244588401730705421,5273693839317643428,5299126755924257074,5323166894161388469,5355866216188403083,542474824220241407,5459349044974919050,5667247294059643266,5719359132374805038,5747992436212377688,5758314959301290064,594163751685517104,5957845271936421132,5976508064010876378,5985258173409607042,6027526262953798483,6073221581642062931,61494911653050657,6164421514204477878,616876365882979526,630539076635905943,6308872169364491054,63337669995045686,6335003451019547426,634975264558814806,6421023510315489216,6499151904426085196,6669588476604189439,6689628083368928810,6796972879647088276,6801453741360989606,7047316566068643767,711399345042811816,7131092542150673918,7182694917269861655,7332702358155165891,7384303957539756153,7420194482999410776,7514179493161478107,7595146187582612647,7610230873176633016,7668382907066868100,7748792911257865149,7772454146485348144,7778212381326428506,7809700179877682009,7856712253524734665,7887695466924756217,7978207241048434286,8017254598465592035,8120595865777366352,812403196308051554,8193632308147275733,8207934261420733145,8218348469760193372,8222076802255951097,826869528778347934,8343076612180304922,8369080281335857833,8438381123239628461,8486392554247546472,8523424687144966607,8594239920695785429,8634255894088353930,8859107409708909139,8880981180142656600,9066361774034559500,9179571299324141893,9200272704380354417,9217905515599141652,954923205786485257,986208086077001104,99945974533355999",
"-1076948781748165278,-1265355753840649734,-1284654606580560853,-1399315643001942870,-1417486090657422403,-1515961737342829497,-1543383064435665173,-1547235025256150167,-1578807387263906773,-1581048826713330067,-1611210544159981057,-1658446616987831898,-1700863490241633017,-1730860032074581540,-1815553251537777261,-1839287825723426127,-185331578140671825,-1859803792019531187,-188473071173018031,-2047666361809437899,-2323456002171668820,-2402763688662938,-2436959185709709594,-2530207948066687280,-2541759622097885027,-260507494319944276,-26258730538764638,-2652013470426692073,-2681062133008079324,-2714882728863509126,-2820975043153917658,-2830790122721430445,-2949989045848848106,-3103646342101894862,-3169351465923589159,-3233655317513704309,-3286540536669612586,-3410626150664737690,-3463529880953342860,-3554375525655618917,-3566202699588395093,-360463487663013023,-361603787617211181,-364906184870862942,-379376306199178110,-3815226751204143682,-3929941266353184088,-4032965972063329561,-4076613398816862488,-4118417828902204883,-4197277237620210035,-4406803893771515651,-445323847863978131,-4522901881093014740,-4789033389517978770,-4805864470388930610,-4812343116515889987,-4827554995156300922,-4988842929999256987,-5042593639855901993,-5085788251891086202,-5153355378635610841,-5174665415530279518,-5290468959788221941,-5396444922028416301,-5515674782489332582,-5687003457685279616,-5734898211562800602,-5743986211473411433,-579702232890384225,-58126367259657815,-5822163464823565988,-5831508888474250835,-584386283175275345,-5846740566695107137,-5974886906315790608,-6117137103299575923,-614101576203278166,-6199136011900394629,-6215669705282421043,-6234759842040568784,-6237659580493358419,-6351961631212618220,-6393052974592925477,-6590534861225833719,-6622472485707347827,-6676283093888131181,-6756141548926425344,-6804796042872090811,-7140968891231130393,-715456907340933496,-7312847488781882311,-7315322533786145970,-7486133579196976462,-7533119016560240415,-7803198045319375330,-7976441450491470265,-7987114731978309802,-8065220468278629855,-8192684199049029086,-8205353653972125680,-824431118618097458,-8287368053783335214,-8287587700317623390,-8400767228084887426,-8401513863143427910,-8457630403377574183,-8502587054064234255,-8568935199194806014,-8732383066011238984,-8753913388779905343,-8818131995568673688,-8837389680705197359,-8898183363408972032,-9005209222623674220,-9083061774649505985,-9173623876699563493,-9187698874298461157,-9219411747474251862,-936233333298036294,-953738364809556846,-960673813521865163,1016131234132290868,1046564331317896677,1117813533660315993,1153213906670631264,1289573155329441806,1315708271664143176,1317031553693708612,1421775197630803620,1501551442877449102,1589371488362164999,1734627085144531154,1735109187465724988,1785633559394988072,1819992993444881063,1861616360529737873,1928163302129522278,1952854268264727175,2113096253919011811,2126124004158387750,2147195531797733289,2159544107282627389,2219204834802088916,2250720897661829218,232017849170356974,2400995366451620546,2600174975322282399,2824479368318291539,2845274234816052452,2855975636047521095,3051858268701834559,3102105029052269545,3148992892884464949,3181319471692705248,3214433293295779057,3232641240979217115,3363205094782424254,3385463060671703452,3391630688724379950,3465060531204606952,3590501168956157645,3662064221633331580,3765225679297892319,3871611494471721888,391890219904768668,3969547209398708459,4021107627818576456,4204444618099778369,4211768763979814392,4245265140474405604,4442089944424307225,4762297505473109762,4839285735418804410,4854377161159703645,4859116817769247145,4892990026532819058,5015770667990538218,5058040869502524356,506313145717571148,5133351513386328915,5142557070951019647,5182407509056994296,5186217846024219198,5228424437322484887,5272797120871757902,5402656796824100460,5448241412085553238,5450453866042160565,546291006163997764,5536473806083398127,5544522401384564899,5620492941877181446,5621858189931526582,5752379812035341267,5790176068069584762,5846932846083026298,5864049612793712230,5881325951234146965,5921175583469955582,6098141657422305687,613247685960422143,6351394634143651413,6364486314852568326,6372868817570367327,6421075771940387094,6482533393425398686,662594319541955786,6635222878858831969,6636746598208714129,6641161932188707666,6660620821847407105,6741129163576808306,6864425155403538880,695888312684448910,6968204411172648353,6996337089398581495,7118280767844992561,7162355961712591564,7304785165142895753,7314823458373576285,7392798803318048721,7419160531946294147,7447171892379975201,7602251076354957306,763121193042927417,7639004630705023595,7664233124634297917,7708804826344184326,7789787305608244659,7842720054473540628,7856448999257331108,7905361251706048233,7961662196607203500,8035549040333901567,8115693295441625848,8284005345733007649,835224112027977782,8430100458099592987,8433700503635334716,8546068453278116332,8580631483990148985,8667664687091968337,8719615307957175341,8726647382030713488,8805092795197107728,8828193670842731488,8839106297550462080,8849132467349049990,8977669208137444973,9055324496387166115,9061876532112938567,9114054610040502973,9146558510533363732,9180265866957165127,9189960722729532614",
"-1026094134756146871,-1056550227233696857,-1104389388293329385,-110547985583240880,-1114967512459706369,-1163844016721535039,-1299718975984554892,-1392169149388511427,-1488000360236305962,-1543830071713543489,-1629959993581430262,-1644070625163479796,-1697359907333264902,-1697729226001149501,-1703831159876525603,-1729548017760019818,-1768089667980721667,-1910646041523192454,-2287546473793316529,-2445605879273624284,-2473475462753496992,-2551987783363938460,-2586006343715020741,-2634314929732370546,-2694311330691111080,-2706819594003067380,-2711011656752202605,-2822181343512353901,-2846518989206307101,-2973296008064969979,-3032029554167781257,-3181686436134711767,-3241297393427464735,-3268117174616301446,-3292040831722872087,-3354457279377936451,-3513597071582371436,-3546532920613124439,-3550254347100395030,-3660509850265367517,-3773082334518063018,-4005324791622082166,-4042598968116905417,-41293052303524062,-4130058189841464756,-4394238942881954069,-4606847561603094454,-4623259429089303967,-4744800542708154315,-4782737927138381405,-488758815026125481,-4896954330882920609,-4941376821781276707,-5057125341661992025,-5060702899057346188,-5070518043541565174,-510484243693997521,-5109534246104491556,-5112888238042685432,-5169723762789032468,-53437696960152308,-5381137151734807643,-5466378095818096840,-5648357871004509755,-5839117111270299207,-5923497898786608227,-6139371929318919150,-6152373186405249560,-6156965880035279103,-6249431323512074438,-6481824539727208067,-6504829775546510742,-6528259804185181726,-6560456309770381342,-6584561847298512570,-6619912645180616038,-6735798091333928020,-6830335727917439070,-6830989773277280779,-6889580462411299245,-6893984495334932965,-6909963803333687358,-7080184436322902038,-7247227373473235938,-7343662344618221089,-7502554762994100745,-754918838144326870,-7735458082234123047,-7779996772849287420,-7833487239589650815,-7855879780846394699,-7933278178875412060,-7950726297156259811,-7971759521656212655,-8044553142392650199,-8133396179647556556,-814674892701359662,-8159049428593883580,-8211895200059809530,-8292354983715053726,-8635652542580553656,-8647627500115147304,-8847463952465135322,-8953208231118516716,-9077525831747832004,103338763324216526,104909427465514368,1129389601195668128,1135090189227630552,1166587729281527150,1169210971261768509,1220208862390149323,1270692962882603524,1332279077208128810,1393146048065722094,1415854701759989008,1455915161108051859,1469520492959690919,1471740569894251419,1555030024080598645,1609542956497151359,1642107101646356174,1719755789779695732,1734164405976751063,178453225359218466,1827339490631346024,1873787666783521977,1918499124121427722,2171457901067595638,219915069210764744,2226882100287211958,2230297383242096987,2249968059986607284,2275137634221914188,2292643012105794503,2459847424080400344,2506462566452075617,2596344535295873912,2620650813274727348,2624447403558300268,266668858084312260,2773143403367059627,2870390770780378952,3050830608590213971,3073444641967851774,3152273836013102974,3166590684169487953,3176343119678989062,3176381813688177876,3217737329354003164,3223108956300746971,3236931390462806341,3242213335505978658,3243596319252606786,3390558557838251211,341011389173876571,3451469389865007903,356458444886536736,3675702657879351292,3748258604365248233,3750234988656484547,3769737610064770831,3782320939794345416,3869494356669102037,3901481821446088386,393239659033642915,3952939842242132298,3959218255916296205,4016285748028926561,4026715172057740895,4051494368244526474,4090605107761628624,4093304386072198907,4094165512877189541,4137118808520935094,4145281013816433749,4150166947102846816,4178939295759695494,4215543352383986217,4253783507180384724,428604139941735664,4343396092650263474,4391488197483946853,4528938331430824063,4549436784556746581,4555354595444735556,4586381065649737296,4611865821453888465,4640843325798871616,4701170451017650512,4703893415044967803,485169204831259241,4888121532343933216,4935267318270948115,4943742271916570291,509396080706463785,5113054272759121346,5127671813439892682,5197399226269819664,5254533143979192743,5348002662758656885,5395107072829236208,5456742903948393751,5594302769673694478,5652174287353213916,5657511829569061802,5762756527365881065,5864477852975150066,5989715694983679245,599700849539730284,60095716207619474,6064548742391922630,6101125740144813426,6289841228484196215,6393135778235976348,6400665565475710747,6413594595402110174,6458793780053376537,6503675373856146121,6540043407217404925,6603031766157891390,6773779860518738372,6853483378870126818,6865537821281018043,6985790443453252130,70276192446697501,705790750066499493,7066593086676898269,7102519676946516450,7169244846299199034,7170249307988653160,7171660225122944279,7172439269306185561,7292861089552749895,7391608019874281719,7602340001870316537,7606305848548777620,7623575365911565093,7802205818478743175,7985400813282171307,8029496961562512650,8032023051659737005,8093142662073897853,8133971128420749155,8304543775051726826,8425353235598276319,8448387283550705991,8579218693210552228,8687568816941906467,8725317847673090339,8756242913241041709,897573647188012050,898671718707935763,9002358480857228168,9144101248756231520,9164708931581656990",
"-1010785617384475030,-101377257073549839,-1118956466977700834,-1168124385988592293,-1245670788627021171,-1279855608391005599,-1325724264556624930,-1332342595477124120,-1348616214569255615,-1364825924297803186,-1402020725429340913,-1547466843624488649,-1567141111749256578,-1683708515937670957,-1748294787849010528,-1835633633059884101,-190374276871510563,-1952060024596065654,-2045581560380049091,-2113099846785066339,-2130941716627944987,-2172532055332877127,-2254831776304270671,-2356688035399681503,-2373544856784278514,-2501067674716085500,-2533519064413603532,-2619922447855844153,-2625008619305401033,-2667145490854016280,-2876684730030267741,-2919907843583625791,-2990451938960871443,-299877479176197459,-3001100733682473834,-3171831997126213324,-3245328046084804841,-3290712063703785626,-331913681340288657,-3324735720970250955,-3338528575034651830,-334124052445745541,-3349788557239990605,-3369581844982630151,-3406014213558301968,-3497385195853056345,-3515757480349658100,-3563728432590803184,-3584307170924233873,-3621215662742127708,-3669987882289993190,-3720828746817180837,-3752196124307399696,-3754284142000806768,-3831023922402271068,-3898652929682148456,-3973047687680399015,-3980536969961986313,-3988135585078270551,-4001603880163804446,-404459187977120055,-4329965069680949686,-4351692977378757113,-4366056243075991299,-4397150365710872445,-4557930327714851306,-4596591452918134070,-4612587716436693242,-4629627990680894941,-4737230185860184407,-4871004482935990819,-5160836709218418297,-5246199856971795335,-5254474152398845998,-5281423024642391434,-5340150197271054230,-5612988632703626513,-5769548757129212994,-5774493090415607072,-5821449164819186694,-5871332922264139420,-6180605377724136442,-6256161378494650748,-6295996792384629083,-6442403530249502226,-6446226352819559751,-6537865076280653866,-6590772859746670169,-661113443794395797,-6657183101104471733,-6715188664747945025,-6812827832210086736,-6824527196628261507,-6853227563184005526,-6889150750859072469,-6929476631743311052,-6985145141710431741,-7008932531294982899,-7162867666695293022,-723983694850428094,-7555378008093455293,-7663967878339714716,-7674967179050914960,-7853729454142106167,-8027229633740231673,-80456507196607724,-8102992952289337553,-8117614850094251860,-822431508411022616,-8367503026959302513,-8396876984783806762,-8415419765809687590,-8445348312036306038,-8517916532972615502,-8642001993326170311,-8709817648868483755,-871280660292141567,-880887955148523373,-8837235833358709710,-8916472064021766112,-8930988371533710263,-8951853828293429338,-9031100864510789812,-9186373894081159180,1049060016799219301,1151766776731958572,1375046750297571226,1517184982185739613,1588867318863056437,1660100110291031583,1786697582045210107,1788262457326545334,1936063513411655629,1960123963822840979,1989764979397961548,1996934000453524282,206648837260029994,2125691926845485302,2141849887882402999,2149725666483065203,2186657680776134073,220215223075118283,2269266560666460124,2358570664590892891,2470851915599372450,2539035945161710348,2549316866818310930,2673786874762720889,2694379440326633575,271449695701194175,2752042068808851831,287201885726991467,2968002336177351983,2970326472433671591,2997108911628112433,3097889338792914717,3147295767667219865,3217560122512119847,3236836858180623083,3299713896416238713,3365472994061659527,3407615359844382754,3507579533637153227,3514475545050905994,3549781108503990500,361813262801198207,3706473186733120332,3790041973153895436,3804811550786160096,3837959872057168393,3888564829658296349,3907035873270055070,3980261131028290060,4143170711770557996,4163718240698993737,4166649314355626376,4295203140890325958,4309138400665475863,4395662400176407514,4447094946661947401,4450863498149232156,4535982825684782077,4593605959274538800,4602544629943508477,4602802541815407698,4631689955097608706,4903097760304499981,4933570564110435203,4958635829658234529,5363713890496642744,5384889809916295326,5514257869081127742,5573972904120505742,5604736679896297390,5652078880831609844,5652828750282476461,566108030805082943,5739001586399753082,5805582098978824463,582600819837764691,5891495955073922610,5927793544707434616,5962330387717680145,6151723753796449045,6169803097478896521,6178998753388430451,6214497985323073123,6335582577738383445,6389261775694218740,6422628223635950,6437897088347962052,6441377353209285531,6477420063228424670,6507036010248303495,6556289285578251563,6609856138230751811,6940317109143866337,695246415077501574,6964832784562548365,7071348277003189426,7148479766624456478,7199491717547573903,7244211702173290854,7266293911079288651,7341652060266278680,7368541387257109167,7399274499232759966,7437025338442622074,7534729974878208860,7580917193464764829,7631806175009286847,7654305843431818222,775044280114069572,7773534809195162297,780334360952603985,7853700417044847258,7907714680857377608,7998712250990590271,8017114013400071141,8051758642983975678,8054359353665967519,8062510633316520590,8197206817192799587,8320128335135538616,8360539882908629918,8426038297285278068,8426488588286228802,8511059640085529831,8584920704996390194,8719455182546519494,8724403676182080829,8739056590418557250,8993330792535653974,9081156398912122453,9082804785311202898,954069165026730841",
"-100569780225947643,-103316166419764519,-1125236481955076183,-1147609408748602190,-1271135478744100240,-1574157668970820273,-1715886224276485988,-1750365049061246853,-1794951430288109414,-1848372993611736214,-2017392838559960941,-2024354939420779532,-2061646116244883593,-2123041590897039942,-2302277794337408911,-2333294863220153965,-236202411400562746,-237638324293340984,-2435274957876096856,-2493955092560349432,-2555003727028349440,-26075501150498104,-2660203015472677653,-2701017277995981624,-2800804784163979430,-2823771471158562626,-2844963802693471953,-2851491844098361599,-2873961106127862041,-289586049311480938,-2961668200783356147,-3027788460102805405,-30459932940619658,-3059167358053061550,-3097382942583809883,-344850368051073639,-3523050856073246268,-3538055874878426234,-3583878616171339334,-3637869692266172715,-367243996880030377,-3682686903462799654,-3712821522225111317,-3789061046253803195,-3800578413509751829,-388231920782659904,-4086962795187355501,-4214760284542013994,-4278208367976993731,-457130036302959482,-4636648966810661797,-4751606236643256217,-475460915888163124,-4898957840298338691,-4932344304251596776,-4935568366783968386,-5052547807331696438,-5052744415277347405,-5057380277709075023,-5300562405417739720,-5355706217699248896,-5397520769508522260,-5417237349048830006,-542484119377578149,-5477705757971107870,-5491962838654576884,-5593962810294375878,-5605982953446579901,-5624593612248144107,-5801341319341502810,-5925967970738167473,-5930653276323146232,-5939473421084911447,-5957587810718323858,-6014129096743920598,-6114466360529602007,-6122294126475324427,-613664994600497467,-6171201159401358366,-6301271150634901200,-6453549292686673486,-6533092188160390929,-6568879223044747996,-6660991789199283620,-6685159586338042270,-6756245956985100979,-6778881088720462138,-6877839673062961065,-6885161620327785417,-7083939330686954116,-7156325163566588031,-7221189944643840082,-7234365610484025439,-7320677334163823211,-7351001142332935117,-7362324164671199037,-7455213208386847983,-7458062453144358466,-7507228724864810624,-7527045069588891713,-7591240013362301176,-7600016296651266028,-7612615658241333708,-7688285629168488665,-7705934162817872628,-7720886590835617021,-7901466204684835218,-7966753048619499314,-8026809237544219571,-8048705030210186866,-8181196482364731240,-8224787114241118832,-8316333974558969044,-8371129091110781840,-8535497143083403272,-8549933491132455542,-8568683974760191398,-8591975438885549689,-8618595053778883875,-8672623527379942745,-8813880629205825160,-8838781687601178732,-8891832575138718145,-8972001135870478050,-8997986957127840295,-994868224431552976,1022943252671084440,1132739405508944408,1248349087718373533,139355219544691184,1395346859289460691,1510773989236214729,1540909182461438771,159336517965044518,1599108313003331831,1673011649964274029,1684463271857324154,1722577628604921222,179113168040154165,1842525832901393901,1892966284970758511,1928253096340637286,2083617929493093164,2164095801827872787,2216728077346322377,2268350487103585184,233906971604712255,2366031838730983295,2407171593158470142,2544529789589605008,2753452750489746823,2806584376023910321,2808819519403812342,2833926151375493550,2863308403107764821,2876863735003830116,3099553541015617423,3115643965551495875,3162789404419551050,3247418397217997828,3283393143150584499,3305752867914933166,3324659034339168163,349354217780180373,3564913767560845209,3589144592313596242,35999745032901180,3640463612196069158,3724143617970818201,3792851217417792344,3798406660323901493,3921826225086646078,3935673362036631617,3967178233458140505,3984675692627616643,3993679507996273177,4040599481700719811,408854188419234586,4089393893447352023,4152651323155130806,4248682559918172660,4388308246785643989,4388765668853502310,4408268718958622072,4434482068281629628,4455322282530875481,4463978476214093725,4502352528867767125,4562963939455576553,4689052788117415969,4770711343428534330,4794252301421831753,4815356128447071244,5054759201437770526,5143352532595672321,5176879251039822800,5204059535403788302,5344587220180260043,53481705174567953,5464161414518147614,5471139409216849616,5584079203089803044,5641943318283892060,567201400780320622,5866202713311799734,5873141364223590055,598116734826698509,6049634136727856198,6199868106896670025,6312368510922244018,6322175702947747502,6337149695871779534,635113697600951284,6444555491122561794,6454377657277254723,6464763888522104527,6552888766426989045,6659064301439270658,669297332344845331,6697964239313019205,7130038064803774390,7438531032231793682,745009577338133751,7518909158103068012,753523570555647316,7576529052114840401,7586370909174788934,7595213466357005854,7609484772580243564,7823804237910730248,7850493625993118,7869311706465572185,7995582477067299931,8036019337549123152,8093655994106761227,8205686630856345453,8357588409083612274,8374697776121162919,842450097804824889,8464444619062218331,8626680026360582374,869438720307330002,8711454368870856727,8728754137805450099,8732595485604238472,8786813226319032118,8893079330876770505,890356934438925233,8957647839037525101,8961473886620218416,8989400484236349754,9089926814894622854,9101998684826354373,9105795953720313203,915547714381147280,988440729094757563",
"-1114345092571359644,-1139444488978708903,-1404156597060876103,-1420722365191946455,-1443305064002429413,-1511039661813240464,-1563577939520064468,-1609128124726044099,-2059579240346708631,-2089663247046589229,-2119785341924574329,-2140795026998002093,-2311100103858727671,-2438864992281120190,-2587743708696460680,-2651331818525233357,-2665472194996205964,-2742015415944699524,-2923000216884148630,-3085766133186206494,-3103481981859797228,-320624127585224417,-3231408739706824668,-3275055464806819837,-3330723620970860631,-3342918007491294643,-3346239327341015486,-3411055395678963828,-3521068403091231233,-356775388059726571,-3611174997281609321,-3789049669132624897,-392225887829235408,-3929529022392211247,-3948492008301118807,-4051007318451644203,-405282722592986082,-4076111133607261763,-4096150092499352845,-4200870669072129995,-4207336979803946415,-4218817063505148041,-422861887274329410,-4234754025263160709,-4389811568571558509,-4865651269273312022,-4994185625219256303,-5045901555841848147,-5048587898269748150,-5130133480511822062,-5264430452480524017,-5350279637638300564,-537374137996376509,-5429159903278950691,-5454422290956761866,-5563207336964926592,-5575284748022820582,-5684248771966177973,-5695796770349597868,-571184284809013432,-5718985574024205107,-5757536219162519554,-5761130735880722484,-5762481290200717923,-5768091424061833982,-5841741029895939150,-5883562374396034657,-5935364122577259158,-5996641850418558238,-6019800649563215090,-6117286779798204925,-6130206343871746362,-6154343107321239006,-622170389519154836,-6329768667516289133,-6532786919578778670,-6590446142134790525,-6621387162355550264,-665826258034839185,-6749483608976583337,-6771808945351979008,-6798598330064490368,-6986391165111804107,-7030075370503099513,-7277497501364841404,-7415349667641760506,-7510400508194193549,-7536048619429703847,-7606492451138866835,-7751469215433907598,-7753228658764953507,-7864314928324345709,-7907197856374666420,-7929254357878774451,-7962380167672223418,-7994322221508586704,-8049862644954607222,-8154882497038706211,-8157989269257219397,-8302000938152490930,-8318736307711486646,-8473160487594263916,-8481136460491418953,-8631567864943289064,-9009872689778601616,-9048165716557417739,-9059710760145371210,-9090318093196737396,-9132164555230523849,-9134588774396225562,-9186999193684068137,-9213665945159279301,100244961139360342,1077367579495833295,109663464380230478,1203068601969644541,1336229688285847451,134292692338157759,1421068447643283461,1430491682151766942,143829215007536099,1490311327074029982,1510158046682274596,1516382080439061397,1521745575337209594,1540847019258503651,1558418395622220804,1589016968505527176,1601311601314523212,1791576519830313341,1962731369208270054,1984463105965287933,1993949158872543328,207213565674140840,212791764828627723,2224364679092389496,2232289228197534633,228734036291728563,2346915519756491901,2349321316348032345,2383620160979697330,2391969846221290639,2439819008617995481,248417054935201746,261297871670255989,2690554665717527357,2696691859521362211,2829026839410334171,2892192057212202648,2894360481540100758,293574062398830981,2939860740253278850,3029706422164903786,3043870779733706811,30862831450329083,3153878149578494588,317427001656605214,3240925733918167126,3283451346782927946,3327758149590932796,3331996208937830079,3392761097341673054,3473943085689299806,3536151000862582156,3703474350131173059,3719006650257191100,3735694436597949265,3752485958520964398,3778407167230902761,3936523819378228977,3980653862717572286,4127121435354214490,4256900687042196597,4275056903269983089,4400030841410249489,442598335573270186,4465599129055661960,4593391059029657818,4718275077653296939,4725715228660709885,4728719896139111423,4750135277451484480,4768410326884690013,4805553276584812190,4891818607023871480,4898924374904771377,5003955089753656293,5029941189230336876,5126756726364588342,5271773205028301309,5329478118648373137,5440032033491178734,5530118603108026682,571664203583543970,5758618137287381694,5830703105276162780,5880226576790833442,590368056086607830,6318416306337362072,6342655018520830687,6398083668849017169,6410393844842172578,6455181926088789155,6565211934200689432,6582715104946944521,6623670188457483544,6661542046238781758,6677679888873826047,6740965515536052037,6767656046709470360,6846857627762102005,6922447033769706650,6960931818702746988,7008203078064216640,7079363645916651706,7111654517400160798,7148267847837817416,7246353726851400882,7276960318222455814,7283584517648997555,7303452088242851169,7450012027586532233,7462652276950977711,7497427099160557577,7505437872244461632,7528357104609310137,765325012847268537,7789946022583555083,7879056075968336554,7897258498001147266,7994343971391594308,7998991470072463522,8002064005183014794,8042252269103059116,809791594782772671,8194973868559868164,8262160053122254835,8285208002137945193,8288199030726063463,8324861760408607916,8330304335162686438,8348569457466039253,8377484850753475164,8630978571652690576,8743401380438233088,8824145561296584415,8825406805805007649,8911924945656664219,8997870531190801278,9043087833993566705,9116022290280119003,9120436685927937949,9126363120814419938,9138944015254473724,9183358442144667599,966290897271661867",
"-1060565251516677570,-1152130170839283840,-1158329350054059984,-1174061514451926441,-1179120205191810798,-1208254890409368611,-1388763003399254111,-1485307100885129318,-1514627712677356144,-1738545428062780101,-1849402882514946429,-1877686820773781719,-200498937378386248,-2066905532911252270,-2088209213530428838,-2258641111666503387,-2277045912587007051,-2315718008482708469,-2463663365832870459,-2578305255408051367,-2594242237298952245,-263276429486866767,-2634881546201242295,-2721950503735898426,-2785878550629125094,-2870936240540090074,-2982963442979834604,-3007876496427860430,-3015720651152456796,-3114248108444519682,-3195940304534489147,-3525532601185393069,-3541138812003479277,-3547000894675068444,-359917817874794016,-365405925516393417,-3723160614776306972,-3773525351591768884,-3849847950224922636,-3973044623624656151,-3975448249039440248,-3987064368542697674,-40095353858387639,-4180223285455050863,-4233869957685310866,-4252744456571092540,-4264400290310019029,-4358341775003586554,-4425281789419857126,-4446295898332439284,-4464466657242736277,-4520884084635461187,-4554402676959052689,-4582517859993076588,-4676013979753103992,-4687405695297632011,-4748126227079184224,-4762733829646074606,-4767992604231533560,-483903721865870685,-4846832756188889896,-4855140099363171847,-4857214107634189637,-4884837853911990951,-4895761193730390375,-4950837635787522799,-4998814617618944266,-5026054715096678128,-5062218209358488481,-5177208740457264040,-5182906888434172769,-5316307896014932753,-5424838488281970352,-5489387592740740817,-5513933359893628888,-5701029934053566053,-574454534826061100,-588138937842542641,-5931143137137057195,-5973032827482847075,-5994549437363982035,-6084292692684837117,-610043798611483245,-6127132282645549234,-6242988464674010563,-627605195459234825,-6505372939119357525,-6564464475209907371,-6662252979883760979,-6725995910653419657,-6758312070356452801,-6838535860224756570,-6853058302017497030,-6992359246930080328,-7008481385686689260,-704477865786505816,-7160511088619468809,-7184352586424718459,-7272927047246992079,-7367974458983328184,-7464908081910944434,-7505897444107143003,-7583209362673623201,-767685874422927392,-769406213701023230,-7704794850730308598,-7924806145033393172,-8051033326521991463,-8059939650707689610,-8071765648129498642,-81167987760800988,-8148681714354997055,-8169347580319881635,-8183115156706972864,-8186695247483238804,-8256946151672245663,-8389463154951462956,-8398136766239765070,-8408960067127759311,-844376815229704696,-8446082984520623085,-867425206393125865,-8704807344561794349,-8725190000359774719,-8743922090548140008,-8769586437163342426,-878203499261512671,-8815040580659965542,-8823830094514259392,-884859288332034459,-8943744833095481360,-8982852608556302084,-9013935946145256100,-9017260789762684066,-9034840627393450197,-9093767792946040455,1116130891619685990,1143619272467716582,1191882665606693426,1396569383514704165,1422324280059324787,1457515100255634875,1611731613169554493,1633086651232112190,1671695425417482258,1681399937375019756,1682432603668075018,1683906841959871406,1820786367093268072,1870881292626552551,1919417210727794373,194706185883012429,1948501133996487590,1968204921998822753,2034942077664829902,2149505284663335983,2232780479479715087,2235398101194782537,2383477572695646977,2552396655854376227,2693972613693563889,2763630481584745180,27985193455534094,2840371001399663027,2849524834566673548,2894283342537734758,2904617691810756644,2945202194548975476,3083872409668672343,3089646361362536376,3254626345102469419,3329399704952209255,3389602995200618757,340236408860171511,3402815251559556459,3419553802582404947,3482725687083332240,3484475857285446463,3485447501668186603,3657044767580226678,3791965060682676895,3920039837910531499,4041351292127414947,4091003458975747140,4400332773792725836,4413705353515399216,444003006369772286,4477820796460455562,4544691449665212032,456304584685878088,4789791255336681472,4813871555567310173,5186535867046332640,5264222228859544067,52654793841269447,5331792345575232584,5332641398801055403,5382050189632742007,5507736952813879663,5612200004408452148,5634108064351035705,5703826958949650517,5783606072133376803,5827571960995488961,5998464029525843101,6070222300627929792,6076335800251556463,613632572184870119,6156258240525606319,626269429646448447,6276847097449895427,6277006818519991245,6277635550987296773,6498967219942159837,6530505953823658361,6616773779010705150,6755521217517410030,6798410856041247481,6829651714618806901,688273046588668104,6997722750413604089,7031859687177446886,7195643271596321780,7350800240236398236,7373937787037312950,7379223459280262366,7381431811096696660,7460362681217203246,7467769174669971630,7561756468853564946,7665381880144498568,7861636541773011586,8038648972877972609,8071967371965333133,813326205821273189,8147264410399803912,8255172304796172786,8290704603418265483,8356474820252242762,8356663571099072,840483089965944942,8473969396873561871,8488350068676206936,8503333100093981897,8550719854091577014,8587570959140531158,8715241303451095375,87829095502246852,8857820514387962894,8884587073847195689,8973811021254944894,9108072062155567739,9110293876369090437,9139178548692710702,951400299071511791,982144329477560196",
"-1073304286026897507,-1092468754826259941,-1097901161128274842,-1266633387258139270,-1289848542208196961,-1302137047617363227,-1404734444548136704,-1413042425260469224,-1490227710393430291,-1508852917837975352,-1562148151884744099,-1578291859608659056,-1582871681480326398,-1616832590403650967,-1620278585180059221,-1647274896980926582,-1662792867308594312,-167992971745542304,-1713590890449744354,-1762839878765923945,-1770943436289584591,-1783996441336259888,-1786332230761225104,-1840979823027352882,-1990880175394613003,-2215473020936291972,-2217110540045364929,-2337182843091485484,-2389736680510600794,-2408419002832207148,-2441836388953857299,-262923138046939596,-2643390892760317769,-271551824510817720,-2810935469280553650,-2811758427257832520,-2910483216958757428,-2950098806522899544,-296256061326583722,-2978934932766716783,-2999334379755091194,-3005592882804229722,-3006823440137667026,-3008654522827887893,-3125877464818754627,-3128166935330315890,-3649510996887436501,-3728525233226543014,-3771673488519248736,-3810879881453827711,-3833928715292787147,-4006147065098263680,-4075545242487896056,-42157650166867899,-4316659519521154873,-4337666321604319169,-4357789629386949863,-4429019842088336591,-4439111311062938456,-4446606400358029422,-4491444399286562995,-4606956310069661335,-470003518074259791,-4758737261226171136,-4787430042456139573,-4790239270472060578,-4825251505806554965,-4856401527047600435,-4967383736174750552,-497497827560723160,-4977827887120539152,-503480133046345371,-5054287830578136329,-5099917078551528377,-5104160236006987757,-5199394059349874537,-5206444931488578053,-5223244127993844353,-5258003727217924413,-5400133683614981076,-5438375202000335235,-5449724595599085215,-5493393580975504572,-5564190249843474938,-5610147694019607551,-5673911063352476919,-5774707632970824418,-5803269913709727514,-5818415365991663759,-5841772426192903485,-585298067680773368,-595085721437446342,-6037339535471678099,-6058808386233468385,-6072346147159704587,-6090646113632222154,-6311186986739459368,-6330958310497644551,-6500594418426053939,-6533181613910059743,-6677705918371319196,-6736913857399755444,-6772948167569308813,-6855858527280727917,-6875568350307502430,-6953054577688871187,-6999568211663303025,-7235795212253666107,-7339666726094788224,-734779577905923850,-7404651205411868414,-7512873141665021890,-752603529120341767,-7569879903860446268,-764080161833818628,-7861987992563784230,-7915113196583925795,-7930113232924370064,-8188747735564217192,-8221393369769694408,-8231235578807445313,-8264288065711383720,-8343529793900056535,-8385085487057004381,-846106832541172258,-8500592693782182729,-8537608187344332358,-8693125352203869248,-8979135678642222782,-9077825253570677401,-9105366915565625120,-9119800577115062038,1282189235189770036,1321188088563407707,1334661725397817819,135145778133587606,1400236984833048942,1530831796514128282,1607260408541485560,1666048761775462198,1713180295219464361,1718801058493490247,1725369889780296676,1739580229379960944,1861759495226795947,1903989459799439856,1910843227001561514,1935016316178314804,1992153129609137511,2020247077463774984,2139814183808369889,2141270000514139383,2163572356803725154,222219598216872110,2224098403395377253,2296687059168878749,2390908184489374210,2418433156580566408,245211131642591749,2523129059794714124,2551799662666908526,2560575136471530673,2678372840477255104,2720237829479021462,2765807634160517558,2832843605800642757,284429439761910328,3034502545931574297,3067454377458638388,3077912151541801721,3091009076612972931,3201366594153678864,3204104007724378756,3305083686163010969,3328481169833654216,3505526673180721851,3554200327119642049,3587751674042457997,3784231145091791427,3802234788023512128,3903475940341722307,3962875734820457142,4040005126745851826,4101311837945858395,4137344149082319284,4169009951496522747,4173736161557044573,4207099669322521128,4265095576571432942,4344114664346178593,4456945698979559591,4507704314443345929,4525121688436741690,4532405133459659286,4644203751366412163,4682886697709342019,4688953584333611753,4693758817132861748,4754839461992133283,4848110314832005294,4892575794555538076,5021897678451428336,5035403484271569107,5114859066705640638,5128325319827012430,5141799886189980873,5215319958515494216,5315776300123409194,5315861766903943040,5323553733293285729,5329492055974220288,5408072640134556996,5494004298086360331,5537548048877864010,5563105991959351638,5586235122330994650,5811340998159087613,5853218328253984703,5882753151940763319,6049233977005879601,6188969712063132624,656630366479572741,6630015205051758207,6671090889615490726,6735951830353559295,6737402939161821734,6770260126453942452,6831124966701943979,6831598942161722799,6864580679382712931,7014223326539906206,7168094701326253063,7180545079126477915,7251862366520620545,7294695397008797104,7401405726986326033,7443721769581004123,7469730213953772637,7640583820676783449,7703286641235859178,7771714807649145401,7794418160986138387,7874817802561376901,7897756160392536688,7917598660766889679,7939239772328828688,7981099485648892466,7984249810351967952,8036106460623313229,8095979765186052012,8257056826442505257,8468528777620009657,8649129295778939072,8738840962419169010,8765078800268918151,9084735464209157949",
"-1075606026282666491,-1102886786808097171,-1131624780594722557,-1156119064484059374,-1167036565897906867,-117730648288405900,-1264628700858629425,-1324896276983361053,-1365290358296606210,-1384435774003250400,-144790982821856048,-1499437230449088487,-1529095974098741056,-1579761013315569362,-1615602613417394409,-1662717667941447347,-1688548067003889155,-1724116815417302591,-175691570051660257,-176892450715640880,-1906638131337587005,-2082346882379461666,-2101543031214832009,-2182418192324164135,-2192080843819192019,-2241724440332083009,-2241736456122104458,-2373533931135256353,-2406378394181853387,-2512128372366519306,-2559267661048671713,-2562434835496146252,-2588282413116342829,-2630899033049343544,-267996295134161992,-2708754102969168566,-2743163175699686438,-2757990468875477860,-2810436077166593313,-2875610255484244355,-3010230877195017204,-3011561763568787220,-3028582189907904956,-3073780787318682629,-3088338352661416925,-3098175410602894223,-3293980503011002828,-3308560002596538058,-3445252683494149251,-34553261321295663,-345811033719042350,-3480752423174017014,-3533463896628483948,-3596933352411894403,-363866779389933242,-3748660864566954973,-3807834228703870266,-3860677420265553341,-38901923317818418,-3904619850470851127,-4040300844106006355,-4042278941207959915,-4081909867179605070,-4248785160661843777,-4273569765970581728,-4280227993431536642,-4316439255252869575,-4357335878020250275,-443656781304734609,-4448154231028191741,-4482718811625970313,-4511910980364965627,-4591720365495311261,-4819936432386956004,-4885471070240807719,-4898507993080713262,-4920744164472533823,-4949446139567268300,-4969755543701078134,-4976088938560000809,-5088607435165292613,-5116646539908044900,-5206421127495427953,-5231863658435216447,-5275617287628965660,-5314199491415451109,-533181810594443446,-5339164860943711175,-5347667318035281356,-5377126357720105699,-5508337337410523975,-5553391490517274258,-5563557074020277537,-5624732197387490011,-5874295253845460338,-5953122850093504555,-6005147440335920607,-6031061515050397015,-6172505754135407677,-6295410352996656800,-6380723643916812247,-6381190232160324046,-6445697765171286853,-6460529987956090326,-6519524422518015563,-6542487627205103598,-6633091319166134742,-6650320038545775731,-6872799643691193169,-6874157138933457783,-6952809053311653836,-6972939797096712201,-6996665352579631165,-7229754018675502769,-7252039064686428949,-7356363927382354986,-7358985899146165609,-7388506378264274355,-7408845242345923392,-7555770650719052953,-7608106592911115120,-7643624857698535279,-7665785152390799008,-767074940060266227,-7846882664493880282,-7938783934285658383,-7964556439804430962,-8121226212716380973,-8312306436242550841,-8339377337592926154,-8346345317610618490,-8423143593682393550,-8470246679692897041,-853857396279039203,-863529036728245691,-8651452386619997680,-8754631478472695595,-8770990222086687500,-8778459856126934505,-8836376544765950216,-8969532074675137938,-9062166926925100383,-987026422564137720,1020115260059148589,1127072017643319293,122756045799290076,1234731313236900284,1243486942750443671,1284199029917975781,1373904917869173890,1494032352704724694,1525463894399812499,160614200368299426,1665770257738206712,1667252381980316036,1670421679843520151,1677865331397851261,1760247697896989416,180889030288444857,1841516403119266884,19710516799044283,1971700521199021983,2086438514059591800,2087817425482355991,2339507833236216106,2475711391623425223,2553017487743970718,2571699024898095321,264422766472795863,2852125696249901757,2865007479151815098,2997363992672316807,3021251148981520704,3075412995719562900,309194436970320875,3209374876081213013,3270305970653344366,3451477015595360077,3452271247778787164,3482462208944094068,3495460579389250144,3505226781686269546,3569241304529006795,3631435717879896765,3681319313775362703,3915030906910585998,3934886639051623754,402369418210136180,4066360699246013401,4122360266259749115,4162813465826057025,4185401461832627256,4241272867896607004,4407808538642452702,4674292256435676329,4718105472090546764,4877008815082934440,5066986792494537073,5160655381807922395,566805429404268648,5932756498847184326,5965528849653311178,6156694847009996005,6268993895019134239,6301883805379919407,6349198866129389355,6376045698178409882,6421871296891203156,6437756191503493596,6449853588799906082,6575735561056312109,657730036531265831,6651205741683111427,6681856261935443846,6745000288023662916,6832014599579449459,6914899364855985784,6916077355196237707,6927645284838065059,6956254028798651560,6983711884650228621,7083934693068175129,7160222926677271923,7283464837715088759,7349658343253713505,746759173120216176,7502766286731945284,751124875517354306,765738056150108046,7740313681379004599,7828792866294859424,7881817266756356141,7892570314225202202,7906745541143733689,7957802171984692490,8004187827350388287,805048286129978070,8071324928908524978,8085128046192475075,8086372424874977156,8106802822042492774,823170562311641414,8271917476514018072,8453665849022086651,8457735321176085576,8463877718450058676,8514396669197538797,8572601182213779086,8623192826897134069,8673995123053107705,8906047576247595080,8910616884185106224,8969856540434063260,9101005655408371001,9216952662403548030,935172916344867932",
"-1035522573259785754,-117142756836150865,-1224820437087578343,-1449516468093326884,-1461598057973062332,-1618232056132145066,-1733131322757204706,-1735705248454706758,-1807131080619826097,-1958145521088158362,-1964460590745870933,-1982867931279779905,-214947622346084030,-2263365595456251087,-2271596072135864280,-2360823425927233614,-2411944126728937616,-2465409460991065587,-2534466493999974482,-2758381223262685185,-2880039627780733908,-2923783765846876742,-2932818693155589318,-299376315598361795,-2996290760419916352,-3024891755329129708,-3076543041056287854,-3120358888983528414,-3185018962948084716,-3583099512502779812,-3665828284277790289,-3829278896040833271,-3859012032597045491,-3870006039505054940,-4048103315284313056,-4077790547425548769,-4203549498875672885,-4207828363289416664,-4213162970988941509,-4520511471764582592,-4523509358665404045,-4535472889445595159,-458503220417174773,-4592085545668168717,-4593077889989702789,-4616732855466595146,-4653991616124360006,-4681977972375913325,-4762136994287358033,-4811188582532636339,-4818486637494070009,-4847120659560831111,-4964276515892848112,-497979309176568161,-5065802900676005534,-5136543556995439972,-5140248794893033893,-5153127356189249807,-5326653608356845700,-5434671680081436196,-5668636778911885725,-5734472438361401278,-5789681416281899678,-5846327977999830579,-5880319994905166253,-5914099584622574290,-5985614538125389515,-5999355071195602143,-6040459799708676991,-6079412962276629290,-6312153878542308927,-6581275709328101456,-6619689386163090602,-6627002212281520430,-6813731907025609554,-6875374527424231309,-6900910192116729625,-7066361897022150873,-7366461903033551186,-7526036305505917047,-7582270555074322542,-7591425082856290177,-761929931865783427,-7678849677125214968,-7710707348435133216,-7721984703643978396,-7753711008692561450,-7758559629192580300,-7812519755023839750,-800008169364826319,-8007093728042387248,-8020251558618975722,-8098211519978067068,-8123444079770223854,-8125585882206116392,-8152365917290723540,-8166351031751757099,-8304007402232292252,-8343728997195554748,-8349297762317908728,-8352848497201883099,-8398169311713974571,-843777033903302696,-8484160365936971470,-8561665897169292290,-8601888941305348476,-8653309860848182332,-8698829647427741780,-87589390534845472,-8794386857691164064,-879719843234058471,-8932805268744948880,-9058428868354678870,-9065242473499692652,-9126824808293115102,-9128408126909219447,-9159455369241605261,100623982387175755,1006810019389533295,1055311054927056909,1108078540657663452,1205377945037031813,1249313830172139291,1375201444066595837,1452012558714303786,1519991183480747748,1531129125547962011,1576972604203300579,1636187097062703225,1646662376393091173,1668462328787514290,1686689459175358748,1691823246893025904,1744509929468084971,1836528170537606765,1840030177816993685,1894233260752502879,1919196142349639020,1940139625835702612,1944395100876615539,1957502110363042743,1984983888176710155,2047203959830468937,2119270492722580267,214664689598666494,2150212848502602348,2195021481367096612,2298140722301127682,2310797171081387281,2344320631391646464,2386635116192955181,2427420347279998476,2520317420322768179,2553793305499900797,2583644291144737012,2693172597035584591,2785392569344157688,2788742319528203060,2798825986577591690,28201716632719535,2856651915183132725,2883560243508690171,2905872026545370308,2996772780772069181,3003779797350179007,3018454789487389452,3203392800570448115,3223204938451993216,3243962487379892420,3326720646205626578,3614774604422271343,3672075216145009198,3731456756484513964,3787506712955825616,3801185830071336915,3822341457925281756,3919210376330113854,4038731847194638176,4049783034930958308,4084417664406967831,4257365152308984196,427552679756973963,4279198816057695967,428188606835417795,449585923778378644,4581264216828833649,4782260918607611435,4831330967199112525,4848047594226137719,4877977625663969842,5109747619885040334,5153227747180931716,5160866431052856701,5208148529739585910,5216084113596860089,5242921149573560674,535317639950089171,5563592531406267467,5715777225628054752,5725813964512373418,5728741232742976903,5886289315664063802,6024809183778057914,60359950039229655,609858947440250535,6144060987003529249,620757169869244283,6219366311881896093,6323562114785663975,6338205109000720679,6367959352713319097,6440582421322891563,6594347509409028947,6599698792517444949,6663329171811208618,676382711945539663,6863823466955978136,6964313365591078742,6966145963547409785,7053393175604608693,7152913385500764173,7208866188212057511,7275357468645729907,7306005436403124779,733718356623160181,7337877755223678849,7366627057219540827,7431108682389755380,7646683356866287152,7665195244331581725,770708962774120114,7761469518611277423,7860791800306665730,7912608516139033920,7927050480817313477,8136640718184468267,8158320533997392822,8209480897173377434,8221346311880816327,8239345319053895064,824126141255079151,8307732731916653120,83095772622531219,8381392130533634937,8638112237626510135,8642776202495348386,8739635458192633428,8766949536629665188,8819082976458840739,8878952261387678037,8908148936558294041,8908493380770428464,8913128271376078780,8986952723810869420,9135553508064096679,96893671177625826",
"-1007025661458070295,-1101857837537414335,-1121023746391028751,-1168054879381508783,-1337539412240779166,-1386139584641653620,-140279232919009182,-1504882292899803971,-1612777602361190406,-1844575508152622145,-1866707281417090090,-1873242228446637286,-191189264536507964,-2033374313118811412,-2159503700480925225,-2170880440113286076,-2287084763353013926,-2532979348788037250,-2536015100368441914,-2611614969785276869,-2644031429459844828,-2684803235293321867,-2930089669209551703,-3163690067922703155,-3197108662133983048,-3218888352293285041,-3310795734549456376,-3390355954625022937,-3442067277288254122,-3488584674058143884,-3519974831900280360,-3768739231916322679,-3772921824934103570,-3849959826478751976,-3911732948960911196,-4017134248960823273,-4265421385063677921,-4306649314240194806,-4328165698855896563,-4353869622008534425,-4361528868448593632,-4414973536711723812,-4489227313462780635,-4518446375732702787,-4542324364921223836,-4544390790044620242,-4546736477601196130,-4606905000792182325,-4652043011223019982,-4661970877241978212,-4735805540948514,-4925475817678119573,-4940432440955665376,-4966305823016515924,-5293464391087495660,-5335897906632052447,-5538200328992357529,-5601303567400215640,-5605699209967717983,-56608301325835373,-5680656881450318180,-5728335241100246308,-5774046290157882231,-5812931541401159704,-5885704718422865383,-6012845344567599230,-60529306091844449,-6058620768648456114,-6294208267756626552,-6390446483485486623,-6473413596838623884,-6503831284260267929,-6585994664065708051,-6596163283224029873,-6752014702476528226,-6777906773688846314,-6799631168302019958,-6867348106143334536,-6870745296304018647,-7027144726953712083,-712828215564827447,-7150028628356591368,-7198457358267872754,-7362822761858637262,-7438183733336298188,-7628682265142795199,-7657993395280611396,-7807144482142436269,-7816376574999785331,-785252950004469746,-7960918363938305471,-8001794266591164748,-8071359336821401827,-8085438480378883172,-813937539986791588,-8319367468927755209,-8420810510031574117,-8436336645349156011,-8456653925115722361,-8493121314997281313,-8497360626360486039,-8510596410835723229,-857014838915962267,-8639065572395293650,-8686037611300197666,-8708467915171699088,-8769002115796639848,-8795590318984014537,-879739910600613727,-9128603103902217003,-9150476253043533054,-935509079600573410,-971385985935874473,1062097591607664446,1128374857781143886,115759206463654461,1162837101816552722,1172794714281277559,1265726853238841531,1266030103810523218,1367311647412406758,1401242116859659365,1404909225425450869,143911440599188267,1516318646821153355,1539886622277138369,1613217452430239534,1687898904719037603,1689625352057137083,1698920206529111937,1723482557687970137,1787725874756906916,1830076657818389513,1879406830061393788,189764823851774770,1946932922100232776,2059912598421084574,21225540434852283,2245587411292197054,2250061670256581718,2365184730738126923,2396107680344827842,2485298372521005208,2500790145179387338,2509078914136403064,2564248923449946485,2758167776115465451,2760137356978301483,2824126942847952667,3035570725847090274,3088859056944106739,3247730109843234432,3281185085677597057,3360023827885194137,3392648643786868788,3434232402211177120,358984955972319293,3629067156621618307,3761444132195880340,3796000049511608059,3833572166790597779,3869498932572353887,3928031092626963881,4110466566343907879,414138630962763279,4171496248004243372,436360751441918660,4441135466304227880,4441555792290700574,4566117768361026181,4606822499021369827,4640754342502672435,4645601133604534646,4662044893149356649,4749342266699572474,4797817174789254881,4804019667757175802,4838486786908487926,4859228985135466830,4955105072295384134,4965537256037898028,5022160502111912770,5125383185108143073,517225166806528877,5186583414457843383,5260324503212438926,532087684561363314,5416883940677404584,5492729880383945656,5496107679095915996,5500479917078493152,56025630234383820,5670572078256077100,5715612225495032823,5716604592086167401,5892960376501637266,589653683025251546,5949245335712436509,6082708678067949011,6088016032753965237,611367243746794509,6128079180596753211,6129621406192919992,6168080799260479270,6300082823851067654,6348461200725464381,6461880273989971157,652458853259052902,6536266944168941736,6538146847436960652,6576160478911395108,6576676101826482768,6770248309479862602,6878234838522036254,6901604666430613436,7021199077395577343,7071788960750445635,713526399088309299,7142415434815874311,7304144606976207613,7333636771076383202,7359048865794839121,7387283916773494989,7394884949230356324,7440213281443053772,7470924699412728275,7529939130247101621,7550004732915217168,7604418249754310068,7634966300606090075,763516344274475452,7643409432882723234,7678541825942391749,7731541524119651186,7764378004910582966,7802675028171480306,7839570253522354021,7871232957234980109,7871999442295286337,8168091180005101061,8206601646095805946,8248092088282174812,8276065033838755355,8311630916645340735,8551285118580164007,8558975180148976900,8600004364140357994,8620407348206566146,8639165159979682436,871831703603649260,8746361982082810245,8782586687770662335,8998114246840530863,9069069379596920313,9089577794592778815,962771268274212849",
"-1019383349829346854,-1092719244299213898,-1152465522067334592,-120703452808968286,-128537881799631063,-1322413373378482317,-133218945159124304,-1366689839899551621,-1460032828161716071,-1632074204536588746,-1711465110244923925,-1819428806462798049,-183505314213661376,-2025430326834223094,-2085689891855103611,-2207870708072701841,-2236393615847828324,-2304154614903431681,-2500174742292735802,-2578020298971160855,-2602347888234287981,-2627829134059989238,-2664894007521930556,-2667099786184819265,-2817326498867328347,-2830507057457586662,-28523784639365673,-2917960031757330808,-2947027114090001986,-3031441546191797944,-30552460993634806,-3072198700337519170,-3295976603089944929,-3389533493506071398,-3486206913382230216,-354107776642137752,-3707570275645314204,-3723148201909553151,-3801011077661422468,-3845125392857370173,-4036803439518128276,-407957685351079705,-4135327341710393603,-4172477169542376108,-4178434501595453237,-4254017749849338180,-4300717434830297490,-4464810069699534481,-4615474842955871648,-4662702121859799925,-4751063742679996923,-4855750881899458156,-4986953579374654483,-5001253181146350592,-5067964944700815783,-5094053223607384371,-5125970842790581546,-5151643368099623286,-5241961742256531931,-5241968471217308546,-5265289326719665795,-5291829844570140757,-5433968346267426625,-5466123331636100508,-5598306250474668440,-5603487808457543878,-5779564261846188319,-5793135776529564428,-5893878889520935391,-5902726304058399232,-5957552470474450054,-6064599964652415553,-607491377685594964,-615726925525673273,-6240413456787699374,-6420713003183250647,-6570442401671518562,-6617472664291002009,-6639110636836524431,-6641892403271260386,-6697274518390219350,-6726719658410669878,-6854860447931788083,-6859644413709508439,-6902250369676332482,-6984451903740070558,-7090825548510454383,-7109923027441003020,-7153815939765316415,-7264787145969393677,-7377990362225471539,-738434044433679907,-7464033468657101774,-7542494269411725113,-7570483911607914761,-7592306646993966547,-7703000624394153310,-7823422133113783537,-7857871338278995469,-7930305792771424985,-8002126068451992986,-8093234508885475239,-8261677819717141543,-8270164934880516210,-8283179497701011924,-8374797667930527509,-8398248772164289724,-8454962206316144869,-8480054515204123617,-851163953672434094,-8675060382275771035,-8861801182705609282,-8883429837128498527,-8901038179359497124,-8938958457301164828,-8987997903541520954,-9071801498423407270,-9150508512162178426,-9176645041997125211,-9194417946427229718,-9210957250140969073,-9212784757958918775,-990517164785826779,-995285161608727453,1117049809650648054,115692152447979746,1219875795806160310,1236592160478296795,1256799878788956955,1326206861206332816,1378272797077525393,1386877017012522435,1430010614834517227,1499928731926577675,1536647542105470845,1635468343784700656,18993584142994657,191978183251973460,1932568920575106168,1936434116155354686,2101591789399127179,229823115461255869,2301929676061501675,242608823816538713,2469260223298302932,2688961483850405243,2767086147744515805,2835738939317630498,3133114474332846400,3356861383813201471,3370666403795801052,3417199927716300818,3486124672169268094,3490112970211396295,3546877539274519267,3556031394169311202,3585614766304656192,3627372078275712213,3876143166727995914,3943199613729443593,394825473585716172,398295862733457514,3990409726720411824,4007645296328095700,4008892905662201953,4011966716129870052,4124974097670896664,4127560819357448705,4173162762406630091,4232924075898328273,4242059415464647490,4256467956602388773,4268790132944277675,4436296244524438698,4442076272905950119,4501267713602320278,4508254516294619942,45238558063391916,459621315602274696,46016193615602607,4659303901104778095,4836210747976620563,483676272072946223,49020737572878837,5013736301967194842,5096278248295424100,5102411996394718563,5131542309043924613,5168840349574068119,5221462154878725708,5371240200923139516,5530643448485244013,5553328426727951891,5653206954780164529,5655139817375751905,5677609307359147955,5710312091590638281,5714021408722855266,5811139718156178657,5960246792410548596,5975630241556732697,6004037747305403686,612221106354984026,6150426706008167771,6257121607356496051,6299795110434626049,6507358961348997713,6507690856951974377,6598298181957250259,6614536232811262663,6695490008509017535,6731498484522885975,6767507473969946799,6868538758806657451,6931322850958891727,6998136174125973933,7024804139406910425,7070330768379988607,7087087425752435239,713170863188066012,7218696488356284847,7238013139131052829,7281627202744354633,7322473788497365074,7469980418025902234,7475879225618339700,7514551691918126109,7551599188478893268,7689901294195460001,7723594708108014757,7912555874089277651,7929655759503708724,8091533755437177003,8208519005519327100,8321381960284753398,833871361368771304,8348091537526706372,837519508161614093,8471713712252350720,8532507684269054309,8702038110287184440,8703906804819433779,8706359658304121423,8786080661736454541,8842645936635785661,8881840162022467941,8895581439833600157,8895901325592988710,8906096403262673259,9046026089167658937,9092949696136912886,9160234574977021898,918246611447639915,958196697178970986,961034614846558531,992513368947326640"
],
"static-algorithmic": [
"-1094664114039251656,-1165451676697763720,-123126027720617000,-1237785980292710345,-1262610062555426303,-126398714477064680,-144546053837625058,-1467095102742245706,-1492114157876574513,-1539569112293646967,-1562600127402093662,-1654794424274264234,-165534614865318516,-1718233386299547325,-176659368909710126,-1850986576198303383,-1950019573937865110,-2159558968215930673,-220003414575652033,-2211989943155284142,-2271599491875614513,-2288373773500109057,-2315009061991449373,-2353475286656585741,-237501865815910071,-2405315394861914083,-2407305241183758790,-2418301867502574669,-2418500279702014594,-2478931122623861227,-264516362574914495,-2713266920903462495,-2771909503873837976,-2858781540010916985,-2905688844039003864,-2926819601687509393,-2948667152052358050,-3007021845359248342,-301425579824289284,-3336482454071267579,-3353076607552805762,-3359117846498407,-3469135848310416135,-356140763520272698,-3565412337432194177,-3592636848635022287,-3616328828169536279,-3762727325801803802,-3773642974210316302,-382012318968743025,-3912806283708083994,-4019738658490836736,-4103895626100762676,-4202038636810162381,-4312022332337998456,-435884778928908511,-4454540589215447199,-4518418663950568071,-4536885370053842094,-4540303026987864586,-4555963082195904587,-4572359899632614182,-4617487965170709677,-4634500718996949317,-4636173498151074223,-4692024830973663315,-4773977094058548734,-4800005364116076957,-485462768473390741,-4933766774460068980,-5168824565143503452,-5285898543243369044,-5492043175367854641,-5495686515026060169,-5567492180996010671,-5582270374418726971,-5631040855954951097,-564903869538546533,-5752207939882721053,-5810383222049242169,-5817008075735939891,-5839670939719556750,-5901459359309628698,-5943882713537026108,-629709115433379262,-6343403645694917424,-6411431729085406013,-6439915197430371732,-653936670744053059,-6775169770654353324,-6868531970356754785,-6966198540030973043,-6983673102599518340,-702148632612354988,-7063334447119316134,-7072644416132859716,-7156566108398173068,-7190148937274549490,-7219492702587384434,-7228759790640108374,-7266648249637200730,-7277413476032119203,-7304956255510470507,-7375375531545611677,-7405587824833301580,-7502797053319788889,-7591442103435629511,-7603406692228085894,-768541439030518522,-7692386632188464323,-7720505013261421500,-7738077288162827935,-7831171648115056118,-8164931360980282868,-817613694999505086,-8183543019244207251,-8212020219013966948,-8226773956157458178,-8263440897014843950,-8386369146302634306,-8394692974350286399,-8428069832197725439,-8730827816831111353,-8793304452358841940,-8823063338951410251,-8851323907503600092,-8874243789534940399,-8970844740435434640,-8991103104765830294,-901614014245309899,-9170837017023023207,-9190673342583121908,-9200565098818432217,-9208792851980357018,-951269391859405862,1018880044057328035,1309004051155297978,1329230284654847484,135569433407561587,1482878412445434487,1613168608573331996,1635037197511382309,1676083157707930708,1699687864441659013,1786899478413848966,1854175516488882703,1941925420068257058,1962928542767293786,1966023979451795209,1968695627117373124,1977411844490135472,2080718092606758951,2102209726212230903,2141864473759975980,2272512242171349951,2301838216056082806,2382221173225806718,2386140006019305089,2398396820565378801,2422417095807201647,2439140275165946044,2454312710733174626,2589331376199647441,2621438968590728668,2726336338174551373,2747339345312633677,2942887180286629876,29463194698365673,3082088177209243966,3098005036789893142,315255564521095931,3381902151686236280,3384935700245028058,3424661042193814493,3457352595687001692,3561954395804393206,3672227903811780171,3735624883875822832,3859651896271474043,3907405900334941961,394167353831955243,3996563235269069113,401780229570672053,4077377721311546326,4126256193575924349,4145699597901240096,4290526721314613509,4362313206826350397,4417633160314677318,4610804370939848643,4756639430666634131,4768440977182436462,4888913361106016316,5091513279618106606,5161794935084112888,5208184945221965751,5262823398984354083,5288265733434542661,5301158055903173260,5361013357882210504,5406183649818157650,5866963705523813330,5880888986050872232,5949087164589298785,5970059990466925913,6044976376437453490,6047670721144637984,6242186528284282962,6245777795264256421,6280232937589626648,6330250184625127715,6354064634751190390,643657223089036778,6482350178265825444,6487964111634336201,6785431078064746115,6790930879928186267,6892432272848260093,694925982980649841,6949539799244253002,6975918397095283273,7076249793872260884,7259691581006263585,7361709562388176883,7393643202181388484,7458029317070775161,7473804304940736249,7598039045589673479,7653913091080414599,7655268526396629312,7700946781924772198,772911717972166078,7894083391629519317,7923522156732159751,7990811271178040450,8051359515072486446,8131414379842154708,8156850648056089993,8413207961112345184,8421339942947841019,8424991175277124805,8457225734313933629,852622000464544310,8589177242030470462,871466133018169018,8761398924986177035,8774394581212082162,8797000725022193171,8810405694908293905,8837089346016157641,8890102368902110835,8956940400392585798,8992616430764479353,9096341777321337174,9103706204887317853,9201370731436512736",
"-1022966752949328759,-1130057895368507688,-1201618828495237033,-124762371098840840,-1250198021424068324,-135472384157344869,-1364852582648836005,-1479604630309410110,-1515841635085110740,-155040334351471787,-1551084619847870315,-1608697275838178948,-1686513905286905780,-171096991887514321,-1784609981248925354,-1900503075068084247,-198331391742681080,-2054789271076897892,-2185774455685607408,-2241794717515449328,-2279986632687861785,-228752640195781052,-2301691417745779215,-2334242174324017557,-2379395340759249912,-2406310318022836437,-2412803554343166730,-2418401073602294632,-2448715701162937911,-251009114195412283,-2596099021763661861,-2742588212388650236,-2815345521942377481,-282970971199601890,-2882235192024960425,-2916254222863256629,-2937743376869933722,-2977844498705803196,-3171752149715257961,-328783171672280991,-3344779530812036671,-3411106227931610949,-3517274092871305156,-3579024593033608232,-3604482838402279283,-3689528076985670041,-369076541244507862,-3768185150006060052,-3843224628959200148,-3966272471099460365,-4061817142295799706,-408948548948825768,-4152967131455462529,-4257030484574080419,-4383281460776722828,-4486479626583007635,-4527652017002205083,-4538594198520853340,-4548133054591884587,-4564161490914259385,-4594923932401661930,-460673773701149626,-4625994342083829497,-4635337108574011770,-4664099164562368769,-4733000962516106025,-4786991229087312846,-4866886069288072969,-5051295669801786216,-5227361554193436248,-525183319005968637,-5388970859305611843,-5493864845196957405,-5531589348011035420,-5574881277707368821,-5606655615186839034,-5691624397918836075,-5781295580965981611,-5813695648892591030,-5828339507727748321,-5870565149514592724,-5922671036423327403,-597306492485962898,-6143643179615971766,-63242572783557704,-6377417687390161719,-641822893088716161,-6425673463257888873,-6607542484042362528,-678042651678204024,-6821850870505554055,-6917365255193863914,-6974935821315245692,-7023503774859417237,-7067989431626087925,-7114605262265516392,-7173357522836361279,-7204820819930966962,-7224126246613746404,-7247704020138654552,-7272030862834659967,-7291184865771294855,-7340165893528041092,-735345035821436755,-7390481678189456629,-7454192439076545235,-7547119578377709200,-7597424397831857703,-7647896662208275109,-7706445822724942912,-7729291150712124718,-7784624468138942027,-793077567015011804,-7998051504547669493,-8174237190112245060,-8197781619129087100,-8219397087585712563,-8245107426586151064,-8324905021658739128,-8390531060326460353,-8411381403274005919,-8579448824514418396,-859613854622407493,-8762066134594976647,-8808183895655126096,-8837193623227505172,-8862783848519270246,-8922544264985187520,-8980973922600632467,-9080970060894426751,-9180755179803072558,-9195619220700777063,-9204678975399394618,-926441703052357881,1163942047606313006,13052038425933633,1319117167905072731,1406054348550140985,1548023510509383241,1624102903042357152,1655560177609656508,1687885511074794860,1743293671427753989,1820537497451365834,1898050468278569880,1952426981417775422,1964476261109544497,1967359803284584166,1973053735803754298,2029064968548447211,2091463909409494927,2122037099986103441,2207188357965662965,225412498964328759,2287175229113716378,2342029694640944762,2384180589622555903,2392268413292341945,2410406958186290224,2430778685486573845,2446726492949560335,2521822043466411033,2605385172395188054,2673887653382640020,2736837841743592525,2845113262799631776,3012487678747936921,3090046606999568554,3239953594238064711,3383418925965632169,3404798371219421275,3441006818940408092,3509653495745697449,354711459176525587,3617091149808086688,3703926393843801501,3797638390073648437,3883528898303208002,3951984567802005537,397973791701313648,4036970478290307719,4101816957443735337,4135977895738582222,4218113159607926802,4326419964070481953,4389973183570513857,4514218765627262980,4683721900803241387,4762540203924535296,4828677169144226389,4990213320362061461,5126654107351109747,5184989940153039319,522718726329854415,5235504172103159917,5275544566209448372,5294711894668857960,5331085706892691882,5383598503850184077,5636573677670985490,5873926345787342781,5914988075320085508,5959573577528112349,6007518183452189701,6046323548791045737,6144928624714460473,6243982161774269691,6263005366426941534,6305241561107377181,6342157409688159052,6418207406508507917,6485157144950080822,6636697594849541158,669291603034843309,6788180978996466191,6841681576388223180,6920986036046256547,6962729098169768137,7026084095483772078,7167970687439262234,7310700571697220234,733918850476407959,7377676382284782683,7425836259626081822,7465916811005755705,7535921675265204864,7625976068335044039,7654590808738521955,7678107654160700755,7797515086777145757,7908802774180839534,7957166713955100100,8021085393125263448,8091386947457320577,812766859218355194,8144132513949122350,82516314052963630,8285029304584217588,8417273952030093101,8423165559112482912,8441108454795529217,8523201488172202045,862044066741356664,8675288083508323748,8767896753099129598,8785697653117137666,8803703209965243538,8823747520462225773,8863595857459134238,8923521384647348316,8974778415578532575,9044479104042908263,9100023991104327513,9152538468161915294,9219660976582853666,945173088537748526",
"-1058815433494290208,-1243992000858389335,-1256404041989747314,-130935549317204775,-1313731322602131154,-140009218997484964,-1415973842695540856,-1473349866525827908,-1485859394092992312,-149793194094548423,-1545326866070758641,-1556842373624981989,-1751421683774236340,-1817798278723614369,-2002404422507381501,-2107174119646414283,-2295032595622944136,-2308350239868614294,-233127253005845562,-2410054397763462760,-244255490005661177,-2537515072193761544,-257762738385163389,-2654682971333562178,-2910971533451130247,-2921536912275383011,-2932281489278721558,-2943205264461145886,-3089386997537253152,-3254117301893262770,-33300845315028056,-3340630992441652125,-3382091417742208356,-3440121038121013542,-3493204970590860646,-3541343215151749667,-3572218465232901205,-3585830720834315260,-3598559843518650785,-3610405833285907781,-362608652382390280,-3652928452577603160,-3726127701393736922,-375544430106625444,-3808433801584758225,-3878015456333642071,-3939539377403772180,-3993005564795148551,-4177502884132812455,-4229534560692121400,-4284526408456039438,-4347651896557360642,-4418911024996085014,-4532268693528023589,-4552048068393894587,-4560062286555081986,-4630247530540389407,-4635755303362542997,-4780484161572930790,-4793498296601694902,-4833445716702074963,-4900326421874070975,-4992531222130927598,-5110060117472644834,-5198093059668469850,-5256630048718402646,-5337434701274490444,-5440507017336733242,-5571186729351689746,-5578575826063047896,-5661332626936893586,-5721916168900778564,-5815351862314265461,-5822673791731844106,-5834005223723652536,-6043762946576498937,-6243523412655444595,-635766004261047712,-6418552596171647443,-6432794330344130303,-647879781916384610,-6523728840736367130,-6691356127348357926,-6798510320579953690,-6845191420431154420,-6941781897612418479,-6979304461957382016,-7065661939372702030,-7197484878602758226,-7212156761259175698,-7269339556235930349,-7274722169433389585,-7284299170901707029,-7298070560640882681,-7382928604867534153,-7398034751511379105,-7429890131954923408,-7478494746198167062,-7594433250633743607,-7600415545029971799,-7699416227456703618,-7713475417993182206,-7724898081986773109,-7733684219437476327,-7807898058126999073,-7914611576331362806,-8081491432763976181,-8169584275546263964,-8190662319186647176,-8204900919071527024,-8215708653299839756,-8294172959336791539,-8355637083980686717,-8503759328356071918,-8655138320672764875,-8800744174006984018,-8815623617303268174,-8830128481089457712,-8844258765365552632,-8857053878011435169,-8868513819027105323,-8898394027260063960,-8946694502710311080,-8975909331518033554,-9036036582830128523,-9125903538958724979,-9175796098413047883,-9185714261193097233,-9193146281641949486,-9198092159759604640,-93184300252087352,-987118072404367311,109042873730262608,1091411045831820520,1236473049380805492,1314060609530185354,1324173726279960107,1367642316602494234,1444466380497787736,1515450961477408864,1580596059541357618,1618635755807844574,1629570050276869730,1665821667658793608,1681984334391362784,1693786687758226936,180490966185945173,1966691891368189687,1975232790146944885,2003238406519291341,2054891530577603081,2086091001008126939,2096836817810862915,2112123413099167172,2131950786873039710,2174526415862819472,2239850300068506458,2279843735642533164,2294506722584899592,2395332616928860373,2404401889375834512,2416412026996745935,2434959480326259944,2442933384057753189,2450519601841367480,2488067377099792829,2555576709833029237,2647663310986684344,2700111995778595696,270334031742712345,2796226304056132726,2894000221543130826,2977687429517283398,3047287927978590443,3168979315513978926,3310927872962150495,3384177313105330113,3394867035732224666,3414729706706617884,3535803945775045327,3589522772806239947,3644659526809933429,3766631636974735634,3828645143172561240,396070572766634445,4131117044657253285,4140838746819911159,4181906378754583449,4254319940461270155,4344366585448416175,4465925962970970149,4562511568283555811,462249477950263234,4647263135871545015,4720180665734937759,4759589817295584713,4798559073163331425,4858795265125121352,4939563340734038888,5040863299990084033,5269183982596901227,5281905149821995516,5297934975286015610,5521378663744571570,55989754375664651,5751768691597399410,583187974709445596,5870445025655578055,5877407665919107506,5954330371058705567,5964816783997519131,6096299672929549228,6193557576499371717,6336203797156643383,6348111022219674721,6386136020629849153,6450278792387166680,6562330853241938679,6711064336457143636,6786806028530606153,6956134448707010569,6969323747632525705,7001001246289527675,7051166944678016481,7122110240655761559,7213831134222762909,7369692972336479783,7461973064038265433,7504862990102970556,7566980360427439171,7654251949909468277,7749230934350958977,7845799239203332537,7901443082905179425,7916162465456499642,8137773446895638529,8150491581002606171,8220939976320153790,8349118632848281386,8424078367194803858,8490213611243067837,8556189365101336253,857333033602950487,8632232662769397105,8718343504247250391,8764647839042653316,8780046117164609914,8791349189069665418,8800351967493718354,8817076607685259839,8830418433239191707,9070410440682122718,908319610777958772,9101865097995822683,9128122336524616573,982026566297538280",
"-1005042412676848035,-1040891093221809484,-1076739773766770932,-1112361004703879672,-1183535252596500377,-1219702404393973689,-1240888990575549840,-1288170692578778729,-1390413212672188431,-142277636417555011,-1585648701620136305,-160287474608395152,-1631745850056221591,-187495380326195603,-1875744825633193815,-1925261324502974679,-1976211998222623306,-2028596846792139697,-2080981695361656088,-209167403159166557,-2133366543931172478,-224378027385716543,-2275793062281738149,-2284180203093985421,-2324625618157733465,-2343858730490301649,-2406807779603297614,-2508223097408811386,-2566807046978711703,-2625390996548612020,-2683974946118512337,-273743666887258193,-2837063530976647233,-292198275511945587,-3048204421448250747,-3130569573626255557,-3212934725804260366,-3295299877982265175,-3348928069182421217,-3505239531731082901,-3553377776291971922,-3582427656933961746,-359374707951331489,-4128431378778112603,-4189770760471487418,-4329837114447679549,-4365466678667041735,-4401096242886403921,-4436725807105766107,-4523035340476386577,-4544218040789874587,-4568260695273436784,-4606205948786185804,-4621741153627269587,-4712512896744884670,-4777230627815739762,-4963148998295498289,-5021913445966356907,-505323043739679689,-5080677893637215525,-5139442341308074143,-5311666622258929744,-5363202780290051144,-5414738938321172543,-545043594272257585,-5466275096352293942,-5513637931518547795,-5549540764503523046,-5812039435470916600,-5912065197866478051,-5933276874980176756,-5993822830056762523,-6093703063096235352,-6193583296135708181,-6293463529175181010,-6481822019083369431,-6565635662389364829,-6649449305695360227,-6733262949001355625,-6810180595542753873,-6856861695393954603,-6892948612775309350,-6953990218821695761,-6970567180673109368,-7164961815617267174,-7181753230055455385,-7238231905389381463,-7257176134887927641,-7301513408075676594,-7379152068206572915,-7386705141528495391,-7401811288172340343,-7442041285515734322,-7490645899758977976,-7524958315848749045,-7569280840906669356,-7625651677218180502,-7670141647198369716,-7716990215627301853,-7722701547624097305,-7761350878150884981,-7819534853121027596,-7872891612223209462,-7956331540439516150,-8039771468655822837,-8123211396872129525,-8178890104678226156,-8235940691371804621,-8254274161800497507,-8403037188812146159,-8419725617735865679,-8465914580276898679,-8541604076435245157,-8617293572593591636,-8692983068751938114,-8804464034831055057,-8865648833773187785,-8910469146122625740,-8958769621572872860,-8986038513683231381,-9013569843797979409,-9103436799926575865,-9191909812112535697,-9206735913689875818,-9217937974553527484,-969193732131886587,1055145544944574277,1127676546719066763,1200207548493559249,1272738550268051735,1316588888717629042,1348436300628670859,1386848332576317609,1645298687560519408,1660690922634225058,1670952412683362158,1721490767934706501,1765096574920801477,1876112992383726291,1919987944173413469,1947176200743016240,1957677762092534604,1968027715200978645,1974143262975349591,202951732575136966,2099523272011546909,2107166569655699037,2117080256542635306,21257616562149653,2126993943429571575,2136907630316507845,2276177988906941557,2383200881424181310,2396864718747119587,2419414561401973791,2426597890646887746,2448623047395463907,247873265353520552,2597358274297417747,2613412070492958361,2731587089959071949,2742088593528113101,2820669783427882251,2918443700914880351,292794798131904138,3086067392104406260,3094025821894730848,3133492176151936034,3204466454876021818,3275440733600107603,3346415012324193387,334983511848810759,3389901367988626362,3399832703475822970,3409764038963019579,3419695374450216188,3432833930567111292,3449179707313704892,3483503045716349570,374439406504240415,3895467399319074981,3929695234068473749,3974273901535537325,4057174099800927022,4163802988327911772,4200009769181255125,4236216550034598478,4272423330887941832,4308473342692547731,432014853760467643,4335393274759449064,4353339896137383286,4490072364299116564,4586657969611702227,4629033753405696829,4701951283269089573,4846460289717613,492484102140058824,4964888330548050174,5066188289804095319,5463781156781364610,552953350519650005,5578976170707778530,5694171184634192450,5809366198560606370,5967438387232222522,5988789086959557807,6026247279944821595,6120614148822004850,613422598899241187,6217872052391827339,6244879978519263056,6254391580845598977,6271619152008284091,6339180603422401217,6483753661607953133,6525147482438137440,6599514224045739918,6673880965653342397,6748247707260944875,6816306228158204723,6867056924618241636,6988459821692405474,7038625520080894279,714422416728528900,7145040464047511896,7236761357614513247,7285196076351741909,7336205067042698558,7365701267362328333,7373684677310631233,7385659792233085583,7469860557973245977,7654929667567575633,7773373010564052367,7821657162990239147,7869941315416425927,7912482619818669588,792839288595260636,8188895312188121891,8252984640452185689,8317073968716249487,8381163296980313285,8433049815036327011,8449167094554731423,854977517033747398,866755099879762841,8782871885140873790,8965859407985559186,8983697423171505964,9018547767403693808,9098182884212832343,9115914270705967213,9176954599799214015,9210515854009683201,926746349657853649",
"-1031928923085569122,-1147754786033135704,-1239337485434130093,-128667131897134728,-1339291952625483580,-1441534472718893281,-1542447989182202804,-168315803376416419,-1734827535036891833,-1801204129986269862,-182077374617952865,-192913386034438342,-1989308210365002404,-203749397450923819,-2094077907504035186,-214585408867409295,-2226892330335366735,-2319817340074591419,-2339050452407159603,-2348667008573443695,-2522869084801286465,-2581453034371186782,-2640036983941087099,-2669328958726037258,-2698620933510987416,-2793627512908107729,-2963255825379080623,-2992433172032525769,-3027613133403749545,-3068795709492751950,-3151160861670756759,-3192343437759759164,-3233526013848761568,-3315891166026766377,-3346853799997228944,-3367584012647507059,-3396598822836909653,-3425613633026312246,-3454628443215714839,-3499222251160971774,-3547360495721860795,-3580726124983784989,-3634628640373569720,-3707827889189703482,-3744427513597770362,-3770914062108188177,-3791038387897537264,-3860620042646421110,-4040777900393318221,-4082856384198281191,-4243282522633100910,-4356559287612201189,-4392188851831563375,-4427818416050925561,-4502449145266787853,-4600564940593923867,-4650136331356721496,-4678061997768016042,-4753489028287327380,-4816725540409075960,-4883606245581071972,-4977840110213212944,-5036604557884071562,-5095369005554930180,-5212727306930953049,-5271264295980885845,-5492954010282406023,-5766751760424351332,-5795839401507611890,-5906762278588053375,-5917368117144902727,-5927973955701752080,-5938579794258601432,-5968852771796894316,-6018792888316630730,-6068733004836367145,-6118673121356103559,-6168613237875839974,-6218553354395576388,-6268493470915312803,-6318433587435049217,-6360410666542539572,-638794448674881937,-6394424708237783866,-6460868608256870582,-6502775429909868281,-6544682251562865980,-6586589073215863679,-6628495894868861378,-6670402716521859077,-6712309538174856776,-6754216359827854475,-6804345458061353782,-6851026557912554512,-6977120141636313854,-7003588438729467789,-7043419110989366686,-7093624839199188054,-7135585685331844730,-718746834216895872,-7233495848014744919,-7252440077513291097,-7261912192262564186,-7280856323466913116,-7322561074519255800,-7357770712536826385,-7403699556502820962,-751943237425977639,-7695901429822583971,-7813716455624013335,-7852031630169132790,-7893751594277286134,-7935471558385439478,-7977191522493592822,-8018911486601746165,-8060631450709899509,-8102351414818052853,-8144071378926206197,-8201341269100307062,-8258857529407670729,-838613774810956290,-8415553510504935799,-8446992206237312059,-8484836954316485299,-8560526450474831777,-8598371198554005016,-8636215946633178256,-8711905442791524734,-8746446975713044000,-8777685293476909294,-8797024313182912979,-880613934433858696,-8904431586691344850,-9058503321862277637,-9148370277990874093,-9194382751171363275,-9196855690230190852,-9213365413266942251,1000453305177433157,1109543796275443641,1145809297162689884,1182074798049936127,1254605799824428613,1290871300711674856,1425260364523964360,1463672396471611111,1499164686961421675,158030199796753380,1640167942535950858,1650429432585087958,1663256295146509333,1803718487932607400,1837356506970124268,2256181271119928204,2278010862274737360,2290840975849307985,2321933955348513784,2362125433933375740,2471190043916483727,2504944710283101931,2572454043016338339,2593344825248532594,2601371723346302900,2609398621444073207,2617425519541843514,2771782824684383201,2869556742171381301,2995087554132610159,3064688052593917204,3151235745832957480,3186722885195000372,3222210024557043264,3364158582005214833,3384556506675179085,3402315537347622122,3575738584305316576,3630875338309010058,3901436649827008471,4016766856779688416,4133547470197917753,416897541665569848,4317446653381514842,4339879930103932619,4348853240792899730,4357826551481866841,4376143195198432127,4441779561642823733,4538365166955409395,4665492518337393201,4738410048200785945,4914238350920027602,5015538310176072747,5078850784711100962,5109083693484608176,5144224521217611317,537836038424752210,5434982403299761130,5492579910262968090,5550177417226175050,5607774924189382010,5665372431152588970,5722969938115795930,5780567445079002890,5838164952042209850,5897938530685478870,5932037619954692146,6045649962614249613,6071985197037093606,6169243100606916095,6258698473636270255,6275926044798955369,6483051919936889288,6486560628292208511,6506555797036236820,6580922538643839298,6618105909447640538,6655289280251441777,6729656021859044255,6766839392662845495,6906709154447258320,6935262917645254774,6959431773438389353,7099180017264011221,7190900910831012571,7381668087258934133,7389651497207237033,7409739730903735153,753415284224287018,7582509703008556325,7612007556962358759,7639944579707729319,7725088858137865587,7897763237267349371,7940344435343629925,7973988992566570275,8071373231264903511,8111400663649737642,8147312047475864260,8236962308386169739,832694429841449752,8333096300782265436,8365140964914297335,8453196414434332526,8506707549707634941,853799758749145854,8610704952399933783,8653760373138860426,8696815793877787069,8739871214616713713,8788523421093401542,8906811876774729575,8940230892519967057,8949249357825623,8970318911782045880,8988156926967992658,9205943292723097968",
"-1036410008153689303,-1300951007590454942,-1352072267637159793,-1403193527683864644,-1454314787730569494,-1488986775984783413,-1503977896480842627,-1527705373689378854,-1553963496736426152,-1643270137165242913,-1670654164780585007,-1702373645793226553,-173878180398612224,-1768015832511580847,-18329981580763232,-1834392427460958876,-1863365700915748599,-2041693058934518795,-2146462756073551576,-2256697104695531921,-2317413201033020396,-2351071147615014718,-2408679819473610775,-240878677910785624,-2433607990432476253,-2463823411893399569,-2493577110016336307,-2610745009156136941,-2691297939814749877,-2727927566646056366,-2757248858131244106,-2804486517425242605,-2870508366017938705,-2893962018031982145,-3109978285581754355,-315104375748285138,-3274708589937763973,-342461967596276845,-3481170409450638391,-3529308654011527412,-3581576890958873368,-3671228264781636601,-3825829215271979187,-3895410870020863033,-3926172830555928087,-395480433958784397,-3979639017947304458,-4006372111642992644,-4051297521344558964,-4093376005149521934,-4215786598751141891,-422416663938867140,-4270778446515059929,-4352105592084780916,-4361012983139621462,-4396642547358983648,-4432272111578345834,-4470510107899227417,-4850165892995073966,-4917046598167069978,-4948457886377783635,-5065986781719500871,-5154133453225788798,-5183458812405986651,-5241995801455919447,-5324550661766710094,-5376086819797831494,-5401854898813392193,-5427622977828952893,-5479159135860074292,-5646186741445922342,-5706770283409807320,-5737062054391749809,-581105181012254716,-5855118044617074737,-5886012254412110711,-5981337800926828420,-6006307859186696627,-6031277917446564834,-6081218033966301249,-6106188092226169456,-6131158150486037663,-613507803959671080,-6181098267005774078,-6206068325265642285,-6231038383525510492,-6280978500045246907,-6305948558305115114,-6330918616564983321,-640308670881799049,-6429233896801009588,-6471345313670120007,-6555158956976115405,-6597065778629113104,-6638972600282110803,-665989661211128542,-6680879421935108502,-6722786243588106201,-6764693065241103900,-6786840045617153507,-690095642145279506,-7104115050732352223,-7146075896865008899,-7177555376445908332,-7394258214850417867,-7709960620359062559,-7749714083156856458,-7772987673144913504,-7816625654372520466,-78213436517822528,-8278806928175817745,-8340271052819712923,-8417639564120400739,-849113814716681892,-8522681702395658538,-8674060694712351495,-8798884243594948499,-891113974339584298,-8934619383847749300,-9069736691378352194,-9159603647506948650,-9193764516406656381,-9207764382835116418,1037012794500951156,1073278295388197398,1218340298937182370,1311532330342741666,146799816602157483,1531737235993396052,1564309785025370429,1596882334057344807,1637602570023666583,2158195444811397726,2190857386914241218,2223519329017084711,2298172469320491199,2444829938503656762,25360405630257663,2538699376649720135,2759561084998508439,2857335002485506538,2960287304901956637,3029887803363263682,3115748606470914588,3257697163919086157,3293184303281129049,3328671442643171941,3428747486380462892,3445093263127056492,3453266151500353292,3470427820701675631,3603306961307163317,3658443715310856800,3688077148827790836,3719775638859812166,3782135013524192035,3844148519722017641,3871590397287341022,4134762682968249987,4403803171942595587,4429706360978750525,4453852762306896941,4477999163635043356,4502145564963189772,4526291966291336187,4550438367619482603,4574584768947629019,4598731170275775435,4765490590553485879,477366790045161029,4813618121153778907,4873854313115568834,4901575856013021959,4952225835641044531,5002875815269067104,5053525794897089676,507601414234956619,5221844558662562834,5249163785543757000,5291488814051700310,5316121881397932571,5346049532387451193,5420583026558959390,5449381780040562870,5478180533522166350,5535778040485373310,5564576793966976790,5593375547448580270,5622174300930183750,5650973054411787230,5679771807893390710,5708570561374994190,5766168068338201150,5794966821819804630,5823765575301408110,5852564328783011590,598305286804343391,6059827959090865795,6084142434983321417,6108456910875777039,6157085862660688284,6205714814445599528,628539910994138982,6370100327690519771,6402171713569178535,6466314485326496062,6543739167840038059,656474413061940043,6692472651055243016,6803618554043195495,6854369250503232408,69253034214314140,7087714905568136052,7110645128959886390,7179435799135137402,7202366022526887740,7272443828679002747,7323452819369959396,7367697119849404058,743671221609603,7441932788348428491,7520392332684087710,7713017820031318892,7737159896244412282,7761301972457505672,7785444048670599062,7809586124883692452,7833728201096785842,7857870277309879232,7882012353522972622,8005948332151651949,8036222454098874947,8172872980122105942,8269006972518201638,8301051636650233537,8397185629046329234,8429020495156725908,8437079134915928114,8445137774675130320,8473719672778500733,853210879606845082,8539695426636769149,8572683303565903357,8599941097215202122,8642996517954128765,8686051938693055408,8729107359431982052,8763023382014415175,889892871898063895,9005582099084086580,9057444772362515490,9083376109001729946,9122018303615291893,9164746533980564654,9208229573366390584,963599827417643403",
"-108155163986352176,-1275390377567102516,-1377632897660512218,-1574124414511114984,-1597172988729157627,-1678584035033745394,-1710303516046386939,-1776312906880253101,-1842689501829631130,-1888123950350639031,-1912882199785529463,-1937640449220419895,-1963115786080244208,-2067885483219276990,-2172666711950769041,-2198882199420445775,-222190720980684288,-2341454591448730626,-2366435313707917827,-2392355367810581998,-2552161059586236624,-2847922535493782109,-2929550545483115476,-2935012433074327640,-3017317489381498944,-3037908777426000146,-3058500065470501349,-3079091353515002551,-3099682641559503754,-3120273929604004956,-3140865217648506158,-3161456505693007360,-3182047793737508563,-3202639081782009765,-3223230369826510967,-3243821657871012169,-3264412945915513372,-3285004233960014574,-3305595522004515776,-3326186810049016978,-3643778546475586440,-3680378170883653321,-3716977795291720202,-3753577419699787082,-3834526922115589668,-3904108576864473514,-3952905924251616273,-4116163502439437640,-4140699255116787566,-4165235007794137492,-4298274370397018947,-4478494867241117526,-448279276315029069,-4534577031790932842,-4702268863859273993,-4722756929630495348,-473068271087270184,-4743244995401716703,-4763733061172938057,-4790244762844503874,-48271709049292880,-4858525981141573468,-4925406686313569479,-5007222334048642253,-5124751229390359489,-5298782582751149394,-5594462994802783003,-5618848235570895066,-5676478512427864831,-589205836749108807,-5956367742666960212,-6156128208745905870,-621608459696525171,-6450391902843621157,-6492298724496618856,-6513252135323117706,-6534205546149616555,-6576112367802614254,-6618019189455611953,-6659926011108609652,-6701832832761607351,-6743739654414605050,-6833521145468354238,-6880740291566032068,-6905156933984586632,-6929573576403141197,-7013546106794442513,-7053376779054341410,-7125095473798680561,-7417738978394112494,-7466343592637356149,-7536038947113229123,-7580361472171149434,-7636774169713227806,-7681264139693417020,-780809503022765163,-7841601639142094454,-7862461621196171126,-7883321603250247798,-7904181585304324470,-7925041567358401142,-7945901549412477814,-7966761531466554486,-7987621513520631158,-8008481495574707829,-8029341477628784501,-8050201459682861173,-805345631007258445,-8071061441736937845,-8091921423791014517,-8112781405845091189,-8133641387899167861,-8154501369953244533,-8203121094085917043,-8309538990497765334,-8371003115141660512,-8456453393257105369,-8494298141336278609,-8532142889415451848,-8569987637494625087,-8607832385573798326,-8645677133652971566,-8683521881732144805,-8721366629811318044,-8886318908397502180,-9024803213314053966,-9114670169442650422,-914027858648833890,-938855547455881872,1027946419279139595,1064211920166385837,1209273923715370809,122306153568912097,1317853028311350886,1415657356537052672,1454069388484699423,1523594098735402458,1556166647767376835,1588739196799351212,1647864060072803683,1710589316188182757,1754195123174277733,1865144254436304497,1909019206225991674,191721349380541069,1968361671159175884,1976322317318540178,2016151687533869276,2067804811592181016,2150029959285686853,2182691901388530345,2215353843491373838,2311886085702298295,2331981824994729273,2352077564287160251,236642882158924655,2530260710058065584,2660775482184662182,2713224166976573534,2808448043742007488,281564414937308241,2832891523113757013,2906221961229005588,2930665440600755113,2951587242594293256,3021187741055600301,3106876821630403865,3248825379078575434,3284312518440618326,3319799657802661218,3496578270731023509,3548879170789719266,3680152526319785503,3711851016351806833,3751128260425279233,3774383325249463834,3813141766623104838,3918550567201707855,3963129234668771431,4006665046024378764,4026868667534998067,4047072289045617370,4067275910556236674,4089597339377640831,4114036575509829843,4134155076583083870,447132165855365438,4729295356967861852,4783500025172883943,4843736217134673870,4977550825455055817,5196587442687502535,5299546515594594435,5506979287003769830,568070662614547800,5701370873004593320,5737369314856597670,6132771386768232661,6181400338553143906,6230029290338055150,6292737249348501914,6317745872866252448,6362082481220855080,6394153867099513844,6434243099447837298,6458296638856831371,6497259954335286510,6534443325139087749,6571626695942888988,6608810066746690228,6645993437550491467,6683176808354292706,6720360179158093945,6757543549961895185,682108793007746575,6828993902273213951,6879744598733250864,7013542670886649876,7063708369275138682,7133575352351636727,7225296245918638078,7297948324024481071,7348957314715437720,7433884523987255156,743667067350347488,7489333647521853402,7512627661393529133,7551451017846322017,8061366373168694978,8101393805553529109,8145722280712493305,8164861814089097967,8204917644254137840,822730644529902473,8260995806485193663,8293040470617225562,8389174463013321259,8427005835216925356,8443123114735329768,8465472703546217181,8531448457404485597,8564436334333619805,8621468807584665444,8707579649062518730,8750635069801445374,8762211153500296105,880679502458116456,8850342601737645939,8876849113180622536,9031513435723301035,9118966287160629553,9140330402343265933,9189162665617863375,954386457977695964,95779593891613119,991239935737485718",
"-1014004582813088397,-115640595853484588,-1156603231365449712,-1174493464647132049,-1192577040545868705,-1228744192343342017,-1281780535072940623,-1326511637613807367,-1384023055166350325,-1428754157707217069,-1620221562947200270,-1743124609405564087,-1809501204354942116,-1969663892151433757,-2015500634649760599,-2074433589290466539,-2120270331788793381,-2179220583818188225,-2205436071287864959,-2264148298285573217,-2372915327233583870,-2398835381336248041,-2441161845797707082,-2471377267258630398,-2500900103712573847,-2559484053282474164,-25815413447895644,-2618068002852374481,-2735257889517353301,-2764579181002541041,-2782768508390972853,-2826204526459512357,-3625478734271553000,-3698677983087686762,-3799736094741147745,-3869317749490031591,-3959589197675538319,-4030258279442077479,-4072336763247040449,-4305148351367508702,-4583641916017138056,-4825085628555575462,-4891966333727571474,-495392906106535215,-4955803442336640962,-5014567890007499580,-5073332337678358198,-5132096785349216816,-515253181372824163,-5161479009184646125,-5190775936037228251,-5249312925087161047,-5305224602505039569,-5350318740782270794,-535113456639113111,-5453391056844513592,-5522613639764791608,-554973731905402059,-5558516472749766859,-55757140916425292,-5653759684191407964,-5684051455173350453,-5714343226155292942,-5744634997137235431,-5862841597065833731,-5893735806860869705,-6056247975706433041,-6256008441785378699,-6368914176966350646,-6402928218661594940,-6993630770664493065,-7033461442924391962,-7083134627666023885,-727045935019166314,-7331363484023648446,-7366573122041219031,-7513877684584268967,-7558200209642189278,-760242338228248081,-7614529184723133198,-7659019154703322413,-7796261263132970550,-828113734905230688,-8286489943756304642,-8317222006078252231,-8347954068400199820,-8378686130722147409,-8437531019217518749,-8475375767296691989,-8513220515375865228,-8551065263455038467,-85698868384954940,-8588910011534211706,-8626754759613384946,-8664599507692558185,-870113894528133095,-8702444255771731424,-9002336474281904852,-9047269952346203080,-9092203430410501308,-9137136908474799536,-978155902268126949,1009666674617380596,1046079169722762716,1100477421053632080,1118610171497255202,1136742921940878323,1154875672384501445,115674513649587352,1173008422828124566,1191141173271747688,1245539424602617052,1263672175046240174,1281804925489863295,1299937675933486417,1338833292641759171,1358039308615582546,1377245324589405921,1396451340563229297,1434863372510876048,1473275404458522799,169260582991349276,1732392219681230245,1775998026667325221,1795308983173228183,1828947002210745051,1887081730331148085,1930956682120835263,1990325125504713406,2009695047026580308,2041978249563025146,2061348171084892048,214182115769732862,2372173303579591229,2462751377324829176,2496506043691447380,2564015376424683788,259103648548116448,2634551139788706506,2654219396585673263,2686999824580617858,2706668081377584615,2784004564370257963,2881778481857256063,2986387491824946778,304025181326500034,3055987990286253823,3142363960992446757,3177851100354489649,3213338239716532541,325119538184953345,3355286797164704110,344847485512668173,3490040658223686539,3522728720760371388,3542341558282382296,364575432840383001,3743376572150551032,3805390078348376637,3836396831447289440,384303380168097829,3940839900935239643,3985418568402303219,4154751293114575934,4190958073967919287,4209061464394590963,4227164854821262640,4263371635674605993,42726474537015162,4281475026101277670,4299500032003580620,439573509807916540,4619919062172772736,4656377827104469108,4674607209570317294,4692836592036165480,469808133997712131,4747524739433710038,4775970501177660202,4806088597158555166,4836206693139450129,4866324789120345093,4926900845827033245,500042758187507721,5028200805083078390,5100298486551357391,5135439314284360532,5173392437618576103,5308639968650552915,5338567619640071537,5372305930866197290,5394891076834170863,5442182091670162000,5470980845151765480,5499779598633368960,5528578352114972440,5557377105596575920,5586175859078179400,560512006567098902,5614974612559782880,5643773366041386360,5672572119522989840,5730169626486196800,5758968379967800280,5787767133449403760,5816565886931007240,5845364640412610720,5889413758368175551,590746630756894493,5923512847637388827,5979424538713241860,5998153635205873754,6016882731698505648,6035611828191137542,620981254946690084,6426225252978172607,6515851639737187130,6590218381344789608,6627401752148590848,6664585122952392087,6701768493756193326,6738951864559994565,675700198021294942,6776135235363795805,6822650065215709337,6873400761675746250,704674199854589370,7156505575743387065,724170633602468429,7248226469310388416,7291572200188111490,7342581190879068139,7481568976231294825,7543686346555763440,763163501098226548,7666688090278665033,7689527218042736476,782875503283713357,7931933296037894838,7965577853260835187,7998379801664846199,802803073906807915,8028653923612069197,8081380089361112044,8121407521745946175,8196906478221129865,842658215152997031,8664524228323592087,8843715973876901790,8870222485319878387,8898457122838420205,89147953972288374,8931876138583657686,9025030601563497421,917532980217906210,935959719097801087",
"-1049853263358049846,-1067777603630530570,-1085701943903011294,-1103512559371565664,-1121209450036193680,-1138906340700821696,-1210660616444605361,-1307341165096293048,-1332901795119645474,-1358462425142997899,-1409583685189702750,-1435144315213055175,-1460704945236407600,-1625983706501710931,-1662724294527424621,-1694443775540066167,-1726530460668219579,-1759718758142908594,-1792907055617597608,-1826095353092286623,-1894313512709361639,-1919071762144252071,-1943830011579142503,-2022048740720950148,-2048241165005708344,-2126818437859982930,-2153010862144741125,-2234343523925408032,-2515546091105048926,-2530192078497524005,-2574130040674949243,-2588776028067424322,-2632713990244849560,-2647359977637324639,-2676651952422274798,-2705943927207224956,-2970550162042441910,-2999727508695887056,-321943773710283065,-3374837715194857708,-3403852525384260301,-3432867335573662894,-3461882145763065487,-349301365558274772,-3662078358679619881,-3735277607495753642,-3782340681053926783,-3817131508428368706,-3851922335802810629,-3886713163177252552,-3932856103979850134,-3986322291371226505,-4013055385066914690,-402214491453805083,-4122297440608775122,-4146833193286125048,-4171368945963474974,-4222660579721631646,-4277652427485549684,-429150721433887826,-4320929723392839003,-4338744505502520096,-4374374069721882282,-4410003633941244468,-4445633198160606653,-4462525348557337308,-4494464385924897744,-4510433904608677962,-454476525008089348,-4589282924209399993,-479265519780330463,-4808365452262576459,-4841805804848574465,-4875246157434572471,-4908686510020570477,-4970494554254355617,-4985185666172070271,-5029259001925214235,-5043950113842928889,-5088023449596072853,-5102714561513787507,-5146787897266931471,-5220044430562194649,-5278581419612127445,-5330992681520600269,-5356760760536160969,-5382528839551721669,-5408296918567282368,-5434064997582843068,-5459833076598403767,-5485601155613964467,-5504662223272303982,-5540565056257279233,-5600559304994811019,-5624944545762923082,-573004525275400625,-5774023670695166472,-5803111311778427030,-5878288701963351718,-5962610257231927264,-605407148222816989,-6062490490271400093,-6162370723310872922,-6262250956350345751,-6351907156118728498,-6385921197813972793,-6886844452170670709,-6911261094589225273,-6935677737007779838,-710447733414625430,-7313758665014863154,-7348968303032433739,-7423814555174517951,-743644136623707197,-7802079660629984812,-786943535018888484,-811479663003381766,-8738637396272077677,-8754256555154010324,-8769875714035942971,-8785494872917875617,-9007953159039942131,-9097820115168538587,-9142753593232836815,-920234780850595886,-945062469657643867,-960231561995646225,-996080242540607673,1082344670610008959,1227406674158993931,1491021549703428081,1539880373251389646,1572452922283364023,1605025471315338401,1812127992691986617,1845766011729503485,1983868484997424439,2035521609055736178,2166360930337108599,2199022872439952091,2231684814542795584,2248015785594217331,2264346756645639077,2479628710508138278,2513383376874756482,2547138043241374686,2580892709607992890,2627995054189717587,2680443738981628939,2777893694527320582,2802337173899070107,2826780653270819632,2875667612014318682,2900111091386068207,2924554570757817732,2968987367209620017,3003787616440273540,3038587865670927062,3073388114901580585,3124620391311425311,3160107530673468203,3195594670035511095,3231081809397553987,3266568948759596880,3302056088121639772,3337543227483682664,3373030366845725556,3463890208194338661,3516191108253034418,3596414867056701632,36094834617690417,3651551621060395114,3696001771335796168,3727700261367817499,3789886701798920236,4083487530344593578,409338885618120950,4107926766476782590,4172854683541247610,424456197713018745,4245268245247934316,4396888177756554722,4638148444638620922,4711065974502013666,484925446092609926,4920569598373530423,4971219578001552995,5021869557629575568,5117868900417858961,5153009728150862102,5167593686351344495,5215014751942264292,5242333978823458458,530277382377303312,5366659644374203897,5389244790342177470,5413383338188558520,545394694472201107,5456581468410963740,5571776482337377660,5658172742782188100,5686971496263791580,5802166510190205500,5906463303002782189,5940562392271995465,605863942851792289,6126692767795118755,6175321719580030000,6223950671364941244,62621394294989395,6286485093469064281,6311493716986814814,6410189560038843226,6474332331796160753,650065818075488410,6553035010540988369,6848025413445727794,7007271958588088775,7057437656976577581,7150773019895449480,7242493913462450831,7266067704842633166,7317076695533589815,7401691466542561818,7417787995264908487,7449981052709601826,7528157003974646287,7574745031717997748,7590274374299114902,7660978308337647172,7683817436101718615,7948755574649365012,7982400131872305362,8180884146155113916,8228951142353161764,8244973474419177714,8277018138551209613,8309062802683241512,8325085134749257461,8357129798881289360,8373152130947305310,8405196795079337209,8481966642010784285,8498460580475351389,8514954518939918493,8547942395869052701,8580930272798186909,8915166630711038945,8948585646456276427,899106241338011333,8999099264924282966,9050961938202711876,9076893274841926332,9134226369433941253,9183058632708538695,972813196857590841",
"-100669732119219764,-10844549713630820,-1294560850084616836,-1345682110131321687,-1396803370178026538,-1447924630224731388,-1579886558065625645,-1602935132283668288,-1869555263274471207,-1881934387991916423,-1931450886861697287,-1982760104293812855,-1995856316436191953,-2035144952863329246,-2087529801432845637,-2100626013575224735,-2139914650002362027,-2219441136745325439,-2249245911105490625,-2426054135067245424,-2456269556528168740,-2486254116320098767,-2544838065889999084,-2603422015459899401,-2662005965029799718,-2720597243774759431,-2749918535259947171,-2788198010649540291,-2831634028718079795,-2853352037752349547,-2955961488715719337,-2985138835369164483,-308264977786287211,-335622569634278918,-3360330310100156411,-3389345120289559005,-3418359930478961598,-3447374740668364191,-388746376463763711,-3919489557132006041,-3972955744523382412,-4035518089917697850,-4077596573722660820,-40786277182160468,-4134565316947450085,-415682606443846454,-4195904698640824900,-4208912617780652136,-4250156503603590665,-4263904465544570174,-4643154914753897860,-4657117747959545133,-4671080581165192406,-4685043414370839679,-4941112330418926308,-4999876778089784926,-500357974923107452,-5058641225760643544,-5117405673431502162,-5176141688774745052,-520218250189396400,-5205410183299711450,-5234678677824677848,-5263947172349644246,-5318108642012819919,-5369644800043941319,-540078525455685348,-5421180958075062718,-5472717116106184117,-559938800721974296,-5638613798700436720,-5668905569682379209,-5699197340664321698,-5729489111646264187,-5759479850153536193,-5788567491236796751,-5847394492168315744,-5975095286361861368,-5987580315491795472,-6000065344621729575,-6012550373751663679,-6025035402881597782,-6037520432011531886,-6074975519401334197,-6087460548531268301,-6099945577661202404,-6112430606791136508,-6124915635921070611,-6137400665051004715,-6174855752440807026,-6187340781570741130,-6199825810700675233,-6212310839830609337,-6237280898090477544,-6287221014610213959,-6299706043740148062,-6312191072870082166,-6324676102000016269,-6337161131129950373,-6455630255550245870,-6497537077203243569,-6539443898856241268,-6581350720509238967,-6623257542162236666,-6707071185468232064,-6748978007121229763,-6839356282949754329,-6899052773379947991,-6960094379426334402,-6998609604696980427,-7038440276956879324,-70728004650690116,-7088379733432605970,-7130340579565262646,-7472419169417761606,-7519418000216509006,-7541579262745469162,-7563740525274429317,-7585901787803389473,-7620090430970656850,-7642335415960751458,-7664580400950846065,-7686825385940940672,-8271123912595330848,-8301855974917278437,-8332588037239226026,-833363754858093489,-8363320099561173615,-875363914480995896,-8892356467828783070,-8940656943279030190,-9030419898072091245,-9052886637104240359,-9120286854200687701,1507307824219415269,163645391394051328,1705138590314920885,1726941493807968373,1748744397301015861,1770547300794063349,1859659885462593600,186106157783243121,1881597361357437188,1903534837252280777,1925472313147124366,208566924172434914,231027690561626707,2367149368756483484,253488456950818500,2753450215155571058,275949223340010293,2814558913584944869,2851224132642569157,2912332831071942969,298409989729202086,320187551353024638,339915498680739466,3476965433209012600,3568846490054854891,3610199055557625002,3623983244058548373,3665335809561318485,3758879948700007433,3820893454897833039,3851900207996745842,3912978233768324908,3935267567501856696,3957556901235388484,3979846234968920272,4369228201012391262,4383058189384472992,4410718166128636452,4423669760646713921,4447816161974860337,4471962563303006752,4496108964631153168,4520255365959299583,4544401767287445999,454690821902814336,4568548168615592415,4592694569943738831,4791029549168107684,4821147645149002648,4851265741129897611,4881383837110792575,4895244608559519137,4907907103466524780,4945894588187541709,4958557083094547352,4996544567815564282,5009207062722569925,5047194547443586854,5059857042350592497,5072519537257598140,515160070282405517,5190788691420270927,5228674365382861375,5255993592264055541,5323603794145312226,5353531445134830848,5427782714929360260,5485380221892567220,5514178975374170700,5542977728855774180,5600575235818981140,5629373989300584620,5715770249745395060,5744569003226998540,575629318661996698,5773367756708602020,5830965263671808980,5859764017153412460,6053749340117751889,6078063816010207511,6102378291902663133,6151007243687574378,6199636195472485622,636098567041587880,6378118174160184462,6442260945917501989,6797274716985690881,6809962391100700109,6860713087560737022,6899570713647759206,6913847595246757433,6928124476845755660,6942401358444753888,6982189109393844373,7032354807782333178,7127842796503699143,7219563690070700493,7278819952515372328,7329828943206328977,7497098318812411979,7559215689136880594,75884674133638885,7605023301276016119,7618991812648701399,7632960324021386679,7646928835394071959,777893610627939717,797821181251034275,8013516862638457698,8043790984585680696,8076376660313007777,8116404092697841908,8212928810287145815,8341107466815273411,837676322497223391,8616086879992299613,8659142300731226256,8702197721470152899,8745253142209079543,8856969229598390088,9012064933243890194,9158642501071239974",
"-1000561327608727854,-1054334348426170027,-1072258688698650751,-1090183028971131475,-1215181510419289525,-1269000220061264410,-1320121480107969261,-1371242740154674112,-1422364000201378963,-1509909765782976684,-1533637242991512911,-1591410845174646966,-1637507993610732252,-1649032280719753574,-1857176138557025991,-1906692637426806855,-1956567680009054659,-2008952528578571050,-2061337377148087441,-2113722225717603832,-2166112840083349857,-2192328327553026592,-2359955300182251784,-2385875354284915955,-2799057015166675167,-2876371779021449565,-2899825431035493005,-3022465311392624245,-3043056599437125447,-3063647887481626650,-3084239175526127852,-3104830463570629055,-3125421751615130257,-3146013039659631459,-3166604327704132661,-3187195615748633864,-3207786903793135066,-3228378191837636268,-3248969479882137470,-3269560767926638673,-3290152055971139875,-3310743344015641077,-3331334632060142279,-3487187690020749519,-3511256812301194029,-3535325934581638540,-3559395056862083050,-3630053687322561360,-3666653311730628241,-3739852560546762002,-3946222650827694227,-3999688838219070598,-4046037710868938593,-4088116194673901563,-4110029564270100158,-4159101069624800011,-4236408541662611155,-4291400389426529193,-4325383418920259276,-4343198201029940369,-4378827765249302555,-4414457329468664741,-442082027621968790,-4450086893688026926,-4611846956978447741,-466871022394209905,-5292340562997259219,-5343876721028380619,-5395412879059502018,-5446949037090623417,-5509150077395425889,-5545052910380401140,-5612751925378867050,-5950125228101993160,-6149885694180938818,-6224795868960543440,-6274735985480279855,-6518490488029742418,-6665164363815234365,-672016156444666283,-6792675183098553599,-6816015733024153964,-6862696832875354694,-6874636130961393427,-6923469415798502556,-696122137378817247,-7098869944965770139,-7140830791098426815,-7448116862296139779,-7496721476539383433,-774675471026641843,-7755532480653870720,-7767169275647899243,-7778806070641927766,-7825353250618041857,-7846816634655613622,-7867676616709690294,-7888536598763766966,-7909396580817843638,-7930256562871920310,-7951116544925996982,-7971976526980073654,-799211599011135125,-7992836509034150326,-8013696491088226997,-8034556473142303669,-8055416455196380341,-8076276437250457013,-8097136419304533685,-8117996401358610357,-8138856383412687029,-8159716365466763701,-843863794763819091,-8442261612727415404,-8480106360806588644,-8517951108885761883,-8555795856964935122,-8593640605044108361,-8631485353123281601,-8669330101202454840,-8707174849281628079,-885863954386721497,-8916506705553906630,-8964807181004153750,-9019186528556016688,-9064120006620314916,-9075353376136389473,-907820936447071895,-9109053484684613144,-9153986962748911372,-9165220332264985929,-932648625254119877,-964712647063766406,1005059989897406876,102411233810937863,1077811482999103178,1222873486548088150,128937793488236842,1334031788648303327,1353237804622126702,1372443820595950077,1391649836569773453,141184625004859535,1430061868517420204,1468473900465066955,152415008199455431,1996781766012002373,2022608328041158243,2048434890070314113,2074261452099469983,2641107225387695425,2667331567783651101,2693555910179606777,2719780252575562453,2765671954841445820,2839002392956694394,2863445872328443919,287179606534606189,2936776310443692494,3120184498891169949,3155671638253212841,3226645916977298625,3262133056339341518,3297620195701384410,3333107335063427302,3368594474425470194,3503115883238360479,3529266333267708357,3555416783297056236,3582630678555778261,359643446008454294,3637767432559471743,379371393336169122,3865621146779407532,3889498148811141491,4095707148410688084,4120146384542877096,4168328835934579691,4240742397641266397,4435742961310787129,4484035763967079960,4532328566623372791,4580621369279665623,4633591099022158875,4706508628885551619,4933232093280536066,49358114456339906,4983882072908558639,5034532052536581211,5085182032164603784,5974742264590083886,5993471361082715780,6012200457575347674,6030929554067979568,6065906578063979700,6114535529848890944,6163164481633802189,6211793433418713433,6298989405227939547,6323998028745690081,6511203718386711975,6548387089190513214,6585570459994314453,6622753830798115693,662883008048391676,6659937201601916932,6697120572405718171,6734303943209519410,6771487314013320650,6835337739330718565,688517387994198208,6886088435790755478,6994730533990966574,699800091417619605,7019813383185210977,7044896232379455380,7069979081573699783,7081982349720198468,7093447461416073636,7104912573111948805,7139307908199574311,7173703243287199818,7185168354983074986,719296525165498664,7196633466678950155,7231028801766575662,7304324447860850652,7355333438551807301,758289392661256783,7706982300978045545,7719053339084592239,7731124377191138934,7755266453404232324,7767337491510779019,7779408529617325714,7803550605830419104,7815621643936965799,7827692682043512494,7851834758256605884,7863905796363152579,7875976834469699274,8605323024807567952,8648378445546494595,8691433866285421238,8734489287024347882,8883475741041366685,894499556618037614,9037996269883104649,9063927606522319104,9089858943161533560,9109810237796642533,912926295497932491,9146434435252590613,9170850566889889334,931353034377827368,968206512137617122",
"-1018485667881208578,-1107936782037722668,-1125633672702350684,-1143330563366978700,-1161027454031606716,-1179014358621816213,-1197097934520552869,-1233265086318026181,-1498046027178708570,-1521773504387244797,-1568362270956604323,-1614459419392689609,-2809916019683810043,-2842493033235214671,-2864644953014427845,-2888098605028471285,-3032760955414874846,-3053352243459376048,-3073943531503877251,-3115126107592879656,-3135717395637380858,-3156308683681882060,-3197491259770884465,-3218082547815385667,-3238673835859886869,-3279856411948889274,-3300447699993390476,-3321038988037891678,-3475153128880527263,-3523291373441416284,-3703252936138695122,-3786689534475732024,-3821480361850173947,-3856271189224615870,-3891062016599057793,-4056557331820179335,-4098635815625142305,-4183636822302149937,-4578000907824876119,-4707390880302079332,-4717634913187690009,-4727878946073300687,-4748367011844522042,-4758611044730132719,-4768855077615743396,-4812545496335826210,-4845985848921824216,-4879426201507822222,-4912866554093820228,-5527101493887913514,-5563004326872888765,-5588366684610754987,-6050005461141465989,-6249765927220411647,-6356158911330634035,-6390172953025878330,-6466106960963495295,-6476583666376744719,-6487060371789994144,-6508013782616492994,-6549920604269490693,-6560397309682740117,-6570874015095989542,-6591827425922488392,-659963165977590801,-6602304131335737816,-6633734247575486091,-6644210952988735515,-6654687658401984940,-6675641069228483790,-6686117774641733214,-6717547890881481489,-6728024596294730913,-6738501301707980338,-6759454712534479188,-6769931417947728612,-6781004908135753416,-6827686007986954147,-684069146911741765,-6947886058217057120,-7008567272761955151,-7018524940826929875,-7058355613086828772,-7109360156498934308,-714597283815760651,-7151321002631590984,-7318159869767059477,-7353369507784630062,-7411663401613707037,-7435965708735328865,-7460268015856950692,-747793687024842418,-7484570322978572519,-7508337368952028928,-7530498631480989084,-7552659894009949239,-7574821156538909395,-7608967938475609546,-7631212923465704154,-7653457908455798761,-7675702893445893368,-7743895685659842197,-7790442865635956289,-7857246625682651958,-7878106607736728630,-7898966589790805302,-7940686553898958646,-7961546535953035318,-7982406518007111990,-8024126482115265333,-8044986464169342005,-8065846446223418677,-8107566410331572021,-8128426392385648693,-8149286374439725365,-8461183986767002024,-8499028734846175264,-8527412295905555193,-8536873482925348503,-854363834669544693,-8574718231004521742,-8612562979083694981,-8650407727162868221,-8678791288222248150,-8688252475242041460,-8726097223321214699,-8880281348966221290,-8928581824416468410,-8952732062141591970,-896363994292447099,-8996719789523867573,-9041653267588165802,-9086586745652464030,-9131520223716762258,-982636987336247130,1041545982111856936,1095944233442726300,1114076983886349421,1132209734329972543,1150342484773595664,1168475235217218786,1186607985660841907,1241006236991711272,1259138987435334393,1277271737878957515,1295404488322580636,1410855852543596828,1449267884491243579,1503236255590418472,1716040042061444629,1737842945554492117,174875774588647224,1759645849047539605,1807923240312297008,1841561259349813876,1870628623410015394,1892566099304858982,1914503575199702571,197336540977839017,219797307367030810,2306862150879190550,2316910020525406039,2326957890171621528,2347053629464052506,2357101499110267995,242258073756222603,2475409377212311002,2509164043578929206,2542918709945547410,2576673376312165614,264718840145414396,2790115434213195344,2887889351700193444,2964637336055788327,2999437585286441849,3034237834517095372,3069038083747748894,309640372923797982,3137928068572191395,3173415207934234287,3191158777615255733,3208902347296277179,3350850904744448748,3877559647795274512,3924122900635090802,3946412234368622590,3968701568102154378,3990990901835686166,4001614140646723938,4011715951402033590,4021817762157343241,4042021383667962544,4062225005178581848,4150225445507908015,4186432226361251368,4204535616787923044,4222639007214594721,4258845788067938074,4276949178494609751,4295013376659097064,4459889362638933545,4508182165295226376,4556474967951519207,4604767770607812039,4615361716556310689,4651820481488007061,4670049863953855247,4688279246419703433,4742967393817247991,5113476296951233568,5148617124684236709,5179191188885807711,5202386193954734143,5377952217358190683,5400537363326164256,5902200916844130529,5936300006113343805,6090221053956435322,6138850005741346567,6187478957526257811,6236107909311169056,6374109250925352116,6438252022682669643,6539091246489562904,6604162145396215073,6687824729704767861,6715712257807618790,6752895628611420030,7116377684807823974,7162238131591324649,7208098578374825324,7253959025158326000,738792958913377723,7672397872219682894,7695236999983754337,7743195415297685629,7791479567723872409,7839763720150059189,7888047872576245969,7944550004996497468,7978194562219437818,8056362944120590712,8066369802216799244,8096390376505424843,8106397234601633375,817748751874128833,8208923227270641827,827712537185676112,8337101883798769423,8594559169622836292,8637614590361762935,8680670011100689578,8723725431839616221,8910989253742884260,8944408269488121742,9195266698527188055"
]
},
"random": {
"static-random": [
"100321965425289878380448965995332854810,10065780935812382625745630913295956174,101599373395164482597769081018432904605,102118642210297722209380353860921495787,102172878213145464194049782711095066964,102383482264203118849778408659816705571,10312353759974506788807756316265596115,103325887573743109562331879495524057488,104649488516571957490512289274345906800,104914268497485437436785595622803447797,105366627872887068776423303884492693377,105920596493741914384657064283877183443,106189084386510856743434663818826072522,106334353785730334099313118217092529263,106493608045237016118878733777011189984,106589301854415222726255411950248903110,107499697676354632123159954533425660401,107652241140250493655810890833939046590,107844671200765462455083558184595999956,109428306053372905329907162868360485523,109598737258884770130116747125258724011,109608215354896283310713731471647602501,109716937222626296864862266517436297862,110019599534468823531143671011505422284,110375783036078690703152144441813271653,110515447351814383716210393443835122907,111928577949818587108592109562200874913,112196188577051157652483192775696451825,1130298015520124909163994233471962688,113093903325740885814330921449976455282,11336392335207106694345674624973832093,11356791877226497531683371999811943478,115377946363813100628625066345277398215,115850735903536241551155336534388527220,116540746300342641375914189375460174250,117810780016133304519365075773409840713,118364815700229635103423189022890627712,118392702060025793859484719435373136368,118472729351286514900247077406336140414,118621583263815668878136473187991016174,119441607489482086358107762670086531899,122146103696079286535007610992794415486,12225437935275564691480412526286945720,122445114841677855957798153703090027189,122475620668399678951248204491974997901,122788552290003692648576939279491961112,123725804617894092496089788515767614563,124237531551046163174513741494222019342,126341810286215486939910197434967704260,127440445745857796791820190543805439549,127693562473014021114728528228110987076,128359135436669326207460405820099062904,128606463566126097545472062241180752061,13033644450211441275894906614913381507,130699394596843339226304588890935272667,132009780411792914503071353042802597445,132387832067579593926100948502627317291,132817507686943216926559797902416178785,133283602354189667141506587234733042358,134759231143847970503314849389389496741,135045761501047363888701861798416764974,135588340870744986865207658028577305943,136966049121787446529953977006993118384,137585177535952255873324821553974064117,138098373979195354656849527356739725560,138199284458465676612726970296495130909,138380504826896679687826772753486649720,138550468785922852211355352539029545678,14033637330733531788132819859897570177,141162992834807790433726123042005527725,142277377609758214163572379988886800062,142756486782690680165151894029491516441,142951648077556203320457432051225868086,143592453113850844875996740622151368058,144328870184753070813500070393362491908,144546766511186625591399544001848565992,144654613759968102515387997722969410359,144902924098255207044133952093186420296,1456022468388732264532369322740649398,146685978325626323008136761404123816678,147251772389730720554255561300261225158,149241468289658453756578311792665887801,149278111606705492915640104657089110160,149285626920427626802998321393520007123,149709041146988068719959054930402771150,149872075175309386308622368032775430298,150750614610042461926948718391892867820,151333426746151292813007004873161085029,153371311107381319414636104563016924034,153497502342652239187986745070818232940,153501747349669525643422370886989340644,153764852820530785056400736670229517472,154772981436656917570852737486448289444,155113410892530217407835314732024968619,157461192985135957085210290509219915199,15753292250217254902121520960318324472,158091331052162199853196364155945454094,158264558505093978317748500814696651048,159406715234122078905285135038836850772,159675476030518569725387843764074737360,160284628370695859356999166443667103304,160681449661196358749432376095503293229,16071624800245564040496322210141427244,161431521623804954090345307992826204809,161749222638118368959343160214956289558,161783333585723213241684723167371054205,162607090186580648066866918489904810390,163665706659757544179827170491412079964,163839857170243083959798886529577901947,164907211233265966779600373441911820204,165420558090261570492284266339401732133,165504966258138667875516690739161503252,165707089406945097235028002139592484484,167049178746916584588530927774233894429,167699133542548071335723950839496172566,168413111476250537349135800728371646125,16865203749860148649457581665981355446,169225271214658095308787307508256528568,169827559222115620950127217492457382930,17942729806724847746569297991983705158,18007002301851607477029041527475956465,18095213339518024756971371709748741110,18800856588604175658416593376653705762,19139040060644952292016403075497462043,19324754943900812179404554621391861273,20424603886631131239520377963436839111,21708134286075229909497000736334981886,22751163941690433700189724291511057093,24464595439961373016721578004123548039,24465278585974889572758321763826898202,25480003956987240618730144151825459023,26943583211689682221683062068043649932,28793016390694241035629412678383845765,29562776331227897931384701623896034759,29848265530821857616245024073146544720,30296215996148788038365368309377193532,30406901961940454931733641812044808555,30588631149137344964223496070312393501,31303473121461770109547974249719064669,31542653801707585795737383869251888649,31598529088382616204724860770659546485,3346634438386090470570741857903849733,33686802640418652149181769957491247675,34259572856817987304984700014896181812,35282647985888169513099895332779508714,3566498695599383326883587830484246228,36894399948070059630274566568846862220,37432462572000964954972250414135865207,37459050527726185323538323373183951907,38098308535662323942036797855595145295,38109641675732277376420253041965766149,41302546232493946047189846315488331229,41322399013564898947483384295326222617,42601012380551923637272415056180355890,42656216510148896345967845527425258593,42924134578515245407835937028730756116,43085503551290570464892231453577573529,43503082453485944826614745142131696143,43636710339314807698205769690992705312,43645599242657943573126990542654290146,43756012899923853585788677001337402102,44319720224508220272974267891185842919,44549744334780178552222759523492349912,45664331196122740238710878020067799005,46059423736242715488938449505066104709,46128998945700730511819069146301634799,46594997035594400609444839615521946681,48198930687286771493301530368067255512,48709856151213982863367571600566979168,48856138109710606028221031464534316363,48987521234125640132299900685109932194,49359637355083372624364029035728068365,49416209555408986177550545543765006567,49826271415370636481227163176962703793,50612866651974233601271834187870425913,50652023377056460095062698973349478985,51907302788066949802864167035865109605,52205647567233676506834014766653849037,52671829411233621244239476189203181843,54271886392876359039693342621659524375,55233765372126461492712621193265078172,57113261605887241592829304322903598154,5719137767541073989642869299076346318,59098241891692643986252627616280348330,60768598264561557727226853089544120090,60837313232121686326925593219152477155,6110685381184489045341638325138014463,61468040961394752678558161775571360229,61619261086000501128594715069963467426,61867158681383119971286475820447958292,62736992064114128608070572739765144415,63617862900934806422876290391081303094,64233567401903347719896090391638820706,64235844593103768246185711569205871728,64276763541831085364109369114734662322,6481620651197739305033397702667059416,65397928060498300690866811646138936220,68642543909622091072399482295802306761,69769038071013471423138411883075841131,7006273067043644431212324280395412044,70379120512677368202376567426621795027,71251550951166069498247047811229801981,72191274663866219802557150505967453535,72301977203027527930767152978729563139,72346529780255383894194155016610097602,72694881808500825915237555547992794173,73292582950465051822039780654524305449,74113476985347044135250731344715885695,74606666587921581747493136483942706422,75433280800811441473625814073709377728,75822893544379825976143658931326526360,76482325228196754284240146147745092038,76566721623109417538694188913340537581,77826117893880218076451358327645445005,79102582712281231225977564452134331647,79468790209249476793194766705468687297,79563052094587117134434201769896445467,80117534040392173039278691503392263377,80890406734203980180439461314814723899,81643725238132417775348910715184562287,83505843199065704948913939534151109341,83640120874599105042072437824486180710,84604692379519166470154920487763473682,85191425382120564417319508408934544917,86390056850202626953228150733077831846,86573229780957484322487785433722933121,86816389858431459290191738874341092075,87238140079819987359516500644141958681,87383375757474323328542146077623299686,87740258633265331965034642015351616599,8967970118053796684378616094548736713,89774071636586241018253885307112613348,89825509319442746584746370536554341790,90957944150456097076097212481390296015,91360821800232966369696199243630240647,91643428116501569476495021245243232426,91942623281201892309773206603993063831,92782598811826515462908797295074868193,93051755711439739895387584612559091272,93441122457094834533526231045802626244,93657080020421377975919120267160859773,93842146810856325107834671123031743507,94093787845664414068311963949675800766,9412183508860936281315250653214447803,95270605047038282974288983838057480711,95481192842702272771769091140956981020,95852510960211459429261484726567022190,96107604619584083218707253603197893361,96138542377299510393149977600519045830,96818973902089137242692474399804100141,98128250123407121541948478502550726389,98301578352018157136266377700436275146,98466170087106405376260708032127855652,98896570758919135314177143217922851439,99032330373305194178009527128786137751,99414764560395425413069731030781148782",
"10012124133814015620115179362508444552,100176210867505920639885458257756329742,100714599146342025594812756500625878608,102338731912324282933820010106849698099,103531796027611821664667252584400073817,104275188751415813991788046084155963777,105319767984987092456998046200793337087,107847083761079586079121719445182815521,109162401356304693843479400388056817952,109173842765794740325170388029376020025,110336744495867005263861303318557984719,11059067183147866714402882840582775047,110925376595038895903437830140962724762,110940600691510880633585151399617355661,110959771630679480145243703864033181256,112181629102599048473281376718716593930,112942384816310739689188701143800687678,113523716875529812082013668535184922203,114068970841705636259754961276919483718,114404925725872008456004423200480413221,115436013651185231006806307153797397968,115493072459203126982760027542143469114,115528729335615917192892669249908373103,11564067703189413553731765270618174442,11630825082183842170143040691805530411,116455455091778051902241398387833614074,1165189222705056468592399645386896373,116636514790084929699606246042534450115,118414293037103238579829813369614051353,118658270479064925505413805175668315567,119359807941329262240238873321499673460,120690550286629493793818179715267629485,121342158379039428314426582130461004309,121616206303139330492777063839822962781,122086948895242027042087631057450095311,122473213333880824706426799722542190704,123526113993927560217021472669528729123,125753292670934373503482878904800330842,126275018919679239594602898442403063896,12692937649903656768556729382117128360,127507075799204985601458836348509558562,127547110822523012319794855793239400749,129960145254588775980326830478659553074,130676398586764547433890861718354813699,130950522765675153157968424538022106666,132175841399940375839037207028496407992,13227695657897360736178061322639707450,132288716787317621130537283244002942435,132965064339173664054940526436393687007,132973204210462972893584721365532529497,13303952251577855318059133826148278681,134591432374987223796271367238424116218,135879911058587569201195796186259301054,135952093107153474686099441520522982047,136284363138252904763212222674341242481,137028410011880130522967641878765778491,137666125383281121778387071255405476095,13907082259392233033357901052065972489,139299614057092824905133308627941486890,139565540247261506250971653828266060322,139640104626262806672234582794751327319,140581020951229988726652236917917068705,141061655792027710107408787651049202537,141353478725360369842516254836529842192,141772850348804031911763531758505702674,142300725287150354694690052356227926489,143033486434345716323710001279267928577,144381275576941823423699175569790313849,14676729760559138592490674913844718470,147531453650876976445933757529753329324,149062969974522838431380861200464992872,149107032577112981940157349162189386868,149236449061602590985692190798690641619,149264697578898483494539047270210697228,150072247843766761276887086352540152200,150141681455943221447933137055141418003,151071178876426374977802491452628673906,151232895646934742854758838496766552382,152282795913853621407334082273442132727,15282937128063768198837001520505652048,153088830599634350071756693464015834525,153855732810129717042567645172167383853,154273210954179807599289785212645773403,15448597555923429392470797656149460717,15458105742700471106542919790760842371,156522283178870973082738500878753933809,157380444464190773182754065959712783845,157450410226803946029301992135246920222,157641017107141686632007621358852138181,157644947140588032448380597394359269676,158172919700071550547325453657634223607,15853795276887860985982444158483180596,158676990308832992401319351287092080625,1594081743640016479287124738108244268,159422627281157057009926210837055830929,160897776558586296666289184433538715867,160975004037627919093803064685408367804,161526385627169932809811254278787235769,16254684230663027142865336793870398429,16264880440903948331337829575460312680,162881027111025281217594673543124062958,163079390646857882275660237024877892706,163903520264526701181169176515000008456,164471022873493567166202864568617492971,165593386817303264222892992770975552921,166285322095153074478384087320776414762,16691972408014985128438038021111551480,167211960816909444377047106535373320088,169246246934734021140858033974158364817,169888625304003707244102705648830512254,170080430603149639142703099377172612545,1723784874455873560196830943412911699,17599107425553452254413432867398442603,18932963845855896240414265153948726535,198702364377515192924098888799567198,20007743707199596483279650958444732850,20351186261855197229331666633299702025,21073361331814753327881973284022149325,21778693339810799089067726231294783308,22099541535594639713498819830500210914,22247053367041134423004189007911796155,22340522751655115290489406681364039347,2291340882135321065530866158589297839,2529016734878575601282299925875508000,25616846335751055820891527440186517330,25680260691212823017759111414084230518,26258437643116174262626244992917699439,27001572562223969541530129969878156006,27237128425051141703138590174724537125,27370161015571782374965796284270815420,27580118380625652452081516097244381677,27902561456396674568197212651560523519,28733382319469344252805055218126372924,2888626933040453525259563147649648114,29158825445020111960823903489095205927,29519937636945447168670595593645245449,30069706742080927576057260858034650333,30795147198989268027453960285676002921,30922404781663050186178044120172057521,31368052993738374898371215852741082215,31860091110536202269740660931544712125,3194684094827045143115332796281146118,3300142030616110693521853603361834908,33324408640647264597102398529528963595,34585511522544862989134727105133396047,35336497139009515569582200696850841155,35461255193947889862879655630527171802,35496035833528044888925157951953337938,3572864950331211508185637239293468515,35874060282377249963137313430070147343,36044667171163838582826055016188666849,36213337338288274448488695533749208998,36653130988581808070099578263580079918,37460051724629398118266512819878391262,37804008048069162896907898115413166080,37813991172253167417618240251946020726,38974232269671493263539077480277262618,39015934028545442623197911003881854057,39249031930877723799239858360590323246,39933683502467472302206329845553019720,40071980169909172289698361159139229800,4074194074710623422638889196863150525,40884326471693084105946142123922882399,41210604932824465747478056206345995510,41270020552156191213949127309923223826,41338246694786348340606578985647788916,41625054291563074989776771998220764024,42072874110572456036974242116752552537,42428124253765506789532092641603548029,43936809890721643274260704290127248453,44173201266494984854178514484305279275,44425786652956096145320031170347658809,44750576199310404373651590803711945568,44886619613106036941372947753736265831,45881281008418532934564828869663255199,46285860687018894677826328928341712030,47494600152315192789326177378026878846,48112151788257320799775776339421683730,48686032533669607295858970520506495878,48998566813845240210566441557748530513,50080569251416394383226113703086981842,50636117356033895627196512483968084514,52063782950377081517262720244279735781,53447571709121236583076861307364626527,53518704258287458893208794915540293138,54463715019842240807475837454774558447,5461356524888296853441098308203881167,54909602422626090495575927468529487598,55605744151315619891907312761967303704,56612353480117586722659704109873708043,57149109114665560597113753327430285769,57153624938095418619721344997519433735,58075238184313520125781787588220530758,58698193344259609392324369933775669305,59564851508158709756489574110289299177,59820229381726822855093655046269073597,59840985877120884876060526798963152828,61509358433311752157080237317151235956,62508628212620274072820230502966914527,64064028391472327681161135864841265946,64540996768340836222351770764889505570,64625407970195412519230967572315756622,65491130431258304180359392091337301525,69179842516299023410422880261789727693,69290256227879660002225242825357102500,69468041244366496621379162194984682071,69486283594736811237905046979628333652,69901308507253444957920258474521763181,70379426254112792429927395222690935981,7099600682343009710231148571223442298,71100885618376684287394065584840045441,71781682113454861907618928823482297152,73148303254464018016339149056103469334,73160673293397114904812304037103051945,73613497034700186911825396410789922784,74880885840527285349960554941570977876,74988017032550865529274639000861833741,75752197363643388158229823355251421844,76167762861435273359240591242759405664,76215269347725412421241413362799743558,77587390194437449066105166423296307321,7841382710179787410097018325538721263,78555285166570338059128165330532717732,78829671822770193094403693338328527311,79068753904596835868219759948690986542,797802824285826537585200871052810513,80245564595035260856662157208835818849,80407810786027734506537994046412707797,81994456260515684313918408724747175848,82585818934056618941960410351959294435,82636996617842527528371101909706951522,85135428361665460125259342008472278396,8606724998940448784245169362427734469,88087619297870434976241621806561805049,88803601531550322787581141312881843088,88858653735397814013317160048289758388,88930910019992369240332241631170156928,90326404599364394257517764664663986002,91223974618087902268140317126044566082,92134029350103504481659452057694593190,92749912669050121061964335856718530032,940952157614134108251442511414986187,94569683988834664470946038866886525127,95469840403601368559253475562836910199,95656492700903929331580132064900649566,95677060391888195661706508345385254299,96200027942225880163406729796921071049,96239364877612920186772026412533216366,97432859575097652789214133295832872743,9746330888652773426208441328463539342,97870176477862205265026861516532870779,97874211031193861764498810249874612349,98083960135970401789543673250103802612,99207067696798886595936790304508303387,99664623531318533924199589173253890123,99690882742489657956742724989075172791",
"100776117686067016485422730455670912021,101396297848401631675757172471914627522,101525555083018176926794471209776037490,101535972594294700006425809107201954846,101604538146157075475742753881424122394,102709061709247703336232841594886812069,103070523298404461336997372465811192101,103511717133518598013304921748836789887,10356487773659858263238416432285880448,103782221579815234598207049007192838307,105114492877048850580066081505940233101,10551303399364072002804871666147419276,105743296859510909559428024576437518814,107310413319428674353879636159618037941,107610125353771881904520009800805151013,108247483963582702282589335795540352248,108315788758596857365215362225648274702,108450069621131264017188252205512227136,108898964837638305825649074878872019216,1090684618644368012292135536767793069,109824985510026650421379409445866700183,112118843508590951038068136144619189468,113500855973701617233073395832287267223,114033270765975596804725401453596298965,114673282874092382025020134165649391829,114731275726232439492007670793526153152,115054291408382552348936671335078191731,116208544118097478965626925413397516370,117533234313564094115120890042737551314,11790984499288930672230396331038968112,119596942868586420722882149393866297984,120026081368361117018763141893034034165,120095116912728314285965784079902601113,12067934404773002236361113255025097966,121799552210026404512703725452940593116,123390144069859233320379038249734665301,1238033275509718301878733808552059766,12408118798741945050693788403410878092,124611260758590364262809124147823436655,125305939787094028443268275247854410150,126073946612148460236859690787232921236,127221728930217813232695890803219098011,12722399378199946094186070970075682951,127851691414421730267415352669624638290,128197398421991572379461663811901704740,128447303144042872266612257130028605644,129239672273676082907260524261140791421,130137440466723558615519035310709366269,130531965531079599297897073852913230614,132023984011144654231916485102494000521,132402524459548620288070696368273573547,134093565907537826802156095921706056253,134281391315744335795837988909218606729,135056402043268178140510199780533927136,135142736413025963075275638086968089316,135272283751480063864249563243857952791,135793877186194418077480516751496306631,136640170330831698874407701899944792603,136673642346519588034510294481622354358,139229552256022943258223493759319721153,139336168674327774111626613330659340850,139494955342250861978211192799600194488,14017368904648153860888995185506972499,140317725292519382083778780143852295841,140894826786672932392330756113643022515,141394762727967089108968528238986529496,141729890000275416278774741298096262809,143543411387991970981738234139548548812,143627019959287162423387382953240718407,143702875807433608286038018308689723992,143807547129777596745611983563563178220,143942305639607908635186363646871467028,144001090766122375537801443268089208752,144120171137952281610825171449475308623,145591727659937488147696968376719793103,146398508736632414719220059188841008375,147008860394422746356790431616042849301,147571354033254842090646785391496480035,149102019809079573629606605614918839506,149330852300457563783308143744422830135,14970214130046307380751748089773800426,150176149015577720386774931076673492764,150926122652027757948862649090131215798,151747806080186900851309557841593133549,152024743269983979606994842002312790879,152150813589512845900775884126593882705,152749534147947633036492306598877314929,152813015915444483484655395668207234692,153125256116884934195641749332091553869,153356625082082983939261082097537708419,153586501701232768187740546302709774636,15582400357732993293953966526696718363,156176152001568849658167967868589333436,156369762669890901085243085109628700067,157451948079320204139976059480855590981,158315307951702530967786048368210018394,15836508686537995755585473652024756168,16030271994550500638673178883091668948,160419549885075144540953873444741961802,160600949353218140357167609668316190281,162260025564057667341522061573873598381,163329763275909189067190192945807457099,164185481722402403114409472958820927358,164603201041472459218345754680087769170,164812358264156600281952295920043464700,165578590674881003527055104079661634879,165736616857968194751015643478284257823,166288474453533841500615566937528630887,166333521855467704711208167288827862022,166753446233244955398490090288285267292,166988843254915546162735997081339618371,167090726958766835160586277309660624779,167230571626598040263535406947229647167,167490822052413244044167990565029917944,167837115911151849874750097889532433788,169103225845696988450683804666633034607,169287493028754500926382044217457681768,169656652475469011934428703085772888609,169826224269543413608187156957643175120,169931355982167668301729843082642006355,17281979901083741482223212098728464823,17600695891560443623291482126265737047,17691162521514470558500814718971953354,18203863655857867083409999996636349562,19217429204998487515179496627231015746,19873656137671749918792763649944903597,1989596092481330817446757203242784438,20452056456979552288371820013649749563,20608891696760524748027350280629885752,20694891274686401515319880920631129516,21391301921111629889644119443012980553,21438704043202105279056651042123118178,21502374317352600752901442248590017536,24033974231067556277197481502045579606,24584556479842920145359643714989603883,24644910652125506331560297178923039897,24839498217934361045066781265074255639,25857053086785367637367252089124658819,25964227127589683311318502706297632437,2619053866691546851776674759707830467,26504770908703902517355099453922190626,27402814844218137164677528912027957493,27589818778390794670526781742996730102,29405658587886256217234304302932510243,30408327913195718180395032044518210913,30862465881516254192291309399210404374,31184869335306028812194859966052892014,3163671271193926898610735791299565519,34326839416055696151672871003387514341,34981491559761390910747248597155903317,36388698607499967766903519552985065247,38028681469600549181434181346269566867,38896231241147933853019860511124331990,39449981103833672984055506049024724759,39451463359788286840955280993886662072,39455700890218486187337428999174952770,39993039077767474883038634416247530638,41392220450251308502146872168531979306,42932484370548011416674582209015218418,44429837600211748042656344178663075027,45454089490813454735698033759944042714,45922659876224339551489170790675818483,481968944602876974455200680783713057,49581824527969047247534860940237290314,51599471980006335926190884651632563751,51620888863858300992418203322791475485,51667148943421363297734856979347274233,52442468053209270949695811222935999232,52698948008885552911285449916405173034,52784050327626312435692373766779941375,52925662996531908134943028835163126693,53851356032924916496701878803783071528,54108829552069190754985450677668237488,55287287431769505248727794589284870211,56250010151778397478060231713558200191,56513988212857130505915979961065549249,56519510436040332835214471628983411369,61319140970351121915846863859931458582,62981670924230200029015773692983184766,63238394226948898670839464830159259573,64230118296141258748994280373563197481,64246238319320344339044277803865529605,64451564975410575533301955931778657006,64848359542667996515780114248343457744,65002929839411848212574005965382549532,65495569651393726934898119893462581608,65670242834302048038103813101712873430,6589314866555294041886407396875263726,66031430836704313239257466374134311885,66676804915913041223355652459461556951,67222936762853877639749193612642043169,67429445122931183992773722589131521480,67654950152124350739006258353551218180,67985408164936042859632774449179103938,6811083756247268773711249648284461397,68552937819453055511324224088582929135,68778003973062330130300003594302355753,69479657940526896162710846844619607096,69639799146655703541731562550728706328,69855099826025309880184916871487289707,7030124222713959526620352249953433093,70374258332638231822828953125504770672,71081208944676822077068454958862444917,71265978876257650287770041027920965591,71985627908559323865232556867835394355,73149973701287324004532612189848622043,73730855366233639502926247964851922661,75197937972062869575321226282145698973,75352244949212840735287605771506949677,75608792233697120374510699391426939080,76210659134027438677183790501671842611,7754887450698327182110077599634774488,77739419328454746161926803397944458598,78189134514090776661791397804772040822,79235559633176566107487277817246177904,80504151450182817704359954765320785966,8073149535099892225574422711419464675,8099216015145122539901297341794753592,81053761403873634537185481892402863319,81628654522178215168090265860356288756,81740562801584610227048520669378997243,81868857106146240545433382403585487022,82334164563407852455832135713219875424,84525067348427299235358525903950325124,84679792339760421401599432794848852477,86842683713843623101323572935721726225,86946857569317096516881657504169484574,87180619767073683364892375704932950804,87185699353337076949497071681764990252,87352832843382011102197044277838385468,87667455666385362647217999144305053037,88244203659958156321729388866107607493,88273240074622891078020114719660514417,88858878244240266226872381795841315197,89722448290925642646655704608847168047,89875388962892840225500855879527368323,90667162761262228222307915105731608168,91296821302608635864496499229803003852,92183668619332015464031167779035733934,92252339489892614125584531074078229744,93704909639695263512122499619479557896,9372255425594166494202150835011807518,93794622892138098253735764044120265936,94943858194683778078697322340086334491,95437930682465880573180066438942427854,95504727506038346089344225514016012567,95702098548244560188188902355897878320,95927593899875659308053673266753094116,96853920641493913838246207325447244874,96854174573655397962207209770216340627,97329576758787121713269496254489859828,97831701983054616319171841244372982246,97867632410276238657453847091174840390,98250319701809460467897510959305125176,98519543835865473251505966893507972448,99049171343037239330289591046065434700",
"100624801753273554438937150837099975562,100727421500850577766109492985653931295,100948502884657852655246154714730517909,1010562413021878120391344860188400436,101196878023209069790353718279977713699,101738357739164196054444629536154941114,102779737627552212859918024384081619520,103056174098863895958064329876557080113,103249475119115598021830001721166342909,103277236162360407970209661862134792893,10332443440121939808236027795775740817,104706276861563506415314678369559961500,107231186573728625475996223985394941359,108392700696791831507762169149552762282,108904358688753191452941509237830234237,109360651766579044223882012474310535848,110752606096663629816845745032613882611,11075736179323109715536189754132818831,110791049883546685229370133206432146431,11163837580234898712145871711973029956,111990748854330023221325367842215275618,112266452922971303421260813348365387149,112745901860538033565993361027962482141,112848920255267322389120268011661587098,113237974786693807721384175395073753407,113683576424228669613035625461728942212,114751931916804127205446102483829128476,1161544212359729516908129183364528887,117189536837628367487237974053152554076,117641561090022376488088469591716522705,117893728351498408162735547924242235083,117996986799408193471344415861121731302,11965415636591787785961587953315375689,119812268941440029556377329376056352468,119943917202761662937871170975916695042,121765410313926477274521419773774814347,121978835891761326134061584603914807382,122179633284412341124056146852303708147,122287027432947985021174591302411990492,122976129983301820167090411935807777067,123142186814874617022776144478449484714,123261987764713718134004521791037735575,123768788534834612468650183114583082890,123857496991737357524676852912524580543,12397956564918856523394690234854130162,124513023215336287371309318526894208094,126270429151870633672376306159204357961,126420597232371320262210247276816860684,127895374969869750988859445779910556438,128203477039506823149703668669697285767,129764802138457352426505947714318576117,130191500998367340404817723905054499417,131092830616918330848753669048174034453,131144707514366316367331095432605889959,131813517762710331661372359312329945685,133221186396670596543375172868263580702,133982659137314314979391596526681801917,135685273788385562308396261181019971320,136332384403978885663980023584984770966,136993381022548224078855690111773217420,138041861199308042559784026005324204985,138315640162766996594285131468458149400,13874168920491744617204236720995044894,138906126780349339219642118750205573267,139343075928935338354156696837639976705,140199548731101482199837125115123363623,140794183616593589374669203014988119753,141340748547027637502787413099252429249,142332767818493013783291916374209704354,143071599373060977497175364837478462581,14322807913350704606513788788086564919,143613203598153906384979073943646580290,144894698711051869151414998557704217170,14681654982141296014633801406904937112,147099380070969894430592339232563957365,148331856899420059957315741312243610694,148334232236801028319386731487452167348,148531738702167666315921523319499997247,149686302478742480692027734122192326684,150091014204261004052430955775868815593,150429393841563091178844456478360625104,152502451611998728737540634528253870037,152766429807722538468047363991025920942,152931683465819643179868185092084599646,152968247308069914819770847294348935072,15354820282613839516731523254640261570,154207402237139951422244723476855998931,156133238941159050902151072822002381717,156182879858501370382235234972273451171,158426257804008169281441287641465888202,158648007412355543815835126018708150791,158732038139089736256268202181366445701,159314328978353318986241701036690797229,160116325223005075681617531870122439017,160158443051796605812650863338988759378,160546965218710831328054810445165670565,160765999946228012233189178927837744631,161559232029460906896232981682764935210,161914909728800235596333148058814339868,162377954310098515961091828381589405257,162814803021264426616508052638078554272,163622057909925418027258174001592072357,164115293079141880996310032271898712669,16484036048087265805912413415151339254,164973687376467443785987193815948437220,165239953178610730265010073748103880491,165422023755669628368889763996887648433,166515735280710009503914854569175616477,16665924192050070514918512174350086862,16677282249815843834525750724223314315,167395540197100823975423581677417783707,167854603299963476194600300226887278342,16785842696325847706586954786246295441,168112572306550637622796516334939422715,168113715441676088706510037027399495377,168591109594558363986172119242758736589,168735770149902828821920228725707447242,169164938563441697549700339293549312350,169171514262495884750250137925916024257,169963682280882064198189379207889637680,17393480512228483039867336757368358531,1803029562313929288799271501013664003,18504831211236872599833586392383198085,1876327897361088912750352988733031583,1923233472458395598410194144842107884,20150701674879886664436480810801133747,2037547549389653676892702862464150706,20459658543159594493018645795030125456,20688199985806634871845513566041673777,24503071787135769926568158439161400088,25052636764010955174940419278838027003,25374209435749330305160245210794251926,25453360673710883239695752522935595525,27058427360811871233573224391087587684,27130561551625584306563224505363158542,27714345144931744650835972094927241240,28198551113418722367910047423317294499,28709461216542120578381238472012035932,30695147785761291474166200614720782112,32113580996530976054125082742103735668,32242190301811432576818086443149994296,3246723433032126913173648618758465884,33075688956694308144038954031056361095,33283904183136910996800029810602650215,33309355107010637936430811686550714880,34194702091677462538375436505502270298,34847120268480552092910254744223826181,35753881305648053436734512950418300667,36516669531928460370777861571237570091,36614459535813418758886937064400594686,3702148215985686862614676818754280718,37638948592729237678812915600310251145,3905920230898469907017930853990779604,40172722046866593229163668975317701016,40719771300673654482615690553541754644,41278767924851816638438281019412305283,41653688915421640860419886234613448032,42210398659502930918155630025941550432,42415442011217193620711774438334511495,42494120471732152609558715938930377364,43360744753950529803198992939614925892,44501727723794976164744932603049937843,44512361072733041320601469031657705510,45047459677789609376175520552230850091,45153826048957034835043738964880782609,45328098091219929196980909799030103073,45784750998675502409703716928833402928,46548631103903159778577944074460179161,47252425565605099917835248341425698236,47364564649124327219737954585000669141,48260115193280012098761835569113056794,48557650829448507109986047838303645582,48762821241157833232485353012298807335,49202947216180316443928939012589867101,49912021696868248264425285745427386068,50280265323669802634120737053437430973,50709036547301444259151857090276315363,51257398078303421649213002017689740479,52262812738091924587304261676597876043,53225633346788327845030320839720559858,5426794342841108117090877682880823289,54614973907944204585341686398783669648,55857155647891547850831562821124492146,56484482756007992604066245220227473720,57657026790066367130289335490227544294,57700007224405784169824485107053713607,57824145205669003098693121419359496118,58416165595272857540896344848789095404,58741233496821188443251409225711326357,59062266455794813243672308067523227819,59677971496069704119672492218356555773,59924112019575772429412864539614202370,59975485715022509941541526628697343524,60507046227489571818093978533931356350,60608033440457035513611489435430687000,61284992420467469112792643459990888641,62758437688269459386199105172215634518,64124014485408057285139996817511853985,64527665227423470536310477115708450206,64681326841792416536563551950475934247,64845115404482457167610001545087378801,65601442522045312737240119749266810752,6611168628482626150250931930947325607,6639650365506519838851056762857507854,66769301539386946569248840103431967082,68012918454091251183673781800875677413,68231858686015966193424519836327672836,6827171116983908903308476720626396022,68800966805374366506884391759434468443,70088292585420236032407841957594622645,70758082703465566530487294012221660110,70805148562048374838060675544170512358,71772428948867701564174308956068495377,72377216948948669248247268609490798127,72668920427500996476906351370940052855,73561886915385773820582026424301920636,73602759940427893119447629852694869387,73855265943035454560380985754091282360,74105303776162441650742824661283215505,75398511605495480689722354472211171228,7543042794477207642804417931515189408,76243562274714088471956543234950410448,76358745418601721477214366556019470148,76695526801839375099822103885980485555,76871714231314498535366826727224445705,7790641171665825956846321765397863909,78221512246151976827345773075104437848,78731185447791177051463327671075966844,78747742266133147346935823069211969043,79049448285186523638942680312669802158,79154337995579864085955660420927295407,81272896963032242145639241432080828995,81554737622974148685068953983483910268,82980410530347536019921831258894584172,8416051902169350873548327209698429961,86682380164873776824835204342538420041,87463765938241971614910357345298748379,88466585734376107184279118085361211212,89539960125042066424180685229284625727,91890637994295883797295850839215682521,91978800022285211458551717826236408868,9211675855372146928997912918338424435,92423642900778926764319743345498906948,93243649505706944683535693491364279488,93323158715209280604243162755751463289,9356719045117522870193721078296630880,93984095214997891413894945647854225669,94464169558452090367606098683980581883,95109817620449127511927536757449170601,95706406504810643212194271019642397209,9587829736194916246269281652763443625,96692816936575533009160141825083072531,96898109788422570532143720544122695277,97528940737190140867291186616296202771,98389488855092873676874194135366709201,98966151399148158738192344260711996655",
"100658072500064352026375375994381027408,10211965173283925322904795500435120029,102319706675831185225150797199268521656,103024847754609873467721833690765560370,103032373522675380975488725622804577901,103071905834670977445231421681956227807,103518606866610334528886687019475171592,106989163208803522219426790877679084347,107984383319109071869143655010439160898,108059363358542524604017760747859260567,108415730599112826241754803229187898779,109120833014756882124964196655378993820,109137314216202973964312971120640528051,109627070860300615567890197332647091832,111239041087319002462306717070619329112,111571005717137671823568706758226953913,111658284445434517441804562687790772655,111906615556406336750343764581236935515,113401696238357266716224744574625695975,113614015119286618424998232802842616019,113691431838671063679717244863136470709,113868156445723050752928198783954156458,114146287868442206662698854516815832777,11562212980502402469087386660132755845,116184698454585483574621636368811949153,117776182733597887866848875949120414013,11811656518419248032853582123126241721,118393400440007078048615890727311685053,118774059688172843035253920699178852742,118780194597130177761528113195272082400,12103246264806349400197485945011566772,121154056740910185554992451143347829232,121166634755623186084013856611656171492,121311523975203674182252463826051805392,122298845062337351047383486744363155958,123439886950914079347752184865302427482,123932897714647069896629067983485650650,124069611110121525183378073803455781730,124080752976131553429484734875320211544,124804371292618982658994641451186782891,124945424774928621609261070586588386817,125081959921066640605197253106551473271,127292215432862652676136520606238360632,127314537355997658821336923856791630246,127644591298827827372781134008110370773,129532233290160278842310023827402500331,130644957968251969038953005382221559935,130885814463399110045779279375631018943,131019858543809474492760754359905036760,131520418484418339417822879312011124521,132107171730310198479049072710552205688,132516127071075517556143755002917420468,133394891669855533642366613268301900838,13390743811841090801461303202897782411,134050421449700425192694058423423804720,134831357858579716815999203361777183747,134947655823490249216628306465199510591,135463260023006136712506747803230905732,137374503697002211559238981183119410964,13745340698066378581020686293101026276,1374588414048095488067640226503507467,137486585808904711952433476426136598753,138706336001206501902215522318819126683,139061703381638296046204835369023212884,139489306168363359496585812120436026127,139614875316862376543527621580426302054,142038174593349861367871786897191230712,142086923946461460879355379855845487673,142782273294848615967983621257544720091,143417490211307867775172984194166643768,144231833697070409563470186940383161031,144346646196840307803390874472411071210,144811150068257815981663723828494220565,145081335097200380163319437554261035253,145209913792433027016459421433621016965,145520425662928182990352833247543293560,145539154405411609515174692288285732599,145935628486679417310206696947986384207,146811753089921245389245736264597153792,147199380504503629465273209813848008311,147833513135441104371827623017107902607,149649212516920773591874087749466746059,151173291123526855881306884984177802863,151365396163332766301865286318404819053,151914798517813219248505224257147000007,15232955898643335741346870247935574648,15332384886114510428778853953365938931,153750671929888106214718848973982036860,153778370379151094939313142390040518125,154409301768730344353040127389658436429,155771703821829267355425376121389812696,156081760115600338785984026024892024358,158084404503000616458764105051397845776,158199002966659629742139993114085006368,158971002607246637063364774993296710437,159791870557764295708406769399288790951,160062519501222116794780027208135997300,160294611248508262011234929582966173314,160717695976227228892229974113249842082,160753920062603804785427796120052082876,16093739570255686665272591534753980782,161365371475805775770266646664166410333,1622330431992128658311395869498967852,162492205155822480121384484229014309819,162515951530811415169472398148070791536,163092315149383248043939194445949191502,163916724648901763921504913626235862973,16444408711137854499267138448426598904,164833859640740877444746449128861602976,164852141696610381304473714794115380459,165776012209780154281991478890803508313,16620522773888587242414850286030755198,166638459543120431145929630372013606062,166990248737062621327730371653955985771,167586632853733917295076742265295840918,168460138074849978193052262835777223371,168890790161123621190493324691368125913,169479031330459528782655601673692751297,18452605588307991453491183711348329129,1848798272995729709839751886925269778,19186262583562190496633957752523364889,19243081781809620104967508882153902960,19505344477996627973978405955842926975,19663134660653879711522164137055006214,19764539236438038303890050037561676884,20153570537631515523973043605509254062,20608160125032462039003838130372851977,20787987077521386965503807745181721017,21086988950975171259070820077449306926,21129414624586224164269116613755856008,21438817181529873802476598741393333324,21459937116886520897677200937311925539,22596706453600343956305606203820477893,2270136053266715767206997475243437773,22738864887149813212277419709382759964,23278527723571834907050114841995445280,24171984229630761460963475345884263429,25577855438885231001430544756520459633,25689388913429248793190521626605773458,27219454517173218949679515077951036729,27392877131753557616681716783830825950,27913025093276296988773029818472814366,28959812448607411887835315664211491742,29530901131913632186212353078630123120,29872337110922670842598821586900119269,3047758500952973335611589516743519455,30619743180304616077838547949460877969,31480099791893574439695850120130825289,3160579200098999307342034395588669571,32019869230472102480901279574875973191,34814748774036989218746469044111053930,3496413078824938085253331990183538637,3537881910948853506529646298651765368,3578815325507255432228431880164901187,36109750087246856047990125747882910361,37482145224178261388307003333606912772,37768156289330967586358210971941540609,37844347860211750814462287707051985429,39224897156265080275290563588105135481,40004077208626341591715603971616506441,40874040188836758018015874474616859310,41041475182168981516180211886536494377,41776724152444805849670857455188522515,43501663182677988924121730595342634969,44015651537887709150919887589258535887,44679740258759035529200845377262984006,45081236899297660532600009906755673653,45140588872660767999777973297525257753,46623090238315899852794239124864153538,46830504428232409730051831289397759155,47270513122671600116109088946816887234,4728564030625991158809661788014823999,47718560630532516945732431650846243436,48535194467503943485349265910709096703,48566684445588141150855455245649193115,50334080850460475724903346405925505513,50476302116436304185646747196187006314,5070283992745390509408107829171570248,5232199399919612472839440640064340807,53342803667970908015574645775476919712,53735414125241980306614125469114214697,54262474967437541210911334568498598591,54480368171886646712872444756731919613,55788343321976322156366594931763030086,55825020959141081320466345639922496265,55871666674238016965733993355095699451,56874701532182682663779315993402624779,571070734580730683229749205582627039,58231560707439753163074142329594781853,5848197646487607782987930581623172892,58594267828941898187615763333716570804,60024730287279164430438588464914941656,6103944268861304761238221577635790996,61320301124319498293857082175748869258,61368261236391390521561610044966852942,63352987485452090053355846703605911744,64853422095099940381421398364762255641,65187653195747228955546529585771528488,67393957036883141289347120321985837476,67400687180863655507183688139257917318,67404214300925414991073088702635514712,68069254023114952088976491681754600442,68121096672765560986383417335196407248,70387715738141612157429026228583366447,70575448125168320042059647299286930492,70708419500333057787294677188764868634,71297166679533536334326585888545765728,71798519012167943117787948175111720653,71849101492900309030127668060866803654,71903653580236101616674242613477735381,7220608518472379858835970559492989135,72507135372099828358547686154802771471,72557529384604289147689822829383166669,73000510314588339015220326799739705348,73440683335484621688834284666485409771,74747597566971838123411342505311577584,75533316572866627827161564103029347869,76749241901960632957376047451611712017,76852471617441139384613060774441616432,77860862011262682877516068796343135945,78108653973618092261033490817464073917,78806630223800830821255488908735882078,78928312676364006788739202264579891020,81528442360351296415167249956864605158,8311802831798618270243164322129874031,8489268432217643221322347099284854822,85337203987025646439654938144953772106,85435883322423582461783905609542720809,85692378850371023455215255156815352704,85835718966470444999196569132633176933,85882599890857449028215022447026333424,86541829089657723902509938341264642332,87151593094480703700786061000314711266,87474796936475008334312558946695372331,88525717248581407079513489794219658840,88943501101021117595038017141275249657,89586197864062535441945962007614397368,90177609122519708255120695709532156207,90193333157886732729527645904293403289,90302840032753669228017273732156642953,91518250532039732548880858656482358280,93056317992734205536726516647371699310,93135213996029223371937299089896246605,93918673768688994541107635259838763188,93985963112888081340860844712986741252,94502883579606690335906412829555827994,94644073923976728297120114067671050629,94990428087737506862007943152636408009,95245901188494657994926195996168143005,95703364789094292671572221109596024112,96794719807403958034582526574420263440,96804786688780882914338282707760980060,97091217861523984602725874872758186217,97483264361256959066282329061637159973,9825952507681114919209193848969988253,99780027321002262717425674842258922554",
"100392922839550915466281818814486269475,10130074969061274762032614242582312191,105318186573240815683096148711363343826,105623444039561856919919570895596324802,105843346035814310855745320418595783498,105894845130008489200623805834085111235,107154223895937388881672765209035395702,108842158619447880844966255519891289058,109370378930036579473981172733582179564,11052018341667050342550190577632218315,110926076628049256433672553837207262231,110965903999618495730319870154319016854,111352234487485917492683896156848858963,111855118426176613672558783550792396364,112133198352458115885499530789140782423,112923244301931740572999677272399644405,113135300807692628291091720367592755688,113559439332688297993411951063415194323,115637042628748442164485070087021136783,116629969184211163715312720623207561720,116792566857954849165891049692638841425,116900376966371246089463112313600008402,116963541855740070470933452530287686129,117619890709647439236697089914554243329,117625036213068055252095923698827009492,117769807537941247561854990875219507682,118591225607595865289561091872664240274,119398539847988332128982156150208915867,119579198591179044988086271491997744241,119933385667511849719025694802835796647,119975859243750955727758192149237222547,12058024962435081368979311330312146382,12073048740896242747523438270094428972,121141046520037638215373067854165161002,123163779444690442650852388333491761329,12322537595637227955413083681461804095,123294957742386213922873195431773828510,124303733083410775937457332081621886813,124684273653933746428936312662367081115,126008341715094874704972200393788709290,127628138636343800638107955056616335160,128879750776694203591995979801986864665,130295256319234032579027665321162750430,130306137885264658882716801215324376971,131643418718292379326010812855068474237,13289078777869433337713727186000322815,133049914125578185615590921750693032776,133332873518053983424407768350022698813,133420702482180382106045996645246899341,133545532712366372080679182749037082435,133723822743736591331595225855146979958,133769468036173772262099658024624280970,134928668491886263171292586951100854063,136848292415933783077042703724175036894,137448085154226210196948302557117669978,138677585652449343981688604376572771771,139272562612076466136679701968981761286,140819794357996340233622368616467965530,141053529399523714196712983551043996395,142020171226070158180218592760375675550,142024701320483233078403515286523809317,142353403541941023756909215158632470632,142890446450327319041649497349694851355,142919781526778653495246035577543323768,142959787171108832188428643310748248787,143180909856951477225795068250159076878,143308550693178860782900560593779694078,143348809567297630053107978572222127263,144629349890420360240123796746060146166,144667924543710894786051466231945253290,146026047077685901543378754389987937438,146590761638274739583942984885385938310,14682892933967162890298499112060052896,146898724966135854464101597753772459548,14710514792904973201912112418935927367,147430985557453368906602383617335524961,147473905207216419799751596024098978457,147716936412851304426636648591112925170,149818485532497182570178563176639358080,150319028613397228200520940163491706638,150616898041018373768888633369990451330,151402411561267893182876829571940124281,153061779499059138274230740961490271704,15315411279379061197638402430046376551,154630740674920012713885179371215341727,155352501956679266953416245469054989254,156086919336845581424679348956545229554,156715951263157055092708205870216441272,158381095810231890727682040862977281703,158533853668570487072412436558456315413,158542181337817323904074478449866755783,161598176790695090555823917562168126283,16258423572050210041039645724758082298,163070637445171109624311705048201939268,163410859357553656298484232737024647209,163491296789820146075985957033121880954,16422940797196170210195363140767809255,164436191695513594410936142598977558631,165147686420439759249479666295175788659,165250899635111736475166286392492988263,165393854944647487022450974443586833946,16601480610094609660348043281508777927,166132312829356399048246780867226745644,166730846255204835543200937419203404723,168003600902855152882907252709617352780,17483186889874258512750969657893679421,17619166906986681306423173682889095102,17658382822937469278293457524913091156,19933352235322184745462589537151724675,20380844456059098933097662379879444671,21139915883306085225822864458439623277,21793111333382625054797114927696322391,21901968365980432319888290342087811676,21930168260761731315196290172408519631,2219343451208034061740287313245657618,22974633582176230385244917834417527763,23019931846829507465785439914986245297,24866016182720807262063901957058693173,25097904709086810578270184186644990544,25251045973846680545328469438008226211,25293447756008395378712587377519528600,25530612701293644089609610389962153835,25611041518974911938137453690843407263,26184434665881080839701372503835547376,28397587422284689792948053396605616534,28482779890455864929530336748352607622,29053206294172932178778562018250254184,29062342228758090127568507282566148861,29442549307260079941273982252255206870,29503608294276882982352074385185723056,29595850898904443300395405127388825878,30008777939788294279554448270960266198,30162025888897495554703878712380781630,31457880890516281871899533886578796563,32399555753739025639368760050009314878,3274254179182774681202814219738071308,32947072500786609197406833833504466587,34026990617896825157031922623384094910,34725408899015839874801093246318986182,3532536636874771500593210101109260812,36886610998811724762984856507741527047,38171025674409937684487199057053340253,38762693596189240008448342045634652088,39409975051664729261208574736895549562,41244154274063627713182049214067199587,4129816174060222583109433443012245840,41495479357178703871856045655944513934,42274796134052805204913739534936973216,42923440487134633052126229666213572966,43148084783376110570857393381866089241,43356314134606890763977252417896323001,4445685588461924455846796013797673454,45453324392179549017410274127409258413,4600392124057302489583432784465251424,46792989390671118653030350253039997627,47169582562308006213256061671466763986,47199044154309538380611386340872928884,47331292525963885702223366436783728909,47626576952808868270768402221108006726,4795855241547131205669749904631946540,4803057570547512874740061227730975542,48076517135963434674692675724749562130,48372795897957641200811308289725951435,48407587103745943505995376610596897255,48723046056759759455609890677061938068,51181150973499904940164849378938159938,51695542484086601057459576992991415993,52131265342671760849605584989250454116,52271257139522157336766771929313097196,52598342044190441799918742475055941983,52763259722135779118116909798042834293,52922718696332578308411355087600500758,53097188293669693479264099981857931554,53098361192620765232060723875417710487,54095819208871900137583639191997222226,54189533956787124211693555068424507300,54248514197446979072358606390407103144,54431488056500958551849478413757888608,54561991683783089756792732412491817162,54645141491602273077919526413404467744,55284381376775393485121534253637722078,55844421185714113024041262407718605491,55872959239324307663882113180757154832,56133526523200622079257638308825381557,56281106119154036864866721845586013599,56787584258209839124947099342614684294,5716778360493624786037884357403818701,58952028947318508933832565908510203527,61612396166245383114988956547457167579,62724084412712930325596028129650654539,63598966164931696220338005595598351389,64302692939914144701419488181148791981,65864700459826751680630297849373826832,66509711236683964872661936611511877105,67487869977024250101370293957905983553,67548934262679719290186420428645791126,67874494736855229211000741144949778155,67937994822989329463874884672841714683,68000596010106458398223177460214295875,68674015055078131359472096174424403024,69484263869152374259394212522013910073,7028443773527686534204199781257157502,70392683824389863127177001182668726350,704074063419505516073462960365256764,72806660957992974320917066398412339083,72930670183273882109443568754874541924,73664085254664703809756988401733149006,74320910511140539633157769357601226096,75236178523814449530708972209631758538,7528873085225184026199340096320071710,7537742255676775366833250187861877935,75423398664288965960984772958717957767,75529221542942959086065167964151818866,75626506883068496030321480652094960940,7577894500390190947082701100503017859,75978131885037711640588986645354887037,7720917341789381488893645135968392782,77420785447671419466741145177698053866,78532519519326526963557745776303823457,80837025239089240307930879851380070293,80993421766011639157157692597654372346,81132429052760375089972971282113061857,82458583543732033910724596049741661086,83164391459826479956213512037093547978,84352511155465656527744344138619442005,84735051822018128315426907946991649451,84837079247545154707760026605464590597,85328336113190030875740568903742661213,85940211278422970008713083827137966934,86276826186499064148031538558162795142,86805437746370318302005807667692569748,87006837477975084682067494331229350469,87721886202973628839968469341366333331,89152596992265515646042610407832903593,89407845288814353198356950776510671357,90229456710832177347180071088737863333,90467847937338363560424799522520166294,90576382785285815776375257691870281675,91228768690562327186871376317308918625,9205426819952124248096401813541090660,9210755976766795229375018586064576257,92946174175558015686636416460982384822,92989745658060349186105866205797623560,93817995949854947714076159410210875351,94135905286875703408267792498548452390,95962010923679014378141659216418054015,96441688064010744065759143169233206107,97065216310545391227661539657245222632,97338273301418266460990361124303609523,97474449752944916417703368346519415638,9749527773233598340484278217339128790,9775486879872323991433325071517537315,98557851543816152940912070359343149907,99251623473083310791884123577516376167,99308836861901252570561177555533068446,99896009046289964580055920682688917575",
"100540413660728673261051381750287094744,100604145369792118385644020583921234566,100744235839692013197301141164804687271,102604945636678930776777999812216126556,102971733694263063590750374927063791459,104482693199495431961862692108902797512,104509278924357412621188330700292028791,104740417540837801951505042470569415363,104746706366785081004304341002291874669,105101421687281659817685096679948986280,10596603738528722068557444532278530072,106106426712450785373095704714326060905,107235458943520873216097563691753895693,107406459461955005127565089772273677962,107679997813363541016576361089001219396,108920720934148393137740699034709943150,110488477699363236735246547909448205985,110941647211602380275285295568445017819,111222782953343325890568748577785608290,112455136130837091314745880614975235802,113251480371793201885063804200039967819,113370479433149356364767377892088653267,113372280758701263724458655666431316966,114050297970963901327805944817697760924,114651915116430946120492552709605995878,115415117559423981536410557649061065148,115957464436905927272322071426355930589,116314674091190356504088936080021875388,11668800460995188682799570192864661364,117963011923186752238065732787643824191,118022558844069655784130032411072904904,118427076037095450113936902803532947624,118563008832671101408820452408952835994,118605127710716943715711118265886490908,118984740360371369386150623772045263354,11905472347372958195233321382708026288,119059045856476475195989655689271808277,120889599117144558002981748004192507720,121653418075390406120092924294129826349,122022151510843163652226432302071428952,122393242007013659538583079230679728917,123875337125498917274142684548718220680,124072889493154157342031991683135645445,126215188289446911633330108148818245993,126511036047417959135831308173839170171,126582063057898885750750922378784148658,127242301840181465705845694059877098044,127481161964733038974445931661708244707,128596955522132871706086032693324602966,128950524389954521603552683900789750541,129631324176649308320608145160746735081,129664849466828060423228275561878838996,130798648574793356010651897539853962014,13116612182176043318372487780205353925,132156496257563878361601594579851182031,133029778384781601319909018984480624076,134287795271829864370174036737096549547,135144798956392879970046873895847893127,137397785778716947238795380901601578511,137522275864622020141752691333112079742,138090626994386841631457421098239698450,138870414419219542232620550714026126715,139333027287496656780338204487519132155,139476179612328989269218326532753641127,140073040930122386668563887557542291629,140295880236780960685302121848293045172,141608477438252580751642396842180680485,141702585623111701742230378837617435480,142679422468580669945643578670600937237,142820612869721860437110237236499779975,143244120768772105053905804145241080882,145446353505336024637798142712262061945,149066423186051104491231663311853057215,15052101166254750598045811619239697950,150737177302899733063452808675999043919,152167337490448057208074408638521150535,153681109992016352473573420096665617835,155336127534715977362510215996407642204,155488144819765649883449163079759410614,155904070442926580483780789307311874057,156390763243394900099345334367170973153,156511295163839010323443099913766157274,15654636818027694056829960730010745584,156873322771884199373399475269183211194,158155367606474781757229554257129124838,158181098577120695799752839573501930134,158433087232154369122970638047514571403,158905886379097939390956920946891176067,159520710414244654389271604325434859994,159606823082450827425917095341504371932,160459476385413530465225405610152162760,162577434700812995658118068119362903914,16381748933070737963604435541829109885,163861248405312025577384735536064524830,164046168380711965550698846172387582510,164195536238937916193625431802249809489,164853690423660326680659640322025173179,165600181341836336318716460765152369096,166740570568096191746002036579401366079,167975989532272235603487871002051382303,16826724347131044018280702604402413870,169010873039768794963363463439503793287,169119628352995941385788800561000092454,169226274914669328798377080682224595295,170105466953161226669310561081414222228,17377506056363470782132896539161839978,18048645318919021810820490297343796901,18065909466433867479057247234256345306,18253570010205215813736248775002851260,1870496408715811549080663436750990737,18989121855956592293404495434978880123,19555627276810719724653369330749791133,19725778495522407656222715946247384341,21070213458187611641560095430152185964,21088686550277553489270924819977664235,22267507152594963600564831594934332124,23157831349510343708076991363379788349,23511119014896037844897625283324165833,23822049304944479293816345177379079408,2432752251485333638899667538721180366,24824393068007255889776009325525591510,25011931900014302333071483485761314050,26062247434862104595600664947704830661,26945482973253024663378954561744924392,26995967665326336398907781200865198766,27653386311928941069637082768813746659,27655489337701942007864089402094979286,27822082687665171380227973737576329424,27950214465478534137614469941901411058,28412101362999343060319720807615471599,28864298484817155304667706778033506835,30314845122139532930608863589967922505,30721397675748542258361200411159892831,31074613669767213802045124177224398906,32053637074349404579488347535803788606,32610375861487387179481473596642891734,32686634920767839447485414396811171701,32881475933072949730906791825674679452,34408853579407628854776866566321355792,35048283936929388676082673241896603929,35149508281344329663674868998923707955,35976010043021918937473153946054345821,36380979593854747812132253524826301492,36736962646503635756532675820325236072,37395929382213288514656350905421715460,37844246388908641840581447027528746599,38394658707747916250077553327541704353,38914182059262378908560849918393792903,3921366076961148491467616853699962946,39263016052830008001055704843338349136,39911449747957825521940051872209564260,41474312655222570224601331649068535283,44562352038718930374046969403627645672,44997158121031302538563216455040722611,45056239660460664322670183312870459202,45079413452009297751110061466253604232,4585302386936304946147696095430581037,45925343629227300469363435975228839556,46394408960435469226388678919601072608,46505919119442002683558251342114702728,46895129739158944742857633823516585665,47418083729523567034234706219652415600,47933281937258925573132601899016616776,49829102219509548509915061446401237204,50245375367911564388351963669310356297,50378603282312901897494472226091041479,5066328041204029243541625146931195553,52005082444641218970570977923517263458,52141376811132069048073727841867236658,53155515770325448889743587082613910646,54213342466641181052120556942754292280,54345916927604294400172715109180698277,54438853441454919604645507958531557977,54731639618553914844652408047309176603,54993296339412980642000546025161838038,55147550474300815443927769957883730463,56021573170588930043489542682501796421,56656697027320389369231284969546664658,57090274149863555909138173711617485535,57156292314229633886259811252011735672,57954887453646331993949624383089688826,58062445961545720529812585391022223414,58770477068560607223147910766202359813,59604099581941935255690622120594679740,59709235819837909401525448444135667796,60355885559833158872626720110579959429,60529846301077515941509846505751928808,61724648087133320666878597828148634640,62514585883104240761250873604952433087,62601735943579601649517304692982163240,62797547691346522455901392622357050260,63674171103548017809293586715690825739,638612691803704191414586289369822157,64627640199438890666575786535628867193,64834698237329538980380780063498277712,64898973126154545576785782238360259131,66433448204336194286334797208984083715,67413946000746147681002268531092106637,68513051307211958153813990074994455662,68819420357660733545338729218392541394,68831378773739384232062985305116213161,68949984555399833858441970764224527997,69214783547297233265368120047127863646,69478586955318988026989167077614086784,69744942329984528597367011728259735812,7060974822238122997912830821490921129,70767085278730502016089697614982740485,7077248439683855923222904758295050758,71636081147641313778289384927537120192,72026202161414236915291474029668581082,72689226176831756061678509328991911253,7294768769548173108447289642227561371,73369264654642790312456914408538603981,7446672749352141227494803596059506072,74537167139205336450143467575803437020,7587959299939783484698986206334897042,76384592685125661297777443652610123774,77203256166419694502046978311745097145,77722421892308851706134248577590339986,77875581937845608397925629244984568322,78198311400636613049224802312483166268,80130454315775316109285903040911392850,80253499318628365960699386802650369697,8169840713014163484746431471117088687,82293724773106953714659342186126732895,82328817822072991605711670013998078259,82377454902544528553303040063652487763,82393211980081588905278124800721666542,83120345525662748363134959179076853403,83582890404412181397762898972135161387,8385484989386447274056538478521527228,83977116697314406579757450519203910553,84677520242283256343903925862148351633,84694699225272569710931849027594264049,85133365470476024120637326737476438225,85515233857662617165686310791721073671,86373212532763340105867301136865453219,86502603575072658162552957448719303569,86571341900483827541488840148645110746,8865594138638954264898846163433350451,89046833869196162140420169562689877439,89200504601659266682196779912711040659,91626558671905215524422835228861761723,91734150778651488173737821643015075874,92563795876046117598989574170903251097,94014634986166104917269065105802727357,94137728332178343313567116235412595,94599649019377129402341720503811426832,94782120554041224151316018098209144279,94863675991735019681331435318949294197,94942871975447427244565146696142892573,95749018698349641302927868157118799916,96113817141428699825252996047738779056,96687765294532193869094242288929307081,97608016897126326678678230507694453042,98588932794219495652798659248954575993",
"100501022527805722838316282471095965209,100779621683872333411895375421520601474,101010639181048323279538377436279112371,10223246985946787834105410912597219704,103885828886711463242804033372811156796,104699531932568180697826310279680810973,105128384929590493919382777793214221091,105190679372907516777097246451342456544,106657034586160383810805731034786364934,106928470053091033476350524039952509445,107806349971330006045334715931309370793,108212635716586873545730243862417610766,108333457534516717344670828803303007862,108394683827986325457123356105782944229,108760590951171491420013100636074946461,108852151360352516773601669846593660332,109153319819312889848483025771740653591,109976763732960308118316293214443778128,110095779784467875317004237009927466341,110786087488505183856112623087583970351,111490840951612172749689609909586839898,11473009721861020167167536178913714901,115460416884376488458132372377233354545,115934711887852452737355924401517587489,116746369588889108431520987309786819331,11876519094919776351302261987192815370,119929823778538788298329201338065116640,120006600746114874649482428078159240967,120957370570368088144627122489312104987,121499989724023082228851480079047127400,121715183477307385433639763046452973624,121767268060067717696926762293788910737,12214839958038944065449931036222740227,122845775518482925129386703762650025863,123197058075506199249096039542205748664,123287381055920256622738561243124837859,123581303127888526926022334337388973347,123746841719562491766554190218155026230,124033600689023512733419467737916084081,125695464595299522700772676457646729634,126786199262244937676131828259897035534,127095797217203809533630061728927258553,127290105243703189991016861311841220107,128406422836414210429073993819932588847,128858237532172266844474082426886119825,128989183587832764021025513300272397914,130040663934585769096654461826064161914,13255082202299443194040209209311618281,133467215182785578001134664518034517164,133527934039260975183324649776235434820,133697468895159257860992959453861601870,134345322610729215028878121110116421566,135588922506529853366056831158859456193,135742682678026711776186706061455419457,135780512969766845643592958201492546023,137509639129931466568060637719206434861,137738903128995572447024555088744242463,137860402376681616161340904447111167500,138249778756837804383100916866773971414,139174726232747045968094640670727571259,139558570088179056417942480140990283002,142236456408276841785912513956294964578,142858214598357565326706689660585591963,143128211546216279826571524241460894407,14314928214947509370659483253754837140,143624261895260181191026353957721638031,143777985347791494188826715359773256094,144640063699329473790495849251226324757,145281624235144511090207109741524193548,145892767900760433287623548910739602190,146274649662890812824550936652064782194,147029344826390762887541601407722287329,147038662099976809599874559062161176205,147877001682366914922712522872544006263,1482525363781588890332291492087443527,148557933767982202573805239633497313622,14860346793988213364272180792675782742,148980179442043226660103301613620909986,149595309295967119567299736633896143190,150281495747132868290412857180243388931,150901124702571507629403542781503052216,151591493909823561264172871566191287100,151667924295250452706215823491572285979,152727496319910263290556264125108095797,15280300165458768649871531868426799614,153190067490035632910790418222331082414,153976083717948801962066653523892470379,153986384715730675903611765092229358348,154778523722070729899307623317066664117,155442467938742943243965613050863489680,155645795059323303452013861863098115208,156230045010981261675799356819508639018,156599282648629134062800739106316250009,157192816520771996255815296633309242392,157529165787023215259146634633091690423,157529626507499825148202402371545995930,157755492175897064259618360809621900421,157928101462428047237431356566812301289,157964931786910636835218066451375282406,158835743959015537182621466222185445152,158948527041244658930134648111629472678,159010652289999331037902768210431874668,160936435057223164042805217397923598433,161316420040197431013367811329656210428,162024135911326582926511672882687475324,162520031352775675282485863365257133899,162594658446085696204296282965599465393,162674868973319752687120259882441522154,162694966146724319638742388830878989267,165603228692957383578019067632916236358,165636774472005212816726421207681431944,166711069890227409813225014969694450332,167070182927221786460952575948598784735,167191939200180848338910559070086708748,167203982491242248067879975904580727663,167483878696093311260218865616234207688,167942223068282527115487909395488303914,168099971682168584590896483128600512398,168831976554380041079118906343529047812,169540906732086255162263985082517235525,17148184936864797965041535411750004979,17429445463525588698935969863784797836,18094025634937601543645109812983103895,18236844099019934654288052029176501790,20506041351693338897263325444828155528,21204451401067745406454648165245317236,2181172304283220623549851073901089580,23991297235821505494732388886134782407,24239851567450865866486685230069029703,24416053696158038476880179201352058258,24684695255419585212966829672946666649,25819713235203336813919780212638449406,25973600418898440523034863142261816291,2747056638885391031880474220149390095,2751145079962954378104651280733526048,28074964994551078310436420055497683495,28098236235765476443351460843426856896,28667623166387163613513417618980075139,29267316240476655262158844494167811993,29527716135464020393595240507316896416,29737587079578859853946500429013861516,2986167407050486717514111450300043836,30352980582684270544603121587260423331,31187829664497579320209816593473440118,31708352897133496876995158524237463290,32093868386210688936473303055079252420,32998492852285525980535954953129529853,33566236746857928757697561835066335304,33755041844633963919741501768432618816,34084873566256108072258054576254624105,34181716982342938937574722615738933729,34246425307772976006082393357884928342,34310803508519823830516804744116351175,34446823288531607095118680168827262251,34805113126618679486828488593736978662,34900430177532881848208036890785819079,3574596216850928872318049630665691019,37059886950752091873547523116414234535,3721953999455032399482976345107945651,38479541511706656478848242555656176549,38637917141039535202460373801767005478,38826911223089274483971855164020868482,38936174520633411246591523625648617159,39431042963186744595883069398547826064,39625399836204391553064062507512256145,39957931709303566060318763376900459668,40014318836750566918372620675674354895,40092010495693055540404989033007418185,40376922718843927357170839526503647434,40710869078225778594057809452926033709,40734830187951993238051488188046455058,40917710124746382905429697008118641394,4132619538888161006906249598905821437,41698578798368501473181504267499055146,4257638016911502527746456711229802267,43432467382456509190096515280272990241,43476094187883469049705855022142567744,43977421870754931401862353610429568817,45115804610538028770680014624388794970,45423470897414999013468336838467503053,46313849822666441391182492389168600727,46318118931772985847490145991189506036,46569777248808780113515628557159207739,47658034461288137594685967216153883423,48843970352824729722662207682015441152,48924900935633429803674047372473067849,4963765657664929699780312751616866302,50525155308061149703014291807284026679,51918833261531173630204937548664742120,52360016423204753146224150560407470354,53060115897532640781309164190818172219,5357936994831958422900713978205391350,53692157294582314744012747453732389999,53932340440608168915295260418440110320,53938429456978855105949637997395653191,54413918731398443708267678262353056062,55332810120660747255509232834042238169,55445293577115109358954232319397841612,57964485131685548809367664335791297966,58355023987762715703187543866097171067,58452880547709152709266419138832870540,58471625357539278744877818098957687762,59130806040286668899685155865030948571,59572551806522896663411430978330592472,59856524958692348527336064361851931274,60246623985220202292933928220047361332,60361172719375742130497750720485291814,6062949424709753534913403401723004653,61713296747796292279785502398615778204,62024503852253185036361547808118725291,62523290744126423065811294273984038462,62965881461515849043826654121027504841,64678688487897055198798868375131386019,65567626582005097918254197068376466389,66163300371371361489389898352048388541,66611851430772134217391974523833133180,67667840315778629823066579789502543944,68965408819737835336834935911901556001,70383552663740299166908188727609589353,70954870912467961461030126193155066207,71353105206804231511126904801692655091,71586261350717665976465543895457073312,71718751852779306912637281424720455773,72178888610739790212862862067362306608,7244694918651800733009573009501923493,72890272195366114525367236436488668331,7318417683574512465660874681295530557,73578460485143106654835375504228315223,75263468926673716004108660328189277499,77428071282258841788101043882363153134,78388093372986348284685927671681772875,78994761453512975908395675389480811942,79344613250778603764646427318968916725,79692279572570790629888072850454793495,79842172075567140682317264797840349142,80919490407502791357117995404814418054,82021215773396252533999671867778353560,82300577177940485639389486651166198023,82459798821120607534935920929006087000,82961207771531159625292610220783393037,83105907443005620480070608812267017882,85203188776801044788563393689342598316,877640489937837827429008611771219760,88446831658006946294837842134713728103,88526803824940367606341465856436586811,89143023436642568672259762955963578915,91208192804424652144214728884849254077,91354898021893270221382817605670939248,91557516703660458327626712414442675218,93554047668106554821672228712897143844,94719171980815090121828070407831411540,94894125406603566430092311153290285438,96013454971484179093285411979750459055,97522425837231219756244272428987134173,99413318102699832071757145319766958313,99692993344501138078402562526896602095",
"100614172350229262021080520271233865273,100960216794861763834810998155968592380,101298664488361901624360502381291499457,101477922928170943878848410219269092052,101517971794402440323748962261772407535,10162891666562231308130881841503396749,101970045926301366826489085223660763881,103862531545370910121061137651339859796,104067106663635850064444440109189739775,104448414609030310971456625596071397203,104627895605282233079156422395191965989,105040960806395533709005409422425419156,105483479253263555758152393066005658404,105763270035427334907046538490986232139,106031120878181972133457615681509698025,106721334442291158544593534873484026371,110366262352783111810760428358005290786,111742560648203490500599210260436653762,111755795105859088569322004910372032,111825788957026881755263642594092897999,113287457209673384393237318453292800240,114567228138648453990444150048614077109,114964863496413066556060472522105146061,115762275364660717285247594659193875707,11584453244768359487587047866449715257,115881335378936279977388859387399316104,116237669244760360063576421711302874203,116301142138227572536270546641633935722,118236748274833177162571577430165193487,118817343701905139998902861202353973212,119503249543422760100406823519626133646,119628119895688343347662387991799090754,119965338218308741669791120624281876656,120144616570734199573093588686515042692,120391432965267406625535528484378010301,120597332789815282013141660974657963427,121563094353855060837496118913594783184,122175303289296780869543322954693799809,122426543480149371105227371285513371433,122657965307475194447667159758916715649,123005295145628779137315444210846701358,123467656461561171767399202322230366953,123986729573584401953211277716884489176,124073733091758828397517387080683101370,124392673493648917425597447610952443257,124828274970321546800594642774290528765,126295539195274381839885374315140767701,126574211343287343764860554271386040068,127869960325085271200237926807126425880,128285975330710960339486823877473641094,128413869769159640359918908275038447059,128932034380143006943768931490905150131,12926018465500064387224768480349730040,129452976542275978450326504575772733349,130166243442700469163165101819785811852,130468059386027845462634533563973486965,130482984546138426441074745742515892746,1306558132775125879429035534199690111,130975663613166490061484250870761747963,133173880393040304112956863830087451576,133232290837184802033804512186157937722,13354980428173163123591995628009903384,134666743610925986976898831864248109314,134840531931100104563645671016259239530,136024302889576042793242106910328893257,136369465617691591607360397186779725204,136853742136606704670568318033719919963,137579592299178220571144689992982487594,137827921121118350087977619562480798625,137960805478208739286386452860984738383,138115468924901431304007202484343092299,14058695696168619664035631780625011553,141160334308274416586986432690890315635,144006728379526628888980253105400257843,144119034711673720235014661871828702810,144278819613765001416577017148560003879,14491120588715334397918942073501460645,145781078545159479559183598128558568915,145912446654151352403250436859220966607,148303034483755583864067059994097165876,148736472854149966822659302217132255885,148745559228875279817059651710436048698,148847413616533576454503277821724678129,149628277934193639762804431283915454715,149832501847211972330052619161551715512,150350955795817452549994514800451007141,151516276294501870652715965233130320144,151592143841093354941134146362845713708,151830411479233089101593000953035269842,152031898654855165818742190458309024704,153629699367024874303953823660448642436,154406368014565847551397875146263552535,154658037627935629264999007193653719708,154673927763187438028054134272941363977,155278491750816428177950133311700683148,155453931865250672626738156198061536874,15668598810519856364135121496517859711,158399576172934855420510496942657401875,159204940089461198001488804890627830982,160179911490068098887833415140813384777,160625972214088985574620489744719302496,160907950716018019503705133999914848078,162758894219139243317565513903877041141,163351323577981510578471774581535976199,16379998244323545480111605828287076815,163841010090941691813227031290611596379,164621847627966387295551338292868543760,165393518044653533119396728826345651155,165649484705413988438159545190556025380,165890660347857608527230209558275287307,166057157080382395373422425032495757209,166382952714599205638797010739210427712,166780976068285051483840953291922532934,167434478031504827335852137759426124077,167629637245781106998013621571258609873,16769277531993451165955278514583516466,168480027600805090591775564788809459397,17133444722778427943694468560156949213,17376459945179371941583156222095975639,18029436252310794781618944682834512040,1886779809486021068165675255220861967,1979473038410515828364968946550317162,20066168156401288760970486638468390441,20825067543818939867789619843589610471,21628131569157913113225827456857104030,2218544127986901651155039506109030645,22775040139041209770078472133385164694,22891858064391023748210631870691415426,23484642485642358036377297099816710186,24298048297448794192991876553822167346,24393237144550201570905872609376586050,25109528443753705799651138265353340845,25888804035025692341180067240262550505,26439812025993248555925600139809703648,2659332034901899458428939662809763732,26731602456027970847512067448946783288,26814280165557550064593480339044017970,27174163029272982241292212120637483123,27380541376086061497723083608999167312,28060681709768615354326004241540266526,28115460932194821339673136378678533756,28116672592022600471356793468385863410,3060128956219142979232093186095611374,30885733776131092237438498364808949106,30909626143901766144751937711439531415,32236990052272422574670604758538598234,32832808701564982009036660590307396587,32937550109154095533485253920346582690,33836655835085480543243828774035851886,34145770356114233253128570709409921071,34722733349111013650642009896472842713,36524231060779731838164900907213245840,38021828545212751815538386336886114142,38368474340063623315781835043087688157,3896660014270181776057740524913601373,39163284097129760319507899216644621027,40867730118064339623100911113784386642,41547513087582108793973393410233227586,419825413745311028107243030255200960,42697076656544422252433263230931822509,42719679394024979785494103128952051000,43155668969828429216222866330717222022,43338696784284057007516636982803084807,44397470979993513943717512219008253460,4488923813209086324647355827754171534,47415441977480555664759466633994843479,48219694512139843780805499817225420606,48792955271202123673772884911766253312,50165663306670099413932520898640630779,50579236215676976774805400925207605282,51354499615482615917850205020982059704,51530835661652360606111599406415292201,54755172006014959794340564818701480930,55741045801909291254577352921596926663,56088739698145848543937140538953921329,56907528488525681407970850408824891506,57042227154714595140493262360741746255,57773350351336306275748218892291049479,57904491371599776132877361016023019504,59260740055665789431195943987317577030,5999018715545929884955186980046088438,60159443841563201743265874773470845533,61444880376762141375327098877583572590,61475020353280437287275519789352927635,63547935206066694232503503066738297017,64122115843406123184399106951706934355,64239794852854389268768515096383305425,64673912632700510911690295817641539206,65942681116658532927378440332527541367,66685310681662540585808199561003501700,67121620439889724477825703034376975253,67156043323030840470311546924874456722,68325081207285640112327592215575482096,68817297928759955838763240197406100662,6905999504571751660371750830852065767,69301096408921545739899358338859660512,69768004616573879416812680501008220216,71128042170746355445932621719104851288,71202066917311490372305670770300896373,71268630746672481681487614147120251073,7180794273148938878274663140059298398,72749074392855729669952786791669938959,74368937816327154254869143949713643435,74518993060965207870840944308646647898,76384137568054220056121681147664444635,76802873420064594642285150702867365804,77041336836681325733701152491254510156,77956565105396548204121640057496610138,78325093530297957704741175222831783679,7863445084923290144228135205450077415,79779489812412447468071813604869777989,79799664302533803198924635269394006414,80019975385751240273991902022233565032,81359225324351706617181503870967307339,82219067432238648091408046525125554187,83618347473792944308087752132185937498,84023177613226988477225943071583945124,84906134235669189525791609288448357184,85277346027396091066105047911344615427,8550656943674690143794933477622320093,86193942797008785025604217480564470876,86355852151178075704250882497939605011,86711221618403243008268168681794731553,87544487997478356213656368913655723262,88481138861877695182286399282482470945,88636866316413193732716968408861380311,88915309056922053867519596100637079035,89243978454066797616674329800953645921,89272972033489246920372446862350551077,89992331935119586071800331789779252228,90071369460249638530321455132561691482,90083336082712664369760830590052004337,90688952076181392798762274232019253623,90992958867360679907321188692415074309,91093457947647532503496439357760717856,9230467152048757420910133209947272590,92469303634020257584988636111439739939,92781329629653846285460931475487253451,92986431717762905075588806942189964557,93191418390178480169329373060697162953,9352739266685001706556553343460774380,93674812043212781162099691356336339372,94023215373343640951602819471311422806,94591274926558359007439814445326347749,94698499156737927261637716203035636653,9518878709029570075570020032807918766,95354118949117026027677902046313505466,95553069592879651574015917917470028416,9663182067893918333489687464792449748,9731958386452844991605595514757504167,97992163045750004598117418460916382176,98315020198516976411445748410121948309,98461260416787416934459464156364429664,99287898606029668100734354349908427745,99715549874888772864448964666014775827,99904041518387603816229703280711422278",
"100168687958984653870338213608861412803,100345523442869935004045656843518574034,103358929147995171752916650960560899580,103379170561428383625778236283423582017,105186193007337092817722075797902775141,105450798538803791892594174760555646440,106068997410716782936289955880885049944,106112838284856560245866905815163999653,106281535421378462173323770201090339724,10716908293936271989158611739686872182,107422374590762288720982269913373788835,109481473978088745169631088188151471145,109910508234697935643080328431007664054,110392311474123607004474632872567939005,110593982921898225060482868421510320240,11105713903330937669146264992133428225,112463421809800741719670670023824273743,1131538586576825499018310159187419997,114153923987193052208802237689343186470,115067182750858326858766232317568243578,115118220013919750984693124698358434634,115537835006560656003318702991056908201,11719007540361445997831429263257779944,117939592575422418608301819965652429863,118067259923485884431315794147771391415,118796188335240280028473629210320960666,119021342916295425855233432947586464907,119160212804602483550152087569003809527,119378559197840266179191047367775243455,120624052385984016156960182733044337631,121910290213418180866906785284938225701,122941033007181095559556855047593734593,123132433522186269579891119605536327503,124705473081191299804402390358268604029,124850488718624718104345059269556733973,126362270640769904166871789279968321530,126633272311497747085347029818857808455,126980543934926699860141758834257204534,127215033455719795852389942541912036900,129239478880384469682316248861614939709,129850129789536912967481936274218115380,130033361185748032213651429383044962229,130492393660464491996877176456032332232,130760375987686447894460084085455858215,131059426806465952541336712726925653136,131158515732566812478681697165729161619,131401709737501891947421797005104434975,131960322504395258678173269449515122971,132097886468946616548279370508706865930,132250998103620309194434825009008662037,13304868760702787017977427828659196008,133395920613639486427118392019858151497,13450723214841851949197180340421548673,136163480003498390290908624961407594756,136770819992537435384616582196063787928,1371184839970511332460981280326295316,137327756417143706261523101289613430984,137408717580580401523026417723602982968,138599529435497564965726874888409673213,139022462670545296828929962404634171034,139842654959063002262346252486987705364,141160078643630410221703845868756395282,141611957690471781338434003435541585462,141708683627014977459051655015222611909,141998536150216441160639083698268409381,142459105316037714479554958177932864687,143693119372625689811430703335463681883,143995363203785200497566106920502226519,14435567031500703139145812651475314241,144861576871543684808156630373290562996,145290105228123563755353605480938102286,145324999762412326256447457491764589324,145603846699616308804447423506268716634,146641757318051781459449351618963328622,146657929739422201176703856267451071253,146875937531034802316850759838985887418,147149804441045566857685548108658966928,149089926613515098835440983813492244495,151163996575829865212106030240938789780,151183665837280481836813127784781650932,151408982192398054875856750631887766941,152035483503996830535604420644120011673,152100827362271357132937435717802481438,152853977180583776788470687744729813616,152911574562412098910976229588251352127,154024139450626585760971706506134176891,154394009495312640410338635634201115982,154468889066884515120385017595264739432,154843188060274449922759694859258804595,154930870302109620072234750365705808468,154936790714259113602929604565388577224,155078698850649899180676841384933414953,155634047750037582183570643679989599936,157626636265080701339418636348887069196,157808933107653389514546169399447653901,158280982750284483205720853397214959568,158317289512920093359890563788163932399,158346860427471958389610006314404531924,158448620510715544234808217581713012928,158915567558097232237442534303369709323,159068774947289562573176967773718237316,159209175995837125316083633986547957,160317668109651368965942109108149593983,160686968222563155218790302135103836504,160851153221390679703833141042209866345,160869261343641808312964098539195961099,160880581394243668150321354562596282490,162192226915810847482598472641361303531,162253571109362335237100148341264825377,162827453724302672199741393986534009338,162850078210078469347932986499349890879,163358849558222303792676450964601696527,163529340090304129559007635663060805454,163889695706184973657482619522225734169,165249096748285419278228026319348896544,166221517774015690330165985330451548340,166542125242374922956800190470623228428,16700457194086637809811315386764967700,167095850049871721028366397157371905140,167643361002657937730385905692326467961,169689284308654541902780620722690553152,169848502193247159764665394547113770089,169851139892935664524215442643076948641,17065181743229381962091411538414614437,17397939774645152218838564424605061369,17535368808083884503519228589379050959,18139466712612850456981476492468693531,1881038683498718135734332289392969633,19095223217074950474311371559916210677,1968540088636479623357222129471673745,19738789107008567290653909608925732429,19932219738463842155047662470892246857,20431099622020288743822891257973999349,21131734639955846086878787977022272234,21143037036524256867752285588551702751,22117700397115932770878520495246049056,22142512809852013307330091886176820187,22279647169129044525166001419681479959,2228978672689620954228347480045251617,22727116007166040341060700422551949927,23573360599845948378866787437210837753,25108344706161745777917115676391272576,26842800466040589115705201593676781584,27227312059234903127755197208274484177,27302934124699989478847613375867022748,27824008097695583674402581389564330197,28149405298003714335783865163923839586,28432206706973663838499752976945614369,2913900081944119659487884225922458908,31076657450447347900036814620904438460,31134276752986304131531618254348278128,313122647049897691972680059848288969,31574510114915909084313718264467710515,32655170325154150970452980986917417146,34045968505781136596035097409377165493,35363837412438119195852610069657138464,36216018888908052923088603826520172583,36297637532013524043885718947569317911,364422617627805210924398301556606997,3675025113428760150560015999108033212,38185087546497137017661909286158562409,38704567146052691283650871956257198496,38890222743110707972694379967842922249,39984513352373977421796086067599952955,40066711014933272588310552206352560371,4061319804698056627259135244724239373,40935227254751195977561741898614523785,42267029284651320933023641496609041341,42408039635638041385234567086646037486,42971478011550908378601930465295981488,43055964931844436281920740794741151035,44927648207586144212199244447679655011,46158530691845794407883575463484053087,46750826677524424126962348512080239903,47011170329798278455400133280227918222,47573863716820174159799658761513889515,54488502305358422363131018059604561347,54746415871324631629717762458121810465,55610478972041636113263219406110983366,55672891938899951963180883178504675025,56137278969438856884678966291869882763,56199033065680893934824568821794919993,56405540419689703882734002603344230352,56579119052893330254935380869752435497,56986518115829784322185801670555713210,58049941771154247589608585763155069144,58718672757769646176929397757497406955,58861336972871144318443500553697155378,59038409622504472051584738603586252564,60322452915761557297122256858976752743,61981446164177435559116843115620102412,62408493885392623592958608620977730762,6244510224327073116785797630287516522,63155172130766072548363024726687797535,63307190580784562175200249536852203478,63868219700942258516096322471720500499,6422939098652196490923797512784050904,64506192177462438411060456487957618448,64808547937928168303528439113737608995,65767099218912424301191769740096731721,66375897616206569923756059838306934542,67055096054954871002564640047976203196,67375957855599617208207580952298454200,67539193242220300637332127804211148330,6754049358306093657891122165818510052,67608885318887282397834741891862668916,68322617201160968631300539925123458257,68571718392071618802473349166132123596,6976968958782775769656932503476618956,70964880838013978182174803218282406458,71129682410031489517185224355045051871,72410946420923029064373053130132955521,72446260522555801655315500938406691183,7334810248111581192455776507432277721,73983385201021653365127192947962378906,74308576814044365531050622272147810827,75277450807165489233646682801558148350,76198987904845896521717900581437622728,76795197307264252455581051612892891163,77196261512908944583030126897542521399,78537544038476798207760968187940352924,79498252684973702048998013678051138517,80192547922877554850238598734241858609,8034502795027571872181739208206011348,80648569967938488216629904535956596552,80897392868045314783528249893632052280,82279639428299882076871385018558196007,82420916714398919350836574624064552152,82494144118771554335782416352021031939,84193038798177762392976735138393276496,84317818302863437187178464177744079930,85431721760350849592281887425164090712,86549753317334860190423182471719906001,86818814798422164702815307177198159155,87073498129352576109818082504627492036,88704901442433333002027730806005583737,88941856476300549840504394747087702690,89288640003443879255430624295213817234,89476687488402963637279299510565514822,89749018880724313152876078929995372209,90356742144061415536044460093549836441,90457017796601508972735486326283485929,90725956215653277881690641517171468157,90947945286696272898673716650913362168,91025784732675603943408536477125631374,92818753407335469347889954396343953626,94991264059935448546981802067557714235,96737041488366787744276145385660203468,97020285755545389318286975062450866957,9730131937515401722341368228923524810,97768161586420599508485578754083871364,97811539839417800146471368831144233501,98829742299736868273645531500300122253,99547851517210520001503818313056023819,9964674615654224363066211083946697781,99904148628880635907452992157730794150",
"100498243836524077756957794443987726904,100805429047344744611451501398664593762,100872072449925434566287264983834519007,102179536040522750467717559704231220237,10223315947764291207626672735572073834,102459886586530634600775343923867121979,102577307766568168655121214467454070364,104302817970873152561699598550353495933,104639230142341848172996343210578086561,104832348197958876754811643632111036463,10544019432769242987844445009812548578,105688088770112865591893938877857177674,106823740153595372106671986268383850715,107855719837047340123401254575580367741,108052274465965200014604339269787242945,108708611220595195340576776680010049251,111299865800142609345165835266872937251,111690001338189429825642846600504343011,111979325201025883580091670248506248755,11272856924789422192669341092239245928,113111474686880781959504141118828003208,113114759187001121883000738249545465161,113202738023800547131550445727415165454,11425527831839696567669955539445606921,114503746976323640261423320265179001755,114673255284435441117248293552128472195,115891208566971738273026179101857153437,115901767401719701509965210220299359718,116094383874421347181377126958093883395,116708372092787554705206185163897674720,116754678201635204718096023983425389972,117160384387666044653988720869188347065,117902442572961767157291545071219785118,117920594205208132576050295881591251707,119130923105108803032341974571177044585,119605318528592603688716738332844740328,120967588392357867061713768372246477326,121205464771702686365218897310721911111,12134089846532571845606157369302345607,121395457020395540366134992869696366791,121839725430755186672838279071760453098,122284735933865418954536280005971093803,124266856026167481194793077171122928203,124545593033193593894056832034432398750,124684854717183500781931264671653821017,125435792647556835408005403702551544494,126284909281558063806393512238216218054,12705666976081072375350762272789794686,128112725688861793121977090687953358782,128450061935925612080803606659576495606,128511984566398242182206079850646390508,129837883221997921999571074413064665105,129871491399945407643258706510217436429,131727995313109705274759222578804655168,131779266005692346772118653419280137738,131803423435766418436095430430392196422,132249131434583203387819507461892976427,132788211560346822147384766129412272483,134218922373689240891441591194281432666,134622842523432478828020762395395773527,136213812789418012579399262272941542724,1366983118440731288145381800997504123,138224601332793500481693532451009357895,138428412264609415568867504956001749005,138553354281105905102221898938694916043,139521043066084949919194454307397977200,139943541159517349615419645256755073279,140118357503819728269374237201720938199,141228041057140029707283923056940467853,142153384823776171018857176914595380827,142164436824915383477205028428155570585,143378792516643392592464191233543267171,143924585551033947289808150228690567340,144023037284269075852705254074857647127,144336425938444109532656086327538340386,145259535990773237108269257702809194780,145407447087354121411784122150654760581,145728190899213071416315164070274573061,146259308659688027940922441281515717948,146566363819152016433087464340059404749,147294039639812198847797563878632692354,147978099822319418621721080395915250105,148192931787150810262434764214253805942,148479931380743229571789159670110299339,148768580313381438629899021015775979901,148999255251710612449014553197734720745,14948467635396819964638425357637971517,149796019813278445268984063740490623093,149871356175785859988759674692440390170,150194359085519577904129069360696074281,150408126024783745361149862447379022872,150580346202312793143063158779818048753,150894611905043423428281756056579019571,152966200412207828270826106725621135817,153211639270274212073715558960965829063,15327610241080477420826781365942007001,153864147225938680199548168851578972359,154014312567390230573814102745349927390,155181156741718222416177300947415731727,15545757513848006693911157424176398524,155490204100246252851038900927344855470,156298805335991928252206710555272737599,156629950842109044698455084282878801853,156910591321203098676367095914931312889,157102029650372453743124567757279244934,158425627912172281912034016785199671489,158870989059045496026551746887544383107,161488705931242558134486653781594580353,162189091474404005021522267286213761311,16251077081977669911284555902398013013,162876794116006451631089779310215117300,162951377713559163638609362394874017075,163071706738735826285713035667723753220,16430583377659535583602631669343070626,164669529262162570753524825714453728632,165592516161233196427279510553430773794,165690140770685461779450956631569271291,165980359548893126281279453537560892659,166119033668480683474485283971619413356,166308141592259835764482336546817536921,166426405056940191256145176914966288051,166900730163984482495650216497210710645,166978428181037380719482562111462750300,167907845410155441231102238408659561186,168425109172772814260544495998047689174,168770286402129312953720957313105032720,169352526971857707051590925258611440036,170066514328606520934188920682100157545,18359281325046226168914533951096060357,19586604499772646532127038944122075038,20288626263948900838731245735402495751,2055389716411126537784937931392142703,22322425267146612043782370125737958932,23108426475253364122242370212176166656,23627823762428764684562513028075096954,24382973143313614730703161332957857858,24393902676514054099251775746477436200,25301424121621313607045631297948302344,25540528315009710588477685197241934187,26224825883984963333293009990659624976,27181642625811383198472180312849589329,2764498926174444261954925138527424139,27892330005548856225936381967489080854,29601034390673857301978434953432560642,3024820036697133276972316018672041285,32482059265170681129792050161447180506,33569454580669804402126271695620968372,33619055597575124974334434830318969038,34391341746539480715389514772745128132,34447019175221197311258215461974160490,34766066625610209980039146968230707959,34879623909527874806383441151414686527,34896921149887922091956132623051719128,35616569240544761825506554430378011578,36577319350161165943033944417834860834,38012465585191728097109344831542745142,38370027746985702116701983573735495069,38872097448902620955071983324845023070,40447208878691047383386910771378909601,40492633369402246581883304005334470418,40858011982115433435400022368682852515,41144587853357062537812553060119020643,42474249853892111492519767967988965089,44528598641568634716567444163389448189,44648829313120273177785290658175914329,46168109161841833275974681349927059839,4671677349031360052409453304314191435,47043640264783931381833709956852111730,47604874490899076747200885666192042629,47636190044985033369492256730602444627,47908741041701588089882675630900677060,47943525528136110549587175474819825043,49148860372140823668270750998140011601,50497740450700768030577516144446282715,50903887257685023081600675804295233190,51959357788272699632719267499147981517,52211076743527993577592646551817485252,52337386727061177082344846225270514280,52368162133720490488294122776219311783,52610481110931108079119960515837910882,54093602560481285825381206270085780766,55395913051254649714603696357015396265,55472965881689499990283156831240033371,55955077800098736158976102546740716440,56459992341295483369649320096599207004,56502416298483023132187936837245209288,57190870320599393056343430973176027335,57781689041458555341860140045347877979,57876825662474742528258671250383534702,5823037756741719790647238735000978955,58274031026902188038235186765179392685,59328043935744716387830573647942410500,59455786841727223081708070466268953192,59809357115761575543556220404028243839,60491916599851961197555747271582979397,61024850060872587969786389608528736197,6121556012184035844605664824132343039,6165118399964843957238693666296726586,63154128403018232394971691441567279225,63956772269585332146307397552021421483,64473129422663825263828545404792917388,66027528890998183680140228736791985958,66766158974120046888561042894897366278,67270223598710591339598567754586864599,67730064571374352181038579694620281931,69042051918235220539625183764796827162,69611209252817716640479511497218233097,69800060629731422457376931327315240122,70959263788556779851408931151663506886,71639156006512720483223379198156286721,73418137353295332935550033464879576613,74255213893417231998057595877903140412,74991417799614024424028500864189712046,75434763181548608952131098611467826451,76567881838790081081714782394775581727,77444822619980713537725013878957100235,78346132430436895281788537330709882116,7880892970401366627411308964476538376,78935187825019667545904087242425414358,79134879821608211778184096429967992218,80292671426104808995263353269058560195,80348728736787516310650726804612840400,8051935918060862953898007267663120527,80531656860555847348674155014983309519,81318404491484726726104084603385519983,82275868767599737414277104353328011389,83181169052829437129242873017700720743,8349210929336985763414154304094128852,83498930424477323630775059462515164126,83794852514217627891319267309991352915,8425462330787096416439069896939163259,84561430868236241091325855717674678751,84864090879924359771783651776126003199,85538404907540923591562718463027377242,85814634064075014403158884286585839387,87130110778537591001334736471859263975,87883618073046124926541178969251893331,8806668607424146985034877385926046871,88126386540017402985000385409012422031,8885128904714085378367183290591577935,88912164090893394190408180758484313727,89108628907984805006214194979780029832,89214311290540208923099075620695167869,89294943403601414877834097737512689598,90111605190370240361009887934382053740,91108917556503651864800337148760140118,91936078674540468689100928469877429271,92008482929325625255573318189353778957,92050153745140607765469025712036465992,92801419115756988598712581954133192898,95139212279228929830679955500528616100,95794028497926340121598722162538827741,96053658788984406614965412954852988360,96336402775946046060190406288780492833,96737213609650749128025653184240542603,9932457140319848811486133148943125335",
"100768304092991342566330925616963523675,101359820699271518584219106861092698720,102740026131548832044011270381013181999,103072905175418217608443363076554588277,103592996946443395312818075885061574309,104370679123374257917498648821512251623,104873239599335622502781365373440869558,10488613798562157344568230539113000279,106037692317809464550915747207018005318,106486269349461424008983346530922653191,106784596024401438056683921663071467286,107270025981150188844115625877712545260,107285736439073695069348326115356183081,107962265029601671080271925896830040611,108223842577308457356417830367815880684,108312828225101287112010419116548842128,10856713402596904842218601294380745975,10873964697448211584797094952747349922,109140507027922184555883415855400032073,109698657268049857927196954489484609638,109735471259252080446862302957062410155,110238811105200936728318777218398641193,111392205058337952703006385189273837014,112486520348614340185620727386748886222,112938534773615121249857783257904487970,113528967070031884993386561598424948184,11358770030564942542751874885047062090,113620532094152521189769014553338895966,114801095186470479036030697778664763528,115103785091668485588727550692504263065,115455270965423338564856485031992220365,116060674743118028019061875084822258140,117536345574494794010064276643979919938,117613873444185667638906151315112132914,1178556922731985737859864894500132598,117954651064909730779530568625203250742,118164548884338189920417807680777407976,118389010437391044954393375050818455413,118445718711136624708001305508577111771,118516411811483060458086281652311699400,118671085383734155969391565506414542452,119326749756324054671689719202051286514,120172374226168126202100127440441624579,120649222854871665624617993335440187034,120716118101606150202086711207026769278,120731147796810841704362338236623639425,123875393075802019085521137756343168638,123957314719691896745291454795922996819,124025380816657503525795271339563792241,126455345951214468344808240074337569434,126831549198126412310076354820563505476,127483852494995805029620485511452725587,127818446630531289884496621776065208981,128390710251305899777597009613756345527,12864752126198111365457848023789018089,128720641806240716743884038577348141391,128914106021152001646092556496242614520,129752729730289650678238136513692123807,130308437080880315431229380542356483468,130333328987059641716509016635345587157,130341429313495918150598495226813126317,130555693096272206166825998144096303717,13073375061999062650665113995449467070,131776951705733878190864045631158577117,133142144855469234681125944498533539935,133178661768337997853616606052530863764,133568385737410869407023125279413151472,133908937004430719886265404664464354787,136339026098733962239169801778476018128,137800841657287967916147541531032647549,138141752915330906615405592271456850508,139352704569858445680372448580218193933,140545031230716747077062386209079618435,140574750848358017784392148168121725642,141750558930498691338408792160119064940,144124736169703538861076805867150172985,144680714373785640699155350926516602200,145362047885573314364965876524106403986,145468143713213807747018412954567908752,145723945309519592866702591658388843044,146021709116605276957242890746418509102,1465473865856578178185615856569886482,1470798562239567981799823306794114300,14751964247001672988662518685539021038,147663860433761050719908541023565689095,147774842982973371835689634730651461406,149640090765559508842942139163552919772,149641796885172399318505929126395302948,150193048322689776004559158645554621073,150599583178503738435899938018084917030,150778490366262564245670922076268506034,151037944171032864049998667270194206173,151041953158657336842994550960834153753,151625245116985900626764448155253007581,151671113245599369632051070717385877570,151730257177777501914350705673305449550,151808078427915301688712282229788105492,153311662600179520010690201786101667006,15335156636955457622762724177959831414,154154952591378443460084647257571206760,154158129262451399950075019142963085822,154510364885622404245215171816459550993,156194780324864449335556363740720271833,157190044264548933382441597623236820708,157530497450609785169274601702731578388,158220888627657485360943560432881909512,15884779715161791843015598797613209749,15913458904530591290917473439687743152,159247154931903855306852292121969137821,160027120118121410475745632982139035333,161090645478909617893979980312442857865,161212676800285645176147310441214141624,161751511425275630631310361509738243405,162278647665167094670979723249781142507,162957284730178998704759551807034488498,163334698302785472710480269419516106052,163765581153288492692985578611876238579,165024210215163440088644581095446666663,165044034773684075145789718545176254303,165156876834349185930710849993832020675,165957176803625684054573100386921201820,166159973329525921835404942503496054671,166544202691725871209898871887774010970,167563283396649515495346291876855206050,168864962271427662439323591158901361776,17558713957438839838040198978267670599,18721708710567929116022324359494921459,18821303385662756937622518755300301374,18920496033281789051125929701190459610,20539572522724350702492448792437112848,21210193446763696649836955780408132847,23418991456755089518860210956586142760,23530130794072012583185187357239299243,24161714259292885293875522387241276207,24500519761389162890711118187946503247,25192116736215025548831573411262775239,25222110724265229664809997226006752291,25314062928512889471730617681867333945,25362472200831734326361545409396955793,2583919321499518397670323597369816114,26580643876512366520140092298905157189,27026864729292623486540736940853052640,27320612520146656706844467617511673168,27581336288040569876287965952638043385,28131013401983386733277834372522868663,29244626641758935990046047751863689743,29947759507620438949469657394272629404,30283021370435385776473637831500659493,30772417734770284070346995567415143401,31808633720115883404569063064415097462,31952023912770506281440226795716174919,32449328598649453476017611163029723075,32597709016474450857982493747149301543,33250614859780527543653922791129258232,33399235535914688699011857090412069963,33505987824714043178684107358835094496,33852003631596901583416227847684696753,33954101995010466053641851172709661887,36228720036123194928973941127203313404,36547455398554886839167346640517214326,36855472738451229464781594410640073588,37142765842687158488016172325184656471,38969509379059877808059794698409482993,40082595549683988235563539924730771931,40646162732974241657890604775652189788,40860573762168115687516141598702379310,43416128523032228821256757300440903533,43437938671830795599965525936227971614,43503640900992094476739242379211551274,43579341142343456276666997611209041150,43787287104783148818089149508392419943,43830781499397504616518373121492819390,44003730264539227235116302120074125424,44358771861333920250221987559910546762,46772335207280206103882953778512243575,46867831498666392117029383496749487710,47092786266701306009104332272292133189,48280659657371145255550767906085884199,48346875736591078297663066946862780434,49906415162592567715913938409646896200,50126428601301289797774053903744440776,50728648272703244768115068870477914430,51317781597092145689835991457780482988,53923824923403485610729022500775026914,54016441786751088913415551658849431153,54848944533672529993976203897226558188,5580325667242872403463665908725840141,56080298832125073461107105751993418707,56289725515545462356895759142658817134,5675520628724905698145784944852801026,59932986183970751606574811441027744128,60105823118944088751746899663970298297,6277944942667403131182817276080739562,62895988699615698238749930258772819683,6467582576508590122096999987841152257,65639799683018569448605513064512508864,66284960059844560467002222420339558055,66333932380669240296025412617987954943,66412777882313246227349663524907015501,66468313665260403353164250712133623596,68286903843122404230469855890025448498,69612105898786776158865112130489308553,69614981083069487299525173897377675247,70081803755972825515105004048389810114,70561865210449942499773728475126129052,70576761462971434873047716954161145856,7077030006228109615068860096374257819,71368666646311630480062988276460976778,72201682578484681545568390825583947734,72497352396523855538862874350754496654,72806579820476817718459163687762596782,74261399609592409350519519523802227041,74786627054990323158541507368611783730,74836985275690259919931244676005703470,75590471894009745141429291703974243332,75684100695485256993569682147240956675,76702636733780742646493761274144918241,77779523066971291495637190503635339714,78675454106922550124066226232782680997,79019050536082875240202032968280725511,7947339997943832844938496289958449668,79602196769725705758435921765105464017,79825808195579132845518507495534076651,80052901719426402502061418994349335475,81411957507199040316087548688748821551,81650939692143430859122644975887949503,82554324822760811080500260173624251589,83076050162767033811093565512634051972,83177221495805058851287776635486026436,83812163508018824296080304218792125200,84722811685387909205642443684764616251,85522105966826596398852422278163282870,86169714267008000767138116362926775357,87198399482593740562305624308042808336,87419570453069218266337832356092031454,87951651854112576065578974613381870128,89177562506183867755587207036832187776,89958848688119426596127644691992330889,90413819989750036978089666533032118903,91039697833310297959719359483588899121,91222930590209131649732684561646529470,92026582884961933329851912939200324111,92275368227533473716872860252594677753,92989619591511163856627676096386192510,94326001442670244331131536764489444170,94454391392065074387980815831645967905,95420417814503927995987027308944248543,96086234075595859030290106915767457515,96233744067919782604758153016065650273,96428128231963861300518633736224487300,96592711269898816851288858883462690199,96711584787710023715028356375889347704,96891777709294714579949715234000564078,96909882239296528668441208419601391694,96944423107084797645192377736782015591,992952118028006455835726937379275379"
]
}
}
| 4,657.45283
| 10,099
| 0.947664
| 9,240
| 246,845
| 25.316234
| 0.998593
| 0.000154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.949205
| 0.002277
| 246,845
| 52
| 10,100
| 4,747.019231
| 0.000605
| 0
| 0
| 0.04
| 0
| 0.72
| 0.996787
| 0.996476
| 0
| 0
| 0
| 0
| 0
| 1
| 0.02
| false
| 0
| 0
| 0.02
| 0.04
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
a9d48839cfda653f14a6cb2c808e87dd667cb207
| 130
|
py
|
Python
|
web/helpdesk/tests/__init__.py
|
stesla/arxcode
|
a0ebf7c4d310de8c1980a8ba2a48948a68bb5a0a
|
[
"MIT"
] | 2
|
2015-09-08T14:20:56.000Z
|
2016-03-01T21:09:30.000Z
|
helpdesk/tests/__init__.py
|
tuna/django-helpdesk
|
ba5cc2e4d538fb0c962d160a1c6c1c1dc0c2d77c
|
[
"MIT"
] | null | null | null |
helpdesk/tests/__init__.py
|
tuna/django-helpdesk
|
ba5cc2e4d538fb0c962d160a1c6c1c1dc0c2d77c
|
[
"MIT"
] | 13
|
2017-01-12T11:09:38.000Z
|
2019-04-19T10:01:17.000Z
|
from helpdesk.tests.ticket_submission import *
from helpdesk.tests.public_actions import *
from helpdesk.tests.navigation import *
| 43.333333
| 46
| 0.846154
| 17
| 130
| 6.352941
| 0.529412
| 0.333333
| 0.472222
| 0.425926
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.084615
| 130
| 3
| 47
| 43.333333
| 0.907563
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
e70b8f2c0fe1a05f984fc623b6527ff5c0625429
| 214
|
py
|
Python
|
Server/Python/src/dbs/dao/MySQL/DatasetParent/List.py
|
vkuznet/DBS
|
14df8bbe8ee8f874fe423399b18afef911fe78c7
|
[
"Apache-2.0"
] | 8
|
2015-08-14T04:01:32.000Z
|
2021-06-03T00:56:42.000Z
|
Server/Python/src/dbs/dao/MySQL/DatasetParent/List.py
|
yuyiguo/DBS
|
14df8bbe8ee8f874fe423399b18afef911fe78c7
|
[
"Apache-2.0"
] | 162
|
2015-01-07T21:34:47.000Z
|
2021-10-13T09:42:41.000Z
|
Server/Python/src/dbs/dao/MySQL/DatasetParent/List.py
|
yuyiguo/DBS
|
14df8bbe8ee8f874fe423399b18afef911fe78c7
|
[
"Apache-2.0"
] | 16
|
2015-01-22T15:27:29.000Z
|
2021-04-28T09:23:28.000Z
|
#!/usr/bin/env python
"""
This module provides DatasetParent.List data access object.
"""
from dbs.dao.Oracle.DatasetParent.List import List as OraDatasetParentList
class List(OraDatasetParentList):
pass
| 21.4
| 74
| 0.766355
| 26
| 214
| 6.307692
| 0.807692
| 0.207317
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.140187
| 214
| 9
| 75
| 23.777778
| 0.891304
| 0.373832
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 7
|
e72ad280ee4017fc7b7cc58b1101e8f54bdb3e44
| 105
|
py
|
Python
|
app/kubernetes/__init__.py
|
zephyrxvxx7/KubeZephyr-Backend
|
242410bc236e1f7204c24d635eb3346b0c256dc8
|
[
"MIT"
] | 2
|
2021-04-25T01:49:45.000Z
|
2021-11-25T09:10:40.000Z
|
app/kubernetes/__init__.py
|
zephyrxvxx7/KubeZephyr-Backend
|
242410bc236e1f7204c24d635eb3346b0c256dc8
|
[
"MIT"
] | null | null | null |
app/kubernetes/__init__.py
|
zephyrxvxx7/KubeZephyr-Backend
|
242410bc236e1f7204c24d635eb3346b0c256dc8
|
[
"MIT"
] | null | null | null |
from .utils import get_k8s_core_v1_api, get_k8s_storage_v1_api, get_k8s_networking_v1_api, get_k8s_v1_api
| 105
| 105
| 0.904762
| 22
| 105
| 3.636364
| 0.454545
| 0.3
| 0.3
| 0.4125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.080808
| 0.057143
| 105
| 1
| 105
| 105
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 9
|
e73234ab5dd919ff43e8f6522c66771e94ab48ee
| 12,918
|
py
|
Python
|
nvidia_original/src/trainers/cocogan_trainer_da.py
|
lgraesser/im2im2im
|
835d84b782921f6c40d8cc4416c3fc492187eb58
|
[
"MIT"
] | 7
|
2018-04-17T09:56:37.000Z
|
2021-08-28T10:03:22.000Z
|
nvidia_original/src/trainers/cocogan_trainer_da.py
|
lgraesser/im2im2im
|
835d84b782921f6c40d8cc4416c3fc492187eb58
|
[
"MIT"
] | null | null | null |
nvidia_original/src/trainers/cocogan_trainer_da.py
|
lgraesser/im2im2im
|
835d84b782921f6c40d8cc4416c3fc492187eb58
|
[
"MIT"
] | 2
|
2018-03-03T20:39:49.000Z
|
2018-04-17T03:48:23.000Z
|
"""
Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-ND 4.0 license (https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode).
"""
from cocogan_nets_da import *
from init import *
from helpers import get_model_list, _compute_fake_acc2, _compute_true_acc2
import torch
import torch.nn as nn
import os
import itertools
class COCOGANDAContextTrainer(nn.Module):
def __init__(self, hyperparameters):
super(COCOGANDAContextTrainer, self).__init__()
gen_ch = hyperparameters['gen_ch']
dis_ch = hyperparameters['dis_ch']
output_dim_a = hyperparameters['input_dim_a']
output_dim_b = hyperparameters['input_dim_b']
input_dim_a = output_dim_a + 2
input_dim_b = output_dim_b + 2
exec( 'self.dis = %s(dis_ch, output_dim_a, output_dim_b)' % hyperparameters['dis'])
exec( 'self.gen = %s(gen_ch, input_dim_a, output_dim_a, input_dim_b, output_dim_b)' % hyperparameters['gen'])
self.dis_opt = torch.optim.Adam(self.dis.parameters(), lr=0.0002, betas=(0.5, 0.999), weight_decay=0.0005)
self.gen_opt = torch.optim.Adam(self.gen.parameters(), lr=0.0002, betas=(0.5, 0.999), weight_decay=0.0005)
self.dis.apply(xavier_weights_init)
self.gen.apply(gaussian_weights_init) # Generator makes use of batch norm so we use gaussian
self.ll_loss_criterion = torch.nn.MSELoss() # We use MSELoss here
xy = self._create_xy_image()
self.xy = xy.unsqueeze(0).expand(hyperparameters['batch_size'], xy.size(0), xy.size(1), xy.size(2))
def cuda(self, gpu=0):
self.gpu = gpu
self.dis.cuda(self.gpu)
self.gen.cuda(self.gpu)
self.xy = self.xy.cuda(self.gpu)
def _create_xy_image(self, width=32):
coordinates = list(itertools.product(range(width), range(width)))
arr = (np.reshape(np.asarray(coordinates), newshape=[width, width, 2]) - width/2 ) / (width/2)
new_map = np.transpose(np.float32(arr), [2, 0, 1])
xy = Variable(torch.from_numpy(new_map), requires_grad=False)
return xy
def _compute_kl(self, mu, sd):
mu_2 = torch.pow(mu, 2)
sd_2 = torch.pow(sd, 2)
encoding_loss = (mu_2 + sd_2 - torch.log(sd_2)).sum() / mu_2.size(0)
return encoding_loss
def _compute_ll_loss(self,a,b):
return self.ll_loss_criterion(a, b) * b.size(1) * b.size(2) * b.size(3)
def gen_update(self, x_a, x_b, hyperparameters):
self.gen.zero_grad()
x_a_xy = torch.cat((x_a, self.xy), 1) # Create input image to the generator a
x_b_xy = torch.cat((x_b, self.xy), 1) # Create input image to the generator b
x_aa, x_ba, x_ab, x_bb, lt_codes = self.gen(x_a_xy, x_b_xy, self.gpu)
fake_recon_res, fake_feat_aa, fake_feat_bb = self.dis(x_aa, x_bb)
fake_trans_res, fake_feat_ba, fake_feat_ab = self.dis(x_ba, x_ab)
ones = Variable(torch.LongTensor(np.ones(fake_trans_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_fake_recon_loss = nn.functional.cross_entropy(fake_recon_res, ones)
ad_fake_trans_loss = nn.functional.cross_entropy(fake_trans_res, ones)
ad_loss = ad_fake_trans_loss + ad_fake_recon_loss
ll_loss_a = self._compute_ll_loss(x_aa, x_a)
ll_loss_b = self._compute_ll_loss(x_bb, x_b)
encoding_loss = 0
for i, lt in enumerate(lt_codes):
encoding_loss += 2 * self._compute_kl(*lt)
total_loss = hyperparameters['gan_w'] * ad_loss + \
hyperparameters['kl_normalized_direct_w'] * encoding_loss + \
hyperparameters['ll_normalized_direct_w'] * (ll_loss_a + ll_loss_b)
total_loss.backward()
self.gen_opt.step()
self.gen_ad_loss = ad_loss.data.cpu().numpy()[0]
self.gen_ll_loss_a = ll_loss_a.data.cpu().numpy()[0]
self.gen_ll_loss_b = ll_loss_b.data.cpu().numpy()[0]
self.gen_enc_loss = encoding_loss.data.cpu().numpy()[0]
self.gen_total_loss = total_loss.data.cpu().numpy()[0]
return x_aa, x_ba, x_ab, x_bb
def dis_update(self, images_a, labels_a, images_b, hyperparameters):
self.dis.zero_grad()
true_res, true_feat_a, true_feat_b = self.dis(images_a, images_b)
ones = Variable(torch.LongTensor(np.ones(true_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_true_loss = nn.functional.cross_entropy(true_res, ones)
x_a_xy = torch.cat((images_a, self.xy), 1)
x_b_xy = torch.cat((images_b, self.xy), 1)
x_aa, x_ba, x_ab, x_bb, lt_codes = self.gen(x_a_xy, x_b_xy, self.gpu)
fake_recon_res, fake_feat_aa, fake_feat_bb = self.dis(x_aa, x_bb)
fake_trans_res, fake_feat_ba, fake_feat_ab = self.dis(x_ba, x_ab)
zeros = Variable(torch.LongTensor(np.zeros(fake_recon_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_fake_recon_loss = nn.functional.cross_entropy(fake_recon_res, zeros)
ad_fake_trans_loss = nn.functional.cross_entropy(fake_trans_res, zeros)
ad_fake_loss = 0.5 * ( ad_fake_trans_loss + ad_fake_recon_loss )
dummy_variable = Variable(torch.zeros(fake_feat_aa.size()).cuda(self.gpu))
feature_loss_a = self._compute_ll_loss(fake_feat_ab - fake_feat_aa, dummy_variable)
feature_loss_b = self._compute_ll_loss(fake_feat_ba - fake_feat_bb, dummy_variable)
# Classification loss
cls_outputs = self.dis.classify_a(images_a)
cls_loss = nn.functional.cross_entropy(cls_outputs, labels_a)
_, cls_predicts = torch.max(cls_outputs.data, 1)
cls_acc = (cls_predicts == labels_a.data).sum() / (1.0 * cls_predicts.size(0))
true_acc = _compute_true_acc2(true_res)
fake_trans_acc = _compute_fake_acc2(fake_trans_res)
fake_recon_acc = _compute_fake_acc2(fake_recon_res)
fake_acc = 0.5 * (fake_trans_acc + fake_recon_acc)
total_loss = hyperparameters['gan_w'] * ( ad_true_loss + ad_fake_loss) + \
hyperparameters['cls_w'] * cls_loss + \
hyperparameters['feature_w'] * (feature_loss_a + feature_loss_b)
total_loss.backward()
self.dis_opt.step()
self.dis_true_acc = true_acc
self.dis_fake_acc = fake_acc
self.dis_cls_acc = cls_acc
self.dis_cls_loss = cls_loss.data.cpu().numpy()[0]
self.dis_ad_true_loss = ad_true_loss.data.cpu().numpy()[0]
self.dis_ad_fake_loss_a = ad_fake_loss.data.cpu().numpy()[0]
self.dis_feature_loss_a = feature_loss_a.data.cpu().numpy()[0]
self.dis_feature_loss_b = feature_loss_b.data.cpu().numpy()[0]
self.dis_total_loss = total_loss.data.cpu().numpy()[0]
return
def resume(self, snapshot_prefix):
dirname = os.path.dirname(snapshot_prefix)
last_model_name = get_model_list(dirname,"gen")
if last_model_name is None:
return 0
self.gen.load_state_dict(torch.load(last_model_name))
iterations = int(last_model_name[-12:-4])
last_model_name = get_model_list(dirname, "dis")
self.dis.load_state_dict(torch.load(last_model_name))
print('Resume from iteration %d' % iterations)
return iterations
def save(self, snapshot_prefix, iterations):
gen_filename = '%s_gen_%08d.pkl' % (snapshot_prefix, iterations + 1)
dis_filename = '%s_dis_%08d.pkl' % (snapshot_prefix, iterations + 1)
torch.save(self.gen.state_dict(), gen_filename)
torch.save(self.dis.state_dict(), dis_filename)
class COCOGANDATrainer(nn.Module):
def __init__(self, hyperparameters):
super(COCOGANDATrainer, self).__init__()
gen_ch = hyperparameters['gen_ch']
dis_ch = hyperparameters['dis_ch']
output_dim_a = hyperparameters['input_dim_a']
output_dim_b = hyperparameters['input_dim_b']
input_dim_a = output_dim_a
input_dim_b = output_dim_b
exec( 'self.dis = %s(dis_ch, input_dim_a, input_dim_b)' % hyperparameters['dis'])
exec( 'self.gen = %s(gen_ch, input_dim_a, output_dim_a, input_dim_b, output_dim_b)' % hyperparameters['gen'])
self.dis_opt = torch.optim.Adam(self.dis.parameters(), lr=0.0002, betas=(0.5, 0.999), weight_decay=0.0005)
self.gen_opt = torch.optim.Adam(self.gen.parameters(), lr=0.0002, betas=(0.5, 0.999), weight_decay=0.0005)
self.dis.apply(xavier_weights_init)
self.gen.apply(gaussian_weights_init)
self.ll_loss_criterion = torch.nn.MSELoss()
def _compute_kl(self, mu, sd):
mu_2 = torch.pow(mu, 2)
sd_2 = torch.pow(sd, 2)
encoding_loss = (mu_2 + sd_2 - torch.log(sd_2)).sum() / mu_2.size(0)
return encoding_loss
def cuda(self, gpu=0):
self.gpu = gpu
self.dis.cuda(self.gpu)
self.gen.cuda(self.gpu)
def _compute_ll_loss(self,a,b):
return self.ll_loss_criterion(a, b) * b.size(1) * b.size(2) * b.size(3)
def gen_update(self, x_a, x_b, hyperparameters):
self.gen.zero_grad()
x_aa, x_ba, x_ab, x_bb, lt_codes = self.gen(x_a, x_b, self.gpu)
fake_trans_res, fake_feat_ba, fake_feat_ab = self.dis(x_ba, x_ab)
fake_recon_res, fake_feat_aa, fake_feat_bb = self.dis(x_aa, x_bb)
ones = Variable(torch.LongTensor(np.ones(fake_trans_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_fake_trans_loss = nn.functional.cross_entropy(fake_trans_res, ones)
ad_fake_recon_loss = nn.functional.cross_entropy(fake_recon_res, ones)
ad_loss = ad_fake_trans_loss + ad_fake_recon_loss
ll_loss_a = self._compute_ll_loss(x_aa, x_a)
ll_loss_b = self._compute_ll_loss(x_bb, x_b)
encoding_loss = 0
for i, lt in enumerate(lt_codes):
encoding_loss += 2 * self._compute_kl(*lt)
total_loss = hyperparameters['gan_w'] * ad_loss + \
hyperparameters['kl_normalized_direct_w'] * encoding_loss + \
hyperparameters['ll_normalized_direct_w'] * (ll_loss_a + ll_loss_b)
total_loss.backward()
self.gen_opt.step()
self.gen_ad_loss = ad_loss.data.cpu().numpy()[0]
self.gen_ll_loss_a = ll_loss_a.data.cpu().numpy()[0]
self.gen_ll_loss_b = ll_loss_b.data.cpu().numpy()[0]
self.gen_enc_loss = encoding_loss.data.cpu().numpy()[0]
self.gen_total_loss = total_loss.data.cpu().numpy()[0]
return x_aa, x_ba, x_ab, x_bb
def dis_update(self, images_a, labels_a, images_b, hyperparameters):
self.dis.zero_grad()
true_res, true_feat_a, true_feat_b = self.dis(images_a, images_b)
ones = Variable(torch.LongTensor(np.ones(true_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_true_loss = nn.functional.cross_entropy(true_res, ones)
x_aa, x_ba, x_ab, x_bb, lt_codes = self.gen(images_a, images_b, self.gpu)
fake_trans_res, fake_feat_ba, fake_feat_ab = self.dis(x_ba, x_ab)
fake_recon_res, fake_feat_aa, fake_feat_bb = self.dis(x_aa, x_bb)
zeros = Variable(torch.LongTensor(np.zeros(fake_recon_res.size(0), dtype=np.int)).cuda(self.gpu))
ad_fake_trans_loss = nn.functional.cross_entropy(fake_trans_res, zeros)
ad_fake_recon_loss = nn.functional.cross_entropy(fake_recon_res, zeros)
ad_fake_loss = 0.5 * ( ad_fake_trans_loss + ad_fake_recon_loss )
dummy_variable = Variable(torch.zeros(fake_feat_aa.size()).cuda(self.gpu))
feature_loss_a = self._compute_ll_loss(fake_feat_ab - fake_feat_aa, dummy_variable)
feature_loss_b = self._compute_ll_loss(fake_feat_ba - fake_feat_bb, dummy_variable)
# Classification loss
cls_outputs = self.dis.classify_a(images_a)
cls_loss = nn.functional.cross_entropy(cls_outputs, labels_a)
_, cls_predicts = torch.max(cls_outputs.data, 1)
cls_acc = (cls_predicts == labels_a.data).sum() / (1.0 * cls_predicts.size(0))
true_acc = _compute_true_acc2(true_res)
fake_trans_acc = _compute_fake_acc2(fake_trans_res)
fake_recon_acc = _compute_fake_acc2(fake_recon_res)
fake_acc = 0.5 * (fake_trans_acc + fake_recon_acc)
total_loss = hyperparameters['gan_w'] * ( ad_true_loss + ad_fake_loss) + \
hyperparameters['cls_w'] * cls_loss + \
hyperparameters['feature_w'] * (feature_loss_a + feature_loss_b)
total_loss.backward()
self.dis_opt.step()
self.dis_true_acc = true_acc
self.dis_fake_acc = fake_acc
self.dis_cls_acc = cls_acc
self.dis_cls_loss = cls_loss.data.cpu().numpy()[0]
self.dis_ad_true_loss = ad_true_loss.data.cpu().numpy()[0]
self.dis_ad_fake_loss_a = ad_fake_loss.data.cpu().numpy()[0]
self.dis_feature_loss_a = feature_loss_a.data.cpu().numpy()[0]
self.dis_feature_loss_b = feature_loss_b.data.cpu().numpy()[0]
self.dis_total_loss = total_loss.data.cpu().numpy()[0]
return
def resume(self, snapshot_prefix):
dirname = os.path.dirname(snapshot_prefix)
last_model_name = get_model_list(dirname,"gen")
if last_model_name is None:
return 0
self.gen.load_state_dict(torch.load(last_model_name))
iterations = int(last_model_name[-12:-4])
last_model_name = get_model_list(dirname, "dis")
self.dis.load_state_dict(torch.load(last_model_name))
print('Resume from iteration %d' % iterations)
return iterations
def save(self, snapshot_prefix, iterations):
gen_filename = '%s_gen_%08d.pkl' % (snapshot_prefix, iterations + 1)
dis_filename = '%s_dis_%08d.pkl' % (snapshot_prefix, iterations + 1)
torch.save(self.gen.state_dict(), gen_filename)
torch.save(self.dis.state_dict(), dis_filename)
| 47.667897
| 113
| 0.713655
| 2,162
| 12,918
| 3.893617
| 0.091582
| 0.039914
| 0.031361
| 0.033975
| 0.904847
| 0.8957
| 0.888216
| 0.87111
| 0.87111
| 0.862319
| 0
| 0.017806
| 0.156603
| 12,918
| 271
| 114
| 47.667897
| 0.754842
| 0.027558
| 0
| 0.862069
| 0
| 0
| 0.047171
| 0.007012
| 0
| 0
| 0
| 0
| 0
| 1
| 0.073276
| false
| 0
| 0.030172
| 0.008621
| 0.168103
| 0.008621
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e7703b04fd2a325f0219013679c192dd9f9ffd43
| 85
|
py
|
Python
|
htb/admirer-10.10.10.187/privesc/pwn.py
|
benhunter/ctf
|
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
|
[
"MIT"
] | null | null | null |
htb/admirer-10.10.10.187/privesc/pwn.py
|
benhunter/ctf
|
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
|
[
"MIT"
] | 1
|
2022-03-31T22:44:36.000Z
|
2022-03-31T22:44:36.000Z
|
htb/admirer-10.10.10.187/privesc/pwn.py
|
benhunter/ctf
|
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
|
[
"MIT"
] | null | null | null |
import os
os.system("chown root:root /home/waldo/shell; chmod +s /home/waldo/shell")
| 28.333333
| 74
| 0.741176
| 15
| 85
| 4.2
| 0.666667
| 0.285714
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094118
| 85
| 2
| 75
| 42.5
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0.717647
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
e7712b49462b94252f61e41f6c3102c08f92ed26
| 14,034
|
py
|
Python
|
octoprice_main_inky.py
|
jordongriffiths/octopus-agile-pi-prices
|
c02058204c95e0f7a22aa5f1320771dac327e2c4
|
[
"Apache-2.0"
] | 32
|
2019-12-07T09:00:52.000Z
|
2022-03-05T22:30:33.000Z
|
octoprice_main_inky.py
|
jordongriffiths/octopus-agile-pi-prices
|
c02058204c95e0f7a22aa5f1320771dac327e2c4
|
[
"Apache-2.0"
] | 15
|
2020-04-19T16:21:18.000Z
|
2022-02-07T21:13:36.000Z
|
octoprice_main_inky.py
|
jordongriffiths/octopus-agile-pi-prices
|
c02058204c95e0f7a22aa5f1320771dac327e2c4
|
[
"Apache-2.0"
] | 22
|
2020-01-16T15:36:31.000Z
|
2021-08-28T15:49:27.000Z
|
# this is the script you run every half hour by cron, best done about 20-30 seconds after the half hour to ensure
# that the right datetime is read in.
# For example ---> */30 * * * * sleep 20; /usr/bin/python3 octoprice_main_inky.py > /home/pi/cron.log
# NOTE - USAGE
# This script *won't work* unless you have run (python3 store_prices.py) at least once in the last 'n' hours (n is variable, it updates 4pm every day)
# You also need to update store_prices.py to include your own DNO region.
from inky.auto import auto
#from font_hanken_grotesk import HankenGroteskBold, HankenGroteskMedium # should you choose to switch to gross fonts
#from font_intuitive import Intuitive
from font_fredoka_one import FredokaOne # this is the font we're currently using
from PIL import Image, ImageFont, ImageDraw
import sqlite3
import datetime
import pytz
import time
## -- Detect display type automatically
try:
inky_display = auto(ask_user=False, verbose=True)
except TypeError:
raise TypeError("You need to update the Inky library to >= v1.1.0")
try:
# connect to the database in rw mode so we can catch the error if it doesn't exist
DB_URI = 'file:{}?mode=rw'.format(pathname2url('agileprices.sqlite'))
conn = sqlite3.connect(DB_URI, uri=True)
cur = conn.cursor()
print('Connected to database...')
except sqlite3.OperationalError as error:
# handle missing database case
raise SystemExit('Database not found - you need to run store_prices.py first.') from error
inky_display.set_border(inky_display.WHITE)
img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT))
draw = ImageDraw.Draw(img)
# find current time and convert to year month day etc
the_now = datetime.datetime.now(datetime.timezone.utc)
the_now_local = the_now.astimezone(pytz.timezone('Europe/London'))
the_year = the_now.year
the_month = the_now.month
the_hour = the_now.hour
the_day = the_now.day
if the_now.minute < 30:
the_segment = 0
else:
the_segment = 1
print ('segment:')
print (the_segment)
# select from db where record == the above
cur.execute("SELECT * FROM prices WHERE year=? AND month=? AND day=? AND hour=? AND segment=?",
(the_year, the_month, the_day, the_hour, the_segment))
rows = cur.fetchall()
for row in rows:
print(row[5])
# get price
current_price = row[5] # literally this is hardcoded tuple. DONT ADD ANY EXTRA FIELDS TO THAT TABLE on the sqlite db or you'll get something that isn't price.
# Find Next Price
# find current time and convert to year month day etc
the_now = datetime.datetime.now(datetime.timezone.utc)
now_plus_10 = the_now + datetime.timedelta(minutes = 30)
the_year = now_plus_10.year
the_month = now_plus_10.month
the_hour = now_plus_10.hour
the_day = now_plus_10.day
if now_plus_10.minute < 30:
the_segment = 0
else:
the_segment = 1
print ('segment+1:')
print (the_segment)
# select from db where record == the above
cur.execute("SELECT * FROM prices WHERE year=? AND month=? AND day=? AND hour=? AND segment=?",
(the_year, the_month, the_day, the_hour, the_segment))
rows = cur.fetchall()
for row in rows:
print(row[5])
# get price
next_price = row[5] # literally this is peak tuple. DONT ADD ANY EXTRA FIELDS TO THAT TABLE
# Find Next+1 Price
# find current time and convert to year month day etc
the_now = datetime.datetime.now(datetime.timezone.utc)
now_plus_10 = the_now + datetime.timedelta(minutes = 60)
the_year = now_plus_10.year
the_month = now_plus_10.month
the_hour = now_plus_10.hour
the_day = now_plus_10.day
if now_plus_10.minute < 30:
the_segment = 0
else:
the_segment = 1
print ('segment:')
print (the_segment)
# select from db where record = ^
cur.execute("SELECT * FROM prices WHERE year=? AND month=? AND day=? AND hour=? AND segment=?",
(the_year, the_month, the_day, the_hour, the_segment))
rows = cur.fetchall()
for row in rows:
print(row[5])
# get price
nextp1_price = row[5] # literally this is peak tuple. DONT ADD ANY EXTRA FIELDS TO THAT TABLE
# Find Next+2 Price
# find current time and convert to year month day etc
the_now = datetime.datetime.now(datetime.timezone.utc)
now_plus_10 = the_now + datetime.timedelta(minutes = 90)
the_year = now_plus_10.year
the_month = now_plus_10.month
the_hour = now_plus_10.hour
the_day = now_plus_10.day
if now_plus_10.minute < 30:
the_segment = 0
else:
the_segment = 1
print ('segment:')
print (the_segment)
# select from db where record == the above
cur.execute("SELECT * FROM prices WHERE year=? AND month=? AND day=? AND hour=? AND segment=?",
(the_year, the_month, the_day, the_hour, the_segment))
rows = cur.fetchall()
for row in rows:
print(row[5])
# get price
nextp2_price = row[5] # literally this is peak tuple. DONT ADD ANY EXTRA FIELDS TO THAT TABLE
# attempt to make an list of the next 42 hours of values
prices = []
for offset in range(0, 48): ##24h = 48 segments
min_offset = 30 * offset
the_now = datetime.datetime.now(datetime.timezone.utc)
now_plus_offset = the_now + datetime.timedelta(minutes=min_offset)
the_year = now_plus_offset.year
the_month = now_plus_offset.month
the_hour = now_plus_offset.hour
the_day = now_plus_offset.day
if now_plus_offset.minute < 30:
the_segment = 0
else:
the_segment = 1
cur.execute("SELECT * FROM prices WHERE year=? AND month=? AND day=? AND hour=? AND segment=?",
(the_year, the_month, the_day, the_hour, the_segment))
# rows = cur.fetchall()
# get price
row = cur.fetchone()
if row is None:
prices.append(999) # we don't have that price yet!
else:
prices.append(row[5])
if (inky_display.WIDTH == 212): #low res display
font = ImageFont.truetype(FredokaOne, 60)
message = "{0:.1f}".format(current_price) + "p"
w, h = font.getsize(message)
#x = (inky_display.WIDTH / 2) - (w / 2)
#y = (inky_display.HEIGHT / 2) - (h / 2)
x = 0
y = -5
if (current_price > 14.8):
draw.text((x, y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
right_column = 145
# NEXT
message = "2:" + "{0:.1f}".format(next_price) + "p"
font = ImageFont.truetype(FredokaOne, 20)
w2, h2 = font.getsize(message)
x = right_column
y = 0
if (next_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
# NEXT
message = "3:" + "{0:.1f}".format(nextp1_price) + "p"
font = ImageFont.truetype(FredokaOne, 20)
w3, h3 = font.getsize(message)
x = right_column
y = 20
if (nextp1_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
# NEXT
message = "4:" + "{0:.1f}".format(nextp2_price) + "p"
font = ImageFont.truetype(FredokaOne, 20)
w3, h3 = font.getsize(message)
x = right_column
y = 40
if (nextp2_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
pixels_per_h = 2 # how many pixels 1p is worth
pixels_per_w = 3 # how many pixels 1/2 hour is worth
chart_base_loc = 104 # location of the bottom of the chart on screen in pixels
#chart_base_loc = 85 # location of the bottom of the chart on screen in pixels
number_of_vals_to_display = 48 # 36 half hours = 18 hours
# plot the graph
#lowest_price_next_24h = min(i for i in prices if i > 0)
lowest_price_next_24h = min(i for i in prices)
if (lowest_price_next_24h < 0):
chart_base_loc = 104 + lowest_price_next_24h*pixels_per_h - 2 # if we have any negative prices, shift the base of the graph up!
print("lowest price Position:", prices.index(lowest_price_next_24h))
print("low Value:", lowest_price_next_24h)
# go through each hour and get the value
for i in range(0,number_of_vals_to_display):
if prices[i] < 999:
scaled_price = prices[i] * pixels_per_h # we're scaling it by the value above
if prices[i] <= (lowest_price_next_24h + 1): # if within 1p of the lowest price, display in black
ink_color = inky_display.BLACK
else:
ink_color = inky_display.RED
# takes a bit of thought this next bit, draw a rectangle from say x = 2i to 2(i-1) for each plot value
# pixels_per_w defines the horizontal scaling factor (2 seems to work)
draw.rectangle((pixels_per_w*i,chart_base_loc,((pixels_per_w*i)-pixels_per_w),(chart_base_loc-scaled_price)),ink_color)
#draw minimum value on chart <- this doesn't seem to work yet
# font = ImageFont.truetype(FredokaOne, 15)
# msg = "{0:.1f}".format(lowest_price_next_24h) + "p"
# draw.text((4*(minterval-1),110),msg, inky_display.BLACK, font)
# draw the bottom right min price and how many hours that is away
font = ImageFont.truetype(FredokaOne, 15)
msg = "min:"+"{0:.1f}".format(lowest_price_next_24h) + "p"
draw.text((right_column,60), msg, inky_display.BLACK, font)
# we know how many half hours to min price, now figure it out in hours.
minterval = (round(prices.index(lowest_price_next_24h)/2))
print ("minterval:"+str(minterval))
msg = "in:"+str(minterval)+"hrs"
draw.text((right_column,75), msg, inky_display.BLACK, font)
# and convert that to an actual time
# note that this next time will not give you an exact half hour if you don't run this at an exact half hour eg cron
# because it's literally just adding n * 30 mins!
# could in future add some code to round to 30 mins increments but it works for now.
min_offset = prices.index(lowest_price_next_24h) * 30
time_of_cheapest = the_now_local + datetime.timedelta(minutes=min_offset)
print("cheapest at " + str(time_of_cheapest))
print("which is: "+ str(time_of_cheapest.time())[0:5])
time_of_cheapest_formatted = "at " + (str(time_of_cheapest.time())[0:5])
font = ImageFont.truetype(FredokaOne, 15)
draw.text((right_column,90), time_of_cheapest_formatted, inky_display.BLACK, font)
else: #high res display
font = ImageFont.truetype(FredokaOne, 72)
message = "{0:.1f}".format(current_price) + "p"
w, h = font.getsize(message)
#x = (inky_display.WIDTH / 2) - (w / 2)
#y = (inky_display.HEIGHT / 2) - (h / 2)
x = 0
y = -10
if (current_price > 14.8):
draw.text((x, y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
right_column = 172
# NEXT
message = "2:" + "{0:.1f}".format(next_price) + "p"
font = ImageFont.truetype(FredokaOne, 23)
w2, h2 = font.getsize(message)
x = right_column
y = 0
if (next_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
# NEXT
message = "3:" + "{0:.1f}".format(nextp1_price) + "p"
font = ImageFont.truetype(FredokaOne, 23)
w3, h3 = font.getsize(message)
x = right_column
y = 23
if (nextp1_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
# NEXT
message = "4:" + "{0:.1f}".format(nextp2_price) + "p"
font = ImageFont.truetype(FredokaOne, 23)
w3, h3 = font.getsize(message)
x = right_column
y = 46
if (nextp2_price > 14.8):
draw.text((x,y), message, inky_display.RED, font)
else:
draw.text((x, y), message, inky_display.BLACK, font)
pixels_per_h = 2.3 # how many pixels 1p is worth
pixels_per_w = 3.5 # how many pixels 1/2 hour is worth
chart_base_loc = 121 # location of the bottom of the chart on screen in pixels
#chart_base_loc = 85 # location of the bottom of the chart on screen in pixels
number_of_vals_to_display = 48 # 36 half hours = 18 hours
# plot the graph
#lowest_price_next_24h = min(i for i in prices if i > 0)
lowest_price_next_24h = min(i for i in prices)
if (lowest_price_next_24h < 0):
chart_base_loc = 104 + lowest_price_next_24h*pixels_per_h - 2 # if we have any negative prices, shift the base of the graph up!
print("lowest price Position:", prices.index(lowest_price_next_24h))
print("low Value:", lowest_price_next_24h)
# go through each hour and get the value
for i in range(0,number_of_vals_to_display):
if prices[i] < 999:
scaled_price = prices[i] * pixels_per_h # we're scaling it by the value above
if prices[i] <= (lowest_price_next_24h + 1): # if within 1p of the lowest price, display in black
ink_color = inky_display.BLACK
else:
ink_color = inky_display.RED
# takes a bit of thought this next bit, draw a rectangle from say x = 2i to 2(i-1) for each plot value
# pixels_per_w defines the horizontal scaling factor (2 seems to work)
draw.rectangle((pixels_per_w*i,chart_base_loc,((pixels_per_w*i)-pixels_per_w),(chart_base_loc-scaled_price)),ink_color)
#draw minimum value on chart <- this doesn't seem to work yet
# font = ImageFont.truetype(FredokaOne, 15)
# msg = "{0:.1f}".format(lowest_price_next_24h) + "p"
# draw.text((4*(minterval-1),110),msg, inky_display.BLACK, font)
# draw the bottom right min price and how many hours that is away
font = ImageFont.truetype(FredokaOne, 16)
msg = "min:"+"{0:.1f}".format(lowest_price_next_24h) + "p"
draw.text((right_column,69), msg, inky_display.BLACK, font)
# we know how many half hours to min price, now figure it out in hours.
minterval = (round(prices.index(lowest_price_next_24h)/2))
print ("minterval:"+str(minterval))
msg = "in:"+str(minterval)+"hrs"
draw.text((right_column,85), msg, inky_display.BLACK, font)
# and convert that to an actual time
# note that this next time will not give you an exact half hour if you don't run this at an exact half hour eg cron
# because it's literally just adding n * 30 mins!
# could in future add some code to round to 30 mins increments but it works for now.
min_offset = prices.index(lowest_price_next_24h) * 30
time_of_cheapest = the_now_local + datetime.timedelta(minutes=min_offset)
print("cheapest at " + str(time_of_cheapest))
print("which is: "+ str(time_of_cheapest.time())[0:5])
time_of_cheapest_formatted = "at " + (str(time_of_cheapest.time())[0:5])
font = ImageFont.truetype(FredokaOne, 16)
draw.text((right_column,101), time_of_cheapest_formatted, inky_display.BLACK, font)
# render the actual image onto the display
inky_display.set_image(img)
inky_display.show()
| 34.651852
| 158
| 0.721035
| 2,382
| 14,034
| 4.082284
| 0.143577
| 0.045249
| 0.033937
| 0.040724
| 0.808618
| 0.798334
| 0.787227
| 0.786816
| 0.777972
| 0.770671
| 0
| 0.033828
| 0.163745
| 14,034
| 404
| 159
| 34.737624
| 0.794734
| 0.326208
| 0
| 0.719368
| 0
| 0
| 0.091716
| 0
| 0.031621
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.027668
| 0
| 0.027668
| 0.090909
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e7a549c7e883ddcdf827a16b55e6faf8cf45e7ff
| 190
|
py
|
Python
|
tests/callbacks.py
|
ilindrey/aiotapioca-wrapper
|
9fc84b8b5c7e11df3ee9a3c8aa6615bc94948524
|
[
"MIT"
] | null | null | null |
tests/callbacks.py
|
ilindrey/aiotapioca-wrapper
|
9fc84b8b5c7e11df3ee9a3c8aa6615bc94948524
|
[
"MIT"
] | null | null | null |
tests/callbacks.py
|
ilindrey/aiotapioca-wrapper
|
9fc84b8b5c7e11df3ee9a3c8aa6615bc94948524
|
[
"MIT"
] | null | null | null |
from aioresponses import CallbackResult
def callback_201(*args, **kwargs):
return CallbackResult(status=201)
def callback_401(*args, **kwargs):
return CallbackResult(status=401)
| 19
| 39
| 0.757895
| 22
| 190
| 6.454545
| 0.545455
| 0.15493
| 0.225352
| 0.422535
| 0.507042
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073171
| 0.136842
| 190
| 9
| 40
| 21.111111
| 0.792683
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| true
| 0
| 0.2
| 0.4
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 8
|
e7b8ce484292cd0c0cce73ccb9be05b9c0c2e9d0
| 160
|
py
|
Python
|
nanoblocks/work/backend/__init__.py
|
ipazc/nanoblocks
|
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
|
[
"MIT"
] | 3
|
2021-03-16T23:59:37.000Z
|
2021-12-11T13:52:46.000Z
|
nanoblocks/work/backend/__init__.py
|
ipazc/nanoblocks
|
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
|
[
"MIT"
] | 1
|
2021-04-02T14:11:02.000Z
|
2021-06-16T00:03:33.000Z
|
nanoblocks/work/backend/__init__.py
|
ipazc/nanoblocks
|
d7433b60029e4bcda4c2c802c3ff05c53d7b220a
|
[
"MIT"
] | null | null | null |
from nanoblocks.work.backend.nano_remote_work_server import NanoRemoteWorkServer
from nanoblocks.work.backend.nano_local_work_server import NanoLocalWorkServer
| 53.333333
| 80
| 0.9125
| 20
| 160
| 7
| 0.55
| 0.2
| 0.257143
| 0.357143
| 0.414286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05
| 160
| 2
| 81
| 80
| 0.921053
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.